@tradecanvas/chart 1.3.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -49
- package/dist/Chart.d.ts +724 -18
- package/dist/Chart.d.ts.map +1 -1
- package/dist/DataManager.d.ts +5 -0
- package/dist/DataManager.d.ts.map +1 -1
- package/dist/HistoryPager.d.ts +58 -0
- package/dist/HistoryPager.d.ts.map +1 -0
- package/dist/LayoutSession-CTZB90NX.cjs +2 -0
- package/dist/LayoutSession-CTZB90NX.cjs.map +1 -0
- package/dist/LayoutSession-CWn3sdbs.js +3967 -0
- package/dist/LayoutSession-CWn3sdbs.js.map +1 -0
- package/dist/PaneManager.d.ts.map +1 -1
- package/dist/ThemeManager.d.ts +5 -1
- package/dist/ThemeManager.d.ts.map +1 -1
- package/dist/chartA11y.d.ts +59 -0
- package/dist/chartA11y.d.ts.map +1 -0
- package/dist/charts/ChartTypeStrategy.d.ts +11 -4
- package/dist/charts/ChartTypeStrategy.d.ts.map +1 -1
- package/dist/grid/ChartGrid.d.ts +7 -1
- package/dist/grid/ChartGrid.d.ts.map +1 -1
- package/dist/i18n-CiQ8EDVs.js +1469 -0
- package/dist/i18n-CiQ8EDVs.js.map +1 -0
- package/dist/i18n-WsLA9SmD.cjs +2 -0
- package/dist/i18n-WsLA9SmD.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -89
- package/dist/index.js.map +1 -1
- package/dist/indicatorLabel.d.ts +7 -0
- package/dist/indicatorLabel.d.ts.map +1 -0
- package/dist/layout/LayoutManager.d.ts +50 -0
- package/dist/layout/LayoutManager.d.ts.map +1 -1
- package/dist/layout/priceAxisWidth.d.ts +2 -0
- package/dist/layout/priceAxisWidth.d.ts.map +1 -1
- package/dist/regularHours.d.ts +10 -0
- package/dist/regularHours.d.ts.map +1 -0
- package/dist/state/LayoutSession.d.ts +101 -0
- package/dist/state/LayoutSession.d.ts.map +1 -0
- package/dist/state/layoutStorage.d.ts +46 -0
- package/dist/state/layoutStorage.d.ts.map +1 -0
- package/dist/trading/wireExecution.d.ts +7 -3
- package/dist/trading/wireExecution.d.ts.map +1 -1
- package/dist/widget/ChartWidget.d.ts +283 -10
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/ChartWidgetGrid.d.ts +166 -0
- package/dist/widget/ChartWidgetGrid.d.ts.map +1 -0
- package/dist/widget/DrawingTemplateStore.d.ts +29 -8
- package/dist/widget/DrawingTemplateStore.d.ts.map +1 -1
- package/dist/widget/WatchlistStore.d.ts +65 -0
- package/dist/widget/WatchlistStore.d.ts.map +1 -0
- package/dist/widget/WidgetAccountPanel.d.ts +72 -0
- package/dist/widget/WidgetAccountPanel.d.ts.map +1 -0
- package/dist/widget/WidgetAlertsPanel.d.ts +50 -3
- package/dist/widget/WidgetAlertsPanel.d.ts.map +1 -1
- package/dist/widget/WidgetBracketBar.d.ts +3 -1
- package/dist/widget/WidgetBracketBar.d.ts.map +1 -1
- package/dist/widget/WidgetChartNav.d.ts +36 -0
- package/dist/widget/WidgetChartNav.d.ts.map +1 -0
- package/dist/widget/WidgetCommandPalette.d.ts +5 -1
- package/dist/widget/WidgetCommandPalette.d.ts.map +1 -1
- package/dist/widget/WidgetContextMenu.d.ts +40 -0
- package/dist/widget/WidgetContextMenu.d.ts.map +1 -0
- package/dist/widget/WidgetDataWindow.d.ts +3 -1
- package/dist/widget/WidgetDataWindow.d.ts.map +1 -1
- package/dist/widget/WidgetDepthLadder.d.ts +3 -1
- package/dist/widget/WidgetDepthLadder.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingSettings.d.ts +108 -0
- package/dist/widget/WidgetDrawingSettings.d.ts.map +1 -0
- package/dist/widget/WidgetDrawingSidebar.d.ts +26 -1
- package/dist/widget/WidgetDrawingSidebar.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingStyle.d.ts +3 -1
- package/dist/widget/WidgetDrawingStyle.d.ts.map +1 -1
- package/dist/widget/WidgetDropdown.d.ts.map +1 -1
- package/dist/widget/WidgetGoToDate.d.ts +46 -0
- package/dist/widget/WidgetGoToDate.d.ts.map +1 -0
- package/dist/widget/WidgetHistoryPill.d.ts +23 -0
- package/dist/widget/WidgetHistoryPill.d.ts.map +1 -0
- package/dist/widget/WidgetHotkeySheet.d.ts +3 -1
- package/dist/widget/WidgetHotkeySheet.d.ts.map +1 -1
- package/dist/widget/WidgetIndicatorLegend.d.ts +98 -0
- package/dist/widget/WidgetIndicatorLegend.d.ts.map +1 -0
- package/dist/widget/WidgetIndicatorSettings.d.ts +62 -7
- package/dist/widget/WidgetIndicatorSettings.d.ts.map +1 -1
- package/dist/widget/WidgetIntervalInput.d.ts +34 -0
- package/dist/widget/WidgetIntervalInput.d.ts.map +1 -0
- package/dist/widget/WidgetLayoutsDialog.d.ts +39 -0
- package/dist/widget/WidgetLayoutsDialog.d.ts.map +1 -0
- package/dist/widget/WidgetLayoutsUI.d.ts +37 -0
- package/dist/widget/WidgetLayoutsUI.d.ts.map +1 -0
- package/dist/widget/WidgetLoadingOverlay.d.ts.map +1 -1
- package/dist/widget/WidgetNamePrompt.d.ts +31 -0
- package/dist/widget/WidgetNamePrompt.d.ts.map +1 -0
- package/dist/widget/WidgetObjectTree.d.ts +21 -3
- package/dist/widget/WidgetObjectTree.d.ts.map +1 -1
- package/dist/widget/WidgetOrderTicket.d.ts +49 -0
- package/dist/widget/WidgetOrderTicket.d.ts.map +1 -0
- package/dist/widget/WidgetReplayBar.d.ts +52 -7
- package/dist/widget/WidgetReplayBar.d.ts.map +1 -1
- package/dist/widget/WidgetSettings.d.ts +26 -2
- package/dist/widget/WidgetSettings.d.ts.map +1 -1
- package/dist/widget/WidgetStatusBar.d.ts +19 -1
- package/dist/widget/WidgetStatusBar.d.ts.map +1 -1
- package/dist/widget/WidgetStyles.d.ts +3 -1
- package/dist/widget/WidgetStyles.d.ts.map +1 -1
- package/dist/widget/WidgetSymbolInfo.d.ts +64 -0
- package/dist/widget/WidgetSymbolInfo.d.ts.map +1 -0
- package/dist/widget/WidgetSymbolSearch.d.ts +28 -5
- package/dist/widget/WidgetSymbolSearch.d.ts.map +1 -1
- package/dist/widget/WidgetToolbar.d.ts +42 -4
- package/dist/widget/WidgetToolbar.d.ts.map +1 -1
- package/dist/widget/WidgetTooltip.d.ts +43 -0
- package/dist/widget/WidgetTooltip.d.ts.map +1 -0
- package/dist/widget/WidgetWatchlist.d.ts +53 -13
- package/dist/widget/WidgetWatchlist.d.ts.map +1 -1
- package/dist/widget/chartMenu.d.ts +40 -0
- package/dist/widget/chartMenu.d.ts.map +1 -0
- package/dist/widget/drawingMenu.d.ts +21 -0
- package/dist/widget/drawingMenu.d.ts.map +1 -0
- package/dist/widget/escapeHtml.d.ts +3 -0
- package/dist/widget/escapeHtml.d.ts.map +1 -0
- package/dist/widget/focusTrap.d.ts +8 -0
- package/dist/widget/focusTrap.d.ts.map +1 -0
- package/dist/widget/i18n.d.ts +20 -63
- package/dist/widget/i18n.d.ts.map +1 -1
- package/dist/widget/iconSet.d.ts +26 -0
- package/dist/widget/iconSet.d.ts.map +1 -0
- package/dist/widget/icons.d.ts +5 -0
- package/dist/widget/icons.d.ts.map +1 -1
- package/dist/widget/index.cjs +2145 -405
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.d.ts +18 -1
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +7376 -1274
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/indicatorTemplates.d.ts +24 -0
- package/dist/widget/indicatorTemplates.d.ts.map +1 -0
- package/dist/widget/keyTarget.d.ts +11 -0
- package/dist/widget/keyTarget.d.ts.map +1 -0
- package/dist/widget/legendValues.d.ts +19 -0
- package/dist/widget/legendValues.d.ts.map +1 -0
- package/dist/widget/locales/ar.d.ts +4 -0
- package/dist/widget/locales/ar.d.ts.map +1 -0
- package/dist/widget/locales/de.d.ts +4 -0
- package/dist/widget/locales/de.d.ts.map +1 -0
- package/dist/widget/locales/en.d.ts +722 -0
- package/dist/widget/locales/en.d.ts.map +1 -0
- package/dist/widget/locales/es.d.ts +4 -0
- package/dist/widget/locales/es.d.ts.map +1 -0
- package/dist/widget/locales/fr.d.ts +4 -0
- package/dist/widget/locales/fr.d.ts.map +1 -0
- package/dist/widget/locales/he.d.ts +4 -0
- package/dist/widget/locales/he.d.ts.map +1 -0
- package/dist/widget/locales/id.d.ts +4 -0
- package/dist/widget/locales/id.d.ts.map +1 -0
- package/dist/widget/locales/index.cjs +2 -0
- package/dist/widget/locales/index.cjs.map +1 -0
- package/dist/widget/locales/index.d.ts +33 -0
- package/dist/widget/locales/index.d.ts.map +1 -0
- package/dist/widget/locales/index.js +10089 -0
- package/dist/widget/locales/index.js.map +1 -0
- package/dist/widget/locales/ja.d.ts +4 -0
- package/dist/widget/locales/ja.d.ts.map +1 -0
- package/dist/widget/locales/ko.d.ts +4 -0
- package/dist/widget/locales/ko.d.ts.map +1 -0
- package/dist/widget/locales/pt.d.ts +4 -0
- package/dist/widget/locales/pt.d.ts.map +1 -0
- package/dist/widget/locales/ru.d.ts +4 -0
- package/dist/widget/locales/ru.d.ts.map +1 -0
- package/dist/widget/locales/th.d.ts +4 -0
- package/dist/widget/locales/th.d.ts.map +1 -0
- package/dist/widget/locales/tr.d.ts +4 -0
- package/dist/widget/locales/tr.d.ts.map +1 -0
- package/dist/widget/locales/vi.d.ts +4 -0
- package/dist/widget/locales/vi.d.ts.map +1 -0
- package/dist/widget/locales/zh.d.ts +4 -0
- package/dist/widget/locales/zh.d.ts.map +1 -0
- package/dist/widget/locales/zhHant.d.ts +4 -0
- package/dist/widget/locales/zhHant.d.ts.map +1 -0
- package/dist/widget/orderTicket.d.ts +27 -0
- package/dist/widget/orderTicket.d.ts.map +1 -0
- package/dist/widget/settingsControls.d.ts +24 -0
- package/dist/widget/settingsControls.d.ts.map +1 -0
- package/dist/widget/types.d.ts +215 -13
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widgetConfig.d.ts +1 -5
- package/dist/widget/widgetConfig.d.ts.map +1 -1
- package/dist/widget/widgetLayout.d.ts +22 -0
- package/dist/widget/widgetLayout.d.ts.map +1 -0
- package/dist/widget/widgetLocales.d.ts +17 -0
- package/dist/widget/widgetLocales.d.ts.map +1 -0
- package/dist/widget/widgetTimeframes.d.ts +28 -0
- package/dist/widget/widgetTimeframes.d.ts.map +1 -0
- package/dist/widget/widgetTimezones.d.ts +32 -0
- package/dist/widget/widgetTimezones.d.ts.map +1 -0
- package/dist/widget/widgetUI.d.ts +126 -0
- package/dist/widget/widgetUI.d.ts.map +1 -0
- package/package.json +8 -3
- package/dist/DragDropImporter-BazeSQPD.cjs +0 -2
- package/dist/DragDropImporter-BazeSQPD.cjs.map +0 -1
- package/dist/DragDropImporter-cURSpfUb.js +0 -1883
- package/dist/DragDropImporter-cURSpfUb.js.map +0 -1
- package/dist/charts/IndicatorPriceRange.d.ts +0 -20
- package/dist/charts/IndicatorPriceRange.d.ts.map +0 -1
package/dist/widget/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../DragDropImporter-BazeSQPD.cjs`);let t=require(`@tradecanvas/commons`);function n(e,n,r={}){if(e.length===0)return[];let i=r.weekStartsOn??1,a=[],o=null,s=NaN;for(let r of e){let e=(0,t.timeframeBucketStart)(r.time,n,i);o===null||e!==s?(o!==null&&a.push(o),o={time:e,open:r.open,high:r.high,low:r.low,close:r.close,volume:r.volume},s=e):o={time:o.time,open:o.open,high:Math.max(o.high,r.high),low:Math.min(o.low,r.low),close:r.close,volume:o.volume+r.volume}}return o!==null&&a.push(o),a}function r(e){if(e.length<2)return 0;let t=[];for(let n=1;n<e.length;n++){let r=e[n].time-e[n-1].time;r>0&&t.push(r)}return t.length===0?0:(t.sort((e,t)=>e-t),t[Math.floor(t.length/2)])}var i=[{label:`1m`,value:`1m`},{label:`5m`,value:`5m`},{label:`15m`,value:`15m`},{label:`1H`,value:`1h`},{label:`4H`,value:`4h`},{label:`1D`,value:`1d`}],a=[{label:`Candlestick`,value:`candlestick`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Bar`,value:`bar`},{label:`Heikin-Ashi`,value:`heikinAshi`},{label:`Hollow Candle`,value:`hollowCandle`},{label:`Baseline`,value:`baseline`},{label:`Volume Candles`,value:`volumeCandles`},{label:`Equivolume`,value:`equivolume`},{label:`HLC Area`,value:`hlcArea`},{label:`Step Line`,value:`stepLine`},{label:`Line + Markers`,value:`lineWithMarkers`}],o=[{label:`Lines`,tools:[{label:`Trend Line`,value:`trendLine`},{label:`Ray`,value:`ray`},{label:`Extended Line`,value:`extendedLine`},{label:`Info Line`,value:`infoLine`},{label:`Trend Angle`,value:`trendAngle`}]},{label:`Horizontal/Vertical`,tools:[{label:`Horizontal Line`,value:`horizontalLine`},{label:`Horizontal Ray`,value:`horizontalRay`},{label:`Vertical Line`,value:`verticalLine`},{label:`Cross Line`,value:`crossLine`}]},{label:`Channels`,tools:[{label:`Parallel Channel`,value:`parallelChannel`},{label:`Regression Channel`,value:`regressionChannel`}]},{label:`Fibonacci`,tools:[{label:`Fib Retracement`,value:`fibRetracement`},{label:`Fib Extension`,value:`fibExtension`},{label:`Fib Channel`,value:`fibChannel`},{label:`Fib Time Zones`,value:`fibTimeZones`},{label:`Fib Speed Resistance Fan`,value:`fibSpeedResistanceFan`}]},{label:`Shapes`,tools:[{label:`Rectangle`,value:`rectangle`},{label:`Circle`,value:`circle`},{label:`Ellipse`,value:`ellipse`},{label:`Triangle`,value:`triangle`}]},{label:`Gann & Pitchforks`,tools:[{label:`Pitchfork`,value:`pitchfork`},{label:`Schiff Pitchfork`,value:`schiffPitchfork`},{label:`Modified Schiff Pitchfork`,value:`modifiedSchiffPitchfork`},{label:`Gann Fan`,value:`gannFan`},{label:`Gann Box`,value:`gannBox`},{label:`Cyclic Lines`,value:`cyclicLines`}]},{label:`Patterns`,tools:[{label:`XABCD Pattern`,value:`xabcdPattern`},{label:`ABCD Pattern`,value:`abcdPattern`},{label:`Head and Shoulders`,value:`headAndShoulders`},{label:`Elliott Wave`,value:`elliottWave`}]},{label:`Measure`,tools:[{label:`Price Range`,value:`priceRange`},{label:`Date Range`,value:`dateRange`},{label:`Date and Price Range`,value:`dateAndPriceRange`},{label:`Measure`,value:`measure`}]},{label:`Annotation`,tools:[{label:`Text`,value:`text`},{label:`Price Label`,value:`priceLabel`},{label:`Arrow`,value:`arrow`}]},{label:`Forecasting`,tools:[{label:`Long/Short Position`,value:`riskReward`},{label:`Anchored VWAP`,value:`anchoredVWAP`},{label:`Fixed Range Volume Profile`,value:`volumeProfileRange`}]}],s=[{id:`sma`,name:`SMA`,type:`overlay`},{id:`ema`,name:`EMA`,type:`overlay`},{id:`tema`,name:`Triple EMA`,type:`overlay`},{id:`vwma`,name:`VWMA`,type:`overlay`},{id:`wma`,name:`Weighted MA`,type:`overlay`},{id:`hma`,name:`Hull MA`,type:`overlay`},{id:`mtfma`,name:`MTF Moving Average`,type:`overlay`},{id:`bb`,name:`Bollinger Bands`,type:`overlay`},{id:`envelope`,name:`Envelope`,type:`overlay`},{id:`vwap`,name:`VWAP`,type:`overlay`},{id:`avwap`,name:`Anchored VWAP`,type:`overlay`},{id:`svwap`,name:`Session VWAP`,type:`overlay`},{id:`ichimoku`,name:`Ichimoku Cloud`,type:`overlay`},{id:`psar`,name:`Parabolic SAR`,type:`overlay`},{id:`supertrend`,name:`Supertrend`,type:`overlay`},{id:`keltner`,name:`Keltner Channel`,type:`overlay`},{id:`donchian`,name:`Donchian Channel`,type:`overlay`},{id:`pivots`,name:`Pivot Points`,type:`overlay`},{id:`zigzag`,name:`ZigZag`,type:`overlay`},{id:`lrc`,name:`Linear Regression Channel`,type:`overlay`},{id:`chandelier`,name:`Chandelier Exit`,type:`overlay`},{id:`alligator`,name:`Alligator`,type:`overlay`},{id:`rsi`,name:`RSI`,type:`panel`},{id:`macd`,name:`MACD`,type:`panel`},{id:`stochastic`,name:`Stochastic`,type:`panel`},{id:`atr`,name:`ATR`,type:`panel`},{id:`adx`,name:`ADX`,type:`panel`},{id:`obv`,name:`OBV`,type:`panel`},{id:`williamsR`,name:`Williams %R`,type:`panel`},{id:`cci`,name:`CCI`,type:`panel`},{id:`mfi`,name:`MFI`,type:`panel`},{id:`roc`,name:`ROC`,type:`panel`},{id:`tsi`,name:`TSI`,type:`panel`},{id:`cmf`,name:`CMF`,type:`panel`},{id:`aroon`,name:`Aroon`,type:`panel`},{id:`stddev`,name:`Std Deviation`,type:`panel`},{id:`vroc`,name:`Volume ROC`,type:`panel`},{id:`ad`,name:`Acc/Dist`,type:`panel`},{id:`ao`,name:`Awesome Oscillator`,type:`panel`},{id:`chaikinOsc`,name:`Chaikin Oscillator`,type:`panel`},{id:`voldelta`,name:`Volume Delta`,type:`panel`},{id:`vortex`,name:`Vortex Indicator`,type:`panel`},{id:`chop`,name:`Choppiness Index`,type:`panel`},{id:`uo`,name:`Ultimate Oscillator`,type:`panel`},{id:`fi`,name:`Force Index`,type:`panel`},{id:`crsi`,name:`Connors RSI`,type:`panel`},{id:`coppock`,name:`Coppock Curve`,type:`panel`},{id:`kst`,name:`Know Sure Thing`,type:`panel`},{id:`elderray`,name:`Elder Ray`,type:`panel`},{id:`stc`,name:`Schaff Trend Cycle`,type:`panel`},{id:`kvo`,name:`Klinger Oscillator`,type:`panel`},{id:`fisher`,name:`Fisher Transform`,type:`panel`},{id:`dpo`,name:`Detrended Price Osc`,type:`panel`},{id:`bop`,name:`Balance of Power`,type:`panel`},{id:`massindex`,name:`Mass Index`,type:`panel`},{id:`cmo`,name:`Chande Momentum`,type:`panel`},{id:`trix`,name:`TRIX`,type:`panel`},{id:`emv`,name:`Ease of Movement`,type:`panel`},{id:`pvt`,name:`Price Volume Trend`,type:`panel`},{id:`wad`,name:`Williams A/D`,type:`panel`},{id:`chaikinvol`,name:`Chaikin Volatility`,type:`panel`},{id:`rvi`,name:`Relative Vigor Index`,type:`panel`},{id:`stochrsi`,name:`Stochastic RSI`,type:`panel`},{id:`ppo`,name:`Percentage Price Oscillator`,type:`panel`},{id:`ac`,name:`Accelerator Oscillator`,type:`panel`},{id:`rmi`,name:`Relative Momentum Index`,type:`panel`},{id:`disparity`,name:`Disparity Index`,type:`panel`},{id:`qstick`,name:`Qstick`,type:`panel`},{id:`pgo`,name:`Pretty Good Oscillator`,type:`panel`},{id:`volumeProfile`,name:`Volume Profile`,type:`panel`}],c=[`sma`,`ema`,`bb`,`rsi`,`macd`,`stochastic`,`vwap`,`atr`,`obv`,`ichimoku`],l=[`BTCUSDT`,`ETHUSDT`,`SOLUSDT`,`BNBUSDT`],u={candleUpColor:t.DARK_THEME.candleUp,candleDownColor:t.DARK_THEME.candleDown,candleUpWick:t.DARK_THEME.candleUpWick,candleDownWick:t.DARK_THEME.candleDownWick,backgroundColor:t.DARK_THEME.background,gridColor:t.DARK_THEME.grid,gridVisible:!0,volumeVisible:!0,volumeProfileVisible:!1,marketProfileVisible:!1,marketProfileSplit:!1,marketProfileLetters:!1,marketProfileBuckets:48,marketProfileOpacity:.32,depthHeatmapVisible:!1,depthHeatmapOpacity:.7,sessionShadingVisible:!1,pivotMarkersVisible:!1,pivotStrength:5,pivotStructureLabels:!1,periodLevelsVisible:!1,periodLevelsPeriod:`day`,legendVisible:!0,barCountdown:!0,logScale:!1,scaleMode:`regular`,autoScale:!0,crosshairMode:`magnet`,numberLocale:`en-US`,timezone:`local`},d=`/* === TradeCanvas Widget — Premium Styles === */\r
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../LayoutSession-CTZB90NX.cjs`),t=require(`../i18n-WsLA9SmD.cjs`);let n=require(`@tradecanvas/commons`),r=require(`@tradecanvas/core`);function i(e,t,r={}){if(e.length===0)return[];let i=r.weekStartsOn??1,a=[],o=null,s=NaN;for(let r of e){let e=(0,n.timeframeBucketStart)(r.time,t,i);o===null||e!==s?(o!==null&&a.push(o),o={time:e,open:r.open,high:r.high,low:r.low,close:r.close,volume:r.volume},s=e):o={time:o.time,open:o.open,high:Math.max(o.high,r.high),low:Math.min(o.low,r.low),close:r.close,volume:o.volume+r.volume}}return o!==null&&a.push(o),a}function a(e){if(e.length<2)return 0;let t=[];for(let n=1;n<e.length;n++){let r=e[n].time-e[n-1].time;r>0&&t.push(r)}return t.length===0?0:(t.sort((e,t)=>e-t),t[Math.floor(t.length/2)])}var o=[{zone:`Pacific/Honolulu`,city:`Honolulu`},{zone:`America/Los_Angeles`,city:`Los Angeles`},{zone:`America/Denver`,city:`Denver`},{zone:`America/Chicago`,city:`Chicago`},{zone:`America/New_York`,city:`New York`},{zone:`America/Toronto`,city:`Toronto`},{zone:`America/Sao_Paulo`,city:`São Paulo`},{zone:`UTC`,city:`UTC`},{zone:`Europe/London`,city:`London`},{zone:`Europe/Berlin`,city:`Frankfurt`},{zone:`Europe/Paris`,city:`Paris`},{zone:`Europe/Zurich`,city:`Zurich`},{zone:`Africa/Johannesburg`,city:`Johannesburg`},{zone:`Europe/Istanbul`,city:`Istanbul`},{zone:`Europe/Moscow`,city:`Moscow`},{zone:`Asia/Dubai`,city:`Dubai`},{zone:`Asia/Kolkata`,city:`Mumbai`},{zone:`Asia/Bangkok`,city:`Bangkok`},{zone:`Asia/Ho_Chi_Minh`,city:`Ho Chi Minh City`},{zone:`Asia/Jakarta`,city:`Jakarta`},{zone:`Asia/Singapore`,city:`Singapore`},{zone:`Asia/Hong_Kong`,city:`Hong Kong`},{zone:`Asia/Shanghai`,city:`Shanghai`},{zone:`Asia/Taipei`,city:`Taipei`},{zone:`Asia/Seoul`,city:`Seoul`},{zone:`Asia/Tokyo`,city:`Tokyo`},{zone:`Australia/Sydney`,city:`Sydney`},{zone:`Pacific/Auckland`,city:`Auckland`}];function s(e){return!e||e===`local`?null:e===`exchange`?`exchange`:/^-?\d+$/.test(e)?Number(e):(0,n.isValidTimeZone)(e)?e:null}function c(e){return e===null?`local`:String(e)}function l(e,t,r,i){let a=(0,n.offsetAt)(null,t),c=o.filter(({zone:e})=>(0,n.isValidTimeZone)(e)).map(({zone:e,city:r})=>{let i=(0,n.offsetAt)(e,t);return{value:e,label:e===`UTC`?`UTC`:`(${(0,n.tzLabel)(i)}) ${r}`,offset:i}}),l=s(e);typeof l==`number`&&c.push({value:e,label:(0,n.tzLabel)(l),offset:l}),c.sort((e,t)=>e.offset-t.offset);let u=[{value:`local`,label:`${r} (${(0,n.tzLabel)(a)})`,offset:a}];if(i){let e=(0,n.offsetAt)(i.zone&&(0,n.isValidTimeZone)(i.zone)?i.zone:`UTC`,t);u.push({value:`exchange`,label:`${i.label} (${(0,n.tzLabel)(e)})`,offset:e})}return[...u,...c]}var u=[{label:`Candlestick`,value:`candlestick`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Bar`,value:`bar`},{label:`Heikin-Ashi`,value:`heikinAshi`},{label:`Hollow Candle`,value:`hollowCandle`},{label:`Baseline`,value:`baseline`},{label:`Volume Candles`,value:`volumeCandles`},{label:`Equivolume`,value:`equivolume`},{label:`HLC Area`,value:`hlcArea`},{label:`Step Line`,value:`stepLine`},{label:`Line + Markers`,value:`lineWithMarkers`},{label:`High-Low`,value:`hiLo`},{label:`Renko`,value:`renko`},{label:`Line Break`,value:`lineBreak`},{label:`Kagi`,value:`kagi`},{label:`Point & Figure`,value:`pointAndFigure`},{label:`Range Bars`,value:`rangeBars`}],d=[{label:`Lines`,tools:[{label:`Trend Line`,value:`trendLine`},{label:`Ray`,value:`ray`},{label:`Extended Line`,value:`extendedLine`},{label:`Info Line`,value:`infoLine`},{label:`Trend Angle`,value:`trendAngle`}]},{label:`Horizontal/Vertical`,tools:[{label:`Horizontal Line`,value:`horizontalLine`},{label:`Horizontal Ray`,value:`horizontalRay`},{label:`Vertical Line`,value:`verticalLine`},{label:`Cross Line`,value:`crossLine`}]},{label:`Channels`,tools:[{label:`Parallel Channel`,value:`parallelChannel`},{label:`Regression Channel`,value:`regressionChannel`}]},{label:`Fibonacci`,tools:[{label:`Fib Retracement`,value:`fibRetracement`},{label:`Fib Extension`,value:`fibExtension`},{label:`Fib Channel`,value:`fibChannel`},{label:`Fib Time Zones`,value:`fibTimeZones`},{label:`Fib Speed Resistance Fan`,value:`fibSpeedResistanceFan`},{label:`Fib Speed Resistance Arcs`,value:`fibArcs`},{label:`Fib Circles`,value:`fibCircles`},{label:`Fib Spiral`,value:`fibSpiral`},{label:`Fib Wedge`,value:`fibWedge`}]},{label:`Shapes`,tools:[{label:`Rectangle`,value:`rectangle`},{label:`Circle`,value:`circle`},{label:`Ellipse`,value:`ellipse`},{label:`Triangle`,value:`triangle`},{label:`Polyline`,value:`polyline`},{label:`Curve`,value:`curve`},{label:`Arc`,value:`arc`}]},{label:`Brushes`,tools:[{label:`Brush`,value:`brush`},{label:`Highlighter`,value:`highlighter`},{label:`Path`,value:`path`}]},{label:`Gann & Pitchforks`,tools:[{label:`Pitchfork`,value:`pitchfork`},{label:`Schiff Pitchfork`,value:`schiffPitchfork`},{label:`Modified Schiff Pitchfork`,value:`modifiedSchiffPitchfork`},{label:`Gann Fan`,value:`gannFan`},{label:`Gann Box`,value:`gannBox`},{label:`Gann Square`,value:`gannSquare`},{label:`Pitchfan`,value:`pitchfan`}]},{label:`Cycles`,tools:[{label:`Cyclic Lines`,value:`cyclicLines`},{label:`Time Cycles`,value:`timeCycles`},{label:`Sine Line`,value:`sineLine`}]},{label:`Patterns`,tools:[{label:`XABCD Pattern`,value:`xabcdPattern`},{label:`ABCD Pattern`,value:`abcdPattern`},{label:`Head and Shoulders`,value:`headAndShoulders`},{label:`Cypher Pattern`,value:`cypherPattern`},{label:`Three Drives Pattern`,value:`threeDrives`}]},{label:`Elliott Waves`,tools:[{label:`Elliott Wave`,value:`elliottWave`},{label:`Elliott Impulse Wave`,value:`elliottImpulse`},{label:`Elliott Correction Wave`,value:`elliottCorrection`},{label:`Elliott Triangle Wave`,value:`elliottTriangle`},{label:`Elliott Double Combo Wave`,value:`elliottDoubleCombo`},{label:`Elliott Triple Combo Wave`,value:`elliottTripleCombo`}]},{label:`Measure`,tools:[{label:`Price Range`,value:`priceRange`},{label:`Date Range`,value:`dateRange`},{label:`Date and Price Range`,value:`dateAndPriceRange`},{label:`Measure`,value:`measure`}]},{label:`Annotation`,tools:[{label:`Text`,value:`text`},{label:`Price Label`,value:`priceLabel`},{label:`Arrow`,value:`arrow`},{label:`Note`,value:`note`},{label:`Callout`,value:`callout`},{label:`Flag Mark`,value:`flag`},{label:`Arrow Mark`,value:`arrowMark`},{label:`Icon`,value:`icon`}]},{label:`Forecasting`,tools:[{label:`Long/Short Position`,value:`riskReward`},{label:`Anchored VWAP`,value:`anchoredVWAP`},{label:`Fixed Range Volume Profile`,value:`volumeProfileRange`},{label:`Forecast`,value:`forecast`},{label:`Projection`,value:`projection`},{label:`Bars Pattern`,value:`barsPattern`}]}],ee=[{id:`sma`,name:`SMA`,type:`overlay`},{id:`ema`,name:`EMA`,type:`overlay`},{id:`tema`,name:`Triple EMA`,type:`overlay`},{id:`vwma`,name:`VWMA`,type:`overlay`},{id:`wma`,name:`Weighted MA`,type:`overlay`},{id:`hma`,name:`Hull MA`,type:`overlay`},{id:`mtfma`,name:`MTF Moving Average`,type:`overlay`},{id:`bb`,name:`Bollinger Bands`,type:`overlay`},{id:`envelope`,name:`Envelope`,type:`overlay`},{id:`vwap`,name:`VWAP`,type:`overlay`},{id:`avwap`,name:`Anchored VWAP`,type:`overlay`},{id:`svwap`,name:`Session VWAP`,type:`overlay`},{id:`ichimoku`,name:`Ichimoku Cloud`,type:`overlay`},{id:`psar`,name:`Parabolic SAR`,type:`overlay`},{id:`supertrend`,name:`Supertrend`,type:`overlay`},{id:`keltner`,name:`Keltner Channel`,type:`overlay`},{id:`donchian`,name:`Donchian Channel`,type:`overlay`},{id:`pivots`,name:`Pivot Points`,type:`overlay`},{id:`zigzag`,name:`ZigZag`,type:`overlay`},{id:`lrc`,name:`Linear Regression Channel`,type:`overlay`},{id:`chandelier`,name:`Chandelier Exit`,type:`overlay`},{id:`alligator`,name:`Alligator`,type:`overlay`},{id:`rsi`,name:`RSI`,type:`panel`},{id:`macd`,name:`MACD`,type:`panel`},{id:`stochastic`,name:`Stochastic`,type:`panel`},{id:`atr`,name:`ATR`,type:`panel`},{id:`adx`,name:`ADX`,type:`panel`},{id:`obv`,name:`OBV`,type:`panel`},{id:`williamsR`,name:`Williams %R`,type:`panel`},{id:`cci`,name:`CCI`,type:`panel`},{id:`mfi`,name:`MFI`,type:`panel`},{id:`roc`,name:`ROC`,type:`panel`},{id:`tsi`,name:`TSI`,type:`panel`},{id:`cmf`,name:`CMF`,type:`panel`},{id:`aroon`,name:`Aroon`,type:`panel`},{id:`stddev`,name:`Std Deviation`,type:`panel`},{id:`vroc`,name:`Volume ROC`,type:`panel`},{id:`ad`,name:`Acc/Dist`,type:`panel`},{id:`ao`,name:`Awesome Oscillator`,type:`panel`},{id:`chaikinOsc`,name:`Chaikin Oscillator`,type:`panel`},{id:`voldelta`,name:`Volume Delta`,type:`panel`},{id:`vortex`,name:`Vortex Indicator`,type:`panel`},{id:`chop`,name:`Choppiness Index`,type:`panel`},{id:`uo`,name:`Ultimate Oscillator`,type:`panel`},{id:`fi`,name:`Force Index`,type:`panel`},{id:`crsi`,name:`Connors RSI`,type:`panel`},{id:`coppock`,name:`Coppock Curve`,type:`panel`},{id:`kst`,name:`Know Sure Thing`,type:`panel`},{id:`elderray`,name:`Elder Ray`,type:`panel`},{id:`stc`,name:`Schaff Trend Cycle`,type:`panel`},{id:`kvo`,name:`Klinger Oscillator`,type:`panel`},{id:`fisher`,name:`Fisher Transform`,type:`panel`},{id:`dpo`,name:`Detrended Price Osc`,type:`panel`},{id:`bop`,name:`Balance of Power`,type:`panel`},{id:`massindex`,name:`Mass Index`,type:`panel`},{id:`cmo`,name:`Chande Momentum`,type:`panel`},{id:`trix`,name:`TRIX`,type:`panel`},{id:`emv`,name:`Ease of Movement`,type:`panel`},{id:`pvt`,name:`Price Volume Trend`,type:`panel`},{id:`wad`,name:`Williams A/D`,type:`panel`},{id:`chaikinvol`,name:`Chaikin Volatility`,type:`panel`},{id:`rvi`,name:`Relative Vigor Index`,type:`panel`},{id:`stochrsi`,name:`Stochastic RSI`,type:`panel`},{id:`ppo`,name:`Percentage Price Oscillator`,type:`panel`},{id:`ac`,name:`Accelerator Oscillator`,type:`panel`},{id:`rmi`,name:`Relative Momentum Index`,type:`panel`},{id:`disparity`,name:`Disparity Index`,type:`panel`},{id:`qstick`,name:`Qstick`,type:`panel`},{id:`pgo`,name:`Pretty Good Oscillator`,type:`panel`},{id:`volumeProfile`,name:`Volume Profile`,type:`overlay`},{id:`dema`,name:`Double EMA`,type:`overlay`},{id:`smma`,name:`Smoothed MA`,type:`overlay`},{id:`alma`,name:`Arnaud Legoux MA`,type:`overlay`},{id:`kama`,name:`Kaufman Adaptive MA`,type:`overlay`},{id:`lsma`,name:`Least Squares MA`,type:`overlay`},{id:`mcginley`,name:`McGinley Dynamic`,type:`overlay`},{id:`macross`,name:`MA Cross`,type:`overlay`},{id:`fractals`,name:`Williams Fractals`,type:`overlay`},{id:`cks`,name:`Chande Kroll Stop`,type:`overlay`},{id:`bbpb`,name:`Bollinger %B`,type:`panel`},{id:`bbw`,name:`Bollinger BandWidth`,type:`panel`},{id:`mom`,name:`Momentum`,type:`panel`},{id:`hv`,name:`Historical Volatility`,type:`panel`},{id:`vo`,name:`Volume Oscillator`,type:`panel`},{id:`ulcer`,name:`Ulcer Index`,type:`panel`},{id:`seb`,name:`Standard Error Bands`,type:`overlay`},{id:`gmma`,name:`Guppy Multiple MA`,type:`overlay`},{id:`maribbon`,name:`Moving Average Ribbon`,type:`overlay`},{id:`smi`,name:`Stochastic Momentum Index`,type:`panel`},{id:`rvix`,name:`Relative Volatility Index`,type:`panel`},{id:`trendstrength`,name:`Trend Strength Index`,type:`panel`},{id:`lrslope`,name:`Linear Regression Slope`,type:`panel`},{id:`stderror`,name:`Standard Error`,type:`panel`},{id:`adr`,name:`Average Day Range`,type:`panel`},{id:`netvolume`,name:`Net Volume`,type:`panel`}],f=[`sma`,`ema`,`bb`,`rsi`,`macd`,`stochastic`,`vwap`,`atr`,`obv`,`ichimoku`],te=[`BTCUSDT`,`ETHUSDT`,`SOLUSDT`,`BNBUSDT`],ne={candleUpColor:n.DARK_THEME.candleUp,candleDownColor:n.DARK_THEME.candleDown,candleUpWick:n.DARK_THEME.candleUpWick,candleDownWick:n.DARK_THEME.candleDownWick,backgroundColor:n.DARK_THEME.background,gridColor:n.DARK_THEME.grid,gridVisible:!0,volumeVisible:!0,volumeProfileVisible:!1,marketProfileVisible:!1,marketProfileSplit:!1,marketProfileLetters:!1,marketProfileBuckets:48,marketProfileOpacity:.32,depthHeatmapVisible:!1,depthHeatmapOpacity:.7,sessionShadingVisible:!1,pivotMarkersVisible:!1,pivotStrength:5,pivotStructureLabels:!1,periodLevelsVisible:!1,periodLevelsPeriod:`day`,legendVisible:!0,barCountdown:!0,indicatorValueLabels:!0,logScale:!1,scaleMode:`regular`,autoScale:!0,invertScale:!1,leftPriceScale:!1,crosshairMode:`magnet`,numberLocale:`en-US`,timezone:`local`,highLowLines:!1,mainSeriesVisible:!0,extendedHours:!0,chartTypeOptions:{}},p=`/* === TradeCanvas Widget — Premium Styles === */\r
|
|
2
2
|
\r
|
|
3
3
|
/*\r
|
|
4
4
|
* The HTML \`hidden\` attribute only sets \`display: none\` via the UA stylesheet,\r
|
|
@@ -12,14 +12,62 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
12
12
|
display: none !important;\r
|
|
13
13
|
}\r
|
|
14
14
|
\r
|
|
15
|
+
/* Control tooltips (WidgetTooltip): quick to appear, slide in from the control. */\r
|
|
16
|
+
.tcw-tooltip {\r
|
|
17
|
+
position: absolute;\r
|
|
18
|
+
top: 0;\r
|
|
19
|
+
left: 0;\r
|
|
20
|
+
z-index: 60;\r
|
|
21
|
+
max-width: 240px;\r
|
|
22
|
+
padding: 5px 8px;\r
|
|
23
|
+
border-radius: var(--tcw-tooltip-radius);\r
|
|
24
|
+
background: var(--tcw-tooltip-bg);\r
|
|
25
|
+
color: var(--tcw-tooltip-fg);\r
|
|
26
|
+
box-shadow: var(--tcw-tooltip-shadow);\r
|
|
27
|
+
width: max-content;\r
|
|
28
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
29
|
+
font-weight: var(--tcw-weight);\r
|
|
30
|
+
line-height: 1.35;\r
|
|
31
|
+
overflow-wrap: anywhere;\r
|
|
32
|
+
pointer-events: none;\r
|
|
33
|
+
opacity: 0;\r
|
|
34
|
+
visibility: hidden;\r
|
|
35
|
+
transform: translate(var(--tcw-tip-dx, 0), var(--tcw-tip-dy, 0));\r
|
|
36
|
+
transition:\r
|
|
37
|
+
opacity 110ms var(--tcw-ease-out),\r
|
|
38
|
+
transform 110ms var(--tcw-ease-out),\r
|
|
39
|
+
visibility 0s linear 110ms;\r
|
|
40
|
+
}\r
|
|
41
|
+
\r
|
|
42
|
+
.tcw-tooltip--visible {\r
|
|
43
|
+
opacity: 1;\r
|
|
44
|
+
visibility: visible;\r
|
|
45
|
+
transform: none;\r
|
|
46
|
+
transition:\r
|
|
47
|
+
opacity 110ms var(--tcw-ease-out),\r
|
|
48
|
+
transform 110ms var(--tcw-ease-out),\r
|
|
49
|
+
visibility 0s;\r
|
|
50
|
+
}\r
|
|
51
|
+
\r
|
|
52
|
+
/* The modal portal: carries the tokens and fonts, but no box of its own. */\r
|
|
53
|
+
.tcw-root.tcw-portal {\r
|
|
54
|
+
display: contents;\r
|
|
55
|
+
}\r
|
|
56
|
+
\r
|
|
57
|
+
/* Fullscreen: the root fills the screen; the chart resizes with it. */\r
|
|
58
|
+
.tcw-root:fullscreen {\r
|
|
59
|
+
width: 100vw;\r
|
|
60
|
+
height: 100vh;\r
|
|
61
|
+
}\r
|
|
62
|
+
\r
|
|
15
63
|
.tcw-root {\r
|
|
16
64
|
display: flex;\r
|
|
17
65
|
flex-direction: column;\r
|
|
18
66
|
width: 100%;\r
|
|
19
67
|
height: 100%;\r
|
|
20
|
-
font-family:
|
|
68
|
+
font-family: var(--tcw-font);\r
|
|
21
69
|
font-feature-settings: 'cv11', 'ss01', 'ss03';\r
|
|
22
|
-
font-size:
|
|
70
|
+
font-size: var(--tcw-font-size);\r
|
|
23
71
|
line-height: 1.4;\r
|
|
24
72
|
color: #d9dde4;\r
|
|
25
73
|
background: #080b10;\r
|
|
@@ -35,6 +83,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
35
83
|
--tcw-bg-overlay: rgba(20, 25, 34, 0.5);\r
|
|
36
84
|
--tcw-border: #1f2630;\r
|
|
37
85
|
--tcw-border-strong: #2a323e;\r
|
|
86
|
+
--tcw-tooltip-bg: #262e3a;\r
|
|
87
|
+
--tcw-tooltip-fg: #eef0f4;\r
|
|
38
88
|
--tcw-text: #e7e9ee;\r
|
|
39
89
|
--tcw-text-dim: #aab1bd;\r
|
|
40
90
|
--tcw-text-muted: #758091;\r
|
|
@@ -64,11 +114,44 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
64
114
|
--tcw-dur-normal: 180ms;\r
|
|
65
115
|
--tcw-dur-slow: 260ms;\r
|
|
66
116
|
\r
|
|
67
|
-
/*
|
|
68
|
-
--tcw-radius-
|
|
69
|
-
--tcw-radius:
|
|
70
|
-
--tcw-radius
|
|
71
|
-
--tcw-radius-
|
|
117
|
+
/* The look (UI system): Studio's values. The \`ui\` option sets them inline. */\r
|
|
118
|
+
--tcw-radius-xs: 3px;\r
|
|
119
|
+
--tcw-radius-sm: 5px;\r
|
|
120
|
+
--tcw-radius: 7px;\r
|
|
121
|
+
--tcw-radius-lg: 11px;\r
|
|
122
|
+
--tcw-radius-xl: 16px;\r
|
|
123
|
+
--tcw-control-radius: var(--tcw-radius);\r
|
|
124
|
+
--tcw-input-radius: var(--tcw-radius);\r
|
|
125
|
+
--tcw-menu-radius: var(--tcw-radius-lg);\r
|
|
126
|
+
--tcw-dialog-radius: var(--tcw-radius-xl);\r
|
|
127
|
+
--tcw-panel-radius: var(--tcw-radius-lg);\r
|
|
128
|
+
--tcw-tooltip-radius: var(--tcw-radius-sm);\r
|
|
129
|
+
--tcw-tag-radius: var(--tcw-radius-sm);\r
|
|
130
|
+
--tcw-toast-radius: var(--tcw-radius-lg);\r
|
|
131
|
+
--tcw-toolbar-radius: 0px;\r
|
|
132
|
+
--tcw-sidebar-radius: 0px;\r
|
|
133
|
+
--tcw-toolbar-h: 46px;\r
|
|
134
|
+
--tcw-control-h: 30px;\r
|
|
135
|
+
--tcw-control-h-sm: 24px;\r
|
|
136
|
+
--tcw-icon: 18px;\r
|
|
137
|
+
--tcw-sidebar-w: 48px;\r
|
|
138
|
+
--tcw-menu-item-h: 30px;\r
|
|
139
|
+
--tcw-font: 'Manrope', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;\r
|
|
140
|
+
--tcw-font-size: 13px;\r
|
|
141
|
+
--tcw-font-size-sm: 12px;\r
|
|
142
|
+
--tcw-font-size-xs: 11px;\r
|
|
143
|
+
--tcw-font-size-lg: 15px;\r
|
|
144
|
+
--tcw-weight: 500;\r
|
|
145
|
+
--tcw-weight-strong: 600;\r
|
|
146
|
+
--tcw-label-case: none;\r
|
|
147
|
+
--tcw-label-tracking: 0em;\r
|
|
148
|
+
--tcw-border-w: 1px;\r
|
|
149
|
+
--tcw-sep-w: 0px;\r
|
|
150
|
+
--tcw-menu-shadow: var(--tcw-shadow-lg);\r
|
|
151
|
+
--tcw-dialog-shadow: var(--tcw-shadow-xl);\r
|
|
152
|
+
--tcw-tooltip-shadow: var(--tcw-shadow-md);\r
|
|
153
|
+
--tcw-blur: 0px;\r
|
|
154
|
+
--tcw-surface-opacity: 100%;\r
|
|
72
155
|
\r
|
|
73
156
|
/* Elevation */\r
|
|
74
157
|
--tcw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\r
|
|
@@ -91,6 +174,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
91
174
|
--tcw-bg-overlay: rgba(255, 255, 255, 0.75);\r
|
|
92
175
|
--tcw-border: #e3e6eb;\r
|
|
93
176
|
--tcw-border-strong: #d2d6dd;\r
|
|
177
|
+
--tcw-tooltip-bg: #1f2630;\r
|
|
178
|
+
--tcw-tooltip-fg: #f4f5f8;\r
|
|
94
179
|
--tcw-text: #0c1016;\r
|
|
95
180
|
--tcw-text-dim: #3f4754;\r
|
|
96
181
|
--tcw-text-muted: #626a77;\r
|
|
@@ -127,8 +212,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
127
212
|
align-items: center;\r
|
|
128
213
|
gap: 0;\r
|
|
129
214
|
padding: 0 10px;\r
|
|
130
|
-
height:
|
|
131
|
-
border-bottom:
|
|
215
|
+
height: var(--tcw-toolbar-h);\r
|
|
216
|
+
border-bottom: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
132
217
|
background:\r
|
|
133
218
|
linear-gradient(180deg, var(--tcw-bg-elevated) 0%, var(--tcw-bg-surface) 100%);\r
|
|
134
219
|
flex-shrink: 0;\r
|
|
@@ -138,17 +223,20 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
138
223
|
}\r
|
|
139
224
|
\r
|
|
140
225
|
.tcw-toolbar-symbol {\r
|
|
141
|
-
font-size:
|
|
142
|
-
font-weight:
|
|
226
|
+
font-size: calc(var(--tcw-font-size) + 1px);\r
|
|
227
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
143
228
|
color: var(--tcw-text);\r
|
|
144
|
-
|
|
229
|
+
display: inline-flex;\r
|
|
230
|
+
align-items: center;\r
|
|
231
|
+
height: var(--tcw-control-h);\r
|
|
232
|
+
padding: 0 12px;\r
|
|
145
233
|
white-space: nowrap;\r
|
|
146
234
|
letter-spacing: -0.015em;\r
|
|
147
235
|
cursor: pointer;\r
|
|
148
236
|
border: none;\r
|
|
149
237
|
background: transparent;\r
|
|
150
238
|
font-family: inherit;\r
|
|
151
|
-
border-radius: var(--tcw-radius);\r
|
|
239
|
+
border-radius: var(--tcw-control-radius);\r
|
|
152
240
|
transition: background var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
153
241
|
}\r
|
|
154
242
|
\r
|
|
@@ -157,7 +245,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
157
245
|
}\r
|
|
158
246
|
\r
|
|
159
247
|
.tcw-toolbar-sep {\r
|
|
160
|
-
width:
|
|
248
|
+
width: var(--tcw-sep-w);\r
|
|
161
249
|
height: 22px;\r
|
|
162
250
|
background: var(--tcw-border);\r
|
|
163
251
|
flex-shrink: 0;\r
|
|
@@ -176,12 +264,16 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
176
264
|
}\r
|
|
177
265
|
\r
|
|
178
266
|
.tcw-btn {\r
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
267
|
+
display: inline-flex;\r
|
|
268
|
+
align-items: center;\r
|
|
269
|
+
justify-content: center;\r
|
|
270
|
+
height: var(--tcw-control-h);\r
|
|
271
|
+
padding: 0 10px;\r
|
|
272
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
273
|
+
font-weight: var(--tcw-weight);\r
|
|
182
274
|
font-family: inherit;\r
|
|
183
275
|
border: none;\r
|
|
184
|
-
border-radius: var(--tcw-radius);\r
|
|
276
|
+
border-radius: var(--tcw-control-radius);\r
|
|
185
277
|
background: transparent;\r
|
|
186
278
|
color: var(--tcw-text-dim);\r
|
|
187
279
|
cursor: pointer;\r
|
|
@@ -204,10 +296,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
204
296
|
}\r
|
|
205
297
|
\r
|
|
206
298
|
.tcw-btn.tcw-active {\r
|
|
207
|
-
background: var(--tcw-
|
|
208
|
-
color: var(--tcw-
|
|
209
|
-
font-weight:
|
|
210
|
-
box-shadow:
|
|
299
|
+
background: var(--tcw-on-bg);\r
|
|
300
|
+
color: var(--tcw-on-fg);\r
|
|
301
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
302
|
+
box-shadow: var(--tcw-on-ring);\r
|
|
211
303
|
}\r
|
|
212
304
|
\r
|
|
213
305
|
.tcw-btn:focus-visible,\r
|
|
@@ -219,14 +311,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
219
311
|
}\r
|
|
220
312
|
\r
|
|
221
313
|
.tcw-btn-icon {\r
|
|
222
|
-
width:
|
|
223
|
-
height:
|
|
314
|
+
width: var(--tcw-control-h);\r
|
|
315
|
+
height: var(--tcw-control-h);\r
|
|
224
316
|
display: inline-flex;\r
|
|
225
317
|
align-items: center;\r
|
|
226
318
|
justify-content: center;\r
|
|
227
319
|
font-family: inherit;\r
|
|
228
320
|
border: none;\r
|
|
229
|
-
border-radius: var(--tcw-radius);\r
|
|
321
|
+
border-radius: var(--tcw-control-radius);\r
|
|
230
322
|
background: transparent;\r
|
|
231
323
|
color: var(--tcw-text-muted);\r
|
|
232
324
|
cursor: pointer;\r
|
|
@@ -244,76 +336,33 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
244
336
|
\r
|
|
245
337
|
.tcw-btn-icon svg {\r
|
|
246
338
|
display: block;\r
|
|
339
|
+
width: var(--tcw-icon);\r
|
|
340
|
+
height: var(--tcw-icon);\r
|
|
247
341
|
}\r
|
|
248
342
|
\r
|
|
249
343
|
.tcw-badge-count {\r
|
|
250
|
-
font-size:
|
|
251
|
-
font-weight:
|
|
344
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
345
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
252
346
|
color: var(--tcw-accent);\r
|
|
253
347
|
background: var(--tcw-accent-soft);\r
|
|
254
348
|
padding: 1px 5px;\r
|
|
255
|
-
border-radius:
|
|
349
|
+
border-radius: var(--tcw-tag-radius);\r
|
|
256
350
|
font-family: var(--tcw-font-mono);\r
|
|
257
351
|
}\r
|
|
258
352
|
\r
|
|
259
|
-
.tcw-indicator-chips {\r
|
|
260
|
-
display: flex;\r
|
|
261
|
-
align-items: center;\r
|
|
262
|
-
gap: 4px;\r
|
|
263
|
-
padding: 0 4px;\r
|
|
264
|
-
flex-wrap: nowrap;\r
|
|
265
|
-
overflow: hidden;\r
|
|
266
|
-
}\r
|
|
267
|
-
\r
|
|
268
|
-
.tcw-indicator-chip {\r
|
|
269
|
-
display: inline-flex;\r
|
|
270
|
-
align-items: center;\r
|
|
271
|
-
gap: 4px;\r
|
|
272
|
-
padding: 3px 6px 3px 9px;\r
|
|
273
|
-
font-size: 11px;\r
|
|
274
|
-
font-weight: 500;\r
|
|
275
|
-
background: var(--tcw-accent-soft);\r
|
|
276
|
-
color: var(--tcw-accent);\r
|
|
277
|
-
border-radius: 9999px;\r
|
|
278
|
-
white-space: nowrap;\r
|
|
279
|
-
line-height: 1.4;\r
|
|
280
|
-
letter-spacing: -0.005em;\r
|
|
281
|
-
border: 1px solid transparent;\r
|
|
282
|
-
transition: border-color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
283
|
-
}\r
|
|
284
|
-
\r
|
|
285
|
-
.tcw-indicator-chip:hover {\r
|
|
286
|
-
border-color: var(--tcw-accent-line);\r
|
|
287
|
-
}\r
|
|
288
|
-
\r
|
|
289
|
-
.tcw-chip-remove {\r
|
|
290
|
-
cursor: pointer;\r
|
|
291
|
-
opacity: 0.55;\r
|
|
292
|
-
padding: 0 2px;\r
|
|
293
|
-
transition: opacity var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
294
|
-
border: none;\r
|
|
295
|
-
background: transparent;\r
|
|
296
|
-
color: inherit;\r
|
|
297
|
-
display: inline-flex;\r
|
|
298
|
-
align-items: center;\r
|
|
299
|
-
}\r
|
|
300
|
-
\r
|
|
301
|
-
.tcw-chip-remove:hover {\r
|
|
302
|
-
opacity: 1;\r
|
|
303
|
-
}\r
|
|
304
|
-
\r
|
|
305
353
|
/* === Dropdown === */\r
|
|
306
354
|
\r
|
|
307
355
|
.tcw-dropdown-trigger {\r
|
|
308
356
|
display: inline-flex;\r
|
|
309
357
|
align-items: center;\r
|
|
310
358
|
gap: 4px;\r
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
font-
|
|
359
|
+
height: var(--tcw-control-h);\r
|
|
360
|
+
padding: 0 10px;\r
|
|
361
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
362
|
+
font-weight: var(--tcw-weight);\r
|
|
314
363
|
font-family: inherit;\r
|
|
315
364
|
border: none;\r
|
|
316
|
-
border-radius: var(--tcw-radius);\r
|
|
365
|
+
border-radius: var(--tcw-control-radius);\r
|
|
317
366
|
background: transparent;\r
|
|
318
367
|
color: var(--tcw-text-dim);\r
|
|
319
368
|
cursor: pointer;\r
|
|
@@ -332,15 +381,17 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
332
381
|
top: 100%;\r
|
|
333
382
|
margin-top: 6px;\r
|
|
334
383
|
background: var(--tcw-bg-elevated);\r
|
|
335
|
-
border:
|
|
336
|
-
border-radius: var(--tcw-radius
|
|
337
|
-
box-shadow: var(--tcw-shadow
|
|
384
|
+
border: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
385
|
+
border-radius: var(--tcw-menu-radius);\r
|
|
386
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
338
387
|
z-index: 50;\r
|
|
388
|
+
width: max-content;\r
|
|
389
|
+
max-width: min(340px, calc(100vw - 16px));\r
|
|
339
390
|
padding: 6px;\r
|
|
340
391
|
max-height: 420px;\r
|
|
341
392
|
overflow-y: auto;\r
|
|
342
|
-
backdrop-filter: blur(
|
|
343
|
-
-webkit-backdrop-filter: blur(
|
|
393
|
+
backdrop-filter: blur(var(--tcw-blur));\r
|
|
394
|
+
-webkit-backdrop-filter: blur(var(--tcw-blur));\r
|
|
344
395
|
animation: tcw-pop-in var(--tcw-dur-normal) var(--tcw-ease-out);\r
|
|
345
396
|
}\r
|
|
346
397
|
\r
|
|
@@ -353,8 +404,9 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
353
404
|
display: flex;\r
|
|
354
405
|
align-items: center;\r
|
|
355
406
|
justify-content: space-between;\r
|
|
356
|
-
|
|
357
|
-
|
|
407
|
+
min-height: var(--tcw-menu-item-h);\r
|
|
408
|
+
padding: 4px 10px;\r
|
|
409
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
358
410
|
color: var(--tcw-text-dim);\r
|
|
359
411
|
cursor: pointer;\r
|
|
360
412
|
transition: background var(--tcw-dur-fast) var(--tcw-ease), color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
@@ -362,7 +414,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
362
414
|
border: none;\r
|
|
363
415
|
background: transparent;\r
|
|
364
416
|
font-family: inherit;\r
|
|
365
|
-
text-align:
|
|
417
|
+
text-align: start;\r
|
|
366
418
|
border-radius: var(--tcw-radius-sm);\r
|
|
367
419
|
gap: 12px;\r
|
|
368
420
|
}\r
|
|
@@ -372,19 +424,200 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
372
424
|
color: var(--tcw-text);\r
|
|
373
425
|
}\r
|
|
374
426
|
\r
|
|
427
|
+
/* A menu row led by an icon (chart types): icon then label, not spread apart. */\r
|
|
428
|
+
.tcw-dropdown-item--icon {\r
|
|
429
|
+
justify-content: flex-start;\r
|
|
430
|
+
gap: 10px;\r
|
|
431
|
+
}\r
|
|
432
|
+
\r
|
|
433
|
+
.tcw-dropdown-item svg,\r
|
|
434
|
+
.tcw-flyout-item svg {\r
|
|
435
|
+
flex-shrink: 0;\r
|
|
436
|
+
}\r
|
|
437
|
+
\r
|
|
438
|
+
/* The drawing-group button's icon holder: a plain box for the swapped SVG. */\r
|
|
439
|
+
.tcw-sidebar-icon {\r
|
|
440
|
+
display: inline-flex;\r
|
|
441
|
+
}\r
|
|
442
|
+
\r
|
|
375
443
|
.tcw-dropdown-item.tcw-active {\r
|
|
376
444
|
color: var(--tcw-accent);\r
|
|
377
445
|
background: var(--tcw-accent-soft);\r
|
|
378
|
-
font-weight:
|
|
446
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
447
|
+
}\r
|
|
448
|
+
\r
|
|
449
|
+
/* Timeframe menu: pick on the left, pin (star) on the right. */\r
|
|
450
|
+
.tcw-tf-more {\r
|
|
451
|
+
padding: 0 5px;\r
|
|
452
|
+
}\r
|
|
453
|
+
\r
|
|
454
|
+
.tcw-tf-more svg {\r
|
|
455
|
+
display: block;\r
|
|
456
|
+
}\r
|
|
457
|
+
\r
|
|
458
|
+
.tcw-tf-row {\r
|
|
459
|
+
display: flex;\r
|
|
460
|
+
align-items: center;\r
|
|
461
|
+
gap: 2px;\r
|
|
462
|
+
}\r
|
|
463
|
+
\r
|
|
464
|
+
.tcw-tf-row .tcw-dropdown-item {\r
|
|
465
|
+
flex: 1;\r
|
|
466
|
+
min-width: 0;\r
|
|
467
|
+
}\r
|
|
468
|
+
\r
|
|
469
|
+
.tcw-tf-star {\r
|
|
470
|
+
display: inline-grid;\r
|
|
471
|
+
place-items: center;\r
|
|
472
|
+
width: var(--tcw-control-h-sm);\r
|
|
473
|
+
height: var(--tcw-control-h-sm);\r
|
|
474
|
+
flex-shrink: 0;\r
|
|
475
|
+
border: none;\r
|
|
476
|
+
border-radius: var(--tcw-control-radius);\r
|
|
477
|
+
background: transparent;\r
|
|
478
|
+
color: var(--tcw-text-muted);\r
|
|
479
|
+
cursor: pointer;\r
|
|
480
|
+
transition: color var(--tcw-dur-fast) var(--tcw-ease), background var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
481
|
+
}\r
|
|
482
|
+
\r
|
|
483
|
+
.tcw-tf-star:hover {\r
|
|
484
|
+
background: var(--tcw-hover-bg);\r
|
|
485
|
+
color: var(--tcw-text);\r
|
|
486
|
+
}\r
|
|
487
|
+
\r
|
|
488
|
+
.tcw-tf-star.tcw-active {\r
|
|
489
|
+
color: var(--tcw-accent);\r
|
|
490
|
+
}\r
|
|
491
|
+
\r
|
|
492
|
+
.tcw-tf-star.tcw-active svg {\r
|
|
493
|
+
fill: currentColor;\r
|
|
494
|
+
}\r
|
|
495
|
+
\r
|
|
496
|
+
.tcw-tf-star:focus-visible {\r
|
|
497
|
+
outline: 2px solid var(--tcw-accent);\r
|
|
498
|
+
outline-offset: -2px;\r
|
|
499
|
+
}\r
|
|
500
|
+
\r
|
|
501
|
+
.tcw-tf-remove {\r
|
|
502
|
+
display: inline-grid;\r
|
|
503
|
+
place-items: center;\r
|
|
504
|
+
width: var(--tcw-control-h-sm);\r
|
|
505
|
+
height: var(--tcw-control-h-sm);\r
|
|
506
|
+
flex-shrink: 0;\r
|
|
507
|
+
border: none;\r
|
|
508
|
+
border-radius: var(--tcw-control-radius);\r
|
|
509
|
+
background: transparent;\r
|
|
510
|
+
color: var(--tcw-text-muted);\r
|
|
511
|
+
cursor: pointer;\r
|
|
512
|
+
opacity: 0;\r
|
|
513
|
+
transition: opacity var(--tcw-dur-fast) var(--tcw-ease), color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
514
|
+
}\r
|
|
515
|
+
\r
|
|
516
|
+
.tcw-tf-row:hover .tcw-tf-remove,\r
|
|
517
|
+
.tcw-tf-remove:focus-visible {\r
|
|
518
|
+
opacity: 1;\r
|
|
519
|
+
}\r
|
|
520
|
+
\r
|
|
521
|
+
/* No hover on touch screens: keep it visible rather than a hidden tap target. */\r
|
|
522
|
+
@media (hover: none) {\r
|
|
523
|
+
.tcw-tf-remove { opacity: 1; }\r
|
|
524
|
+
}\r
|
|
525
|
+
\r
|
|
526
|
+
.tcw-tf-remove:hover {\r
|
|
527
|
+
color: var(--tcw-red);\r
|
|
528
|
+
background: var(--tcw-hover-bg);\r
|
|
529
|
+
}\r
|
|
530
|
+
\r
|
|
531
|
+
.tcw-tf-remove:focus-visible {\r
|
|
532
|
+
outline: 2px solid var(--tcw-accent);\r
|
|
533
|
+
outline-offset: -2px;\r
|
|
534
|
+
}\r
|
|
535
|
+
\r
|
|
536
|
+
/* Typed interval, under the list: stays in view while the list scrolls. */\r
|
|
537
|
+
.tcw-tf-custom {\r
|
|
538
|
+
position: sticky;\r
|
|
539
|
+
bottom: -6px;\r
|
|
540
|
+
display: flex;\r
|
|
541
|
+
flex-wrap: wrap;\r
|
|
542
|
+
gap: 4px;\r
|
|
543
|
+
margin: 4px -6px -6px;\r
|
|
544
|
+
padding: 6px 10px 8px;\r
|
|
545
|
+
border-top: 1px solid var(--tcw-divider);\r
|
|
546
|
+
background: var(--tcw-bg-elevated);\r
|
|
547
|
+
}\r
|
|
548
|
+
\r
|
|
549
|
+
.tcw-tf-custom-hint:empty {\r
|
|
550
|
+
display: none;\r
|
|
551
|
+
}\r
|
|
552
|
+
\r
|
|
553
|
+
.tcw-tf-custom-hint {\r
|
|
554
|
+
flex-basis: 100%;\r
|
|
555
|
+
width: 0;\r
|
|
556
|
+
min-width: 100%;\r
|
|
557
|
+
color: var(--tcw-red);\r
|
|
558
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
559
|
+
line-height: 1.35;\r
|
|
560
|
+
}\r
|
|
561
|
+
\r
|
|
562
|
+
.tcw-tf-custom-input {\r
|
|
563
|
+
flex: 1;\r
|
|
564
|
+
min-width: 0;\r
|
|
565
|
+
height: 26px;\r
|
|
566
|
+
padding: 0 8px;\r
|
|
567
|
+
border: 1px solid var(--tcw-border);\r
|
|
568
|
+
border-radius: var(--tcw-input-radius);\r
|
|
569
|
+
background: var(--tcw-bg);\r
|
|
570
|
+
color: var(--tcw-text);\r
|
|
571
|
+
font: inherit;\r
|
|
572
|
+
font-family: var(--tcw-font-mono);\r
|
|
573
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
574
|
+
}\r
|
|
575
|
+
\r
|
|
576
|
+
.tcw-tf-custom-input::placeholder {\r
|
|
577
|
+
color: var(--tcw-text-dim);\r
|
|
578
|
+
}\r
|
|
579
|
+
\r
|
|
580
|
+
.tcw-tf-custom-input:focus {\r
|
|
581
|
+
outline: none;\r
|
|
582
|
+
border-color: var(--tcw-accent);\r
|
|
583
|
+
box-shadow: 0 0 0 2px var(--tcw-accent-soft);\r
|
|
584
|
+
}\r
|
|
585
|
+
\r
|
|
586
|
+
.tcw-tf-custom-input[aria-invalid='true'] {\r
|
|
587
|
+
border-color: var(--tcw-red);\r
|
|
588
|
+
box-shadow: 0 0 0 2px var(--tcw-red-soft);\r
|
|
589
|
+
}\r
|
|
590
|
+
\r
|
|
591
|
+
.tcw-tf-custom-add {\r
|
|
592
|
+
display: inline-grid;\r
|
|
593
|
+
place-items: center;\r
|
|
594
|
+
width: var(--tcw-control-h-sm);\r
|
|
595
|
+
height: var(--tcw-control-h-sm);\r
|
|
596
|
+
flex-shrink: 0;\r
|
|
597
|
+
border: 1px solid var(--tcw-border);\r
|
|
598
|
+
border-radius: var(--tcw-control-radius);\r
|
|
599
|
+
background: var(--tcw-bg-surface);\r
|
|
600
|
+
color: var(--tcw-text);\r
|
|
601
|
+
cursor: pointer;\r
|
|
602
|
+
}\r
|
|
603
|
+
\r
|
|
604
|
+
.tcw-tf-custom-add:hover {\r
|
|
605
|
+
border-color: var(--tcw-accent);\r
|
|
606
|
+
color: var(--tcw-accent);\r
|
|
607
|
+
}\r
|
|
608
|
+
\r
|
|
609
|
+
.tcw-tf-custom-add:focus-visible {\r
|
|
610
|
+
outline: 2px solid var(--tcw-accent);\r
|
|
611
|
+
outline-offset: 1px;\r
|
|
379
612
|
}\r
|
|
380
613
|
\r
|
|
381
614
|
.tcw-dropdown-label {\r
|
|
382
|
-
text-transform:
|
|
383
|
-
font-size:
|
|
615
|
+
text-transform: var(--tcw-label-case);\r
|
|
616
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
384
617
|
color: var(--tcw-text-muted);\r
|
|
385
|
-
letter-spacing:
|
|
618
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
386
619
|
padding: 8px 10px 4px;\r
|
|
387
|
-
font-weight:
|
|
620
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
388
621
|
}\r
|
|
389
622
|
\r
|
|
390
623
|
.tcw-dropdown-divider {\r
|
|
@@ -393,11 +626,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
393
626
|
}\r
|
|
394
627
|
\r
|
|
395
628
|
.tcw-tag {\r
|
|
396
|
-
font-size:
|
|
629
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
397
630
|
font-family: var(--tcw-font-mono);\r
|
|
398
631
|
color: var(--tcw-text-muted);\r
|
|
399
632
|
padding: 2px 6px;\r
|
|
400
|
-
border-radius:
|
|
633
|
+
border-radius: var(--tcw-tag-radius);\r
|
|
401
634
|
background: var(--tcw-hover-bg);\r
|
|
402
635
|
letter-spacing: 0.02em;\r
|
|
403
636
|
}\r
|
|
@@ -405,6 +638,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
405
638
|
/* === Body === */\r
|
|
406
639
|
\r
|
|
407
640
|
.tcw-body {\r
|
|
641
|
+
position: relative;\r
|
|
408
642
|
display: flex;\r
|
|
409
643
|
flex: 1;\r
|
|
410
644
|
min-height: 0;\r
|
|
@@ -420,6 +654,77 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
420
654
|
position: relative;\r
|
|
421
655
|
}\r
|
|
422
656
|
\r
|
|
657
|
+
/* === Symbol search results: name and exchange === */\r
|
|
658
|
+
\r
|
|
659
|
+
.tcw-cmd-item-desc {\r
|
|
660
|
+
flex: 1;\r
|
|
661
|
+
min-width: 0;\r
|
|
662
|
+
overflow: hidden;\r
|
|
663
|
+
color: var(--tcw-text-muted);\r
|
|
664
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
665
|
+
text-overflow: ellipsis;\r
|
|
666
|
+
white-space: nowrap;\r
|
|
667
|
+
}\r
|
|
668
|
+
\r
|
|
669
|
+
.tcw-cmd-item-meta {\r
|
|
670
|
+
flex-shrink: 0;\r
|
|
671
|
+
color: var(--tcw-text-dim);\r
|
|
672
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
673
|
+
letter-spacing: 0.02em;\r
|
|
674
|
+
}\r
|
|
675
|
+
\r
|
|
676
|
+
/* === History pill (older bars loading at the left edge) === */\r
|
|
677
|
+
\r
|
|
678
|
+
.tcw-history-pill {\r
|
|
679
|
+
position: absolute;\r
|
|
680
|
+
top: 50%;\r
|
|
681
|
+
left: 10px;\r
|
|
682
|
+
z-index: 4;\r
|
|
683
|
+
display: flex;\r
|
|
684
|
+
align-items: center;\r
|
|
685
|
+
gap: 7px;\r
|
|
686
|
+
padding: 5px 10px 5px 8px;\r
|
|
687
|
+
border: 1px solid var(--tcw-border);\r
|
|
688
|
+
border-radius: var(--tcw-tag-radius);\r
|
|
689
|
+
background: var(--tcw-bg-elevated);\r
|
|
690
|
+
box-shadow: var(--tcw-shadow-sm);\r
|
|
691
|
+
color: var(--tcw-text-muted);\r
|
|
692
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
693
|
+
line-height: 1;\r
|
|
694
|
+
white-space: nowrap;\r
|
|
695
|
+
transform: translateY(-50%);\r
|
|
696
|
+
opacity: 1;\r
|
|
697
|
+
transition: opacity var(--tcw-dur-normal) var(--tcw-ease-out);\r
|
|
698
|
+
pointer-events: none;\r
|
|
699
|
+
}\r
|
|
700
|
+
\r
|
|
701
|
+
.tcw-history-pill--hidden {\r
|
|
702
|
+
opacity: 0;\r
|
|
703
|
+
}\r
|
|
704
|
+
\r
|
|
705
|
+
.tcw-history-pill--error {\r
|
|
706
|
+
border-color: color-mix(in srgb, var(--tcw-red) 45%, var(--tcw-border));\r
|
|
707
|
+
color: var(--tcw-red);\r
|
|
708
|
+
}\r
|
|
709
|
+
\r
|
|
710
|
+
.tcw-history-spinner {\r
|
|
711
|
+
width: 10px;\r
|
|
712
|
+
height: 10px;\r
|
|
713
|
+
border: 1.5px solid var(--tcw-accent-soft);\r
|
|
714
|
+
border-top-color: var(--tcw-accent);\r
|
|
715
|
+
border-radius: 50%;\r
|
|
716
|
+
animation: tcw-history-spin 0.8s linear infinite;\r
|
|
717
|
+
}\r
|
|
718
|
+
\r
|
|
719
|
+
.tcw-history-pill--error .tcw-history-spinner {\r
|
|
720
|
+
border-color: currentColor;\r
|
|
721
|
+
animation: none;\r
|
|
722
|
+
}\r
|
|
723
|
+
\r
|
|
724
|
+
@keyframes tcw-history-spin {\r
|
|
725
|
+
to { transform: rotate(360deg); }\r
|
|
726
|
+
}\r
|
|
727
|
+
\r
|
|
423
728
|
/* === Loading overlay (candle skeleton) === */\r
|
|
424
729
|
\r
|
|
425
730
|
.tcw-loading-overlay {\r
|
|
@@ -449,7 +754,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
449
754
|
gap: 14px;\r
|
|
450
755
|
padding: 22px 26px 20px;\r
|
|
451
756
|
border: 1px solid transparent;\r
|
|
452
|
-
border-radius: var(--tcw-radius
|
|
757
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
453
758
|
}\r
|
|
454
759
|
\r
|
|
455
760
|
/* A slow switch: the previous chart stays readable underneath, dimmed, so the\r
|
|
@@ -461,7 +766,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
461
766
|
.tcw-loading-overlay--veil .tcw-loading-card {\r
|
|
462
767
|
background: var(--tcw-bg-elevated);\r
|
|
463
768
|
border-color: var(--tcw-border);\r
|
|
464
|
-
box-shadow: var(--tcw-shadow
|
|
769
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
465
770
|
}\r
|
|
466
771
|
\r
|
|
467
772
|
.tcw-loading-candles {\r
|
|
@@ -479,6 +784,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
479
784
|
color: var(--tcw-red);\r
|
|
480
785
|
opacity: 0.28;\r
|
|
481
786
|
animation: tcw-candle-light 1.6s var(--tcw-ease) infinite;\r
|
|
787
|
+
animation-delay: var(--tcw-delay, 0ms);\r
|
|
482
788
|
}\r
|
|
483
789
|
\r
|
|
484
790
|
.tcw-loading-candle--up { color: var(--tcw-green); }\r
|
|
@@ -561,66 +867,239 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
561
867
|
max-width: 320px;\r
|
|
562
868
|
text-align: center;\r
|
|
563
869
|
color: var(--tcw-red);\r
|
|
564
|
-
font-size:
|
|
870
|
+
font-size: var(--tcw-font-size);\r
|
|
565
871
|
}\r
|
|
566
872
|
\r
|
|
873
|
+
/* Reduced motion: nothing slides or lifts, but the candles still glow in\r
|
|
874
|
+
turn and the track breathes, so the wait never looks frozen. */\r
|
|
567
875
|
@media (prefers-reduced-motion: reduce) {\r
|
|
568
|
-
.tcw-loading-candle
|
|
569
|
-
|
|
570
|
-
animation:
|
|
876
|
+
.tcw-loading-candle {\r
|
|
877
|
+
animation: tcw-candle-glow 2.4s ease-in-out infinite;\r
|
|
878
|
+
animation-delay: var(--tcw-delay, 0ms);\r
|
|
571
879
|
}\r
|
|
572
|
-
.tcw-loading-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
position: static;\r
|
|
577
|
-
width: auto;\r
|
|
578
|
-
height: auto;\r
|
|
579
|
-
overflow: visible;\r
|
|
580
|
-
clip-path: none;\r
|
|
581
|
-
font-size: 12px;\r
|
|
582
|
-
color: var(--tcw-text-muted);\r
|
|
880
|
+
.tcw-loading-track > span {\r
|
|
881
|
+
width: 100%;\r
|
|
882
|
+
background: var(--tcw-accent);\r
|
|
883
|
+
animation: tcw-loading-breathe 2.4s ease-in-out infinite;\r
|
|
583
884
|
}\r
|
|
584
885
|
}\r
|
|
585
886
|
\r
|
|
586
|
-
|
|
887
|
+
@keyframes tcw-candle-glow {\r
|
|
888
|
+
0%, 60%, 100% { opacity: 0.28; }\r
|
|
889
|
+
25% { opacity: 0.9; }\r
|
|
890
|
+
}\r
|
|
587
891
|
\r
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
892
|
+
@keyframes tcw-loading-breathe {\r
|
|
893
|
+
0%, 100% { opacity: 0.15; }\r
|
|
894
|
+
50% { opacity: 0.7; }\r
|
|
895
|
+
}\r
|
|
896
|
+
\r
|
|
897
|
+
/* === On-chart indicator legend (WidgetIndicatorLegend) === */\r
|
|
898
|
+
\r
|
|
899
|
+
.tcw-ind-legend {\r
|
|
900
|
+
position: absolute;\r
|
|
901
|
+
z-index: 3;\r
|
|
593
902
|
display: flex;\r
|
|
594
903
|
flex-direction: column;\r
|
|
595
|
-
align-items:
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
904
|
+
align-items: flex-start;\r
|
|
905
|
+
gap: 1px;\r
|
|
906
|
+
max-width: calc(100% - 140px);\r
|
|
907
|
+
pointer-events: none;\r
|
|
599
908
|
}\r
|
|
600
909
|
\r
|
|
601
|
-
.tcw-
|
|
602
|
-
|
|
910
|
+
.tcw-ind-legend--collapsed > .tcw-ind-legend-row {\r
|
|
911
|
+
display: none;\r
|
|
603
912
|
}\r
|
|
604
913
|
\r
|
|
605
|
-
.tcw-
|
|
606
|
-
width: 32px;\r
|
|
607
|
-
height: 32px;\r
|
|
608
|
-
margin: 1px 0;\r
|
|
914
|
+
.tcw-ind-legend-row {\r
|
|
609
915
|
display: flex;\r
|
|
610
916
|
align-items: center;\r
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
917
|
+
gap: 8px;\r
|
|
918
|
+
max-width: 100%;\r
|
|
919
|
+
padding: 0 4px;\r
|
|
920
|
+
border-radius: var(--tcw-radius-sm);\r
|
|
921
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
922
|
+
line-height: 19px;\r
|
|
923
|
+
font-feature-settings: 'tnum';\r
|
|
924
|
+
white-space: nowrap;\r
|
|
925
|
+
color: var(--tcw-text-dim);\r
|
|
926
|
+
pointer-events: auto;\r
|
|
927
|
+
cursor: default;\r
|
|
928
|
+
/* A narrow pane: the values shrink first, then the row is clipped. */\r
|
|
929
|
+
overflow: hidden;\r
|
|
930
|
+
}\r
|
|
931
|
+
\r
|
|
932
|
+
/* A pane's indicator: at the top of its pane, where the canvas title was,\r
|
|
933
|
+
short enough to sit in the pane's header below the divider's grab zone. */\r
|
|
934
|
+
.tcw-ind-legend-row--pane {\r
|
|
935
|
+
position: absolute;\r
|
|
936
|
+
z-index: 3;\r
|
|
937
|
+
line-height: 15px;\r
|
|
938
|
+
}\r
|
|
939
|
+
\r
|
|
940
|
+
.tcw-ind-legend-row:hover,\r
|
|
941
|
+
.tcw-ind-legend-row:focus-within {\r
|
|
942
|
+
background: color-mix(in srgb, var(--tcw-bg-elevated) 90%, transparent);\r
|
|
943
|
+
box-shadow: 0 0 0 1px var(--tcw-border);\r
|
|
944
|
+
}\r
|
|
945
|
+
\r
|
|
946
|
+
.tcw-ind-legend-name {\r
|
|
947
|
+
padding: 0;\r
|
|
948
|
+
border: none;\r
|
|
949
|
+
background: none;\r
|
|
950
|
+
font: inherit;\r
|
|
951
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
952
|
+
color: var(--tcw-text);\r
|
|
953
|
+
cursor: pointer;\r
|
|
954
|
+
}\r
|
|
955
|
+
\r
|
|
956
|
+
.tcw-ind-legend-name:hover {\r
|
|
957
|
+
color: var(--tcw-accent);\r
|
|
958
|
+
}\r
|
|
959
|
+
\r
|
|
960
|
+
.tcw-ind-legend-values {\r
|
|
961
|
+
display: inline-flex;\r
|
|
962
|
+
gap: 7px;\r
|
|
963
|
+
min-width: 0;\r
|
|
964
|
+
overflow: hidden;\r
|
|
965
|
+
}\r
|
|
966
|
+
\r
|
|
967
|
+
.tcw-ind-legend-row--hidden .tcw-ind-legend-name,\r
|
|
968
|
+
.tcw-ind-legend-row--hidden .tcw-ind-legend-values {\r
|
|
969
|
+
opacity: 0.45;\r
|
|
970
|
+
}\r
|
|
971
|
+
\r
|
|
972
|
+
/* Show / settings / remove: on hover or keyboard focus (always on touch). */\r
|
|
973
|
+
.tcw-ind-legend-actions {\r
|
|
974
|
+
display: none;\r
|
|
975
|
+
gap: 1px;\r
|
|
976
|
+
margin-left: -2px;\r
|
|
977
|
+
}\r
|
|
978
|
+
\r
|
|
979
|
+
.tcw-ind-legend-row:hover .tcw-ind-legend-actions,\r
|
|
980
|
+
.tcw-ind-legend-row:focus-within .tcw-ind-legend-actions {\r
|
|
981
|
+
display: inline-flex;\r
|
|
982
|
+
}\r
|
|
983
|
+
\r
|
|
984
|
+
@media (hover: none) {\r
|
|
985
|
+
.tcw-ind-legend-actions {\r
|
|
986
|
+
display: inline-flex;\r
|
|
987
|
+
}\r
|
|
988
|
+
\r
|
|
989
|
+
/* Finger-sized targets. */\r
|
|
990
|
+
.tcw-ind-legend-act,\r
|
|
991
|
+
.tcw-ind-legend-toggle {\r
|
|
992
|
+
min-width: 28px;\r
|
|
993
|
+
min-height: 24px;\r
|
|
994
|
+
}\r
|
|
995
|
+
}\r
|
|
996
|
+
\r
|
|
997
|
+
.tcw-ind-legend-act {\r
|
|
998
|
+
display: inline-grid;\r
|
|
999
|
+
place-items: center;\r
|
|
1000
|
+
width: 20px;\r
|
|
1001
|
+
height: 18px;\r
|
|
1002
|
+
padding: 0;\r
|
|
1003
|
+
border: none;\r
|
|
1004
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1005
|
+
background: transparent;\r
|
|
1006
|
+
color: var(--tcw-text-muted);\r
|
|
1007
|
+
cursor: pointer;\r
|
|
1008
|
+
}\r
|
|
1009
|
+
\r
|
|
1010
|
+
.tcw-ind-legend-act:hover {\r
|
|
1011
|
+
color: var(--tcw-text);\r
|
|
1012
|
+
background: var(--tcw-hover-bg);\r
|
|
1013
|
+
}\r
|
|
1014
|
+
\r
|
|
1015
|
+
.tcw-ind-legend-act[data-act='remove']:hover {\r
|
|
1016
|
+
color: var(--tcw-red);\r
|
|
1017
|
+
}\r
|
|
1018
|
+
\r
|
|
1019
|
+
.tcw-ind-legend-toggle {\r
|
|
1020
|
+
display: inline-flex;\r
|
|
1021
|
+
align-items: center;\r
|
|
1022
|
+
gap: 3px;\r
|
|
1023
|
+
margin-top: 1px;\r
|
|
1024
|
+
padding: 1px 5px;\r
|
|
1025
|
+
border: none;\r
|
|
1026
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1027
|
+
background: transparent;\r
|
|
1028
|
+
color: var(--tcw-text-muted);\r
|
|
1029
|
+
font: inherit;\r
|
|
1030
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1031
|
+
cursor: pointer;\r
|
|
1032
|
+
pointer-events: auto;\r
|
|
1033
|
+
}\r
|
|
1034
|
+
\r
|
|
1035
|
+
.tcw-ind-legend-toggle[hidden] {\r
|
|
1036
|
+
display: none;\r
|
|
1037
|
+
}\r
|
|
1038
|
+
\r
|
|
1039
|
+
.tcw-ind-legend-toggle:hover {\r
|
|
1040
|
+
color: var(--tcw-text);\r
|
|
1041
|
+
background: var(--tcw-hover-bg);\r
|
|
1042
|
+
}\r
|
|
1043
|
+
\r
|
|
1044
|
+
.tcw-ind-legend-name:focus-visible,\r
|
|
1045
|
+
.tcw-ind-legend-act:focus-visible,\r
|
|
1046
|
+
.tcw-ind-legend-toggle:focus-visible {\r
|
|
1047
|
+
outline: 2px solid var(--tcw-accent);\r
|
|
1048
|
+
outline-offset: -2px;\r
|
|
1049
|
+
}\r
|
|
1050
|
+
\r
|
|
1051
|
+
/* === Sidebar === */\r
|
|
1052
|
+
\r
|
|
1053
|
+
.tcw-sidebar {\r
|
|
1054
|
+
width: var(--tcw-sidebar-w);\r
|
|
1055
|
+
flex-shrink: 0;\r
|
|
1056
|
+
background: linear-gradient(180deg, var(--tcw-bg-elevated) 0%, var(--tcw-bg-surface) 100%);\r
|
|
1057
|
+
border-inline-end: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
1058
|
+
display: flex;\r
|
|
1059
|
+
flex-direction: column;\r
|
|
1060
|
+
align-items: center;\r
|
|
1061
|
+
padding: 6px 0;\r
|
|
1062
|
+
/* On a short screen the tools scroll; the menus sit outside it. */\r
|
|
1063
|
+
overflow-x: hidden;\r
|
|
1064
|
+
overflow-y: auto;\r
|
|
1065
|
+
scrollbar-width: none;\r
|
|
1066
|
+
box-shadow: var(--tcw-shadow-sm);\r
|
|
1067
|
+
}\r
|
|
1068
|
+
.tcw-sidebar::-webkit-scrollbar {\r
|
|
1069
|
+
display: none;\r
|
|
1070
|
+
}\r
|
|
1071
|
+
.tcw-sidebar > * {\r
|
|
1072
|
+
flex-shrink: 0;\r
|
|
1073
|
+
}\r
|
|
1074
|
+
\r
|
|
1075
|
+
.tcw-tool-group-wrap {\r
|
|
1076
|
+
position: relative;\r
|
|
1077
|
+
}\r
|
|
1078
|
+
\r
|
|
1079
|
+
.tcw-sidebar-btn {\r
|
|
1080
|
+
width: var(--tcw-control-h);\r
|
|
1081
|
+
height: var(--tcw-control-h);\r
|
|
1082
|
+
margin: 1px 0;\r
|
|
1083
|
+
display: flex;\r
|
|
1084
|
+
align-items: center;\r
|
|
1085
|
+
justify-content: center;\r
|
|
1086
|
+
border: none;\r
|
|
1087
|
+
background: transparent;\r
|
|
1088
|
+
color: var(--tcw-text-muted);\r
|
|
1089
|
+
cursor: pointer;\r
|
|
1090
|
+
font-family: inherit;\r
|
|
1091
|
+
transition:\r
|
|
1092
|
+
background var(--tcw-dur-fast) var(--tcw-ease),\r
|
|
1093
|
+
color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
1094
|
+
position: relative;\r
|
|
1095
|
+
flex-shrink: 0;\r
|
|
1096
|
+
line-height: 1;\r
|
|
1097
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1098
|
+
}\r
|
|
1099
|
+
\r
|
|
1100
|
+
.tcw-sidebar-btn svg {\r
|
|
1101
|
+
width: var(--tcw-icon);\r
|
|
1102
|
+
height: var(--tcw-icon);\r
|
|
624
1103
|
}\r
|
|
625
1104
|
\r
|
|
626
1105
|
.tcw-sidebar-btn:hover {\r
|
|
@@ -629,9 +1108,9 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
629
1108
|
}\r
|
|
630
1109
|
\r
|
|
631
1110
|
.tcw-sidebar-btn.tcw-active {\r
|
|
632
|
-
color: var(--tcw-
|
|
633
|
-
background: var(--tcw-
|
|
634
|
-
box-shadow:
|
|
1111
|
+
color: var(--tcw-on-icon-fg);\r
|
|
1112
|
+
background: var(--tcw-on-icon-bg);\r
|
|
1113
|
+
box-shadow: var(--tcw-on-icon-ring);\r
|
|
635
1114
|
}\r
|
|
636
1115
|
\r
|
|
637
1116
|
.tcw-sidebar-btn.tcw-danger:hover {\r
|
|
@@ -652,7 +1131,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
652
1131
|
\r
|
|
653
1132
|
.tcw-sidebar-divider {\r
|
|
654
1133
|
width: 22px;\r
|
|
655
|
-
height:
|
|
1134
|
+
height: var(--tcw-sep-w);\r
|
|
656
1135
|
background: var(--tcw-divider);\r
|
|
657
1136
|
margin: 6px 0;\r
|
|
658
1137
|
flex-shrink: 0;\r
|
|
@@ -666,45 +1145,66 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
666
1145
|
\r
|
|
667
1146
|
.tcw-flyout {\r
|
|
668
1147
|
position: absolute;\r
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
1148
|
+
margin-inline-start: 6px;\r
|
|
1149
|
+
overflow-y: auto;\r
|
|
1150
|
+
overscroll-behavior: contain;\r
|
|
672
1151
|
min-width: 180px;\r
|
|
673
1152
|
background: var(--tcw-bg-elevated);\r
|
|
674
|
-
border:
|
|
675
|
-
border-radius: var(--tcw-radius
|
|
676
|
-
box-shadow: var(--tcw-shadow
|
|
1153
|
+
border: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
1154
|
+
border-radius: var(--tcw-menu-radius);\r
|
|
1155
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
677
1156
|
z-index: 30;\r
|
|
678
1157
|
padding: 6px;\r
|
|
679
|
-
backdrop-filter: blur(
|
|
680
|
-
-webkit-backdrop-filter: blur(
|
|
1158
|
+
backdrop-filter: blur(var(--tcw-blur));\r
|
|
1159
|
+
-webkit-backdrop-filter: blur(var(--tcw-blur));\r
|
|
681
1160
|
animation: tcw-slide-right var(--tcw-dur-normal) var(--tcw-ease-out);\r
|
|
682
1161
|
}\r
|
|
683
1162
|
\r
|
|
1163
|
+
/* Spans the gap to the toolbar button: crossing it stays inside the menu. */\r
|
|
1164
|
+
.tcw-flyout::before {\r
|
|
1165
|
+
content: '';\r
|
|
1166
|
+
position: absolute;\r
|
|
1167
|
+
top: -1px;\r
|
|
1168
|
+
bottom: -1px;\r
|
|
1169
|
+
right: 100%;\r
|
|
1170
|
+
width: 8px;\r
|
|
1171
|
+
}\r
|
|
1172
|
+
\r
|
|
684
1173
|
@keyframes tcw-slide-right {\r
|
|
685
1174
|
from { opacity: 0; transform: translateX(-4px); }\r
|
|
686
1175
|
to { opacity: 1; transform: translateX(0); }\r
|
|
687
1176
|
}\r
|
|
688
1177
|
\r
|
|
689
1178
|
.tcw-flyout-header {\r
|
|
690
|
-
text-transform:
|
|
691
|
-
font-size:
|
|
1179
|
+
text-transform: var(--tcw-label-case);\r
|
|
1180
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
692
1181
|
color: var(--tcw-text-muted);\r
|
|
693
|
-
letter-spacing:
|
|
1182
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
694
1183
|
padding: 6px 10px 4px;\r
|
|
695
|
-
font-weight:
|
|
1184
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1185
|
+
}\r
|
|
1186
|
+
\r
|
|
1187
|
+
.tcw-flyout-hint {\r
|
|
1188
|
+
padding: 6px 10px 2px;\r
|
|
1189
|
+
border-top: 1px solid var(--tcw-border);\r
|
|
1190
|
+
margin-top: 4px;\r
|
|
1191
|
+
font-size: calc(var(--tcw-font-size) - 2.5px);\r
|
|
1192
|
+
color: var(--tcw-text-muted);\r
|
|
696
1193
|
}\r
|
|
697
1194
|
\r
|
|
698
1195
|
.tcw-flyout-item {\r
|
|
699
|
-
|
|
700
|
-
|
|
1196
|
+
min-height: var(--tcw-menu-item-h);\r
|
|
1197
|
+
padding: 4px 10px;\r
|
|
1198
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
701
1199
|
color: var(--tcw-text-dim);\r
|
|
702
1200
|
cursor: pointer;\r
|
|
703
1201
|
width: 100%;\r
|
|
704
|
-
display:
|
|
1202
|
+
display: flex;\r
|
|
1203
|
+
align-items: center;\r
|
|
1204
|
+
gap: 10px;\r
|
|
705
1205
|
border: none;\r
|
|
706
1206
|
background: transparent;\r
|
|
707
|
-
text-align:
|
|
1207
|
+
text-align: start;\r
|
|
708
1208
|
font-family: inherit;\r
|
|
709
1209
|
border-radius: var(--tcw-radius-sm);\r
|
|
710
1210
|
transition: background var(--tcw-dur-fast) var(--tcw-ease), color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
@@ -714,11 +1214,17 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
714
1214
|
background: var(--tcw-hover-bg);\r
|
|
715
1215
|
color: var(--tcw-text);\r
|
|
716
1216
|
}\r
|
|
1217
|
+
.tcw-flyout-item:focus-visible {\r
|
|
1218
|
+
outline: none;\r
|
|
1219
|
+
background: var(--tcw-hover-bg);\r
|
|
1220
|
+
color: var(--tcw-text);\r
|
|
1221
|
+
box-shadow: inset 0 0 0 1px var(--tcw-accent);\r
|
|
1222
|
+
}\r
|
|
717
1223
|
\r
|
|
718
1224
|
.tcw-flyout-item.tcw-active {\r
|
|
719
1225
|
color: var(--tcw-accent);\r
|
|
720
1226
|
background: var(--tcw-accent-soft);\r
|
|
721
|
-
font-weight:
|
|
1227
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
722
1228
|
}\r
|
|
723
1229
|
\r
|
|
724
1230
|
/* Pinned (favorited) flyout item — a star marker on the right. */\r
|
|
@@ -726,7 +1232,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
726
1232
|
content: '★';\r
|
|
727
1233
|
float: right;\r
|
|
728
1234
|
color: var(--tcw-accent);\r
|
|
729
|
-
font-size:
|
|
1235
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
730
1236
|
line-height: 1.4;\r
|
|
731
1237
|
}\r
|
|
732
1238
|
\r
|
|
@@ -775,14 +1281,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
775
1281
|
left: 50%;\r
|
|
776
1282
|
transform: translate(-50%, -50%);\r
|
|
777
1283
|
background: var(--tcw-bg-elevated);\r
|
|
778
|
-
border:
|
|
779
|
-
border-radius: var(--tcw-radius
|
|
1284
|
+
border: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
1285
|
+
border-radius: var(--tcw-dialog-radius);\r
|
|
780
1286
|
width: 520px;\r
|
|
781
1287
|
max-width: 92vw;\r
|
|
782
1288
|
max-height: 82vh;\r
|
|
783
1289
|
display: flex;\r
|
|
784
1290
|
flex-direction: column;\r
|
|
785
|
-
box-shadow: var(--tcw-shadow
|
|
1291
|
+
box-shadow: var(--tcw-dialog-shadow);\r
|
|
786
1292
|
animation: tcw-modal-in var(--tcw-dur-slow) var(--tcw-ease-out);\r
|
|
787
1293
|
}\r
|
|
788
1294
|
\r
|
|
@@ -800,16 +1306,16 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
800
1306
|
}\r
|
|
801
1307
|
\r
|
|
802
1308
|
.tcw-modal-header h3 {\r
|
|
803
|
-
font-size:
|
|
804
|
-
font-weight:
|
|
1309
|
+
font-size: var(--tcw-font-size-lg);\r
|
|
1310
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
805
1311
|
margin: 0;\r
|
|
806
1312
|
color: var(--tcw-text);\r
|
|
807
1313
|
letter-spacing: -0.015em;\r
|
|
808
1314
|
}\r
|
|
809
1315
|
\r
|
|
810
1316
|
.tcw-modal-close {\r
|
|
811
|
-
width:
|
|
812
|
-
height:
|
|
1317
|
+
width: var(--tcw-control-h-sm);\r
|
|
1318
|
+
height: var(--tcw-control-h-sm);\r
|
|
813
1319
|
display: flex;\r
|
|
814
1320
|
align-items: center;\r
|
|
815
1321
|
justify-content: center;\r
|
|
@@ -817,7 +1323,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
817
1323
|
background: transparent;\r
|
|
818
1324
|
color: var(--tcw-text-muted);\r
|
|
819
1325
|
cursor: pointer;\r
|
|
820
|
-
border-radius: var(--tcw-radius);\r
|
|
1326
|
+
border-radius: var(--tcw-control-radius);\r
|
|
821
1327
|
transition: background var(--tcw-dur-fast) var(--tcw-ease), color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
822
1328
|
}\r
|
|
823
1329
|
\r
|
|
@@ -829,20 +1335,22 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
829
1335
|
.tcw-modal-tabs {\r
|
|
830
1336
|
display: flex;\r
|
|
831
1337
|
gap: 4px;\r
|
|
832
|
-
padding:
|
|
1338
|
+
padding: var(--tcw-tabs-pad-block) 18px;\r
|
|
833
1339
|
border-bottom: 1px solid var(--tcw-divider);\r
|
|
834
1340
|
}\r
|
|
835
1341
|
\r
|
|
836
1342
|
.tcw-modal-tab {\r
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
font-
|
|
1343
|
+
height: var(--tcw-tab-h);\r
|
|
1344
|
+
padding: var(--tcw-tab-pad);\r
|
|
1345
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1346
|
+
font-weight: var(--tcw-weight);\r
|
|
840
1347
|
color: var(--tcw-text-muted);\r
|
|
841
1348
|
border: none;\r
|
|
842
1349
|
background: transparent;\r
|
|
843
1350
|
cursor: pointer;\r
|
|
844
|
-
border-bottom:
|
|
845
|
-
|
|
1351
|
+
border-bottom: var(--tcw-tab-line) solid transparent;\r
|
|
1352
|
+
border-radius: var(--tcw-tab-radius);\r
|
|
1353
|
+
margin-bottom: calc(var(--tcw-tab-line) / -2);\r
|
|
846
1354
|
transition: color var(--tcw-dur-fast) var(--tcw-ease), border-color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
847
1355
|
font-family: inherit;\r
|
|
848
1356
|
text-transform: capitalize;\r
|
|
@@ -851,12 +1359,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
851
1359
|
\r
|
|
852
1360
|
.tcw-modal-tab:hover {\r
|
|
853
1361
|
color: var(--tcw-text-dim);\r
|
|
1362
|
+
background: var(--tcw-tab-hover);\r
|
|
854
1363
|
}\r
|
|
855
1364
|
\r
|
|
856
1365
|
.tcw-modal-tab.tcw-active {\r
|
|
857
|
-
color: var(--tcw-
|
|
1366
|
+
color: var(--tcw-tab-on-fg);\r
|
|
1367
|
+
background: var(--tcw-tab-on-bg);\r
|
|
858
1368
|
border-bottom-color: var(--tcw-accent);\r
|
|
859
|
-
font-weight:
|
|
1369
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
860
1370
|
}\r
|
|
861
1371
|
\r
|
|
862
1372
|
.tcw-modal-body {\r
|
|
@@ -874,10 +1384,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
874
1384
|
}\r
|
|
875
1385
|
\r
|
|
876
1386
|
.tcw-settings-section-title {\r
|
|
877
|
-
font-size:
|
|
878
|
-
font-weight:
|
|
879
|
-
text-transform:
|
|
880
|
-
letter-spacing:
|
|
1387
|
+
font-size: calc(var(--tcw-font-size) - 2.5px);\r
|
|
1388
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1389
|
+
text-transform: var(--tcw-label-case);\r
|
|
1390
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
881
1391
|
color: var(--tcw-text-muted);\r
|
|
882
1392
|
margin-bottom: 12px;\r
|
|
883
1393
|
}\r
|
|
@@ -894,7 +1404,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
894
1404
|
}\r
|
|
895
1405
|
\r
|
|
896
1406
|
.tcw-settings-label {\r
|
|
897
|
-
font-size:
|
|
1407
|
+
font-size: var(--tcw-font-size);\r
|
|
898
1408
|
color: var(--tcw-text-dim);\r
|
|
899
1409
|
letter-spacing: -0.005em;\r
|
|
900
1410
|
}\r
|
|
@@ -921,11 +1431,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
921
1431
|
\r
|
|
922
1432
|
.tcw-color-picker-wrap input[type='color']::-webkit-color-swatch {\r
|
|
923
1433
|
border: none;\r
|
|
924
|
-
border-radius:
|
|
1434
|
+
border-radius: var(--tcw-radius-xs);\r
|
|
925
1435
|
}\r
|
|
926
1436
|
\r
|
|
927
1437
|
.tcw-color-hex {\r
|
|
928
|
-
font-size:
|
|
1438
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
929
1439
|
font-family: var(--tcw-font-mono);\r
|
|
930
1440
|
color: var(--tcw-text-muted);\r
|
|
931
1441
|
min-width: 64px;\r
|
|
@@ -988,11 +1498,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
988
1498
|
\r
|
|
989
1499
|
.tcw-settings-select {\r
|
|
990
1500
|
padding: 6px 10px;\r
|
|
991
|
-
font-size:
|
|
1501
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
992
1502
|
font-family: inherit;\r
|
|
993
1503
|
background: var(--tcw-bg-surface);\r
|
|
994
1504
|
border: 1px solid var(--tcw-border);\r
|
|
995
|
-
border-radius: var(--tcw-radius);\r
|
|
1505
|
+
border-radius: var(--tcw-input-radius);\r
|
|
996
1506
|
color: var(--tcw-text);\r
|
|
997
1507
|
cursor: pointer;\r
|
|
998
1508
|
transition: border-color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
@@ -1015,11 +1525,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1015
1525
|
padding: 14px 22px;\r
|
|
1016
1526
|
border-top: 1px solid var(--tcw-divider);\r
|
|
1017
1527
|
background: var(--tcw-bg-surface);\r
|
|
1018
|
-
border-radius: 0 0 var(--tcw-radius
|
|
1528
|
+
border-radius: 0 0 var(--tcw-dialog-radius) var(--tcw-dialog-radius);\r
|
|
1019
1529
|
}\r
|
|
1020
1530
|
\r
|
|
1021
1531
|
.tcw-reset-link {\r
|
|
1022
|
-
font-size:
|
|
1532
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1023
1533
|
color: var(--tcw-text-muted);\r
|
|
1024
1534
|
cursor: pointer;\r
|
|
1025
1535
|
border: none;\r
|
|
@@ -1038,12 +1548,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1038
1548
|
\r
|
|
1039
1549
|
.tcw-done-btn {\r
|
|
1040
1550
|
padding: 8px 18px;\r
|
|
1041
|
-
font-size:
|
|
1042
|
-
font-weight:
|
|
1551
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1552
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1043
1553
|
background: var(--tcw-accent);\r
|
|
1044
1554
|
color: var(--tcw-accent-ink);\r
|
|
1045
1555
|
border: none;\r
|
|
1046
|
-
border-radius: var(--tcw-radius);\r
|
|
1556
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1047
1557
|
cursor: pointer;\r
|
|
1048
1558
|
font-family: inherit;\r
|
|
1049
1559
|
transition:\r
|
|
@@ -1066,23 +1576,171 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1066
1576
|
/* === Status Bar === */\r
|
|
1067
1577
|
\r
|
|
1068
1578
|
.tcw-statusbar {\r
|
|
1579
|
+
/* Above sidebar buttons that overflow a short chart; menus (z 30+) stay on top. */\r
|
|
1580
|
+
position: relative;\r
|
|
1581
|
+
z-index: 1;\r
|
|
1069
1582
|
display: flex;\r
|
|
1070
1583
|
align-items: center;\r
|
|
1071
1584
|
justify-content: space-between;\r
|
|
1072
1585
|
padding: 7px 16px;\r
|
|
1073
1586
|
border-top: 1px solid var(--tcw-border);\r
|
|
1074
1587
|
background: var(--tcw-bg-surface);\r
|
|
1075
|
-
font-size:
|
|
1588
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1076
1589
|
color: var(--tcw-text-muted);\r
|
|
1077
1590
|
flex-shrink: 0;\r
|
|
1078
1591
|
font-feature-settings: 'tnum';\r
|
|
1079
1592
|
}\r
|
|
1080
1593
|
\r
|
|
1594
|
+
.tcw-status-right {\r
|
|
1595
|
+
display: flex;\r
|
|
1596
|
+
align-items: center;\r
|
|
1597
|
+
gap: 14px;\r
|
|
1598
|
+
margin-inline-start: auto;\r
|
|
1599
|
+
min-width: 0;\r
|
|
1600
|
+
white-space: nowrap;\r
|
|
1601
|
+
}\r
|
|
1602
|
+
\r
|
|
1603
|
+
/* Narrow screens: the toolbar already names the symbol and timeframe, so the\r
|
|
1604
|
+
range bar gets the room. */\r
|
|
1605
|
+
@media (max-width: 640px) {\r
|
|
1606
|
+
.tcw-status-info {\r
|
|
1607
|
+
display: none;\r
|
|
1608
|
+
}\r
|
|
1609
|
+
\r
|
|
1610
|
+
.tcw-range-btn {\r
|
|
1611
|
+
padding: 4px 5px;\r
|
|
1612
|
+
}\r
|
|
1613
|
+
}\r
|
|
1614
|
+
\r
|
|
1615
|
+
/* Range presets + go to date, bottom left */\r
|
|
1616
|
+
.tcw-range-bar {\r
|
|
1617
|
+
display: flex;\r
|
|
1618
|
+
align-items: center;\r
|
|
1619
|
+
gap: 1px;\r
|
|
1620
|
+
margin: -4px 12px -4px -8px;\r
|
|
1621
|
+
min-width: 0;\r
|
|
1622
|
+
overflow-x: auto;\r
|
|
1623
|
+
scrollbar-width: none;\r
|
|
1624
|
+
}\r
|
|
1625
|
+
\r
|
|
1626
|
+
.tcw-range-bar::-webkit-scrollbar {\r
|
|
1627
|
+
display: none;\r
|
|
1628
|
+
}\r
|
|
1629
|
+
\r
|
|
1630
|
+
.tcw-range-btn {\r
|
|
1631
|
+
flex-shrink: 0;\r
|
|
1632
|
+
padding: 4px 7px;\r
|
|
1633
|
+
font: inherit;\r
|
|
1634
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1635
|
+
letter-spacing: 0.02em;\r
|
|
1636
|
+
color: var(--tcw-text-muted);\r
|
|
1637
|
+
background: transparent;\r
|
|
1638
|
+
border: none;\r
|
|
1639
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1640
|
+
cursor: pointer;\r
|
|
1641
|
+
transition: color var(--tcw-dur-fast) var(--tcw-ease), background var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
1642
|
+
}\r
|
|
1643
|
+
\r
|
|
1644
|
+
.tcw-range-btn:hover {\r
|
|
1645
|
+
color: var(--tcw-text);\r
|
|
1646
|
+
background: var(--tcw-hover-bg);\r
|
|
1647
|
+
}\r
|
|
1648
|
+
\r
|
|
1649
|
+
.tcw-range-btn:active {\r
|
|
1650
|
+
color: var(--tcw-accent);\r
|
|
1651
|
+
}\r
|
|
1652
|
+
\r
|
|
1653
|
+
.tcw-range-btn:focus-visible {\r
|
|
1654
|
+
outline: 2px solid var(--tcw-accent);\r
|
|
1655
|
+
outline-offset: -2px;\r
|
|
1656
|
+
}\r
|
|
1657
|
+
\r
|
|
1658
|
+
.tcw-range-goto {\r
|
|
1659
|
+
display: inline-grid;\r
|
|
1660
|
+
place-items: center;\r
|
|
1661
|
+
margin-inline-start: 6px;\r
|
|
1662
|
+
padding: 4px 6px;\r
|
|
1663
|
+
}\r
|
|
1664
|
+
\r
|
|
1665
|
+
.tcw-range-goto svg {\r
|
|
1666
|
+
display: block;\r
|
|
1667
|
+
}\r
|
|
1668
|
+
\r
|
|
1669
|
+
/* Go-to-date popover, anchored above the range bar */\r
|
|
1670
|
+
.tcw-goto {\r
|
|
1671
|
+
position: absolute;\r
|
|
1672
|
+
left: 10px;\r
|
|
1673
|
+
bottom: 40px;\r
|
|
1674
|
+
z-index: 40;\r
|
|
1675
|
+
display: grid;\r
|
|
1676
|
+
gap: 10px;\r
|
|
1677
|
+
width: 232px;\r
|
|
1678
|
+
padding: 14px;\r
|
|
1679
|
+
background: var(--tcw-bg-elevated);\r
|
|
1680
|
+
border: 1px solid var(--tcw-border);\r
|
|
1681
|
+
border-radius: var(--tcw-menu-radius);\r
|
|
1682
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
1683
|
+
color: var(--tcw-text);\r
|
|
1684
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1685
|
+
}\r
|
|
1686
|
+
\r
|
|
1687
|
+
.tcw-goto-title {\r
|
|
1688
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1689
|
+
font-size: var(--tcw-font-size);\r
|
|
1690
|
+
}\r
|
|
1691
|
+
\r
|
|
1692
|
+
.tcw-goto-field {\r
|
|
1693
|
+
display: grid;\r
|
|
1694
|
+
gap: 4px;\r
|
|
1695
|
+
color: var(--tcw-text-muted);\r
|
|
1696
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1697
|
+
}\r
|
|
1698
|
+
\r
|
|
1699
|
+
.tcw-goto-input {\r
|
|
1700
|
+
height: 30px;\r
|
|
1701
|
+
padding: 0 8px;\r
|
|
1702
|
+
font: inherit;\r
|
|
1703
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1704
|
+
color: var(--tcw-text);\r
|
|
1705
|
+
background: var(--tcw-bg);\r
|
|
1706
|
+
border: 1px solid var(--tcw-border);\r
|
|
1707
|
+
border-radius: var(--tcw-input-radius);\r
|
|
1708
|
+
color-scheme: dark;\r
|
|
1709
|
+
}\r
|
|
1710
|
+
\r
|
|
1711
|
+
.tcw-root[data-tcw-theme='light'] .tcw-goto-input {\r
|
|
1712
|
+
color-scheme: light;\r
|
|
1713
|
+
}\r
|
|
1714
|
+
\r
|
|
1715
|
+
.tcw-goto-input:focus {\r
|
|
1716
|
+
outline: none;\r
|
|
1717
|
+
border-color: var(--tcw-accent);\r
|
|
1718
|
+
box-shadow: 0 0 0 2px var(--tcw-accent-soft);\r
|
|
1719
|
+
}\r
|
|
1720
|
+
\r
|
|
1721
|
+
.tcw-goto-actions {\r
|
|
1722
|
+
display: flex;\r
|
|
1723
|
+
justify-content: flex-end;\r
|
|
1724
|
+
gap: 6px;\r
|
|
1725
|
+
}\r
|
|
1726
|
+
\r
|
|
1727
|
+
.tcw-goto-submit {\r
|
|
1728
|
+
background: var(--tcw-accent);\r
|
|
1729
|
+
color: var(--tcw-accent-ink);\r
|
|
1730
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1731
|
+
}\r
|
|
1732
|
+
\r
|
|
1733
|
+
.tcw-goto-submit:hover {\r
|
|
1734
|
+
background: var(--tcw-accent);\r
|
|
1735
|
+
color: var(--tcw-accent-ink);\r
|
|
1736
|
+
filter: brightness(1.08);\r
|
|
1737
|
+
}\r
|
|
1738
|
+
\r
|
|
1081
1739
|
.tcw-status-indicator {\r
|
|
1082
1740
|
display: flex;\r
|
|
1083
1741
|
align-items: center;\r
|
|
1084
1742
|
gap: 7px;\r
|
|
1085
|
-
font-weight:
|
|
1743
|
+
font-weight: var(--tcw-weight);\r
|
|
1086
1744
|
}\r
|
|
1087
1745
|
\r
|
|
1088
1746
|
.tcw-status-dot {\r
|
|
@@ -1128,17 +1786,17 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1128
1786
|
left: 50%;\r
|
|
1129
1787
|
transform: translateX(-50%);\r
|
|
1130
1788
|
background: var(--tcw-bg-elevated);\r
|
|
1131
|
-
border:
|
|
1132
|
-
border-radius: var(--tcw-radius
|
|
1789
|
+
border: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
1790
|
+
border-radius: var(--tcw-dialog-radius);\r
|
|
1133
1791
|
width: 560px;\r
|
|
1134
1792
|
max-width: 92vw;\r
|
|
1135
1793
|
max-height: 62vh;\r
|
|
1136
1794
|
display: flex;\r
|
|
1137
1795
|
flex-direction: column;\r
|
|
1138
|
-
box-shadow: var(--tcw-shadow
|
|
1796
|
+
box-shadow: var(--tcw-dialog-shadow);\r
|
|
1139
1797
|
overflow: hidden;\r
|
|
1140
|
-
backdrop-filter: blur(
|
|
1141
|
-
-webkit-backdrop-filter: blur(
|
|
1798
|
+
backdrop-filter: blur(var(--tcw-blur));\r
|
|
1799
|
+
-webkit-backdrop-filter: blur(var(--tcw-blur));\r
|
|
1142
1800
|
animation: tcw-modal-in var(--tcw-dur-slow) var(--tcw-ease-out);\r
|
|
1143
1801
|
}\r
|
|
1144
1802
|
\r
|
|
@@ -1151,7 +1809,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1151
1809
|
}\r
|
|
1152
1810
|
\r
|
|
1153
1811
|
.tcw-cmd-icon {\r
|
|
1154
|
-
font-size:
|
|
1812
|
+
font-size: calc(var(--tcw-font-size) + 5px);\r
|
|
1155
1813
|
color: var(--tcw-text-muted);\r
|
|
1156
1814
|
flex-shrink: 0;\r
|
|
1157
1815
|
display: inline-flex;\r
|
|
@@ -1163,7 +1821,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1163
1821
|
background: transparent;\r
|
|
1164
1822
|
border: none;\r
|
|
1165
1823
|
outline: none;\r
|
|
1166
|
-
font-size:
|
|
1824
|
+
font-size: calc(var(--tcw-font-size) + 1.5px);\r
|
|
1167
1825
|
font-family: inherit;\r
|
|
1168
1826
|
color: var(--tcw-text);\r
|
|
1169
1827
|
caret-color: var(--tcw-accent);\r
|
|
@@ -1175,7 +1833,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1175
1833
|
}\r
|
|
1176
1834
|
\r
|
|
1177
1835
|
.tcw-cmd-hint {\r
|
|
1178
|
-
font-size:
|
|
1836
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
1179
1837
|
color: var(--tcw-text-muted);\r
|
|
1180
1838
|
font-family: var(--tcw-font-mono);\r
|
|
1181
1839
|
border: 1px solid var(--tcw-border);\r
|
|
@@ -1194,12 +1852,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1194
1852
|
}\r
|
|
1195
1853
|
\r
|
|
1196
1854
|
.tcw-cmd-category {\r
|
|
1197
|
-
text-transform:
|
|
1198
|
-
font-size:
|
|
1855
|
+
text-transform: var(--tcw-label-case);\r
|
|
1856
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
1199
1857
|
color: var(--tcw-text-muted);\r
|
|
1200
|
-
letter-spacing:
|
|
1858
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
1201
1859
|
padding: 10px 10px 4px;\r
|
|
1202
|
-
font-weight:
|
|
1860
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1203
1861
|
}\r
|
|
1204
1862
|
\r
|
|
1205
1863
|
.tcw-cmd-item {\r
|
|
@@ -1207,14 +1865,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1207
1865
|
align-items: center;\r
|
|
1208
1866
|
justify-content: space-between;\r
|
|
1209
1867
|
padding: 9px 12px;\r
|
|
1210
|
-
font-size:
|
|
1868
|
+
font-size: var(--tcw-font-size);\r
|
|
1211
1869
|
color: var(--tcw-text-dim);\r
|
|
1212
1870
|
cursor: pointer;\r
|
|
1213
1871
|
width: 100%;\r
|
|
1214
1872
|
border: none;\r
|
|
1215
1873
|
background: transparent;\r
|
|
1216
1874
|
font-family: inherit;\r
|
|
1217
|
-
text-align:
|
|
1875
|
+
text-align: start;\r
|
|
1218
1876
|
transition: background var(--tcw-dur-fast) var(--tcw-ease), color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
1219
1877
|
gap: 10px;\r
|
|
1220
1878
|
border-radius: var(--tcw-radius);\r
|
|
@@ -1233,7 +1891,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1233
1891
|
\r
|
|
1234
1892
|
.tcw-cmd-item.tcw-active .tcw-cmd-item-label {\r
|
|
1235
1893
|
color: var(--tcw-accent);\r
|
|
1236
|
-
font-weight:
|
|
1894
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1237
1895
|
}\r
|
|
1238
1896
|
\r
|
|
1239
1897
|
.tcw-cmd-item-label {\r
|
|
@@ -1242,18 +1900,18 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1242
1900
|
\r
|
|
1243
1901
|
.tcw-cmd-check {\r
|
|
1244
1902
|
color: var(--tcw-accent);\r
|
|
1245
|
-
font-size:
|
|
1246
|
-
font-weight:
|
|
1903
|
+
font-size: calc(var(--tcw-font-size) + 1px);\r
|
|
1904
|
+
font-weight: calc(var(--tcw-weight-strong) + 100);\r
|
|
1247
1905
|
}\r
|
|
1248
1906
|
\r
|
|
1249
1907
|
.tcw-cmd-kbd {\r
|
|
1250
|
-
font-size:
|
|
1908
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
1251
1909
|
font-family: var(--tcw-font-mono);\r
|
|
1252
1910
|
color: var(--tcw-text-muted);\r
|
|
1253
1911
|
background: var(--tcw-bg-surface);\r
|
|
1254
1912
|
border: 1px solid var(--tcw-border);\r
|
|
1255
1913
|
padding: 2px 6px;\r
|
|
1256
|
-
border-radius:
|
|
1914
|
+
border-radius: var(--tcw-tag-radius);\r
|
|
1257
1915
|
box-shadow: inset 0 -1px 0 var(--tcw-border);\r
|
|
1258
1916
|
}\r
|
|
1259
1917
|
\r
|
|
@@ -1261,7 +1919,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1261
1919
|
padding: 32px 16px;\r
|
|
1262
1920
|
text-align: center;\r
|
|
1263
1921
|
color: var(--tcw-text-muted);\r
|
|
1264
|
-
font-size:
|
|
1922
|
+
font-size: var(--tcw-font-size);\r
|
|
1265
1923
|
}\r
|
|
1266
1924
|
\r
|
|
1267
1925
|
.tcw-cmd-footer {\r
|
|
@@ -1270,7 +1928,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1270
1928
|
gap: 18px;\r
|
|
1271
1929
|
padding: 10px 18px;\r
|
|
1272
1930
|
border-top: 1px solid var(--tcw-divider);\r
|
|
1273
|
-
font-size:
|
|
1931
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1274
1932
|
color: var(--tcw-text-muted);\r
|
|
1275
1933
|
background: var(--tcw-bg-surface);\r
|
|
1276
1934
|
}\r
|
|
@@ -1281,7 +1939,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1281
1939
|
width: 220px;\r
|
|
1282
1940
|
flex-shrink: 0;\r
|
|
1283
1941
|
background: var(--tcw-bg-surface);\r
|
|
1284
|
-
border-
|
|
1942
|
+
border-inline-start: 1px solid var(--tcw-border);\r
|
|
1285
1943
|
display: flex;\r
|
|
1286
1944
|
flex-direction: column;\r
|
|
1287
1945
|
overflow: hidden;\r
|
|
@@ -1289,30 +1947,161 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1289
1947
|
}\r
|
|
1290
1948
|
\r
|
|
1291
1949
|
.tcw-watchlist-header {\r
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
color: var(--tcw-text-muted);\r
|
|
1950
|
+
position: relative;\r
|
|
1951
|
+
display: flex;\r
|
|
1952
|
+
align-items: center;\r
|
|
1953
|
+
gap: 4px;\r
|
|
1954
|
+
padding: 6px 8px 6px 8px;\r
|
|
1298
1955
|
border-bottom: 1px solid var(--tcw-divider);\r
|
|
1299
1956
|
}\r
|
|
1300
1957
|
\r
|
|
1301
|
-
|
|
1958
|
+
/* The shown list's name: opens the lists menu. */\r
|
|
1959
|
+
.tcw-watchlist-name {\r
|
|
1302
1960
|
flex: 1;\r
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
}\r
|
|
1306
|
-
\r
|
|
1307
|
-
.tcw-watchlist-row {\r
|
|
1308
|
-
display: grid;\r
|
|
1309
|
-
grid-template-columns: 1fr auto auto;\r
|
|
1961
|
+
min-width: 0;\r
|
|
1962
|
+
display: flex;\r
|
|
1310
1963
|
align-items: center;\r
|
|
1311
|
-
gap:
|
|
1312
|
-
|
|
1313
|
-
|
|
1964
|
+
gap: 6px;\r
|
|
1965
|
+
height: var(--tcw-control-h-sm);\r
|
|
1966
|
+
padding: 0 6px;\r
|
|
1967
|
+
border: 0;\r
|
|
1968
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1969
|
+
background: transparent;\r
|
|
1970
|
+
color: var(--tcw-text-dim);\r
|
|
1971
|
+
font: inherit;\r
|
|
1972
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1973
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1974
|
+
text-transform: var(--tcw-label-case);\r
|
|
1975
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
1976
|
+
text-align: start;\r
|
|
1977
|
+
white-space: nowrap;\r
|
|
1978
|
+
overflow: hidden;\r
|
|
1979
|
+
text-overflow: ellipsis;\r
|
|
1980
|
+
cursor: pointer;\r
|
|
1981
|
+
}\r
|
|
1982
|
+
.tcw-watchlist-name::after {\r
|
|
1983
|
+
content: '';\r
|
|
1984
|
+
flex: none;\r
|
|
1985
|
+
width: 0;\r
|
|
1986
|
+
height: 0;\r
|
|
1987
|
+
margin-inline-start: auto;\r
|
|
1988
|
+
border: 4px solid transparent;\r
|
|
1989
|
+
border-top-color: currentColor;\r
|
|
1990
|
+
border-bottom-width: 0;\r
|
|
1991
|
+
opacity: 0.7;\r
|
|
1992
|
+
}\r
|
|
1993
|
+
\r
|
|
1994
|
+
.tcw-watchlist-add {\r
|
|
1995
|
+
flex: none;\r
|
|
1996
|
+
width: var(--tcw-control-h-sm);\r
|
|
1997
|
+
height: var(--tcw-control-h-sm);\r
|
|
1998
|
+
border: 0;\r
|
|
1999
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2000
|
+
background: transparent;\r
|
|
2001
|
+
color: var(--tcw-text-muted);\r
|
|
2002
|
+
font: inherit;\r
|
|
2003
|
+
font-size: var(--tcw-font-size-lg);\r
|
|
2004
|
+
line-height: 1;\r
|
|
2005
|
+
cursor: pointer;\r
|
|
2006
|
+
}\r
|
|
2007
|
+
\r
|
|
2008
|
+
.tcw-watchlist-name:hover,\r
|
|
2009
|
+
.tcw-watchlist-add:hover {\r
|
|
2010
|
+
background: var(--tcw-hover-bg);\r
|
|
2011
|
+
color: var(--tcw-text);\r
|
|
2012
|
+
}\r
|
|
2013
|
+
.tcw-watchlist-name:focus-visible,\r
|
|
2014
|
+
.tcw-watchlist-add:focus-visible,\r
|
|
2015
|
+
.tcw-watchlist-input:focus-visible {\r
|
|
2016
|
+
outline: none;\r
|
|
2017
|
+
box-shadow: var(--tcw-ring);\r
|
|
2018
|
+
}\r
|
|
2019
|
+
\r
|
|
2020
|
+
/* The lists menu, under the header. */\r
|
|
2021
|
+
.tcw-watchlist-menu {\r
|
|
2022
|
+
top: calc(100% - 2px);\r
|
|
2023
|
+
left: 6px;\r
|
|
2024
|
+
right: 6px;\r
|
|
2025
|
+
margin-top: 0;\r
|
|
2026
|
+
}\r
|
|
2027
|
+
.tcw-watchlist-count {\r
|
|
2028
|
+
color: var(--tcw-text-muted);\r
|
|
2029
|
+
font-family: var(--tcw-font-mono);\r
|
|
2030
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
2031
|
+
}\r
|
|
2032
|
+
.tcw-watchlist-menu .tcw-danger {\r
|
|
2033
|
+
color: var(--tcw-red);\r
|
|
2034
|
+
}\r
|
|
2035
|
+
\r
|
|
2036
|
+
/* Naming a list in place. */\r
|
|
2037
|
+
.tcw-watchlist-input {\r
|
|
2038
|
+
flex: 1;\r
|
|
2039
|
+
min-width: 0;\r
|
|
2040
|
+
height: var(--tcw-control-h-sm);\r
|
|
2041
|
+
padding: 0 8px;\r
|
|
2042
|
+
border: var(--tcw-border-w) solid var(--tcw-border-strong);\r
|
|
2043
|
+
border-radius: var(--tcw-input-radius);\r
|
|
2044
|
+
background: var(--tcw-bg);\r
|
|
2045
|
+
color: var(--tcw-text);\r
|
|
2046
|
+
font: inherit;\r
|
|
2047
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2048
|
+
}\r
|
|
2049
|
+
\r
|
|
2050
|
+
.tcw-watchlist-empty {\r
|
|
2051
|
+
padding: 16px 14px;\r
|
|
2052
|
+
color: var(--tcw-text-muted);\r
|
|
2053
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2054
|
+
line-height: 1.5;\r
|
|
2055
|
+
}\r
|
|
2056
|
+
\r
|
|
2057
|
+
/* A row's remove button shows on hover or focus, over its numbers. */\r
|
|
2058
|
+
.tcw-watchlist-remove {\r
|
|
2059
|
+
position: absolute;\r
|
|
2060
|
+
top: 50%;\r
|
|
2061
|
+
right: 6px;\r
|
|
2062
|
+
display: grid;\r
|
|
2063
|
+
place-items: center;\r
|
|
2064
|
+
width: 20px;\r
|
|
2065
|
+
height: 20px;\r
|
|
2066
|
+
border: 0;\r
|
|
2067
|
+
border-radius: var(--tcw-radius-sm);\r
|
|
2068
|
+
background: var(--tcw-bg-elevated);\r
|
|
2069
|
+
color: var(--tcw-text-muted);\r
|
|
2070
|
+
font: inherit;\r
|
|
2071
|
+
font-size: var(--tcw-font-size);\r
|
|
2072
|
+
line-height: 1;\r
|
|
2073
|
+
opacity: 0;\r
|
|
2074
|
+
transform: translateY(-50%);\r
|
|
2075
|
+
cursor: pointer;\r
|
|
2076
|
+
transition: opacity var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
2077
|
+
}\r
|
|
2078
|
+
.tcw-watchlist-row:hover .tcw-watchlist-remove,\r
|
|
2079
|
+
.tcw-watchlist-row:focus-within .tcw-watchlist-remove {\r
|
|
2080
|
+
opacity: 1;\r
|
|
2081
|
+
}\r
|
|
2082
|
+
.tcw-watchlist-remove:hover {\r
|
|
2083
|
+
color: var(--tcw-red);\r
|
|
2084
|
+
}\r
|
|
2085
|
+
.tcw-watchlist-row.tcw-watchlist-dragging {\r
|
|
2086
|
+
opacity: 0.45;\r
|
|
2087
|
+
}\r
|
|
2088
|
+
\r
|
|
2089
|
+
.tcw-watchlist-list {\r
|
|
2090
|
+
flex: 1;\r
|
|
2091
|
+
overflow-y: auto;\r
|
|
2092
|
+
padding: 4px 0;\r
|
|
2093
|
+
}\r
|
|
2094
|
+
\r
|
|
2095
|
+
.tcw-watchlist-row {\r
|
|
2096
|
+
position: relative;\r
|
|
2097
|
+
display: grid;\r
|
|
2098
|
+
grid-template-columns: 1fr auto auto;\r
|
|
2099
|
+
align-items: center;\r
|
|
2100
|
+
gap: 8px;\r
|
|
2101
|
+
padding: 8px 12px;\r
|
|
2102
|
+
cursor: pointer;\r
|
|
1314
2103
|
transition: background var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
1315
|
-
border-
|
|
2104
|
+
border-inline-start: 2px solid transparent;\r
|
|
1316
2105
|
outline: none;\r
|
|
1317
2106
|
}\r
|
|
1318
2107
|
\r
|
|
@@ -1322,17 +2111,17 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1322
2111
|
\r
|
|
1323
2112
|
.tcw-watchlist-row:focus-visible {\r
|
|
1324
2113
|
background: var(--tcw-hover-bg);\r
|
|
1325
|
-
border-
|
|
2114
|
+
border-inline-start-color: var(--tcw-accent);\r
|
|
1326
2115
|
}\r
|
|
1327
2116
|
\r
|
|
1328
2117
|
.tcw-watchlist-row.tcw-watchlist-active {\r
|
|
1329
2118
|
background: var(--tcw-accent-soft);\r
|
|
1330
|
-
border-
|
|
2119
|
+
border-inline-start-color: var(--tcw-accent);\r
|
|
1331
2120
|
}\r
|
|
1332
2121
|
\r
|
|
1333
2122
|
.tcw-watchlist-symbol {\r
|
|
1334
|
-
font-size:
|
|
1335
|
-
font-weight:
|
|
2123
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2124
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1336
2125
|
color: var(--tcw-text);\r
|
|
1337
2126
|
letter-spacing: -0.005em;\r
|
|
1338
2127
|
white-space: nowrap;\r
|
|
@@ -1354,15 +2143,15 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1354
2143
|
}\r
|
|
1355
2144
|
\r
|
|
1356
2145
|
.tcw-watchlist-price {\r
|
|
1357
|
-
font-size:
|
|
2146
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1358
2147
|
color: var(--tcw-text);\r
|
|
1359
|
-
font-weight:
|
|
2148
|
+
font-weight: var(--tcw-weight);\r
|
|
1360
2149
|
}\r
|
|
1361
2150
|
\r
|
|
1362
2151
|
.tcw-watchlist-change {\r
|
|
1363
|
-
font-size:
|
|
2152
|
+
font-size: calc(var(--tcw-font-size) - 2.5px);\r
|
|
1364
2153
|
color: var(--tcw-text-muted);\r
|
|
1365
|
-
font-weight:
|
|
2154
|
+
font-weight: var(--tcw-weight);\r
|
|
1366
2155
|
}\r
|
|
1367
2156
|
\r
|
|
1368
2157
|
.tcw-watchlist-change.tcw-up {\r
|
|
@@ -1390,10 +2179,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1390
2179
|
padding: 9px 14px;\r
|
|
1391
2180
|
background: var(--tcw-bg-elevated);\r
|
|
1392
2181
|
border: 1px solid var(--tcw-border-strong);\r
|
|
1393
|
-
border-radius:
|
|
1394
|
-
box-shadow: var(--tcw-shadow
|
|
1395
|
-
font-size:
|
|
1396
|
-
font-weight:
|
|
2182
|
+
border-radius: var(--tcw-toast-radius);\r
|
|
2183
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
2184
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2185
|
+
font-weight: var(--tcw-weight);\r
|
|
1397
2186
|
color: var(--tcw-text);\r
|
|
1398
2187
|
opacity: 0;\r
|
|
1399
2188
|
transition: opacity var(--tcw-dur-normal) var(--tcw-ease-out), transform var(--tcw-dur-normal) var(--tcw-ease-out);\r
|
|
@@ -1417,10 +2206,73 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1417
2206
|
\r
|
|
1418
2207
|
/* === Replay scrubber === */\r
|
|
1419
2208
|
\r
|
|
2209
|
+
/* Picking the replay start: the bars right of the pointer would be hidden. */\r
|
|
2210
|
+
.tcw-replay-shade {\r
|
|
2211
|
+
position: absolute;\r
|
|
2212
|
+
z-index: 4;\r
|
|
2213
|
+
pointer-events: none;\r
|
|
2214
|
+
background: color-mix(in srgb, var(--tcw-bg) 62%, transparent);\r
|
|
2215
|
+
border-inline-start: 1.5px dashed var(--tcw-accent);\r
|
|
2216
|
+
}\r
|
|
2217
|
+
\r
|
|
2218
|
+
.tcw-replay-group {\r
|
|
2219
|
+
display: inline-flex;\r
|
|
2220
|
+
align-items: center;\r
|
|
2221
|
+
gap: 6px;\r
|
|
2222
|
+
}\r
|
|
2223
|
+
\r
|
|
2224
|
+
.tcw-replay-group[hidden] { display: none; }\r
|
|
2225
|
+
\r
|
|
2226
|
+
.tcw-replay-hint {\r
|
|
2227
|
+
display: inline-flex;\r
|
|
2228
|
+
align-items: center;\r
|
|
2229
|
+
gap: 6px;\r
|
|
2230
|
+
padding: 0 4px;\r
|
|
2231
|
+
color: var(--tcw-text-dim);\r
|
|
2232
|
+
white-space: nowrap;\r
|
|
2233
|
+
}\r
|
|
2234
|
+
\r
|
|
2235
|
+
.tcw-replay-text-btn {\r
|
|
2236
|
+
height: 26px;\r
|
|
2237
|
+
padding: 0 10px;\r
|
|
2238
|
+
border: 1px solid var(--tcw-border);\r
|
|
2239
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2240
|
+
background: transparent;\r
|
|
2241
|
+
color: var(--tcw-text);\r
|
|
2242
|
+
font: inherit;\r
|
|
2243
|
+
font-weight: var(--tcw-weight);\r
|
|
2244
|
+
white-space: nowrap;\r
|
|
2245
|
+
cursor: pointer;\r
|
|
2246
|
+
transition: background var(--tcw-dur-fast), border-color var(--tcw-dur-fast), color var(--tcw-dur-fast);\r
|
|
2247
|
+
}\r
|
|
2248
|
+
\r
|
|
2249
|
+
.tcw-replay-text-btn:hover { background: var(--tcw-hover-bg); border-color: var(--tcw-border-strong); }\r
|
|
2250
|
+
.tcw-replay-text-btn:focus-visible { outline: none; box-shadow: var(--tcw-ring); }\r
|
|
2251
|
+
\r
|
|
2252
|
+
/* At the last bar: the way out is the next thing to do. */\r
|
|
2253
|
+
.tcw-replay-bar--ended .tcw-replay-realtime {\r
|
|
2254
|
+
background: var(--tcw-accent);\r
|
|
2255
|
+
border-color: var(--tcw-accent);\r
|
|
2256
|
+
color: var(--tcw-accent-ink);\r
|
|
2257
|
+
}\r
|
|
2258
|
+
\r
|
|
2259
|
+
.tcw-replay-btn:disabled { opacity: 0.4; cursor: default; }\r
|
|
2260
|
+
\r
|
|
2261
|
+
@media (max-width: 640px) {\r
|
|
2262
|
+
.tcw-replay-bar {\r
|
|
2263
|
+
flex-wrap: wrap;\r
|
|
2264
|
+
justify-content: center;\r
|
|
2265
|
+
max-width: calc(100% - 24px);\r
|
|
2266
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
2267
|
+
}\r
|
|
2268
|
+
.tcw-replay-hint { white-space: normal; }\r
|
|
2269
|
+
}\r
|
|
2270
|
+
\r
|
|
1420
2271
|
.tcw-replay-bar {\r
|
|
1421
2272
|
position: absolute;\r
|
|
1422
2273
|
left: 50%;\r
|
|
1423
|
-
|
|
2274
|
+
/* Above the 30px time axis, so its dates stay readable. */\r
|
|
2275
|
+
bottom: 40px;\r
|
|
1424
2276
|
transform: translateX(-50%);\r
|
|
1425
2277
|
z-index: 25;\r
|
|
1426
2278
|
display: flex;\r
|
|
@@ -1429,11 +2281,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1429
2281
|
padding: 6px 10px;\r
|
|
1430
2282
|
background: var(--tcw-bg-elevated);\r
|
|
1431
2283
|
border: 1px solid var(--tcw-border);\r
|
|
1432
|
-
border-radius:
|
|
1433
|
-
box-shadow: var(--tcw-shadow
|
|
1434
|
-
backdrop-filter: blur(
|
|
1435
|
-
-webkit-backdrop-filter: blur(
|
|
1436
|
-
font-size:
|
|
2284
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
2285
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
2286
|
+
backdrop-filter: blur(var(--tcw-blur));\r
|
|
2287
|
+
-webkit-backdrop-filter: blur(var(--tcw-blur));\r
|
|
2288
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1437
2289
|
color: var(--tcw-text);\r
|
|
1438
2290
|
animation: tcw-pop-in var(--tcw-dur-normal) var(--tcw-ease-out);\r
|
|
1439
2291
|
}\r
|
|
@@ -1447,7 +2299,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1447
2299
|
border: none;\r
|
|
1448
2300
|
background: transparent;\r
|
|
1449
2301
|
color: var(--tcw-text-dim);\r
|
|
1450
|
-
border-radius:
|
|
2302
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1451
2303
|
cursor: pointer;\r
|
|
1452
2304
|
font-family: inherit;\r
|
|
1453
2305
|
transition: background var(--tcw-dur-fast) var(--tcw-ease), color var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
@@ -1504,7 +2356,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1504
2356
|
}\r
|
|
1505
2357
|
\r
|
|
1506
2358
|
.tcw-replay-progress {\r
|
|
1507
|
-
font-size:
|
|
2359
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1508
2360
|
font-family: var(--tcw-font-mono);\r
|
|
1509
2361
|
color: var(--tcw-text-muted);\r
|
|
1510
2362
|
min-width: 64px;\r
|
|
@@ -1514,11 +2366,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1514
2366
|
\r
|
|
1515
2367
|
.tcw-replay-speed {\r
|
|
1516
2368
|
padding: 4px 8px;\r
|
|
1517
|
-
font-size:
|
|
2369
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1518
2370
|
font-family: var(--tcw-font-mono);\r
|
|
1519
2371
|
background: var(--tcw-bg-surface);\r
|
|
1520
2372
|
border: 1px solid var(--tcw-border);\r
|
|
1521
|
-
border-radius: var(--tcw-radius);\r
|
|
2373
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1522
2374
|
color: var(--tcw-text-dim);\r
|
|
1523
2375
|
cursor: pointer;\r
|
|
1524
2376
|
}\r
|
|
@@ -1569,14 +2421,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1569
2421
|
}\r
|
|
1570
2422
|
\r
|
|
1571
2423
|
.tcw-hotkey-sep {\r
|
|
1572
|
-
font-size:
|
|
2424
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
1573
2425
|
color: var(--tcw-text-muted);\r
|
|
1574
2426
|
}\r
|
|
1575
2427
|
\r
|
|
1576
2428
|
.tcw-hotkey-label {\r
|
|
1577
|
-
font-size:
|
|
2429
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1578
2430
|
color: var(--tcw-text-dim);\r
|
|
1579
|
-
text-align:
|
|
2431
|
+
text-align: end;\r
|
|
1580
2432
|
letter-spacing: -0.005em;\r
|
|
1581
2433
|
}\r
|
|
1582
2434
|
\r
|
|
@@ -1624,34 +2476,32 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1624
2476
|
@media (max-width: 768px) {\r
|
|
1625
2477
|
.tcw-toolbar {\r
|
|
1626
2478
|
padding: 0 4px;\r
|
|
1627
|
-
height: 44px;
|
|
2479
|
+
height: max(44px, var(--tcw-toolbar-h)); /* Apple HIG minimum touch target */\r
|
|
1628
2480
|
}\r
|
|
1629
2481
|
.tcw-toolbar-sep {\r
|
|
1630
2482
|
display: none;\r
|
|
1631
2483
|
}\r
|
|
1632
|
-
.tcw-indicator-chips {\r
|
|
1633
|
-
display: none;\r
|
|
1634
|
-
}\r
|
|
1635
2484
|
.tcw-btn,\r
|
|
1636
2485
|
.tcw-dropdown-trigger {\r
|
|
1637
|
-
|
|
1638
|
-
|
|
2486
|
+
height: max(40px, var(--tcw-control-h)); /* fatter tap target */\r
|
|
2487
|
+
padding: 0 12px;\r
|
|
2488
|
+
font-size: var(--tcw-font-size);\r
|
|
1639
2489
|
}\r
|
|
1640
2490
|
.tcw-btn-icon {\r
|
|
1641
|
-
width: 40px;\r
|
|
1642
|
-
height: 40px;\r
|
|
2491
|
+
width: max(40px, var(--tcw-control-h));\r
|
|
2492
|
+
height: max(40px, var(--tcw-control-h));\r
|
|
1643
2493
|
}\r
|
|
1644
2494
|
.tcw-sidebar {\r
|
|
1645
|
-
width: 44px;\r
|
|
2495
|
+
width: max(44px, var(--tcw-sidebar-w));\r
|
|
1646
2496
|
}\r
|
|
1647
2497
|
.tcw-sidebar-btn {\r
|
|
1648
|
-
width: 40px;\r
|
|
1649
|
-
height: 40px;\r
|
|
2498
|
+
width: max(40px, var(--tcw-control-h));\r
|
|
2499
|
+
height: max(40px, var(--tcw-control-h));\r
|
|
1650
2500
|
}\r
|
|
1651
2501
|
.tcw-modal,\r
|
|
1652
2502
|
.tcw-cmd-palette {\r
|
|
1653
2503
|
width: 94vw;\r
|
|
1654
|
-
border-radius: var(--tcw-radius
|
|
2504
|
+
border-radius: var(--tcw-dialog-radius);\r
|
|
1655
2505
|
}\r
|
|
1656
2506
|
\r
|
|
1657
2507
|
/* Hide the right-side watchlist on tablets too — already declared but\r
|
|
@@ -1685,7 +2535,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1685
2535
|
width: 100vw;\r
|
|
1686
2536
|
max-width: 100vw;\r
|
|
1687
2537
|
max-height: 92vh;\r
|
|
1688
|
-
border-radius: var(--tcw-radius
|
|
2538
|
+
border-radius: var(--tcw-dialog-radius) var(--tcw-dialog-radius) 0 0;\r
|
|
1689
2539
|
border-bottom: none;\r
|
|
1690
2540
|
/* Grab handle */\r
|
|
1691
2541
|
padding-top: 8px;\r
|
|
@@ -1728,11 +2578,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1728
2578
|
}\r
|
|
1729
2579
|
.tcw-cmd-item {\r
|
|
1730
2580
|
padding: 12px 14px;\r
|
|
1731
|
-
font-size:
|
|
2581
|
+
font-size: calc(var(--tcw-font-size) + 1px);\r
|
|
1732
2582
|
}\r
|
|
1733
2583
|
.tcw-dropdown-item {\r
|
|
1734
2584
|
padding: 12px 12px;\r
|
|
1735
|
-
font-size:
|
|
2585
|
+
font-size: calc(var(--tcw-font-size) + 1px);\r
|
|
1736
2586
|
}\r
|
|
1737
2587
|
\r
|
|
1738
2588
|
/* Hotkey sheet — single column on phones */\r
|
|
@@ -1745,17 +2595,17 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1745
2595
|
\r
|
|
1746
2596
|
.tcw-alerts-panel {\r
|
|
1747
2597
|
position: absolute;\r
|
|
1748
|
-
top:
|
|
1749
|
-
|
|
2598
|
+
top: var(--tcw-panel-top);\r
|
|
2599
|
+
inset-inline-end: 12px;\r
|
|
1750
2600
|
z-index: 40;\r
|
|
1751
2601
|
width: 300px;\r
|
|
1752
2602
|
max-width: calc(100vw - 24px);\r
|
|
1753
2603
|
display: flex;\r
|
|
1754
2604
|
flex-direction: column;\r
|
|
1755
2605
|
background: var(--tcw-bg-elevated);\r
|
|
1756
|
-
border:
|
|
1757
|
-
border-radius: var(--tcw-radius
|
|
1758
|
-
box-shadow: var(--tcw-shadow
|
|
2606
|
+
border: var(--tcw-border-w) solid var(--tcw-border-strong);\r
|
|
2607
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
2608
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
1759
2609
|
overflow: hidden;\r
|
|
1760
2610
|
animation: tcw-alerts-in var(--tcw-dur, 160ms) var(--tcw-ease, ease) both;\r
|
|
1761
2611
|
}\r
|
|
@@ -1770,8 +2620,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1770
2620
|
align-items: center;\r
|
|
1771
2621
|
justify-content: space-between;\r
|
|
1772
2622
|
padding: 10px 12px;\r
|
|
1773
|
-
font-weight:
|
|
1774
|
-
font-size:
|
|
2623
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
2624
|
+
font-size: var(--tcw-font-size);\r
|
|
1775
2625
|
color: var(--tcw-text);\r
|
|
1776
2626
|
border-bottom: 1px solid var(--tcw-border);\r
|
|
1777
2627
|
}\r
|
|
@@ -1780,12 +2630,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1780
2630
|
display: inline-flex;\r
|
|
1781
2631
|
align-items: center;\r
|
|
1782
2632
|
justify-content: center;\r
|
|
1783
|
-
width:
|
|
1784
|
-
height:
|
|
2633
|
+
width: var(--tcw-control-h-sm);\r
|
|
2634
|
+
height: var(--tcw-control-h-sm);\r
|
|
1785
2635
|
border: none;\r
|
|
1786
2636
|
background: transparent;\r
|
|
1787
2637
|
color: var(--tcw-text-muted);\r
|
|
1788
|
-
border-radius: var(--tcw-radius
|
|
2638
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1789
2639
|
cursor: pointer;\r
|
|
1790
2640
|
}\r
|
|
1791
2641
|
.tcw-alerts-close:hover {\r
|
|
@@ -1808,7 +2658,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1808
2658
|
box-sizing: border-box;\r
|
|
1809
2659
|
height: 32px;\r
|
|
1810
2660
|
padding: 0 8px;\r
|
|
1811
|
-
font-size:
|
|
2661
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1812
2662
|
color: var(--tcw-text);\r
|
|
1813
2663
|
background: var(--tcw-bg-surface);\r
|
|
1814
2664
|
border: 1px solid var(--tcw-border);\r
|
|
@@ -1832,12 +2682,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1832
2682
|
justify-content: center;\r
|
|
1833
2683
|
gap: 6px;\r
|
|
1834
2684
|
height: 34px;\r
|
|
1835
|
-
font-size:
|
|
1836
|
-
font-weight:
|
|
2685
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2686
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1837
2687
|
color: var(--tcw-accent-ink);\r
|
|
1838
2688
|
background: var(--tcw-accent);\r
|
|
1839
2689
|
border: none;\r
|
|
1840
|
-
border-radius: var(--tcw-radius
|
|
2690
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1841
2691
|
cursor: pointer;\r
|
|
1842
2692
|
}\r
|
|
1843
2693
|
.tcw-alerts-add:hover {\r
|
|
@@ -1853,7 +2703,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1853
2703
|
.tcw-alerts-empty {\r
|
|
1854
2704
|
padding: 18px 12px;\r
|
|
1855
2705
|
text-align: center;\r
|
|
1856
|
-
font-size:
|
|
2706
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1857
2707
|
color: var(--tcw-text-muted);\r
|
|
1858
2708
|
line-height: 1.5;\r
|
|
1859
2709
|
}\r
|
|
@@ -1880,26 +2730,26 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1880
2730
|
display: flex;\r
|
|
1881
2731
|
align-items: center;\r
|
|
1882
2732
|
gap: 8px;\r
|
|
1883
|
-
font-size:
|
|
1884
|
-
font-weight:
|
|
2733
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2734
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1885
2735
|
color: var(--tcw-text);\r
|
|
1886
2736
|
font-variant-numeric: tabular-nums;\r
|
|
1887
2737
|
}\r
|
|
1888
2738
|
.tcw-alerts-row-note {\r
|
|
1889
2739
|
margin-top: 2px;\r
|
|
1890
|
-
font-size:
|
|
2740
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
1891
2741
|
color: var(--tcw-text-muted);\r
|
|
1892
2742
|
overflow: hidden;\r
|
|
1893
2743
|
text-overflow: ellipsis;\r
|
|
1894
2744
|
white-space: nowrap;\r
|
|
1895
2745
|
}\r
|
|
1896
2746
|
.tcw-alerts-badge {\r
|
|
1897
|
-
font-size:
|
|
1898
|
-
font-weight:
|
|
1899
|
-
text-transform:
|
|
1900
|
-
letter-spacing:
|
|
2747
|
+
font-size: calc(var(--tcw-font-size) - 4px);\r
|
|
2748
|
+
font-weight: calc(var(--tcw-weight-strong) + 100);\r
|
|
2749
|
+
text-transform: var(--tcw-label-case);\r
|
|
2750
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
1901
2751
|
padding: 2px 5px;\r
|
|
1902
|
-
border-radius:
|
|
2752
|
+
border-radius: var(--tcw-tag-radius);\r
|
|
1903
2753
|
color: var(--tcw-accent);\r
|
|
1904
2754
|
background: var(--tcw-accent-soft);\r
|
|
1905
2755
|
}\r
|
|
@@ -1909,12 +2759,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1909
2759
|
display: inline-flex;\r
|
|
1910
2760
|
align-items: center;\r
|
|
1911
2761
|
justify-content: center;\r
|
|
1912
|
-
width:
|
|
1913
|
-
height:
|
|
2762
|
+
width: var(--tcw-control-h-sm);\r
|
|
2763
|
+
height: var(--tcw-control-h-sm);\r
|
|
1914
2764
|
border: none;\r
|
|
1915
2765
|
background: transparent;\r
|
|
1916
2766
|
color: var(--tcw-text-muted);\r
|
|
1917
|
-
border-radius: var(--tcw-radius
|
|
2767
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1918
2768
|
cursor: pointer;\r
|
|
1919
2769
|
}\r
|
|
1920
2770
|
.tcw-alerts-del:hover {\r
|
|
@@ -1942,16 +2792,16 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1942
2792
|
\r
|
|
1943
2793
|
.tcw-datawin {\r
|
|
1944
2794
|
position: absolute;\r
|
|
1945
|
-
top:
|
|
1946
|
-
|
|
2795
|
+
top: var(--tcw-panel-top);\r
|
|
2796
|
+
inset-inline-end: 12px;\r
|
|
1947
2797
|
z-index: 38;\r
|
|
1948
2798
|
width: 200px;\r
|
|
1949
2799
|
display: flex;\r
|
|
1950
2800
|
flex-direction: column;\r
|
|
1951
2801
|
background: var(--tcw-bg-elevated);\r
|
|
1952
2802
|
border: 1px solid var(--tcw-border-strong);\r
|
|
1953
|
-
border-radius: var(--tcw-radius
|
|
1954
|
-
box-shadow: var(--tcw-shadow
|
|
2803
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
2804
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
1955
2805
|
overflow: hidden;\r
|
|
1956
2806
|
animation: tcw-alerts-in var(--tcw-dur, 160ms) var(--tcw-ease, ease) both;\r
|
|
1957
2807
|
}\r
|
|
@@ -1960,8 +2810,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1960
2810
|
align-items: center;\r
|
|
1961
2811
|
justify-content: space-between;\r
|
|
1962
2812
|
padding: 9px 12px;\r
|
|
1963
|
-
font-size:
|
|
1964
|
-
font-weight:
|
|
2813
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2814
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
1965
2815
|
color: var(--tcw-text);\r
|
|
1966
2816
|
border-bottom: 1px solid var(--tcw-border);\r
|
|
1967
2817
|
}\r
|
|
@@ -1969,35 +2819,35 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
1969
2819
|
display: inline-flex;\r
|
|
1970
2820
|
align-items: center;\r
|
|
1971
2821
|
justify-content: center;\r
|
|
1972
|
-
width:
|
|
1973
|
-
height:
|
|
2822
|
+
width: var(--tcw-control-h-sm);\r
|
|
2823
|
+
height: var(--tcw-control-h-sm);\r
|
|
1974
2824
|
border: none;\r
|
|
1975
2825
|
background: transparent;\r
|
|
1976
2826
|
color: var(--tcw-text-muted);\r
|
|
1977
|
-
border-radius: var(--tcw-radius
|
|
2827
|
+
border-radius: var(--tcw-control-radius);\r
|
|
1978
2828
|
cursor: pointer;\r
|
|
1979
2829
|
}\r
|
|
1980
2830
|
.tcw-datawin-close:hover { background: var(--tcw-bg-surface); color: var(--tcw-text); }\r
|
|
1981
2831
|
.tcw-datawin-body { padding: 6px 4px; max-height: 360px; overflow-y: auto; }\r
|
|
1982
|
-
.tcw-datawin-empty { padding: 14px; text-align: center; font-size:
|
|
2832
|
+
.tcw-datawin-empty { padding: 14px; text-align: center; font-size: var(--tcw-font-size-sm); color: var(--tcw-text-muted); }\r
|
|
1983
2833
|
.tcw-datawin-row {\r
|
|
1984
2834
|
display: flex;\r
|
|
1985
2835
|
align-items: center;\r
|
|
1986
2836
|
justify-content: space-between;\r
|
|
1987
2837
|
gap: 10px;\r
|
|
1988
2838
|
padding: 3px 8px;\r
|
|
1989
|
-
font-size:
|
|
2839
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
1990
2840
|
}\r
|
|
1991
2841
|
.tcw-datawin-label { color: var(--tcw-text-muted); }\r
|
|
1992
|
-
.tcw-datawin-value { color: var(--tcw-text); font-variant-numeric: tabular-nums; font-weight:
|
|
2842
|
+
.tcw-datawin-value { color: var(--tcw-text); font-variant-numeric: tabular-nums; font-weight: var(--tcw-weight-strong); }\r
|
|
1993
2843
|
.tcw-datawin-value.tcw-up { color: var(--tcw-green); }\r
|
|
1994
2844
|
.tcw-datawin-value.tcw-down { color: var(--tcw-red); }\r
|
|
1995
2845
|
.tcw-datawin-sub {\r
|
|
1996
2846
|
margin: 6px 8px 2px;\r
|
|
1997
|
-
font-size:
|
|
1998
|
-
font-weight:
|
|
1999
|
-
text-transform:
|
|
2000
|
-
letter-spacing:
|
|
2847
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
2848
|
+
font-weight: calc(var(--tcw-weight-strong) + 100);\r
|
|
2849
|
+
text-transform: var(--tcw-label-case);\r
|
|
2850
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
2001
2851
|
color: var(--tcw-text-muted);\r
|
|
2002
2852
|
border-top: 1px solid var(--tcw-border);\r
|
|
2003
2853
|
padding-top: 6px;\r
|
|
@@ -2011,16 +2861,16 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2011
2861
|
\r
|
|
2012
2862
|
.tcw-ladder {\r
|
|
2013
2863
|
position: absolute;\r
|
|
2014
|
-
top:
|
|
2015
|
-
|
|
2864
|
+
top: var(--tcw-panel-top);\r
|
|
2865
|
+
inset-inline-end: 12px;\r
|
|
2016
2866
|
z-index: 41;\r
|
|
2017
2867
|
width: 240px;\r
|
|
2018
2868
|
display: flex;\r
|
|
2019
2869
|
flex-direction: column;\r
|
|
2020
2870
|
background: var(--tcw-bg-elevated);\r
|
|
2021
2871
|
border: 1px solid var(--tcw-border-strong);\r
|
|
2022
|
-
border-radius: var(--tcw-radius
|
|
2023
|
-
box-shadow: var(--tcw-shadow
|
|
2872
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
2873
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
2024
2874
|
overflow: hidden;\r
|
|
2025
2875
|
animation: tcw-alerts-in var(--tcw-dur, 160ms) var(--tcw-ease, ease) both;\r
|
|
2026
2876
|
}\r
|
|
@@ -2029,8 +2879,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2029
2879
|
align-items: center;\r
|
|
2030
2880
|
justify-content: space-between;\r
|
|
2031
2881
|
padding: 10px 12px;\r
|
|
2032
|
-
font-size:
|
|
2033
|
-
font-weight:
|
|
2882
|
+
font-size: var(--tcw-font-size);\r
|
|
2883
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
2034
2884
|
color: var(--tcw-text);\r
|
|
2035
2885
|
border-bottom: 1px solid var(--tcw-border);\r
|
|
2036
2886
|
}\r
|
|
@@ -2038,12 +2888,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2038
2888
|
display: inline-flex;\r
|
|
2039
2889
|
align-items: center;\r
|
|
2040
2890
|
justify-content: center;\r
|
|
2041
|
-
width:
|
|
2042
|
-
height:
|
|
2891
|
+
width: var(--tcw-control-h-sm);\r
|
|
2892
|
+
height: var(--tcw-control-h-sm);\r
|
|
2043
2893
|
border: none;\r
|
|
2044
2894
|
background: transparent;\r
|
|
2045
2895
|
color: var(--tcw-text-muted);\r
|
|
2046
|
-
border-radius: var(--tcw-radius
|
|
2896
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2047
2897
|
cursor: pointer;\r
|
|
2048
2898
|
}\r
|
|
2049
2899
|
.tcw-ladder-close:hover { background: var(--tcw-bg-surface); color: var(--tcw-text); }\r
|
|
@@ -2051,16 +2901,16 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2051
2901
|
display: grid;\r
|
|
2052
2902
|
grid-template-columns: 1fr 1fr 1fr;\r
|
|
2053
2903
|
padding: 4px 0;\r
|
|
2054
|
-
font-size:
|
|
2055
|
-
font-weight:
|
|
2056
|
-
text-transform:
|
|
2057
|
-
letter-spacing:
|
|
2904
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
2905
|
+
font-weight: calc(var(--tcw-weight-strong) + 100);\r
|
|
2906
|
+
text-transform: var(--tcw-label-case);\r
|
|
2907
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
2058
2908
|
color: var(--tcw-text-muted);\r
|
|
2059
2909
|
border-bottom: 1px solid var(--tcw-border);\r
|
|
2060
2910
|
}\r
|
|
2061
2911
|
.tcw-ladder-cols span { text-align: center; }\r
|
|
2062
2912
|
.tcw-ladder-body { max-height: 360px; overflow-y: auto; }\r
|
|
2063
|
-
.tcw-ladder-empty { padding: 18px; text-align: center; font-size:
|
|
2913
|
+
.tcw-ladder-empty { padding: 18px; text-align: center; font-size: var(--tcw-font-size-sm); color: var(--tcw-text-muted); }\r
|
|
2064
2914
|
\r
|
|
2065
2915
|
.tcw-ladder-row {\r
|
|
2066
2916
|
display: grid;\r
|
|
@@ -2074,7 +2924,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2074
2924
|
align-items: center;\r
|
|
2075
2925
|
border: none;\r
|
|
2076
2926
|
background: transparent;\r
|
|
2077
|
-
font-size:
|
|
2927
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
2078
2928
|
cursor: pointer;\r
|
|
2079
2929
|
font-variant-numeric: tabular-nums;\r
|
|
2080
2930
|
overflow: hidden;\r
|
|
@@ -2098,11 +2948,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2098
2948
|
display: flex;\r
|
|
2099
2949
|
align-items: center;\r
|
|
2100
2950
|
justify-content: center;\r
|
|
2101
|
-
font-size:
|
|
2102
|
-
font-weight:
|
|
2951
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
2952
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
2103
2953
|
color: var(--tcw-text-dim);\r
|
|
2104
|
-
border-
|
|
2105
|
-
border-
|
|
2954
|
+
border-inline-start: 1px solid var(--tcw-border);\r
|
|
2955
|
+
border-inline-end: 1px solid var(--tcw-border);\r
|
|
2106
2956
|
}\r
|
|
2107
2957
|
.tcw-ladder-price.tcw-ask { color: var(--tcw-red); }\r
|
|
2108
2958
|
.tcw-ladder-price.tcw-bid { color: var(--tcw-green); }\r
|
|
@@ -2119,7 +2969,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2119
2969
|
\r
|
|
2120
2970
|
.tcw-bracket-bar {\r
|
|
2121
2971
|
position: absolute;\r
|
|
2122
|
-
top:
|
|
2972
|
+
top: calc(var(--tcw-panel-top) + 2px);\r
|
|
2123
2973
|
left: 50%;\r
|
|
2124
2974
|
transform: translateX(-50%);\r
|
|
2125
2975
|
z-index: 45;\r
|
|
@@ -2129,18 +2979,18 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2129
2979
|
padding: 7px 8px 7px 14px;\r
|
|
2130
2980
|
background: var(--tcw-bg-elevated);\r
|
|
2131
2981
|
border: 1px solid var(--tcw-border-strong);\r
|
|
2132
|
-
border-radius:
|
|
2133
|
-
box-shadow: var(--tcw-shadow
|
|
2982
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
2983
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
2134
2984
|
animation: tcw-alerts-in var(--tcw-dur, 160ms) var(--tcw-ease, ease) both;\r
|
|
2135
2985
|
}\r
|
|
2136
2986
|
.tcw-bracket-label {\r
|
|
2137
|
-
font-size:
|
|
2138
|
-
font-weight:
|
|
2987
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2988
|
+
font-weight: calc(var(--tcw-weight-strong) + 100);\r
|
|
2139
2989
|
}\r
|
|
2140
2990
|
.tcw-bracket-label[data-side='buy'] { color: var(--tcw-green); }\r
|
|
2141
2991
|
.tcw-bracket-label[data-side='sell'] { color: var(--tcw-red); }\r
|
|
2142
2992
|
.tcw-bracket-hint {\r
|
|
2143
|
-
font-size:
|
|
2993
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
2144
2994
|
color: var(--tcw-text-muted);\r
|
|
2145
2995
|
}\r
|
|
2146
2996
|
.tcw-bracket-cancel, .tcw-bracket-confirm {\r
|
|
@@ -2149,10 +2999,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2149
2999
|
gap: 5px;\r
|
|
2150
3000
|
height: 30px;\r
|
|
2151
3001
|
padding: 0 12px;\r
|
|
2152
|
-
font-size:
|
|
2153
|
-
font-weight:
|
|
3002
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3003
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
2154
3004
|
border: none;\r
|
|
2155
|
-
border-radius:
|
|
3005
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2156
3006
|
cursor: pointer;\r
|
|
2157
3007
|
}\r
|
|
2158
3008
|
.tcw-bracket-cancel {\r
|
|
@@ -2176,7 +3026,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2176
3026
|
.tcw-style-panel {\r
|
|
2177
3027
|
position: absolute;\r
|
|
2178
3028
|
bottom: 12px;\r
|
|
2179
|
-
|
|
3029
|
+
inset-inline-start: var(--tcw-panel-left);\r
|
|
2180
3030
|
z-index: 40;\r
|
|
2181
3031
|
width: 220px;\r
|
|
2182
3032
|
display: flex;\r
|
|
@@ -2185,28 +3035,28 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2185
3035
|
padding: 12px;\r
|
|
2186
3036
|
background: var(--tcw-bg-elevated);\r
|
|
2187
3037
|
border: 1px solid var(--tcw-border-strong);\r
|
|
2188
|
-
border-radius: var(--tcw-radius
|
|
2189
|
-
box-shadow: var(--tcw-shadow
|
|
3038
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
3039
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
2190
3040
|
animation: tcw-alerts-in var(--tcw-dur, 160ms) var(--tcw-ease, ease) both;\r
|
|
2191
3041
|
}\r
|
|
2192
3042
|
.tcw-style-header {\r
|
|
2193
3043
|
display: flex;\r
|
|
2194
3044
|
align-items: center;\r
|
|
2195
3045
|
justify-content: space-between;\r
|
|
2196
|
-
font-size:
|
|
2197
|
-
font-weight:
|
|
3046
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3047
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
2198
3048
|
color: var(--tcw-text);\r
|
|
2199
3049
|
}\r
|
|
2200
3050
|
.tcw-style-close {\r
|
|
2201
3051
|
display: inline-flex;\r
|
|
2202
3052
|
align-items: center;\r
|
|
2203
3053
|
justify-content: center;\r
|
|
2204
|
-
width:
|
|
2205
|
-
height:
|
|
3054
|
+
width: var(--tcw-control-h-sm);\r
|
|
3055
|
+
height: var(--tcw-control-h-sm);\r
|
|
2206
3056
|
border: none;\r
|
|
2207
3057
|
background: transparent;\r
|
|
2208
3058
|
color: var(--tcw-text-muted);\r
|
|
2209
|
-
border-radius: var(--tcw-radius
|
|
3059
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2210
3060
|
cursor: pointer;\r
|
|
2211
3061
|
}\r
|
|
2212
3062
|
.tcw-style-close:hover { background: var(--tcw-bg-surface); color: var(--tcw-text); }\r
|
|
@@ -2239,22 +3089,22 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2239
3089
|
justify-content: center;\r
|
|
2240
3090
|
background: var(--tcw-bg-surface);\r
|
|
2241
3091
|
border: 1px solid var(--tcw-border);\r
|
|
2242
|
-
border-radius: var(--tcw-radius
|
|
3092
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2243
3093
|
color: var(--tcw-text-dim);\r
|
|
2244
3094
|
cursor: pointer;\r
|
|
2245
|
-
font-size:
|
|
3095
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
2246
3096
|
}\r
|
|
2247
|
-
.tcw-style-width span { width: 16px; background: currentColor; border-radius:
|
|
3097
|
+
.tcw-style-width span { width: 16px; background: currentColor; border-radius: var(--tcw-radius-xs); }\r
|
|
2248
3098
|
.tcw-style-width.tcw-on, .tcw-style-dash.tcw-on {\r
|
|
2249
3099
|
border-color: var(--tcw-accent);\r
|
|
2250
3100
|
color: var(--tcw-accent);\r
|
|
2251
3101
|
}\r
|
|
2252
3102
|
\r
|
|
2253
3103
|
.tcw-style-subhead {\r
|
|
2254
|
-
font-size:
|
|
2255
|
-
font-weight:
|
|
2256
|
-
text-transform:
|
|
2257
|
-
letter-spacing:
|
|
3104
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
3105
|
+
font-weight: calc(var(--tcw-weight-strong) + 100);\r
|
|
3106
|
+
text-transform: var(--tcw-label-case);\r
|
|
3107
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
2258
3108
|
color: var(--tcw-text-muted);\r
|
|
2259
3109
|
margin-top: 2px;\r
|
|
2260
3110
|
}\r
|
|
@@ -2264,11 +3114,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2264
3114
|
min-width: 0;\r
|
|
2265
3115
|
height: 28px;\r
|
|
2266
3116
|
padding: 0 8px;\r
|
|
2267
|
-
font-size:
|
|
3117
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2268
3118
|
color: var(--tcw-text);\r
|
|
2269
3119
|
background: var(--tcw-bg-surface);\r
|
|
2270
3120
|
border: 1px solid var(--tcw-border);\r
|
|
2271
|
-
border-radius: var(--tcw-radius
|
|
3121
|
+
border-radius: var(--tcw-input-radius);\r
|
|
2272
3122
|
outline: none;\r
|
|
2273
3123
|
}\r
|
|
2274
3124
|
.tcw-style-name:focus { border-color: var(--tcw-accent); }\r
|
|
@@ -2278,18 +3128,18 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2278
3128
|
gap: 4px;\r
|
|
2279
3129
|
padding: 0 10px;\r
|
|
2280
3130
|
height: 28px;\r
|
|
2281
|
-
font-size:
|
|
2282
|
-
font-weight:
|
|
3131
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3132
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
2283
3133
|
color: var(--tcw-accent-ink);\r
|
|
2284
3134
|
background: var(--tcw-accent);\r
|
|
2285
3135
|
border: none;\r
|
|
2286
|
-
border-radius: var(--tcw-radius
|
|
3136
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2287
3137
|
cursor: pointer;\r
|
|
2288
3138
|
}\r
|
|
2289
3139
|
.tcw-style-savebtn:hover { background: var(--tcw-accent-hover); }\r
|
|
2290
3140
|
\r
|
|
2291
3141
|
.tcw-style-templates { display: flex; flex-direction: column; gap: 2px; max-height: 140px; overflow-y: auto; }\r
|
|
2292
|
-
.tcw-style-empty { font-size:
|
|
3142
|
+
.tcw-style-empty { font-size: var(--tcw-font-size-xs); color: var(--tcw-text-muted); padding: 4px 0; }\r
|
|
2293
3143
|
.tcw-style-template { display: flex; align-items: center; gap: 4px; }\r
|
|
2294
3144
|
.tcw-style-apply {\r
|
|
2295
3145
|
flex: 1;\r
|
|
@@ -2298,13 +3148,13 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2298
3148
|
align-items: center;\r
|
|
2299
3149
|
gap: 7px;\r
|
|
2300
3150
|
padding: 5px 7px;\r
|
|
2301
|
-
font-size:
|
|
3151
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2302
3152
|
color: var(--tcw-text);\r
|
|
2303
3153
|
background: transparent;\r
|
|
2304
3154
|
border: none;\r
|
|
2305
|
-
border-radius: var(--tcw-radius
|
|
3155
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2306
3156
|
cursor: pointer;\r
|
|
2307
|
-
text-align:
|
|
3157
|
+
text-align: start;\r
|
|
2308
3158
|
}\r
|
|
2309
3159
|
.tcw-style-apply:hover { background: var(--tcw-bg-surface); }\r
|
|
2310
3160
|
.tcw-style-tdot { flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; }\r
|
|
@@ -2312,12 +3162,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2312
3162
|
display: inline-flex;\r
|
|
2313
3163
|
align-items: center;\r
|
|
2314
3164
|
justify-content: center;\r
|
|
2315
|
-
width:
|
|
2316
|
-
height:
|
|
3165
|
+
width: var(--tcw-control-h-sm);\r
|
|
3166
|
+
height: var(--tcw-control-h-sm);\r
|
|
2317
3167
|
border: none;\r
|
|
2318
3168
|
background: transparent;\r
|
|
2319
3169
|
color: var(--tcw-text-muted);\r
|
|
2320
|
-
border-radius: var(--tcw-radius
|
|
3170
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2321
3171
|
cursor: pointer;\r
|
|
2322
3172
|
}\r
|
|
2323
3173
|
.tcw-style-tdel:hover { background: var(--tcw-red-soft); color: var(--tcw-red); }\r
|
|
@@ -2336,8 +3186,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2336
3186
|
}\r
|
|
2337
3187
|
.tcw-settings-range-val {\r
|
|
2338
3188
|
min-width: 38px;\r
|
|
2339
|
-
text-align:
|
|
2340
|
-
font-size:
|
|
3189
|
+
text-align: end;\r
|
|
3190
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2341
3191
|
font-variant-numeric: tabular-nums;\r
|
|
2342
3192
|
color: var(--tcw-text-dim);\r
|
|
2343
3193
|
}\r
|
|
@@ -2351,11 +3201,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2351
3201
|
width: 110px;\r
|
|
2352
3202
|
height: 30px;\r
|
|
2353
3203
|
padding: 0 8px;\r
|
|
2354
|
-
font-size:
|
|
3204
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2355
3205
|
color: var(--tcw-text);\r
|
|
2356
3206
|
background: var(--tcw-bg-surface);\r
|
|
2357
3207
|
border: 1px solid var(--tcw-border);\r
|
|
2358
|
-
border-radius: var(--tcw-radius
|
|
3208
|
+
border-radius: var(--tcw-input-radius);\r
|
|
2359
3209
|
outline: none;\r
|
|
2360
3210
|
font-variant-numeric: tabular-nums;\r
|
|
2361
3211
|
}\r
|
|
@@ -2363,6 +3213,40 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2363
3213
|
border-color: var(--tcw-accent);\r
|
|
2364
3214
|
box-shadow: 0 0 0 2px var(--tcw-accent-soft);\r
|
|
2365
3215
|
}\r
|
|
3216
|
+
.tcw-indi-select {\r
|
|
3217
|
+
width: 150px;\r
|
|
3218
|
+
padding-right: 4px;\r
|
|
3219
|
+
cursor: pointer;\r
|
|
3220
|
+
}\r
|
|
3221
|
+
/* A level: its value and a remove button. */\r
|
|
3222
|
+
.tcw-indi-level {\r
|
|
3223
|
+
display: inline-flex;\r
|
|
3224
|
+
align-items: center;\r
|
|
3225
|
+
gap: 6px;\r
|
|
3226
|
+
}\r
|
|
3227
|
+
.tcw-indi-remove {\r
|
|
3228
|
+
display: inline-grid;\r
|
|
3229
|
+
place-items: center;\r
|
|
3230
|
+
width: var(--tcw-control-h-sm);\r
|
|
3231
|
+
height: var(--tcw-control-h-sm);\r
|
|
3232
|
+
padding: 0;\r
|
|
3233
|
+
border: none;\r
|
|
3234
|
+
border-radius: var(--tcw-control-radius);\r
|
|
3235
|
+
background: transparent;\r
|
|
3236
|
+
color: var(--tcw-text-muted);\r
|
|
3237
|
+
cursor: pointer;\r
|
|
3238
|
+
}\r
|
|
3239
|
+
.tcw-indi-remove:hover {\r
|
|
3240
|
+
color: var(--tcw-red);\r
|
|
3241
|
+
background: var(--tcw-hover-bg);\r
|
|
3242
|
+
}\r
|
|
3243
|
+
.tcw-indi-remove:focus-visible {\r
|
|
3244
|
+
outline: 2px solid var(--tcw-accent);\r
|
|
3245
|
+
outline-offset: -2px;\r
|
|
3246
|
+
}\r
|
|
3247
|
+
.tcw-indi-add {\r
|
|
3248
|
+
margin-top: 8px;\r
|
|
3249
|
+
}\r
|
|
2366
3250
|
.tcw-indi-color {\r
|
|
2367
3251
|
width: 36px;\r
|
|
2368
3252
|
height: 28px;\r
|
|
@@ -2377,8 +3261,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2377
3261
|
\r
|
|
2378
3262
|
.tcw-tree-panel {\r
|
|
2379
3263
|
position: absolute;\r
|
|
2380
|
-
top:
|
|
2381
|
-
|
|
3264
|
+
top: var(--tcw-panel-top);\r
|
|
3265
|
+
inset-inline-end: 12px;\r
|
|
2382
3266
|
z-index: 39;\r
|
|
2383
3267
|
width: 280px;\r
|
|
2384
3268
|
max-width: calc(100vw - 24px);\r
|
|
@@ -2386,8 +3270,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2386
3270
|
flex-direction: column;\r
|
|
2387
3271
|
background: var(--tcw-bg-elevated);\r
|
|
2388
3272
|
border: 1px solid var(--tcw-border-strong);\r
|
|
2389
|
-
border-radius: var(--tcw-radius
|
|
2390
|
-
box-shadow: var(--tcw-shadow
|
|
3273
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
3274
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
2391
3275
|
overflow: hidden;\r
|
|
2392
3276
|
animation: tcw-alerts-in var(--tcw-dur, 160ms) var(--tcw-ease, ease) both;\r
|
|
2393
3277
|
}\r
|
|
@@ -2397,8 +3281,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2397
3281
|
align-items: center;\r
|
|
2398
3282
|
justify-content: space-between;\r
|
|
2399
3283
|
padding: 10px 12px;\r
|
|
2400
|
-
font-weight:
|
|
2401
|
-
font-size:
|
|
3284
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
3285
|
+
font-size: var(--tcw-font-size);\r
|
|
2402
3286
|
color: var(--tcw-text);\r
|
|
2403
3287
|
border-bottom: 1px solid var(--tcw-border);\r
|
|
2404
3288
|
}\r
|
|
@@ -2406,12 +3290,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2406
3290
|
display: inline-flex;\r
|
|
2407
3291
|
align-items: center;\r
|
|
2408
3292
|
justify-content: center;\r
|
|
2409
|
-
width:
|
|
2410
|
-
height:
|
|
3293
|
+
width: var(--tcw-control-h-sm);\r
|
|
3294
|
+
height: var(--tcw-control-h-sm);\r
|
|
2411
3295
|
border: none;\r
|
|
2412
3296
|
background: transparent;\r
|
|
2413
3297
|
color: var(--tcw-text-muted);\r
|
|
2414
|
-
border-radius: var(--tcw-radius
|
|
3298
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2415
3299
|
cursor: pointer;\r
|
|
2416
3300
|
}\r
|
|
2417
3301
|
.tcw-tree-close:hover {\r
|
|
@@ -2431,22 +3315,22 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2431
3315
|
align-items: center;\r
|
|
2432
3316
|
justify-content: space-between;\r
|
|
2433
3317
|
padding: 6px 8px 4px;\r
|
|
2434
|
-
font-size:
|
|
2435
|
-
font-weight:
|
|
2436
|
-
text-transform:
|
|
2437
|
-
letter-spacing:
|
|
3318
|
+
font-size: calc(var(--tcw-font-size) - 3px);\r
|
|
3319
|
+
font-weight: calc(var(--tcw-weight-strong) + 100);\r
|
|
3320
|
+
text-transform: var(--tcw-label-case);\r
|
|
3321
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
2438
3322
|
color: var(--tcw-text-muted);\r
|
|
2439
3323
|
}\r
|
|
2440
3324
|
.tcw-tree-add {\r
|
|
2441
3325
|
display: inline-flex;\r
|
|
2442
3326
|
align-items: center;\r
|
|
2443
3327
|
justify-content: center;\r
|
|
2444
|
-
width:
|
|
2445
|
-
height:
|
|
3328
|
+
width: var(--tcw-control-h-sm);\r
|
|
3329
|
+
height: var(--tcw-control-h-sm);\r
|
|
2446
3330
|
border: none;\r
|
|
2447
3331
|
background: transparent;\r
|
|
2448
3332
|
color: var(--tcw-text-muted);\r
|
|
2449
|
-
border-radius: var(--tcw-radius
|
|
3333
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2450
3334
|
cursor: pointer;\r
|
|
2451
3335
|
}\r
|
|
2452
3336
|
.tcw-tree-add:hover {\r
|
|
@@ -2480,7 +3364,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2480
3364
|
}\r
|
|
2481
3365
|
.tcw-tree-name {\r
|
|
2482
3366
|
min-width: 0;\r
|
|
2483
|
-
font-size:
|
|
3367
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2484
3368
|
color: var(--tcw-text);\r
|
|
2485
3369
|
overflow: hidden;\r
|
|
2486
3370
|
text-overflow: ellipsis;\r
|
|
@@ -2496,12 +3380,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2496
3380
|
display: inline-flex;\r
|
|
2497
3381
|
align-items: center;\r
|
|
2498
3382
|
justify-content: center;\r
|
|
2499
|
-
width:
|
|
2500
|
-
height:
|
|
3383
|
+
width: var(--tcw-control-h-sm);\r
|
|
3384
|
+
height: var(--tcw-control-h-sm);\r
|
|
2501
3385
|
border: none;\r
|
|
2502
3386
|
background: transparent;\r
|
|
2503
3387
|
color: var(--tcw-text-muted);\r
|
|
2504
|
-
border-radius: var(--tcw-radius
|
|
3388
|
+
border-radius: var(--tcw-control-radius);\r
|
|
2505
3389
|
cursor: pointer;\r
|
|
2506
3390
|
}\r
|
|
2507
3391
|
.tcw-tree-btn:hover {\r
|
|
@@ -2515,9 +3399,40 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2515
3399
|
background: var(--tcw-red-soft);\r
|
|
2516
3400
|
color: var(--tcw-red);\r
|
|
2517
3401
|
}\r
|
|
3402
|
+
.tcw-tree-group .tcw-tree-name {\r
|
|
3403
|
+
display: inline-flex;\r
|
|
3404
|
+
align-items: center;\r
|
|
3405
|
+
gap: 6px;\r
|
|
3406
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
3407
|
+
}\r
|
|
3408
|
+
.tcw-tree-group .tcw-tree-name svg {\r
|
|
3409
|
+
flex: none;\r
|
|
3410
|
+
color: var(--tcw-text-muted);\r
|
|
3411
|
+
}\r
|
|
3412
|
+
.tcw-tree-member {\r
|
|
3413
|
+
margin-left: 14px;\r
|
|
3414
|
+
padding-left: 10px;\r
|
|
3415
|
+
border-inline-start: 1px solid var(--tcw-border-strong);\r
|
|
3416
|
+
border-radius: 0 var(--tcw-radius-sm) var(--tcw-radius-sm) 0;\r
|
|
3417
|
+
}\r
|
|
3418
|
+
.tcw-tree-rename {\r
|
|
3419
|
+
flex: 1;\r
|
|
3420
|
+
min-width: 0;\r
|
|
3421
|
+
padding: 3px 6px;\r
|
|
3422
|
+
border: 1px solid var(--tcw-accent-line);\r
|
|
3423
|
+
border-radius: var(--tcw-input-radius);\r
|
|
3424
|
+
background: var(--tcw-bg-surface);\r
|
|
3425
|
+
color: var(--tcw-text);\r
|
|
3426
|
+
font: inherit;\r
|
|
3427
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3428
|
+
}\r
|
|
3429
|
+
.tcw-tree-rename:focus {\r
|
|
3430
|
+
outline: none;\r
|
|
3431
|
+
box-shadow: 0 0 0 2px var(--tcw-accent-soft);\r
|
|
3432
|
+
}\r
|
|
2518
3433
|
.tcw-tree-empty {\r
|
|
2519
3434
|
padding: 8px;\r
|
|
2520
|
-
font-size:
|
|
3435
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
2521
3436
|
color: var(--tcw-text-muted);\r
|
|
2522
3437
|
}\r
|
|
2523
3438
|
\r
|
|
@@ -2549,14 +3464,839 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
2549
3464
|
animation-iteration-count: 1 !important;\r
|
|
2550
3465
|
transition-duration: 0.01ms !important;\r
|
|
2551
3466
|
}\r
|
|
3467
|
+
\r
|
|
3468
|
+
/* Except the loader's slow glow (opacity only): without it a long wait\r
|
|
3469
|
+
looks frozen. */\r
|
|
3470
|
+
.tcw-root .tcw-loading-candle,\r
|
|
3471
|
+
.tcw-root .tcw-loading-track > span {\r
|
|
3472
|
+
animation-duration: 2.4s !important;\r
|
|
3473
|
+
animation-iteration-count: infinite !important;\r
|
|
3474
|
+
animation-delay: var(--tcw-delay, 0ms) !important;\r
|
|
3475
|
+
}\r
|
|
3476
|
+
}\r
|
|
3477
|
+
\r
|
|
3478
|
+
/* --- Drawing settings dialog --- */\r
|
|
3479
|
+
.tcw-drawing-settings .tcw-modal-footer { gap: 12px; }\r
|
|
3480
|
+
.tcw-drawing-settings-tools {\r
|
|
3481
|
+
display: flex;\r
|
|
3482
|
+
gap: 14px;\r
|
|
3483
|
+
margin-inline-end: auto;\r
|
|
3484
|
+
}\r
|
|
3485
|
+
.tcw-drawing-text {\r
|
|
3486
|
+
min-height: 56px;\r
|
|
3487
|
+
resize: vertical;\r
|
|
3488
|
+
font-family: inherit;\r
|
|
3489
|
+
}\r
|
|
3490
|
+
.tcw-levels-editor { display: grid; gap: 6px; margin-bottom: 10px; }\r
|
|
3491
|
+
.tcw-levels-grid {\r
|
|
3492
|
+
display: grid;\r
|
|
3493
|
+
gap: 4px;\r
|
|
3494
|
+
max-height: 260px;\r
|
|
3495
|
+
overflow-y: auto;\r
|
|
3496
|
+
padding-right: 2px;\r
|
|
3497
|
+
}\r
|
|
3498
|
+
.tcw-level-row {\r
|
|
3499
|
+
display: grid;\r
|
|
3500
|
+
grid-template-columns: auto minmax(0, 1fr) 32px 24px;\r
|
|
3501
|
+
align-items: center;\r
|
|
3502
|
+
gap: 8px;\r
|
|
3503
|
+
}\r
|
|
3504
|
+
.tcw-level-row input[type='checkbox'] { accent-color: var(--tcw-accent); }\r
|
|
3505
|
+
.tcw-level-remove {\r
|
|
3506
|
+
display: inline-flex;\r
|
|
3507
|
+
align-items: center;\r
|
|
3508
|
+
justify-content: center;\r
|
|
3509
|
+
width: var(--tcw-control-h-sm);\r
|
|
3510
|
+
height: var(--tcw-control-h-sm);\r
|
|
3511
|
+
border: 0;\r
|
|
3512
|
+
border-radius: var(--tcw-radius-sm, 4px);\r
|
|
3513
|
+
background: transparent;\r
|
|
3514
|
+
color: var(--tcw-text-muted);\r
|
|
3515
|
+
cursor: pointer;\r
|
|
3516
|
+
}\r
|
|
3517
|
+
.tcw-level-remove:hover { color: var(--tcw-text); background: var(--tcw-bg-elevated); }\r
|
|
3518
|
+
.tcw-level-remove:focus-visible { outline: 2px solid var(--tcw-accent); outline-offset: 1px; }\r
|
|
3519
|
+
.tcw-level-add { justify-self: start; }\r
|
|
3520
|
+
.tcw-drawing-templates { display: grid; gap: 2px; margin-bottom: 8px; }\r
|
|
3521
|
+
.tcw-drawing-alert { display: inline-flex; align-items: center; gap: 6px; }\r
|
|
3522
|
+
\r
|
|
3523
|
+
/* --- Context menu (right-click on a drawing) --- */\r
|
|
3524
|
+
.tcw-context-menu {\r
|
|
3525
|
+
position: absolute;\r
|
|
3526
|
+
z-index: 70;\r
|
|
3527
|
+
min-width: 200px;\r
|
|
3528
|
+
padding: 4px;\r
|
|
3529
|
+
background: var(--tcw-bg-elevated);\r
|
|
3530
|
+
border: var(--tcw-border-w) solid var(--tcw-divider);\r
|
|
3531
|
+
border-radius: var(--tcw-menu-radius);\r
|
|
3532
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
3533
|
+
}\r
|
|
3534
|
+
.tcw-context-item {\r
|
|
3535
|
+
display: flex;\r
|
|
3536
|
+
align-items: center;\r
|
|
3537
|
+
gap: 10px;\r
|
|
3538
|
+
width: 100%;\r
|
|
3539
|
+
min-height: var(--tcw-menu-item-h);\r
|
|
3540
|
+
padding: 4px 10px;\r
|
|
3541
|
+
border: 0;\r
|
|
3542
|
+
border-radius: var(--tcw-radius-sm);\r
|
|
3543
|
+
background: transparent;\r
|
|
3544
|
+
color: var(--tcw-text);\r
|
|
3545
|
+
font: inherit;\r
|
|
3546
|
+
font-size: var(--tcw-font-size);\r
|
|
3547
|
+
text-align: start;\r
|
|
3548
|
+
cursor: pointer;\r
|
|
3549
|
+
}\r
|
|
3550
|
+
.tcw-context-item svg, .tcw-context-icon { flex: none; width: 14px; height: 14px; color: var(--tcw-text-muted); }\r
|
|
3551
|
+
.tcw-context-item:hover, .tcw-context-item:focus-visible { background: var(--tcw-bg-surface); outline: none; }\r
|
|
3552
|
+
.tcw-context-item:focus-visible { box-shadow: inset 0 0 0 1px var(--tcw-accent); }\r
|
|
3553
|
+
.tcw-context-danger, .tcw-context-danger svg { color: var(--tcw-red); }\r
|
|
3554
|
+
.tcw-context-sep { height: 1px; margin: 4px 6px; background: var(--tcw-divider); }\r
|
|
3555
|
+
\r
|
|
3556
|
+
/* --- Account panel (positions, orders, history) --- */\r
|
|
3557
|
+
.tcw-account-dock {\r
|
|
3558
|
+
flex: none;\r
|
|
3559
|
+
}\r
|
|
3560
|
+
.tcw-account {\r
|
|
3561
|
+
display: flex;\r
|
|
3562
|
+
flex-direction: column;\r
|
|
3563
|
+
height: 220px;\r
|
|
3564
|
+
border-top: 1px solid var(--tcw-border);\r
|
|
3565
|
+
background: var(--tcw-bg-surface);\r
|
|
3566
|
+
}\r
|
|
3567
|
+
.tcw-account-head {\r
|
|
3568
|
+
display: flex;\r
|
|
3569
|
+
align-items: center;\r
|
|
3570
|
+
gap: 8px;\r
|
|
3571
|
+
padding: 4px 8px;\r
|
|
3572
|
+
border-bottom: 1px solid var(--tcw-divider);\r
|
|
3573
|
+
}\r
|
|
3574
|
+
.tcw-account-tabs {\r
|
|
3575
|
+
display: flex;\r
|
|
3576
|
+
gap: 2px;\r
|
|
3577
|
+
flex: 1;\r
|
|
3578
|
+
min-width: 0;\r
|
|
3579
|
+
overflow-x: auto;\r
|
|
3580
|
+
}\r
|
|
3581
|
+
.tcw-account-tab {\r
|
|
3582
|
+
padding: 6px 10px;\r
|
|
3583
|
+
border: 0;\r
|
|
3584
|
+
border-radius: var(--tcw-control-radius);\r
|
|
3585
|
+
background: transparent;\r
|
|
3586
|
+
color: var(--tcw-text-muted);\r
|
|
3587
|
+
font: inherit;\r
|
|
3588
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3589
|
+
white-space: nowrap;\r
|
|
3590
|
+
cursor: pointer;\r
|
|
3591
|
+
}\r
|
|
3592
|
+
.tcw-account-tab:hover { color: var(--tcw-text); background: var(--tcw-hover-bg); }\r
|
|
3593
|
+
.tcw-account-tab[aria-selected="true"] { color: var(--tcw-text); background: var(--tcw-active-bg); }\r
|
|
3594
|
+
.tcw-account-tab:focus-visible, .tcw-account-new:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--tcw-accent); }\r
|
|
3595
|
+
.tcw-account-new {\r
|
|
3596
|
+
display: inline-flex;\r
|
|
3597
|
+
align-items: center;\r
|
|
3598
|
+
gap: 6px;\r
|
|
3599
|
+
padding: 5px 10px;\r
|
|
3600
|
+
border: 1px solid var(--tcw-accent-line);\r
|
|
3601
|
+
border-radius: var(--tcw-control-radius);\r
|
|
3602
|
+
background: var(--tcw-accent-soft);\r
|
|
3603
|
+
color: var(--tcw-accent);\r
|
|
3604
|
+
font: inherit;\r
|
|
3605
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3606
|
+
cursor: pointer;\r
|
|
3607
|
+
}\r
|
|
3608
|
+
.tcw-account-new:hover { background: var(--tcw-accent-glow); }\r
|
|
3609
|
+
.tcw-account-body {\r
|
|
3610
|
+
flex: 1;\r
|
|
3611
|
+
min-height: 0;\r
|
|
3612
|
+
overflow: auto;\r
|
|
3613
|
+
}\r
|
|
3614
|
+
.tcw-account-table {\r
|
|
3615
|
+
width: 100%;\r
|
|
3616
|
+
border-collapse: collapse;\r
|
|
3617
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3618
|
+
font-variant-numeric: tabular-nums;\r
|
|
3619
|
+
}\r
|
|
3620
|
+
.tcw-account-table th {\r
|
|
3621
|
+
position: sticky;\r
|
|
3622
|
+
top: 0;\r
|
|
3623
|
+
padding: 6px 10px;\r
|
|
3624
|
+
background: var(--tcw-bg-surface);\r
|
|
3625
|
+
color: var(--tcw-text-muted);\r
|
|
3626
|
+
font-weight: var(--tcw-weight);\r
|
|
3627
|
+
text-align: start;\r
|
|
3628
|
+
border-bottom: 1px solid var(--tcw-divider);\r
|
|
3629
|
+
}\r
|
|
3630
|
+
.tcw-account-table td {\r
|
|
3631
|
+
padding: 5px 10px;\r
|
|
3632
|
+
color: var(--tcw-text);\r
|
|
3633
|
+
border-bottom: 1px solid var(--tcw-divider);\r
|
|
3634
|
+
white-space: nowrap;\r
|
|
3635
|
+
}\r
|
|
3636
|
+
.tcw-account-table tr:hover td { background: var(--tcw-hover-bg); }\r
|
|
3637
|
+
.tcw-account-side { font-weight: var(--tcw-weight-strong); }\r
|
|
3638
|
+
.tcw-account-buy, .tcw-account-up { color: var(--tcw-green); }\r
|
|
3639
|
+
.tcw-account-sell, .tcw-account-down { color: var(--tcw-red); }\r
|
|
3640
|
+
.tcw-account-actions { display: flex; gap: 2px; }\r
|
|
3641
|
+
.tcw-account-empty, .tcw-account-summary {\r
|
|
3642
|
+
margin: 0;\r
|
|
3643
|
+
padding: 14px 12px;\r
|
|
3644
|
+
color: var(--tcw-text-muted);\r
|
|
3645
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3646
|
+
}\r
|
|
3647
|
+
.tcw-account-summary { padding: 8px 12px; color: var(--tcw-text-dim); }\r
|
|
3648
|
+
@media (max-width: 640px) {\r
|
|
3649
|
+
.tcw-account { height: 45vh; }\r
|
|
3650
|
+
}\r
|
|
3651
|
+
\r
|
|
3652
|
+
/* --- Order ticket --- */\r
|
|
3653
|
+
.tcw-ticket-side {\r
|
|
3654
|
+
display: grid;\r
|
|
3655
|
+
grid-template-columns: 1fr 1fr;\r
|
|
3656
|
+
gap: 6px;\r
|
|
3657
|
+
margin-bottom: 12px;\r
|
|
3658
|
+
}\r
|
|
3659
|
+
.tcw-ticket-side-btn {\r
|
|
3660
|
+
padding: 8px;\r
|
|
3661
|
+
border: 1px solid var(--tcw-border);\r
|
|
3662
|
+
border-radius: var(--tcw-control-radius);\r
|
|
3663
|
+
background: transparent;\r
|
|
3664
|
+
color: var(--tcw-text-muted);\r
|
|
3665
|
+
font: inherit;\r
|
|
3666
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
3667
|
+
cursor: pointer;\r
|
|
3668
|
+
}\r
|
|
3669
|
+
.tcw-ticket-buy[aria-pressed="true"] { background: var(--tcw-green-soft); border-color: var(--tcw-green); color: var(--tcw-green); }\r
|
|
3670
|
+
.tcw-ticket-sell[aria-pressed="true"] { background: var(--tcw-red-soft); border-color: var(--tcw-red); color: var(--tcw-red); }\r
|
|
3671
|
+
.tcw-ticket-side-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--tcw-accent-soft); }\r
|
|
3672
|
+
.tcw-ticket-optional { display: flex; align-items: center; gap: 8px; }\r
|
|
3673
|
+
.tcw-ticket-optional > span { flex: 1; }\r
|
|
3674
|
+
.tcw-ticket-optional .tcw-indi-input { width: 110px; }\r
|
|
3675
|
+
.tcw-ticket-problems {\r
|
|
3676
|
+
min-height: 18px;\r
|
|
3677
|
+
padding: 0 22px 8px;\r
|
|
3678
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3679
|
+
color: var(--tcw-text-dim);\r
|
|
3680
|
+
}\r
|
|
3681
|
+
.tcw-ticket-problems p { margin: 2px 0; }\r
|
|
3682
|
+
.tcw-ticket-problems.tcw-ticket-bad { color: var(--tcw-red); }\r
|
|
3683
|
+
.tcw-done-btn.tcw-ticket-sell { background: var(--tcw-red); color: #fff; }\r
|
|
3684
|
+
.tcw-done-btn:disabled { opacity: 0.45; cursor: not-allowed; }\r
|
|
3685
|
+
\r
|
|
3686
|
+
/* --- Named layouts --- */\r
|
|
3687
|
+
.tcw-layouts-btn { max-width: 190px; }\r
|
|
3688
|
+
.tcw-layouts-label {\r
|
|
3689
|
+
overflow: hidden;\r
|
|
3690
|
+
text-overflow: ellipsis;\r
|
|
3691
|
+
min-width: 0;\r
|
|
3692
|
+
}\r
|
|
3693
|
+
.tcw-layouts-dirty {\r
|
|
3694
|
+
width: 6px;\r
|
|
3695
|
+
height: 6px;\r
|
|
3696
|
+
flex: none;\r
|
|
3697
|
+
border-radius: 50%;\r
|
|
3698
|
+
background: var(--tcw-accent);\r
|
|
3699
|
+
}\r
|
|
3700
|
+
.tcw-name-field { display: flex; flex-direction: column; gap: 6px; font-size: var(--tcw-font-size-sm); color: var(--tcw-text-dim); }\r
|
|
3701
|
+
.tcw-name-field .tcw-indi-input { width: 100%; height: 34px; font-size: var(--tcw-font-size); }\r
|
|
3702
|
+
.tcw-layouts-body { display: flex; flex-direction: column; gap: 10px; }\r
|
|
3703
|
+
.tcw-layouts-search { width: 100%; height: 32px; }\r
|
|
3704
|
+
.tcw-layouts-list {\r
|
|
3705
|
+
display: flex;\r
|
|
3706
|
+
flex-direction: column;\r
|
|
3707
|
+
gap: 2px;\r
|
|
3708
|
+
max-height: 50vh;\r
|
|
3709
|
+
overflow-y: auto;\r
|
|
3710
|
+
}\r
|
|
3711
|
+
.tcw-layouts-row {\r
|
|
3712
|
+
display: flex;\r
|
|
3713
|
+
align-items: center;\r
|
|
3714
|
+
gap: 6px;\r
|
|
3715
|
+
border-radius: var(--tcw-radius);\r
|
|
3716
|
+
}\r
|
|
3717
|
+
.tcw-layouts-row:hover { background: var(--tcw-hover-bg); }\r
|
|
3718
|
+
.tcw-layouts-open {\r
|
|
3719
|
+
flex: 1;\r
|
|
3720
|
+
min-width: 0;\r
|
|
3721
|
+
display: flex;\r
|
|
3722
|
+
flex-direction: column;\r
|
|
3723
|
+
align-items: flex-start;\r
|
|
3724
|
+
gap: 2px;\r
|
|
3725
|
+
padding: 7px 8px;\r
|
|
3726
|
+
border: none;\r
|
|
3727
|
+
background: transparent;\r
|
|
3728
|
+
color: var(--tcw-text);\r
|
|
3729
|
+
font: inherit;\r
|
|
3730
|
+
text-align: start;\r
|
|
3731
|
+
cursor: pointer;\r
|
|
3732
|
+
border-radius: var(--tcw-radius);\r
|
|
3733
|
+
}\r
|
|
3734
|
+
.tcw-layouts-open:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--tcw-accent-soft); }\r
|
|
3735
|
+
.tcw-layouts-name {\r
|
|
3736
|
+
display: flex;\r
|
|
3737
|
+
align-items: center;\r
|
|
3738
|
+
gap: 6px;\r
|
|
3739
|
+
max-width: 100%;\r
|
|
3740
|
+
font-size: var(--tcw-font-size);\r
|
|
3741
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
3742
|
+
overflow: hidden;\r
|
|
3743
|
+
text-overflow: ellipsis;\r
|
|
3744
|
+
white-space: nowrap;\r
|
|
3745
|
+
}\r
|
|
3746
|
+
.tcw-layouts-open[aria-current="true"] .tcw-layouts-name { color: var(--tcw-accent); }\r
|
|
3747
|
+
.tcw-layouts-meta {\r
|
|
3748
|
+
max-width: 100%;\r
|
|
3749
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
3750
|
+
color: var(--tcw-text-muted);\r
|
|
3751
|
+
font-variant-numeric: tabular-nums;\r
|
|
3752
|
+
overflow: hidden;\r
|
|
3753
|
+
text-overflow: ellipsis;\r
|
|
3754
|
+
white-space: nowrap;\r
|
|
3755
|
+
}\r
|
|
3756
|
+
.tcw-layouts-confirm {\r
|
|
3757
|
+
padding: 4px 10px;\r
|
|
3758
|
+
border: none;\r
|
|
3759
|
+
border-radius: var(--tcw-control-radius);\r
|
|
3760
|
+
background: var(--tcw-red);\r
|
|
3761
|
+
color: #fff;\r
|
|
3762
|
+
font: inherit;\r
|
|
3763
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3764
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
3765
|
+
cursor: pointer;\r
|
|
3766
|
+
}\r
|
|
3767
|
+
.tcw-layouts-confirm:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--tcw-red-soft); }\r
|
|
3768
|
+
\r
|
|
3769
|
+
/* --- Chart grid --- */\r
|
|
3770
|
+
.tcw-grid { background: var(--tcw-bg); }\r
|
|
3771
|
+
.tcw-grid-bar {\r
|
|
3772
|
+
display: flex;\r
|
|
3773
|
+
align-items: center;\r
|
|
3774
|
+
gap: 6px;\r
|
|
3775
|
+
min-height: calc(var(--tcw-control-h) + 8px);\r
|
|
3776
|
+
padding: 0 8px;\r
|
|
3777
|
+
border-bottom: 1px solid var(--tcw-border);\r
|
|
3778
|
+
background: var(--tcw-bg-surface);\r
|
|
3779
|
+
overflow-x: auto;\r
|
|
3780
|
+
scrollbar-width: none;\r
|
|
3781
|
+
}\r
|
|
3782
|
+
.tcw-grid-bar::-webkit-scrollbar { display: none; }\r
|
|
3783
|
+
.tcw-grid-group { display: flex; align-items: center; gap: 2px; flex: none; }\r
|
|
3784
|
+
.tcw-grid-label {\r
|
|
3785
|
+
display: inline-flex;\r
|
|
3786
|
+
align-items: center;\r
|
|
3787
|
+
gap: 4px;\r
|
|
3788
|
+
margin-right: 4px;\r
|
|
3789
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
3790
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
3791
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
3792
|
+
text-transform: var(--tcw-label-case);\r
|
|
3793
|
+
color: var(--tcw-text-muted);\r
|
|
3794
|
+
}\r
|
|
3795
|
+
.tcw-grid-sync[aria-pressed="true"] { color: var(--tcw-accent); }\r
|
|
3796
|
+
.tcw-grid-cells {\r
|
|
3797
|
+
flex: 1;\r
|
|
3798
|
+
min-height: 0;\r
|
|
3799
|
+
display: grid;\r
|
|
3800
|
+
gap: 1px;\r
|
|
3801
|
+
background: var(--tcw-border);\r
|
|
3802
|
+
}\r
|
|
3803
|
+
.tcw-grid-cell {\r
|
|
3804
|
+
position: relative;\r
|
|
3805
|
+
min-width: 0;\r
|
|
3806
|
+
min-height: 0;\r
|
|
3807
|
+
background: var(--tcw-bg);\r
|
|
3808
|
+
}\r
|
|
3809
|
+
.tcw-grid-cell-active::after {\r
|
|
3810
|
+
content: '';\r
|
|
3811
|
+
position: absolute;\r
|
|
3812
|
+
inset: 0;\r
|
|
3813
|
+
border: 1px solid var(--tcw-accent);\r
|
|
3814
|
+
pointer-events: none;\r
|
|
3815
|
+
z-index: 5;\r
|
|
3816
|
+
}\r
|
|
3817
|
+
\r
|
|
3818
|
+
/* --- Host toolbar buttons --- */\r
|
|
3819
|
+
.tcw-toolbar-host { display: inline-flex; align-items: center; gap: 2px; }\r
|
|
3820
|
+
.tcw-toolbar-host:empty { display: none; }\r
|
|
3821
|
+
.tcw-host-btn { display: inline-flex; align-items: center; gap: 4px; }\r
|
|
3822
|
+
\r
|
|
3823
|
+
/* --- Pane buttons (move, fold, maximise) --- */\r
|
|
3824
|
+
.tcw-pane-controls {\r
|
|
3825
|
+
position: absolute;\r
|
|
3826
|
+
z-index: 4;\r
|
|
3827
|
+
display: flex;\r
|
|
3828
|
+
gap: 1px;\r
|
|
3829
|
+
transform: translateX(-100%);\r
|
|
3830
|
+
padding: 1px;\r
|
|
3831
|
+
border-radius: var(--tcw-radius-sm);\r
|
|
3832
|
+
background: color-mix(in srgb, var(--tcw-bg) 80%, transparent);\r
|
|
3833
|
+
opacity: 0.55;\r
|
|
3834
|
+
transition: opacity var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
3835
|
+
}\r
|
|
3836
|
+
.tcw-pane-controls:hover,\r
|
|
3837
|
+
.tcw-pane-controls:focus-within { opacity: 1; }\r
|
|
3838
|
+
.tcw-pane-btn {\r
|
|
3839
|
+
display: inline-grid;\r
|
|
3840
|
+
place-items: center;\r
|
|
3841
|
+
width: 18px;\r
|
|
3842
|
+
height: 16px;\r
|
|
3843
|
+
padding: 0;\r
|
|
3844
|
+
border: none;\r
|
|
3845
|
+
border-radius: var(--tcw-control-radius);\r
|
|
3846
|
+
background: transparent;\r
|
|
3847
|
+
color: var(--tcw-text-muted);\r
|
|
3848
|
+
cursor: pointer;\r
|
|
3849
|
+
}\r
|
|
3850
|
+
.tcw-pane-btn:hover { color: var(--tcw-text); background: var(--tcw-hover-bg); }\r
|
|
3851
|
+
.tcw-pane-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--tcw-accent-soft); }\r
|
|
3852
|
+
\r
|
|
3853
|
+
/* --- Typed interval --- */\r
|
|
3854
|
+
.tcw-interval-input {\r
|
|
3855
|
+
position: absolute;\r
|
|
3856
|
+
z-index: 20;\r
|
|
3857
|
+
left: 50%;\r
|
|
3858
|
+
top: 40%;\r
|
|
3859
|
+
transform: translate(-50%, -50%);\r
|
|
3860
|
+
display: flex;\r
|
|
3861
|
+
flex-direction: column;\r
|
|
3862
|
+
gap: 6px;\r
|
|
3863
|
+
padding: 10px 12px;\r
|
|
3864
|
+
border: 1px solid var(--tcw-border);\r
|
|
3865
|
+
border-radius: var(--tcw-radius-lg, 10px);\r
|
|
3866
|
+
background: var(--tcw-bg-elevated);\r
|
|
3867
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
3868
|
+
}\r
|
|
3869
|
+
.tcw-interval-field {\r
|
|
3870
|
+
width: 150px;\r
|
|
3871
|
+
height: 36px;\r
|
|
3872
|
+
padding: 0 10px;\r
|
|
3873
|
+
font: inherit;\r
|
|
3874
|
+
font-size: calc(var(--tcw-font-size) + 5px);\r
|
|
3875
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
3876
|
+
font-variant-numeric: tabular-nums;\r
|
|
3877
|
+
color: var(--tcw-text);\r
|
|
3878
|
+
background: var(--tcw-bg-surface);\r
|
|
3879
|
+
border: 1px solid var(--tcw-accent);\r
|
|
3880
|
+
border-radius: var(--tcw-input-radius);\r
|
|
3881
|
+
outline: none;\r
|
|
3882
|
+
}\r
|
|
3883
|
+
.tcw-interval-field[aria-invalid] { border-color: var(--tcw-red); }\r
|
|
3884
|
+
.tcw-interval-hint { font-size: var(--tcw-font-size-xs); color: var(--tcw-text-muted); max-width: 170px; }\r
|
|
3885
|
+
\r
|
|
3886
|
+
/* --- Alerts: lines, moves, bar close, expiry --- */\r
|
|
3887
|
+
.tcw-alerts-source { grid-column: auto; }\r
|
|
3888
|
+
.tcw-alerts-row-fields {\r
|
|
3889
|
+
grid-column: 1 / -1;\r
|
|
3890
|
+
display: grid;\r
|
|
3891
|
+
grid-template-columns: 1fr 1fr;\r
|
|
3892
|
+
gap: 8px;\r
|
|
3893
|
+
}\r
|
|
3894
|
+
.tcw-alerts-row-fields[hidden] { display: none; }\r
|
|
3895
|
+
.tcw-alerts-row-fields > input[hidden] { display: none; }\r
|
|
3896
|
+
.tcw-alerts-row-fields:has(> input[hidden]) { grid-template-columns: 1fr; }\r
|
|
3897
|
+
.tcw-alerts-options { align-items: center; }\r
|
|
3898
|
+
.tcw-alerts-form .tcw-alerts-check {\r
|
|
3899
|
+
display: inline-flex;\r
|
|
3900
|
+
align-items: center;\r
|
|
3901
|
+
gap: 6px;\r
|
|
3902
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
3903
|
+
color: var(--tcw-text-dim);\r
|
|
3904
|
+
}\r
|
|
3905
|
+
.tcw-alerts-form .tcw-alerts-check input { width: auto; height: auto; }\r
|
|
3906
|
+
.tcw-alerts-form input[aria-invalid="true"] { border-color: var(--tcw-red); }\r
|
|
3907
|
+
.tcw-alerts-row-meta { margin-top: 2px; font-size: var(--tcw-font-size-xs); color: var(--tcw-text-muted); }\r
|
|
3908
|
+
.tcw-alerts-expired { opacity: 0.6; }\r
|
|
3909
|
+
\r
|
|
3910
|
+
/* --- Signal marker note --- */\r
|
|
3911
|
+
.tcw-marker-tip {\r
|
|
3912
|
+
position: absolute;\r
|
|
3913
|
+
z-index: 12;\r
|
|
3914
|
+
pointer-events: none;\r
|
|
3915
|
+
padding: 6px 8px;\r
|
|
3916
|
+
border: 1px solid var(--tcw-border);\r
|
|
3917
|
+
border-radius: var(--tcw-tooltip-radius);\r
|
|
3918
|
+
background: var(--tcw-tooltip-bg);\r
|
|
3919
|
+
color: var(--tcw-tooltip-fg);\r
|
|
3920
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
3921
|
+
line-height: 1.45;\r
|
|
3922
|
+
font-variant-numeric: tabular-nums;\r
|
|
3923
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
3924
|
+
max-width: 240px;\r
|
|
3925
|
+
}\r
|
|
3926
|
+
.tcw-marker-tip strong { display: block; font-size: var(--tcw-font-size-sm); }\r
|
|
3927
|
+
\r
|
|
3928
|
+
/* === Navigation over the chart ===\r
|
|
3929
|
+
* Centred on the plot's bottom edge, shown while a mouse is over the chart. */\r
|
|
3930
|
+
.tcw-nav {\r
|
|
3931
|
+
position: absolute;\r
|
|
3932
|
+
z-index: 15;\r
|
|
3933
|
+
display: flex;\r
|
|
3934
|
+
gap: 2px;\r
|
|
3935
|
+
padding: 3px;\r
|
|
3936
|
+
border: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
3937
|
+
border-radius: calc(var(--tcw-control-radius) + 3px);\r
|
|
3938
|
+
background: var(--tcw-bg-elevated);\r
|
|
3939
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
3940
|
+
opacity: 0;\r
|
|
3941
|
+
pointer-events: none;\r
|
|
3942
|
+
transform: translate(-50%, calc(-100% - 12px));\r
|
|
3943
|
+
transition: opacity var(--tcw-dur-fast) var(--tcw-ease);\r
|
|
3944
|
+
}\r
|
|
3945
|
+
.tcw-nav.tcw-nav-shown {\r
|
|
3946
|
+
opacity: 1;\r
|
|
3947
|
+
pointer-events: auto;\r
|
|
3948
|
+
}\r
|
|
3949
|
+
.tcw-nav-btn {\r
|
|
3950
|
+
display: inline-flex;\r
|
|
3951
|
+
align-items: center;\r
|
|
3952
|
+
justify-content: center;\r
|
|
3953
|
+
width: var(--tcw-control-h);\r
|
|
3954
|
+
height: var(--tcw-control-h);\r
|
|
3955
|
+
border: 0;\r
|
|
3956
|
+
border-radius: var(--tcw-control-radius);\r
|
|
3957
|
+
background: transparent;\r
|
|
3958
|
+
color: var(--tcw-text-dim);\r
|
|
3959
|
+
cursor: pointer;\r
|
|
3960
|
+
touch-action: none;\r
|
|
3961
|
+
}\r
|
|
3962
|
+
.tcw-nav-btn:hover {\r
|
|
3963
|
+
background: var(--tcw-hover-bg);\r
|
|
3964
|
+
color: var(--tcw-text);\r
|
|
3965
|
+
}\r
|
|
3966
|
+
.tcw-nav-btn:active {\r
|
|
3967
|
+
background: var(--tcw-active-bg);\r
|
|
3968
|
+
}\r
|
|
3969
|
+
.tcw-nav-btn:focus-visible {\r
|
|
3970
|
+
outline: none;\r
|
|
3971
|
+
box-shadow: var(--tcw-ring);\r
|
|
3972
|
+
}\r
|
|
3973
|
+
.tcw-nav-btn svg {\r
|
|
3974
|
+
width: var(--tcw-icon);\r
|
|
3975
|
+
height: var(--tcw-icon);\r
|
|
3976
|
+
}\r
|
|
3977
|
+
@media (hover: none) {\r
|
|
3978
|
+
.tcw-nav { display: none; }\r
|
|
3979
|
+
}\r
|
|
3980
|
+
\r
|
|
3981
|
+
/* === Symbol info ===\r
|
|
3982
|
+
* Top left, beside the drawing tools: the panels on the right stay clear. */\r
|
|
3983
|
+
.tcw-syminfo {\r
|
|
3984
|
+
position: absolute;\r
|
|
3985
|
+
top: var(--tcw-panel-top);\r
|
|
3986
|
+
inset-inline-start: var(--tcw-panel-left);\r
|
|
3987
|
+
z-index: 38;\r
|
|
3988
|
+
width: 288px;\r
|
|
3989
|
+
max-height: calc(100% - var(--tcw-panel-top) - 12px);\r
|
|
3990
|
+
display: flex;\r
|
|
3991
|
+
flex-direction: column;\r
|
|
3992
|
+
background: var(--tcw-bg-elevated);\r
|
|
3993
|
+
border: var(--tcw-border-w) solid var(--tcw-border-strong);\r
|
|
3994
|
+
border-radius: var(--tcw-panel-radius);\r
|
|
3995
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
3996
|
+
overflow: hidden;\r
|
|
3997
|
+
animation: tcw-alerts-in var(--tcw-dur, 160ms) var(--tcw-ease, ease) both;\r
|
|
3998
|
+
}\r
|
|
3999
|
+
.tcw-syminfo-header {\r
|
|
4000
|
+
display: flex;\r
|
|
4001
|
+
align-items: center;\r
|
|
4002
|
+
justify-content: space-between;\r
|
|
4003
|
+
padding: 9px 12px;\r
|
|
4004
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
4005
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
4006
|
+
color: var(--tcw-text);\r
|
|
4007
|
+
border-bottom: 1px solid var(--tcw-border);\r
|
|
4008
|
+
}\r
|
|
4009
|
+
.tcw-syminfo-close {\r
|
|
4010
|
+
display: inline-flex;\r
|
|
4011
|
+
align-items: center;\r
|
|
4012
|
+
justify-content: center;\r
|
|
4013
|
+
width: var(--tcw-control-h-sm);\r
|
|
4014
|
+
height: var(--tcw-control-h-sm);\r
|
|
4015
|
+
border: none;\r
|
|
4016
|
+
border-radius: var(--tcw-control-radius);\r
|
|
4017
|
+
background: transparent;\r
|
|
4018
|
+
color: var(--tcw-text-muted);\r
|
|
4019
|
+
cursor: pointer;\r
|
|
4020
|
+
}\r
|
|
4021
|
+
.tcw-syminfo-close:hover { background: var(--tcw-bg-surface); color: var(--tcw-text); }\r
|
|
4022
|
+
.tcw-syminfo-body,\r
|
|
4023
|
+
.tcw-syminfo-news {\r
|
|
4024
|
+
padding: 12px 14px;\r
|
|
4025
|
+
overflow-y: auto;\r
|
|
4026
|
+
}\r
|
|
4027
|
+
.tcw-syminfo-body {\r
|
|
4028
|
+
display: grid;\r
|
|
4029
|
+
gap: 10px;\r
|
|
4030
|
+
}\r
|
|
4031
|
+
.tcw-syminfo-symbol {\r
|
|
4032
|
+
font-size: var(--tcw-font-size-lg);\r
|
|
4033
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
4034
|
+
color: var(--tcw-text);\r
|
|
4035
|
+
}\r
|
|
4036
|
+
.tcw-syminfo-desc {\r
|
|
4037
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
4038
|
+
color: var(--tcw-text-dim);\r
|
|
4039
|
+
}\r
|
|
4040
|
+
.tcw-syminfo-meta {\r
|
|
4041
|
+
margin-top: 2px;\r
|
|
4042
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
4043
|
+
color: var(--tcw-text-muted);\r
|
|
4044
|
+
}\r
|
|
4045
|
+
.tcw-syminfo-quote {\r
|
|
4046
|
+
display: flex;\r
|
|
4047
|
+
align-items: baseline;\r
|
|
4048
|
+
gap: 10px;\r
|
|
4049
|
+
font-family: var(--tcw-font-mono);\r
|
|
4050
|
+
font-variant-numeric: tabular-nums;\r
|
|
4051
|
+
}\r
|
|
4052
|
+
.tcw-syminfo-price {\r
|
|
4053
|
+
font-size: calc(var(--tcw-font-size) + 7px);\r
|
|
4054
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
4055
|
+
color: var(--tcw-text);\r
|
|
4056
|
+
}\r
|
|
4057
|
+
.tcw-syminfo-change { font-size: var(--tcw-font-size-sm); }\r
|
|
4058
|
+
.tcw-syminfo-change.tcw-up { color: var(--tcw-green); }\r
|
|
4059
|
+
.tcw-syminfo-change.tcw-down { color: var(--tcw-red); }\r
|
|
4060
|
+
.tcw-syminfo-status {\r
|
|
4061
|
+
display: flex;\r
|
|
4062
|
+
align-items: center;\r
|
|
4063
|
+
gap: 7px;\r
|
|
4064
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
4065
|
+
color: var(--tcw-text-dim);\r
|
|
4066
|
+
}\r
|
|
4067
|
+
.tcw-syminfo-status::before,\r
|
|
4068
|
+
.tcw-status-market::before {\r
|
|
4069
|
+
content: '';\r
|
|
4070
|
+
flex: none;\r
|
|
4071
|
+
width: 7px;\r
|
|
4072
|
+
height: 7px;\r
|
|
4073
|
+
border-radius: 50%;\r
|
|
4074
|
+
background: var(--tcw-text-muted);\r
|
|
4075
|
+
}\r
|
|
4076
|
+
.tcw-syminfo-status[data-state='open']::before,\r
|
|
4077
|
+
.tcw-syminfo-status[data-state='always']::before,\r
|
|
4078
|
+
.tcw-status-market[data-state='open']::before {\r
|
|
4079
|
+
background: var(--tcw-green);\r
|
|
4080
|
+
}\r
|
|
4081
|
+
.tcw-syminfo-stats {\r
|
|
4082
|
+
display: grid;\r
|
|
4083
|
+
gap: 4px;\r
|
|
4084
|
+
margin: 0;\r
|
|
4085
|
+
padding-top: 10px;\r
|
|
4086
|
+
border-top: 1px solid var(--tcw-divider);\r
|
|
4087
|
+
}\r
|
|
4088
|
+
.tcw-syminfo-stat {\r
|
|
4089
|
+
display: flex;\r
|
|
4090
|
+
justify-content: space-between;\r
|
|
4091
|
+
gap: 12px;\r
|
|
4092
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
4093
|
+
}\r
|
|
4094
|
+
.tcw-syminfo-stat dt { color: var(--tcw-text-muted); }\r
|
|
4095
|
+
.tcw-syminfo-stat dd {\r
|
|
4096
|
+
margin: 0;\r
|
|
4097
|
+
color: var(--tcw-text);\r
|
|
4098
|
+
text-align: end;\r
|
|
4099
|
+
font-variant-numeric: tabular-nums;\r
|
|
4100
|
+
overflow-wrap: anywhere;\r
|
|
4101
|
+
}\r
|
|
4102
|
+
.tcw-syminfo-news {\r
|
|
4103
|
+
border-top: 1px solid var(--tcw-divider);\r
|
|
4104
|
+
}\r
|
|
4105
|
+
.tcw-syminfo-news-title {\r
|
|
4106
|
+
margin-bottom: 8px;\r
|
|
4107
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
4108
|
+
font-weight: var(--tcw-weight-strong);\r
|
|
4109
|
+
color: var(--tcw-text-muted);\r
|
|
4110
|
+
text-transform: var(--tcw-label-case);\r
|
|
4111
|
+
letter-spacing: var(--tcw-label-tracking);\r
|
|
4112
|
+
}\r
|
|
4113
|
+
.tcw-syminfo-news-list {\r
|
|
4114
|
+
display: grid;\r
|
|
4115
|
+
gap: 10px;\r
|
|
4116
|
+
margin: 0;\r
|
|
4117
|
+
padding: 0;\r
|
|
4118
|
+
list-style: none;\r
|
|
4119
|
+
}\r
|
|
4120
|
+
.tcw-syminfo-news-item {\r
|
|
4121
|
+
font-size: var(--tcw-font-size-sm);\r
|
|
4122
|
+
line-height: 1.4;\r
|
|
4123
|
+
color: var(--tcw-text);\r
|
|
4124
|
+
}\r
|
|
4125
|
+
.tcw-syminfo-news-item a {\r
|
|
4126
|
+
color: var(--tcw-text);\r
|
|
4127
|
+
text-decoration: none;\r
|
|
4128
|
+
}\r
|
|
4129
|
+
.tcw-syminfo-news-item a:hover { color: var(--tcw-accent); text-decoration: underline; }\r
|
|
4130
|
+
.tcw-syminfo-news-item a:focus-visible { outline: none; box-shadow: var(--tcw-ring); border-radius: var(--tcw-radius-xs); }\r
|
|
4131
|
+
.tcw-syminfo-news-meta,\r
|
|
4132
|
+
.tcw-syminfo-news-note {\r
|
|
4133
|
+
margin-top: 2px;\r
|
|
4134
|
+
font-size: var(--tcw-font-size-xs);\r
|
|
4135
|
+
color: var(--tcw-text-muted);\r
|
|
4136
|
+
}\r
|
|
4137
|
+
\r
|
|
4138
|
+
/* Numbers keep their sign on the left, and mixed text its own order, in a right-to-left widget too. */\r
|
|
4139
|
+
.tcw-watchlist-price,\r
|
|
4140
|
+
.tcw-watchlist-change,\r
|
|
4141
|
+
.tcw-syminfo-price,\r
|
|
4142
|
+
.tcw-syminfo-change {\r
|
|
4143
|
+
unicode-bidi: isolate;\r
|
|
4144
|
+
direction: ltr;\r
|
|
4145
|
+
}\r
|
|
4146
|
+
.tcw-syminfo-desc,\r
|
|
4147
|
+
.tcw-syminfo-meta,\r
|
|
4148
|
+
.tcw-syminfo-status,\r
|
|
4149
|
+
.tcw-syminfo-stat dd,\r
|
|
4150
|
+
.tcw-syminfo-news-meta {\r
|
|
4151
|
+
unicode-bidi: plaintext;\r
|
|
4152
|
+
}\r
|
|
4153
|
+
\r
|
|
4154
|
+
/* The market's status in the status bar. */\r
|
|
4155
|
+
.tcw-status-market {\r
|
|
4156
|
+
display: flex;\r
|
|
4157
|
+
align-items: center;\r
|
|
4158
|
+
gap: 7px;\r
|
|
4159
|
+
color: var(--tcw-text-muted);\r
|
|
4160
|
+
}\r
|
|
4161
|
+
\r
|
|
4162
|
+
@media (max-width: 640px) {\r
|
|
4163
|
+
.tcw-syminfo {\r
|
|
4164
|
+
top: auto;\r
|
|
4165
|
+
bottom: 0;\r
|
|
4166
|
+
left: 0;\r
|
|
4167
|
+
right: 0;\r
|
|
4168
|
+
width: 100vw;\r
|
|
4169
|
+
max-height: 70%;\r
|
|
4170
|
+
border-radius: var(--tcw-dialog-radius) var(--tcw-dialog-radius) 0 0;\r
|
|
4171
|
+
}\r
|
|
4172
|
+
}\r
|
|
4173
|
+
\r
|
|
4174
|
+
/* === The look: how chosen controls show, floating bars, segmented intervals ===\r
|
|
4175
|
+
* Each switch sets variables on its own root, which its parts read: a grid's\r
|
|
4176
|
+
* look never reaches into a chart that has one of its own. */\r
|
|
4177
|
+
\r
|
|
4178
|
+
/* A chosen button (\`ui.active\`): a tinted fill (default), a solid pill, or an underline.\r
|
|
4179
|
+
* Dialog tabs are chips, or underlined in the underline look. Panels sit below the\r
|
|
4180
|
+
* toolbar and beside the drawing tools. */\r
|
|
4181
|
+
.tcw-root {\r
|
|
4182
|
+
--tcw-on-bg: var(--tcw-accent-soft);\r
|
|
4183
|
+
--tcw-on-fg: var(--tcw-accent);\r
|
|
4184
|
+
--tcw-on-ring: none;\r
|
|
4185
|
+
--tcw-on-icon-bg: var(--tcw-accent-soft);\r
|
|
4186
|
+
--tcw-on-icon-fg: var(--tcw-accent);\r
|
|
4187
|
+
--tcw-on-icon-ring: none;\r
|
|
4188
|
+
--tcw-tabs-pad-block: 8px;\r
|
|
4189
|
+
--tcw-tab-h: var(--tcw-control-h);\r
|
|
4190
|
+
--tcw-tab-pad: 0 12px;\r
|
|
4191
|
+
--tcw-tab-line: 0px;\r
|
|
4192
|
+
--tcw-tab-radius: var(--tcw-control-radius);\r
|
|
4193
|
+
--tcw-tab-hover: var(--tcw-hover-bg);\r
|
|
4194
|
+
--tcw-tab-on-bg: var(--tcw-on-bg);\r
|
|
4195
|
+
--tcw-tab-on-fg: var(--tcw-on-fg);\r
|
|
4196
|
+
--tcw-panel-top: calc(var(--tcw-toolbar-h) + 6px);\r
|
|
4197
|
+
--tcw-panel-left: calc(var(--tcw-sidebar-w) + 12px);\r
|
|
4198
|
+
}\r
|
|
4199
|
+
.tcw-root[data-tcw-active='solid'] {\r
|
|
4200
|
+
--tcw-on-bg: var(--tcw-text);\r
|
|
4201
|
+
--tcw-on-fg: var(--tcw-bg);\r
|
|
4202
|
+
--tcw-on-icon-bg: var(--tcw-text);\r
|
|
4203
|
+
--tcw-on-icon-fg: var(--tcw-bg);\r
|
|
4204
|
+
}\r
|
|
4205
|
+
.tcw-root[data-tcw-active='underline'] {\r
|
|
4206
|
+
--tcw-on-bg: var(--tcw-active-bg);\r
|
|
4207
|
+
--tcw-on-fg: var(--tcw-text);\r
|
|
4208
|
+
--tcw-on-ring: inset 0 -2px 0 var(--tcw-accent);\r
|
|
4209
|
+
--tcw-on-icon-bg: var(--tcw-active-bg);\r
|
|
4210
|
+
--tcw-on-icon-fg: var(--tcw-accent);\r
|
|
4211
|
+
--tcw-on-icon-ring: inset 2px 0 0 var(--tcw-accent);\r
|
|
4212
|
+
--tcw-tabs-pad-block: 0px;\r
|
|
4213
|
+
--tcw-tab-h: auto;\r
|
|
4214
|
+
--tcw-tab-pad: 11px 14px;\r
|
|
4215
|
+
--tcw-tab-line: 2px;\r
|
|
4216
|
+
--tcw-tab-radius: 0px;\r
|
|
4217
|
+
--tcw-tab-hover: transparent;\r
|
|
4218
|
+
--tcw-tab-on-bg: transparent;\r
|
|
4219
|
+
--tcw-tab-on-fg: var(--tcw-accent);\r
|
|
4220
|
+
}\r
|
|
4221
|
+
.tcw-root[data-tcw-toolbar='floating'] {\r
|
|
4222
|
+
--tcw-panel-top: calc(var(--tcw-toolbar-h) + 2 * var(--tcw-border-w) + 14px);\r
|
|
4223
|
+
}\r
|
|
4224
|
+
.tcw-root[data-tcw-sidebar='floating'] {\r
|
|
4225
|
+
--tcw-panel-left: calc(var(--tcw-sidebar-w) + 2 * var(--tcw-border-w) + 22px);\r
|
|
4226
|
+
}\r
|
|
4227
|
+
\r
|
|
4228
|
+
/* The toolbar as an island (\`ui.toolbar: 'floating'\`). */\r
|
|
4229
|
+
.tcw-root[data-tcw-toolbar='floating'] > .tcw-toolbar {\r
|
|
4230
|
+
margin: 8px 10px 0;\r
|
|
4231
|
+
padding-inline: calc(min(var(--tcw-toolbar-radius), var(--tcw-toolbar-h) / 2) / 2 + 8px);\r
|
|
4232
|
+
border: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
4233
|
+
border-radius: var(--tcw-toolbar-radius);\r
|
|
4234
|
+
background: var(--tcw-bg-elevated);\r
|
|
4235
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
4236
|
+
}\r
|
|
4237
|
+
\r
|
|
4238
|
+
/* The drawing tools as an island (\`ui.sidebar: 'floating'\`). */\r
|
|
4239
|
+
.tcw-root[data-tcw-sidebar='floating'] > .tcw-body > .tcw-sidebar {\r
|
|
4240
|
+
align-self: flex-start;\r
|
|
4241
|
+
max-height: calc(100% - 20px);\r
|
|
4242
|
+
margin: 10px 6px 10px 10px;\r
|
|
4243
|
+
padding-block: calc(min(var(--tcw-sidebar-radius), var(--tcw-sidebar-w) / 2) / 2 + 6px);\r
|
|
4244
|
+
border: var(--tcw-border-w) solid var(--tcw-border);\r
|
|
4245
|
+
border-radius: var(--tcw-sidebar-radius);\r
|
|
4246
|
+
background: var(--tcw-bg-elevated);\r
|
|
4247
|
+
box-shadow: var(--tcw-menu-shadow);\r
|
|
4248
|
+
}\r
|
|
4249
|
+
\r
|
|
4250
|
+
/* Frosted menus (\`ui.blur\` above 0): the chart shows through, blurred. */\r
|
|
4251
|
+
@supports (background: color-mix(in srgb, red 50%, transparent)) {\r
|
|
4252
|
+
.tcw-dropdown,\r
|
|
4253
|
+
.tcw-flyout,\r
|
|
4254
|
+
.tcw-context-menu {\r
|
|
4255
|
+
background: color-mix(in srgb, var(--tcw-bg-elevated) var(--tcw-surface-opacity), transparent);\r
|
|
4256
|
+
}\r
|
|
4257
|
+
}\r
|
|
4258
|
+
\r
|
|
4259
|
+
/* The interval buttons in one track (\`ui.intervals: 'segmented'\`). */\r
|
|
4260
|
+
.tcw-root[data-tcw-intervals='segmented'] > .tcw-toolbar > .tcw-tf-group {\r
|
|
4261
|
+
gap: 2px;\r
|
|
4262
|
+
margin: 0 4px;\r
|
|
4263
|
+
padding: 3px;\r
|
|
4264
|
+
border-radius: calc(var(--tcw-control-radius) + 3px);\r
|
|
4265
|
+
background: var(--tcw-hover-bg);\r
|
|
4266
|
+
}\r
|
|
4267
|
+
.tcw-root[data-tcw-intervals='segmented'] > .tcw-toolbar > .tcw-tf-group .tcw-btn {\r
|
|
4268
|
+
height: calc(var(--tcw-control-h) - 6px);\r
|
|
4269
|
+
padding: 0 9px;\r
|
|
4270
|
+
}\r
|
|
4271
|
+
\r
|
|
4272
|
+
/* Phones: the variants keep comfortable tap targets and room for the bar. */\r
|
|
4273
|
+
@media (max-width: 768px) {\r
|
|
4274
|
+
.tcw-root[data-tcw-intervals='segmented'] > .tcw-toolbar > .tcw-tf-group .tcw-btn {\r
|
|
4275
|
+
height: max(34px, calc(var(--tcw-control-h) - 6px));\r
|
|
4276
|
+
padding: 0 10px;\r
|
|
4277
|
+
}\r
|
|
4278
|
+
.tcw-root[data-tcw-toolbar='floating'] > .tcw-toolbar {\r
|
|
4279
|
+
margin: 6px 6px 0;\r
|
|
4280
|
+
padding-inline: 4px;\r
|
|
4281
|
+
}\r
|
|
4282
|
+
.tcw-root[data-tcw-sidebar='floating'] > .tcw-body > .tcw-sidebar {\r
|
|
4283
|
+
margin: 6px 4px 6px 6px;\r
|
|
4284
|
+
}\r
|
|
2552
4285
|
}\r
|
|
2553
|
-
`,f=0,p=`tcw-styles`;function m(){if(f++,f>1||document.getElementById(p))return;let e=document.createElement(`style`);e.id=p,e.textContent=d,document.head.appendChild(e)}function h(){if(f--,f>0)return;let e=document.getElementById(p);e&&e.remove()}var g={cursor:`<path d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="M13 13l6 6"/>`,trendingUp:`<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>`,minus:`<path d="M5 12h14"/>`,penLine:`<path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/>`,zigzag:`<polyline points="2 18 7 8 12 14 17 4 22 12"/>`,hash:`<line x1="4" y1="9" x2="20" y2="9"/><line x1="4" y1="15" x2="20" y2="15"/><line x1="10" y1="3" x2="8" y2="21"/><line x1="16" y1="3" x2="14" y2="21"/>`,square:`<rect width="18" height="18" x="3" y="3" rx="2"/>`,gitBranch:`<line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>`,ruler:`<path d="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"/><path d="m14.5 12.5 2-2"/><path d="m11.5 9.5 2-2"/><path d="m8.5 6.5 2-2"/><path d="m17.5 15.5 2-2"/>`,type:`<polyline points="4 7 4 4 20 4 20 7"/><line x1="9" y1="20" x2="15" y2="20"/><line x1="12" y1="4" x2="12" y2="20"/>`,magnet:`<path d="m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15"/><path d="m5 8 4 4"/><path d="m12 15 4 4"/>`,undo:`<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>`,redo:`<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"/>`,trash:`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>`,camera:`<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>`,settings:`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`,moon:`<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,sun:`<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>`,chevronDown:`<path d="m6 9 6 6 6-6"/>`,chevronUp:`<path d="m18 15-6-6-6 6"/>`,barChart:`<line x1="12" y1="20" x2="12" y2="10"/><line x1="18" y1="20" x2="18" y2="4"/><line x1="6" y1="20" x2="6" y2="16"/>`,x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,play:`<polygon points="6 3 20 12 6 21 6 3"/>`,pause:`<rect width="4" height="16" x="6" y="4"/><rect width="4" height="16" x="14" y="4"/>`,stop:`<rect width="14" height="14" x="5" y="5" rx="1"/>`,receipt:`<path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z"/><path d="M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"/><path d="M12 17.5v-11"/>`,bell:`<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,plus:`<path d="M5 12h14"/><path d="M12 5v14"/>`,layers:`<path d="m12 2 9 5-9 5-9-5 9-5Z"/><path d="m3 12 9 5 9-5"/><path d="m3 17 9 5 9-5"/>`,eye:`<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>`,eyeOff:`<path d="M9.9 4.24A9.12 9.12 0 0 1 12 4c6.5 0 10 7 10 7a13.2 13.2 0 0 1-1.67 2.68"/><path d="M6.6 6.6A13.06 13.06 0 0 0 2 11s3.5 7 10 7a9.1 9.1 0 0 0 5.4-1.6"/><path d="m2 2 20 20"/>`,lock:`<rect width="18" height="11" x="3" y="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,unlock:`<rect width="18" height="11" x="3" y="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>`,palette:`<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2Z"/>`,trendingDown:`<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/><polyline points="16 17 22 17 22 11"/>`,check:`<polyline points="20 6 9 17 4 12"/>`,ladder:`<rect x="3" y="3" width="18" height="18" rx="2"/><line x1="12" y1="3" x2="12" y2="21"/><line x1="3" y1="8" x2="21" y2="8"/><line x1="3" y1="13" x2="21" y2="13"/><line x1="3" y1="18" x2="21" y2="18"/>`};function _(e,t=14){let n=g[e];return n?`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`:``}var v=class{trigger;panel;_isOpen=!1;onOutsideClick;onEscapeKey;onTriggerClick;constructor(e,t={}){this.trigger=e,this.panel=document.createElement(`div`),this.panel.className=`tcw-dropdown`,this.panel.style.width=t.width??`200px`,t.align===`right`?this.panel.style.right=`0`:this.panel.style.left=`0`,this.panel.style.display=`none`,e.style.position=`relative`,e.appendChild(this.panel),this.onTriggerClick=()=>{this._isOpen?this.close():this.open()},this.onOutsideClick=e=>{this.trigger.contains(e.target)||this.close()},this.onEscapeKey=e=>{e.key===`Escape`&&this.close()},e.addEventListener(`click`,this.onTriggerClick)}setContent(e){this.panel.innerHTML=e}open(){this._isOpen||(this._isOpen=!0,this.panel.style.display=``,document.addEventListener(`mousedown`,this.onOutsideClick),document.addEventListener(`keydown`,this.onEscapeKey))}close(){this._isOpen&&(this._isOpen=!1,this.panel.style.display=`none`,document.removeEventListener(`mousedown`,this.onOutsideClick),document.removeEventListener(`keydown`,this.onEscapeKey))}isOpen(){return this._isOpen}destroy(){this.trigger.removeEventListener(`click`,this.onTriggerClick),document.removeEventListener(`mousedown`,this.onOutsideClick),document.removeEventListener(`keydown`,this.onEscapeKey),this.panel.remove()}},y=class{config;callbacks;t;el;chartTypeDropdown=null;indicatorDropdown=null;tfButtons=[];chipsContainer=null;themeBtn=null;constructor(e,t,n,r){this.config=t,this.callbacks=n,this.t=r,this.el=document.createElement(`div`),this.el.className=`tcw-toolbar`,this.build(),e.appendChild(this.el)}build(){let{config:e,callbacks:t,el:n}=this,r=document.createElement(`button`);r.className=`tcw-toolbar-symbol`,r.dataset.role=`symbol`,r.addEventListener(`click`,t.onSymbolClick),n.appendChild(r),n.appendChild(this.sep());let i=document.createElement(`div`);i.className=`tcw-toolbar-group`;for(let n of e.timeframes){let e=document.createElement(`button`);e.className=`tcw-btn`,e.textContent=n.label,e.dataset.tf=n.value,e.addEventListener(`click`,()=>t.onTimeframe(n.value)),i.appendChild(e),this.tfButtons.push(e)}n.appendChild(i),n.appendChild(this.sep());let a=document.createElement(`div`);a.style.position=`relative`,a.style.display=`inline-flex`;let o=document.createElement(`button`);o.className=`tcw-dropdown-trigger`,o.dataset.role=`charttype`,a.appendChild(o),n.appendChild(a),this.chartTypeDropdown=new v(a,{width:`160px`}),this.buildChartTypeMenu(),n.appendChild(this.sep());let s=document.createElement(`div`);s.style.position=`relative`,s.style.display=`inline-flex`;let c=document.createElement(`button`);if(c.className=`tcw-dropdown-trigger`,c.dataset.role=`indicators`,s.appendChild(c),n.appendChild(s),this.indicatorDropdown=new v(s,{width:`280px`}),this.buildIndicatorMenu(),this.chipsContainer=document.createElement(`div`),this.chipsContainer.className=`tcw-indicator-chips`,n.appendChild(this.chipsContainer),n.appendChild(this.spacer()),t.onToggleReplay){let e=this.iconBtn(`play`,this.t(`toolbar.replay`),t.onToggleReplay);e.dataset.role=`replay`,n.appendChild(e)}if(t.onBracket){let e=t.onBracket,r=this.iconBtn(`trendingUp`,this.t(`toolbar.longBracket`),()=>e(`buy`));r.dataset.role=`long`,r.classList.add(`tcw-btn-long`),n.appendChild(r);let i=this.iconBtn(`trendingDown`,this.t(`toolbar.shortBracket`),()=>e(`sell`));i.dataset.role=`short`,i.classList.add(`tcw-btn-short`),n.appendChild(i)}if(t.onToggleLadder){let e=this.iconBtn(`ladder`,this.t(`toolbar.depthLadder`),t.onToggleLadder);e.dataset.role=`ladder`,n.appendChild(e)}if(t.onToggleObjects){let e=this.iconBtn(`layers`,this.t(`toolbar.objects`),t.onToggleObjects);e.dataset.role=`objects`,n.appendChild(e)}if(t.onToggleAlerts){let e=this.iconBtn(`bell`,this.t(`toolbar.priceAlerts`),t.onToggleAlerts);e.dataset.role=`alerts`,n.appendChild(e)}let l=this.iconBtn(`camera`,this.t(`toolbar.screenshot`),t.onScreenshot);n.appendChild(l);let u=this.iconBtn(`settings`,this.t(`toolbar.settings`),t.onSettings);n.appendChild(u),this.themeBtn=this.iconBtn(`moon`,this.t(`toolbar.toggleTheme`),t.onToggleTheme),this.themeBtn.dataset.role=`theme`,n.appendChild(this.themeBtn)}chartTypeLabel(e){let t=`chartType.${e.value}`,n=this.t(t);return n===t?e.label:n}buildChartTypeMenu(){if(!this.chartTypeDropdown)return;let e=this.config.chartTypes.map(e=>`<button class="tcw-dropdown-item" data-ct="${e.value}">${this.chartTypeLabel(e)}</button>`).join(``);this.chartTypeDropdown.setContent(e),this.chartTypeDropdown.panel.querySelectorAll(`.tcw-dropdown-item`).forEach(e=>{e.addEventListener(`click`,e=>{let t=e.currentTarget.dataset.ct;this.callbacks.onChartType(t),this.chartTypeDropdown?.close()})})}buildIndicatorMenu(){if(!this.indicatorDropdown)return;let{indicators:e,popularIndicatorIds:t}=this.config,n=e.filter(e=>t.includes(e.id)),r=e.filter(e=>!t.includes(e.id)),i=e=>this.t(`indicatorType.${e}`),a=`<div class="tcw-dropdown-label">${this.t(`toolbar.indicators.popular`)}</div>`;for(let e of n)a+=`<button class="tcw-dropdown-item" data-ind="${e.id}"><span>${e.name}</span><span class="tcw-tag">${i(e.type)}</span></button>`;a+=`<div class="tcw-dropdown-divider"></div>`,a+=`<div class="tcw-dropdown-label">${this.t(`toolbar.indicators.all`)}</div>`;for(let e of r)a+=`<button class="tcw-dropdown-item" data-ind="${e.id}"><span>${e.name}</span><span class="tcw-tag">${i(e.type)}</span></button>`;this.indicatorDropdown.setContent(a),this.indicatorDropdown.panel.querySelectorAll(`.tcw-dropdown-item[data-ind]`).forEach(e=>{e.addEventListener(`click`,e=>{let t=e.currentTarget.dataset.ind;this.callbacks.onAddIndicator(t)})})}update(e){let t=this.el.querySelector(`[data-role="symbol"]`);t&&(t.textContent=e.symbol);for(let t of this.tfButtons)t.classList.toggle(`tcw-active`,t.dataset.tf===e.timeframe);let n=this.el.querySelector(`[data-role="charttype"]`);if(n){let t=this.config.chartTypes.find(t=>t.value===e.chartType),r=t?this.chartTypeLabel(t):e.chartType;n.innerHTML=`${_(`barChart`,14)} ${r} ${_(`chevronDown`,12)}`}let r=this.el.querySelector(`[data-role="indicators"]`);if(r){let t=e.activeIndicators.size,n=`${_(`trendingUp`,14)} ${this.t(`toolbar.indicators`)}`;t>0&&(n+=` <span class="tcw-badge-count">${t}</span>`),r.innerHTML=n}if(this.chipsContainer){let t=this.getActiveIndicatorList(e);this.chipsContainer.innerHTML=``;for(let e of t){let t=document.createElement(`div`);t.className=`tcw-indicator-chip`;let n=document.createElement(`span`);n.textContent=e.label,t.appendChild(n);let r=document.createElement(`button`);r.className=`tcw-chip-remove`,r.innerHTML=_(`x`,10),r.addEventListener(`click`,()=>this.callbacks.onRemoveIndicator(e.instanceId)),t.appendChild(r),this.chipsContainer.appendChild(t)}}this.themeBtn&&(this.themeBtn.innerHTML=e.isDark?_(`moon`,14):_(`sun`,14))}getActiveIndicatorList(e){let t=[];for(let[n,r]of e.activeIndicators.entries())t.push({instanceId:r,id:n,label:n.toUpperCase()});return t}sep(){let e=document.createElement(`span`);return e.className=`tcw-toolbar-sep`,e}spacer(){let e=document.createElement(`span`);return e.className=`tcw-toolbar-spacer`,e}iconBtn(e,t,n){let r=document.createElement(`button`);return r.className=`tcw-btn-icon`,r.title=t,r.innerHTML=_(e,14),r.addEventListener(`click`,n),r}destroy(){this.chartTypeDropdown?.destroy(),this.indicatorDropdown?.destroy(),this.el.remove()}},ee=[`trendingUp`,`minus`,`penLine`,`hash`,`square`,`gitBranch`,`zigzag`,`ruler`,`type`,`ladder`],te={trendLine:`trendingUp`,ray:`trendingUp`,extendedLine:`trendingUp`,infoLine:`trendingUp`,trendAngle:`trendingUp`,horizontalLine:`minus`,horizontalRay:`minus`,verticalLine:`penLine`,crossLine:`plus`,rectangle:`square`,circle:`square`,ellipse:`square`,triangle:`square`,arrow:`trendingUp`,parallelChannel:`gitBranch`,regressionChannel:`gitBranch`,pitchfork:`gitBranch`,schiffPitchfork:`gitBranch`,modifiedSchiffPitchfork:`gitBranch`,fibRetracement:`hash`,fibExtension:`hash`,fibTimeZones:`hash`,fibChannel:`hash`,fibSpeedResistanceFan:`hash`,gannBox:`hash`,gannFan:`gitBranch`,cyclicLines:`barChart`,elliottWave:`zigzag`,xabcdPattern:`zigzag`,abcdPattern:`zigzag`,headAndShoulders:`zigzag`,priceRange:`ruler`,dateRange:`ruler`,dateAndPriceRange:`ruler`,measure:`ruler`,text:`type`,textAnnotation:`type`,priceLabel:`type`,anchoredVWAP:`trendingUp`,volumeProfileRange:`barChart`,riskReward:`square`};function ne(e){return te[e]??`penLine`}function re(e,t){for(let n of e){let e=n.tools.find(e=>e.value===t);if(e)return e.label}return t}var ie=class{config;callbacks;el;groupWraps=[];groupButtons=[];cursorBtn=null;magnetBtn=null;flyoutEl=null;favoritesEl=null;favoritesDivider=null;favorites=[];constructor(e,t,n){this.config=t,this.callbacks=n,this.el=document.createElement(`div`),this.el.className=`tcw-sidebar`,this.build(),e.appendChild(this.el)}build(){let{config:e,callbacks:t,el:n}=this;this.cursorBtn=document.createElement(`button`),this.cursorBtn.className=`tcw-sidebar-btn`,this.cursorBtn.title=`Cursor`,this.cursorBtn.innerHTML=_(`cursor`,14),this.cursorBtn.addEventListener(`click`,t.onCancelDrawing),n.appendChild(this.cursorBtn),n.appendChild(this.divider()),t.onToggleFavorite&&(this.favorites=[...e.favorites??[]],this.favoritesEl=document.createElement(`div`),this.favoritesEl.className=`tcw-sidebar-favorites`,n.appendChild(this.favoritesEl),this.favoritesDivider=this.divider(),n.appendChild(this.favoritesDivider),this.renderFavorites()),e.drawingToolGroups.forEach((e,r)=>{let i=document.createElement(`div`);i.className=`tcw-tool-group-wrap`;let a=document.createElement(`button`);if(a.className=`tcw-sidebar-btn`,a.title=e.label,a.innerHTML=_(ee[r]??`square`,14),e.tools.length>1){let e=document.createElement(`span`);e.className=`tcw-multi-dot`,a.appendChild(e)}a.addEventListener(`click`,()=>t.onDrawingTool(e.tools[0].value)),i.appendChild(a),i.addEventListener(`mouseenter`,()=>this.showFlyout(r)),i.addEventListener(`mouseleave`,()=>this.hideFlyout()),n.appendChild(i),this.groupWraps.push(i),this.groupButtons.push(a)});let r=document.createElement(`div`);if(r.className=`tcw-sidebar-spacer`,n.appendChild(r),n.appendChild(this.divider()),t.onToggleStyle){let e=document.createElement(`button`);e.className=`tcw-sidebar-btn`,e.title=`Drawing style & templates`,e.dataset.role=`style`,e.innerHTML=_(`palette`,14),e.addEventListener(`click`,t.onToggleStyle),n.appendChild(e)}this.magnetBtn=document.createElement(`button`),this.magnetBtn.className=`tcw-sidebar-btn`,this.magnetBtn.title=`Magnet`,this.magnetBtn.innerHTML=_(`magnet`,14),this.magnetBtn.addEventListener(`click`,t.onToggleMagnet),n.appendChild(this.magnetBtn);let i=document.createElement(`button`);i.className=`tcw-sidebar-btn`,i.title=`Undo`,i.innerHTML=_(`undo`,14),i.addEventListener(`click`,t.onUndo),n.appendChild(i);let a=document.createElement(`button`);a.className=`tcw-sidebar-btn`,a.title=`Redo`,a.innerHTML=_(`redo`,14),a.addEventListener(`click`,t.onRedo),n.appendChild(a);let o=document.createElement(`button`);o.className=`tcw-sidebar-btn tcw-danger`,o.title=`Clear all`,o.innerHTML=_(`trash`,14),o.addEventListener(`click`,t.onClearDrawings),n.appendChild(o)}setFavorites(e){this.favorites=[...e],this.renderFavorites()}renderFavorites(){if(!this.favoritesEl)return;this.favoritesEl.replaceChildren();let e=this.favorites.length>0;this.favoritesEl.style.display=e?``:`none`,this.favoritesDivider&&(this.favoritesDivider.style.display=e?``:`none`);for(let e of this.favorites){let t=document.createElement(`button`);t.className=`tcw-sidebar-btn`,t.title=`${re(this.config.drawingToolGroups,e)} (right-click to unpin)`,t.dataset.toolValue=e,t.innerHTML=_(ne(e),14),t.addEventListener(`click`,()=>this.callbacks.onDrawingTool(e)),t.addEventListener(`contextmenu`,t=>{t.preventDefault(),this.callbacks.onToggleFavorite?.(e)}),this.favoritesEl.appendChild(t)}}showFlyout(e){let t=this.config.drawingToolGroups[e];if(!t||t.tools.length<=1)return;this.hideFlyout();let n=document.createElement(`div`);n.className=`tcw-flyout`;let r=document.createElement(`div`);r.className=`tcw-flyout-header`,r.textContent=t.label,n.appendChild(r);for(let e of t.tools){let t=document.createElement(`button`);t.className=`tcw-flyout-item`,t.textContent=e.label,t.dataset.toolValue=e.value,t.addEventListener(`click`,()=>{this.callbacks.onDrawingTool(e.value),this.hideFlyout()}),this.callbacks.onToggleFavorite&&(this.favorites.includes(e.value)&&t.classList.add(`tcw-flyout-faved`),t.title=`Right-click to pin/unpin`,t.addEventListener(`contextmenu`,t=>{t.preventDefault(),this.callbacks.onToggleFavorite?.(e.value)})),n.appendChild(t)}this.flyoutEl=n,this.groupWraps[e].appendChild(n)}hideFlyout(){this.flyoutEl&&=(this.flyoutEl.remove(),null)}update(e){this.cursorBtn&&this.cursorBtn.classList.toggle(`tcw-active`,e.activeTool===null);let{drawingToolGroups:t}=this.config;for(let n=0;n<t.length;n++){let r=t[n].tools.some(t=>t.value===e.activeTool);this.groupButtons[n].classList.toggle(`tcw-active`,r)}this.flyoutEl&&this.flyoutEl.querySelectorAll(`.tcw-flyout-item`).forEach(t=>{let n=t;n.classList.toggle(`tcw-active`,n.dataset.toolValue===e.activeTool)}),this.magnetBtn&&(this.magnetBtn.classList.toggle(`tcw-active`,e.magnetEnabled),this.magnetBtn.title=e.magnetEnabled?`Magnet ON`:`Magnet OFF`)}divider(){let e=document.createElement(`div`);return e.className=`tcw-sidebar-divider`,e}destroy(){this.hideFlyout(),this.el.remove()}},ae=[`style`,`display`,`scale`],oe=class{callbacks;t;backdrop=null;modal=null;currentTab=`style`;currentSettings=null;bodyEl=null;tabButtons=[];constructor(e,t){this.callbacks=e,this.t=t}open(e){this.currentSettings={...e},this.currentTab=`style`,this.buildModal()}close(){this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.bodyEl=null,this.tabButtons=[]}buildModal(){this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>{this.callbacks.onClose(),this.close()}),document.body.appendChild(this.backdrop),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal`;let e=document.createElement(`div`);e.className=`tcw-modal-header`;let t=document.createElement(`h3`);t.textContent=this.t(`settings.title`),e.appendChild(t);let n=document.createElement(`button`);n.className=`tcw-modal-close`,n.innerHTML=_(`x`,16),n.addEventListener(`click`,()=>{this.callbacks.onClose(),this.close()}),e.appendChild(n),this.modal.appendChild(e);let r=document.createElement(`div`);r.className=`tcw-modal-tabs`,this.tabButtons=[];for(let e of ae){let t=document.createElement(`button`);t.className=`tcw-modal-tab`,t.textContent=this.t(`settings.tab.${e}`),t.dataset.tab=e,e===this.currentTab&&t.classList.add(`tcw-active`),t.addEventListener(`click`,()=>{this.currentTab=e,this.tabButtons.forEach(t=>t.classList.toggle(`tcw-active`,t.dataset.tab===e)),this.renderTabContent()}),r.appendChild(t),this.tabButtons.push(t)}this.modal.appendChild(r),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-modal-body`,this.modal.appendChild(this.bodyEl),this.renderTabContent();let i=document.createElement(`div`);i.className=`tcw-modal-footer`;let a=document.createElement(`button`);a.className=`tcw-reset-link`,a.textContent=this.t(`settings.resetToDefaults`),a.addEventListener(`click`,()=>this.callbacks.onReset()),i.appendChild(a);let o=document.createElement(`button`);o.className=`tcw-done-btn`,o.textContent=this.t(`settings.done`),o.addEventListener(`click`,()=>{this.callbacks.onClose(),this.close()}),i.appendChild(o),this.modal.appendChild(i),document.body.appendChild(this.modal);let s=e=>{e.key===`Escape`&&(document.removeEventListener(`keydown`,s),this.callbacks.onClose(),this.close())};document.addEventListener(`keydown`,s)}renderTabContent(){if(!(!this.bodyEl||!this.currentSettings))switch(this.bodyEl.innerHTML=``,this.currentTab){case`style`:this.renderStyleTab();break;case`display`:this.renderDisplayTab();break;case`scale`:this.renderScaleTab();break}}renderStyleTab(){if(!this.bodyEl||!this.currentSettings)return;let e=this.currentSettings,t=this.section(this.t(`settings.section.candleColors`));t.appendChild(this.colorRow(`Up Body`,e.candleUpColor,e=>this.patch({candleUpColor:e}))),t.appendChild(this.colorRow(`Down Body`,e.candleDownColor,e=>this.patch({candleDownColor:e}))),t.appendChild(this.colorRow(`Up Wick`,e.candleUpWick,e=>this.patch({candleUpWick:e}))),t.appendChild(this.colorRow(`Down Wick`,e.candleDownWick,e=>this.patch({candleDownWick:e}))),this.bodyEl.appendChild(t);let n=this.section(this.t(`settings.section.background`));n.appendChild(this.colorRow(`Background`,e.backgroundColor,e=>this.patch({backgroundColor:e}))),n.appendChild(this.colorRow(`Grid`,e.gridColor,e=>this.patch({gridColor:e}))),this.bodyEl.appendChild(n)}renderDisplayTab(){if(!this.bodyEl||!this.currentSettings)return;let e=this.currentSettings,t=this.section();t.appendChild(this.toggleRow(`Grid Lines`,e.gridVisible,e=>this.patch({gridVisible:e}))),t.appendChild(this.toggleRow(`Volume`,e.volumeVisible,e=>this.patch({volumeVisible:e}))),t.appendChild(this.toggleRow(`Volume Profile`,e.volumeProfileVisible,e=>this.patch({volumeProfileVisible:e}))),t.appendChild(this.toggleRow(`Market Profile (TPO)`,e.marketProfileVisible,e=>this.patch({marketProfileVisible:e}))),t.appendChild(this.toggleRow(`MP split by session`,e.marketProfileSplit,e=>this.patch({marketProfileSplit:e}))),t.appendChild(this.toggleRow(`MP letters (TPO)`,e.marketProfileLetters,e=>this.patch({marketProfileLetters:e}))),t.appendChild(this.rangeRow(`MP buckets`,e.marketProfileBuckets,8,200,1,e=>this.patch({marketProfileBuckets:e}))),t.appendChild(this.rangeRow(`MP opacity`,e.marketProfileOpacity,.05,1,.05,e=>this.patch({marketProfileOpacity:e}),e=>`${Math.round(e*100)}%`)),t.appendChild(this.toggleRow(`Liquidity heatmap`,e.depthHeatmapVisible,e=>this.patch({depthHeatmapVisible:e}))),t.appendChild(this.rangeRow(`Heatmap opacity`,e.depthHeatmapOpacity,.1,1,.05,e=>this.patch({depthHeatmapOpacity:e}),e=>`${Math.round(e*100)}%`)),t.appendChild(this.toggleRow(`Swing markers`,e.pivotMarkersVisible,e=>this.patch({pivotMarkersVisible:e}))),t.appendChild(this.rangeRow(`Swing strength`,e.pivotStrength,2,20,1,e=>this.patch({pivotStrength:e}))),t.appendChild(this.toggleRow(`Swing structure (HH/HL)`,e.pivotStructureLabels,e=>this.patch({pivotStructureLabels:e}))),t.appendChild(this.toggleRow(`Session shading (RTH)`,e.sessionShadingVisible,e=>this.patch({sessionShadingVisible:e}))),t.appendChild(this.toggleRow(`Prior-period levels`,e.periodLevelsVisible,e=>this.patch({periodLevelsVisible:e}))),t.appendChild(this.selectRow(`Period levels basis`,e.periodLevelsPeriod,[{value:`day`,label:`Prior Day (PDH/PDL)`},{value:`week`,label:`Prior Week (PWH/PWL)`}],e=>this.patch({periodLevelsPeriod:e}))),t.appendChild(this.toggleRow(`OHLC Legend`,e.legendVisible,e=>this.patch({legendVisible:e}))),t.appendChild(this.toggleRow(`Bar Countdown`,e.barCountdown,e=>this.patch({barCountdown:e}))),t.appendChild(this.selectRow(`Crosshair Mode`,e.crosshairMode,[{label:`Magnet`,value:`magnet`},{label:`Normal`,value:`normal`},{label:`Hidden`,value:`hidden`}],e=>this.patch({crosshairMode:e}))),t.appendChild(this.selectRow(`Timezone`,e.timezone,[{value:`local`,label:`Local`},{value:`0`,label:`UTC / London`},{value:`-300`,label:`New York (UTC-5)`},{value:`-360`,label:`Chicago (UTC-6)`},{value:`60`,label:`Frankfurt (UTC+1)`},{value:`480`,label:`Singapore/HK (UTC+8)`},{value:`540`,label:`Tokyo (UTC+9)`},{value:`330`,label:`Mumbai (UTC+5:30)`}],e=>this.patch({timezone:e}))),t.appendChild(this.selectRow(`Number Locale`,e.numberLocale,[{label:`en-US (65,234.00)`,value:`en-US`},{label:`de-DE (65.234,00)`,value:`de-DE`},{label:`fr-FR (65 234,00)`,value:`fr-FR`},{label:`vi-VN (65.234,00)`,value:`vi-VN`},{label:`en-IN (65,234.00)`,value:`en-IN`},{label:`ja-JP (65,234.00)`,value:`ja-JP`}],e=>this.patch({numberLocale:e}))),this.bodyEl.appendChild(t)}renderScaleTab(){if(!this.bodyEl||!this.currentSettings)return;let e=this.currentSettings,t=this.section();t.appendChild(this.toggleRow(`Auto Scale`,e.autoScale,e=>this.patch({autoScale:e}))),t.appendChild(this.selectRow(`Price Scale`,e.scaleMode,[{value:`regular`,label:`Regular`},{value:`logarithmic`,label:`Logarithmic`},{value:`percentage`,label:`Percentage`},{value:`indexedTo100`,label:`Indexed to 100`}],e=>this.patch({scaleMode:e}))),this.bodyEl.appendChild(t)}patch(e){this.currentSettings&&Object.assign(this.currentSettings,e),this.callbacks.onChange(e)}section(e){let t=document.createElement(`div`);if(t.className=`tcw-settings-section`,e){let n=document.createElement(`div`);n.className=`tcw-settings-section-title`,n.textContent=e,t.appendChild(n)}return t}colorRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-settings-row`;let i=document.createElement(`span`);i.className=`tcw-settings-label`,i.textContent=e,r.appendChild(i);let a=document.createElement(`div`);a.className=`tcw-color-picker-wrap`;let o=document.createElement(`input`);o.type=`color`,o.value=t;let s=document.createElement(`span`);return s.className=`tcw-color-hex`,s.textContent=t,o.addEventListener(`input`,()=>{s.textContent=o.value,n(o.value)}),a.appendChild(o),a.appendChild(s),r.appendChild(a),r}toggleRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-settings-row`;let i=document.createElement(`span`);i.className=`tcw-settings-label`,i.textContent=e,r.appendChild(i);let a=document.createElement(`button`);return a.className=`tcw-toggle${t?` tcw-on`:``}`,a.addEventListener(`click`,()=>{let e=!a.classList.contains(`tcw-on`);a.classList.toggle(`tcw-on`,e),n(e)}),r.appendChild(a),r}selectRow(e,t,n,r){let i=document.createElement(`div`);i.className=`tcw-settings-row`;let a=document.createElement(`span`);a.className=`tcw-settings-label`,a.textContent=e,i.appendChild(a);let o=document.createElement(`select`);o.className=`tcw-settings-select`;for(let e of n){let n=document.createElement(`option`);n.value=e.value,n.textContent=e.label,e.value===t&&(n.selected=!0),o.appendChild(n)}return o.addEventListener(`change`,()=>r(o.value)),i.appendChild(o),i}rangeRow(e,t,n,r,i,a,o=e=>String(e)){let s=document.createElement(`div`);s.className=`tcw-settings-row`;let c=document.createElement(`span`);c.className=`tcw-settings-label`,c.textContent=e,s.appendChild(c);let l=document.createElement(`div`);l.className=`tcw-settings-range`;let u=document.createElement(`input`);u.type=`range`,u.min=String(n),u.max=String(r),u.step=String(i),u.value=String(t);let d=document.createElement(`span`);return d.className=`tcw-settings-range-val`,d.textContent=o(t),u.addEventListener(`input`,()=>{let e=Number(u.value);d.textContent=o(e),a(e)}),l.appendChild(u),l.appendChild(d),s.appendChild(l),s}destroy(){this.close()}},se=class{el;dotEl;messageEl;infoEl;constructor(e){this.el=document.createElement(`div`),this.el.className=`tcw-statusbar`;let t=document.createElement(`div`);t.className=`tcw-status-indicator`,this.dotEl=document.createElement(`span`),this.dotEl.className=`tcw-status-dot`,t.appendChild(this.dotEl),this.messageEl=document.createElement(`span`),t.appendChild(this.messageEl),this.el.appendChild(t),this.infoEl=document.createElement(`span`),this.el.appendChild(this.infoEl),e.appendChild(this.el)}update(e){this.dotEl.className=`tcw-status-dot`,e.connectionState===`connected`?this.dotEl.classList.add(`tcw-connected`):e.connectionState===`error`&&this.dotEl.classList.add(`tcw-error`),this.messageEl.textContent=e.message,this.infoEl.textContent=`${e.symbol} ${e.timeframe}`}destroy(){this.el.remove()}},b=class{backdrop=null;modal=null;input=null;list=null;items=[];filtered=[];selectedIndex=0;callbacks;boundKeydown;constructor(e){this.callbacks=e,this.boundKeydown=this.handleKeydown.bind(this)}open(e){if(this.backdrop)return;this.items=e,this.filtered=e,this.selectedIndex=0,this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>this.close()),this.modal=document.createElement(`div`),this.modal.className=`tcw-cmd-palette`;let t=document.createElement(`div`);t.className=`tcw-cmd-header`;let n=document.createElement(`span`);n.className=`tcw-cmd-icon`,n.textContent=`⌕`,t.appendChild(n),this.input=document.createElement(`input`),this.input.className=`tcw-cmd-input`,this.input.type=`text`,this.input.placeholder=`Search indicators, chart types, tools...`,this.input.addEventListener(`input`,()=>this.filter()),t.appendChild(this.input);let r=document.createElement(`span`);r.className=`tcw-cmd-hint`,r.textContent=`ESC`,t.appendChild(r),this.modal.appendChild(t),this.list=document.createElement(`div`),this.list.className=`tcw-cmd-list`,this.modal.appendChild(this.list);let i=document.createElement(`div`);i.className=`tcw-cmd-footer`,i.innerHTML=`<span>↑↓ Navigate</span><span>⏎ Select</span><span>Esc Close</span>`,this.modal.appendChild(i),document.body.appendChild(this.backdrop),document.body.appendChild(this.modal),this.renderList(),this.input.focus(),document.addEventListener(`keydown`,this.boundKeydown)}close(){document.removeEventListener(`keydown`,this.boundKeydown),this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.input=null,this.list=null,this.callbacks.onClose()}isOpen(){return this.backdrop!==null}filter(){let e=this.input?.value.toLowerCase().trim()??``;e?this.filtered=this.items.filter(t=>t.label.toLowerCase().includes(e)||t.category.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)):this.filtered=this.items,this.selectedIndex=0,this.renderList()}renderList(){if(!this.list)return;if(this.list.innerHTML=``,this.filtered.length===0){let e=document.createElement(`div`);e.className=`tcw-cmd-empty`,e.textContent=`No results found`,this.list.appendChild(e);return}let e=``;for(let t=0;t<this.filtered.length;t++){let n=this.filtered[t];if(n.category!==e){e=n.category;let t=document.createElement(`div`);t.className=`tcw-cmd-category`,t.textContent=this.categoryLabel(e),this.list.appendChild(t)}let r=document.createElement(`button`);r.className=`tcw-cmd-item`,t===this.selectedIndex&&r.classList.add(`tcw-selected`),n.active&&r.classList.add(`tcw-active`),r.dataset.index=String(t);let i=document.createElement(`span`);if(i.className=`tcw-cmd-item-label`,i.textContent=n.label,r.appendChild(i),n.active){let e=document.createElement(`span`);e.className=`tcw-cmd-check`,e.textContent=`✓`,r.appendChild(e)}if(n.shortcut){let e=document.createElement(`kbd`);e.className=`tcw-cmd-kbd`,e.textContent=n.shortcut,r.appendChild(e)}r.addEventListener(`click`,()=>this.select(t)),r.addEventListener(`mouseenter`,()=>{this.selectedIndex=t,this.updateSelection()}),this.list.appendChild(r)}}updateSelection(){if(!this.list)return;let e=this.list.querySelectorAll(`.tcw-cmd-item`);e.forEach((e,t)=>{e.classList.toggle(`tcw-selected`,t===this.selectedIndex)}),e[this.selectedIndex]?.scrollIntoView({block:`nearest`})}select(e){let t=this.filtered[e];if(t){switch(t.category){case`indicator`:this.callbacks.onIndicator(t.id);break;case`chartType`:this.callbacks.onChartType(t.id);break;case`drawing`:this.callbacks.onDrawingTool(t.id);break;case`timeframe`:this.callbacks.onTimeframe(t.id);break;case`action`:this.callbacks.onAction(t.id);break}this.close()}}handleKeydown(e){switch(e.key){case`Escape`:e.preventDefault(),this.close();break;case`ArrowDown`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex+1)%this.filtered.length,this.updateSelection());break;case`ArrowUp`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex-1+this.filtered.length)%this.filtered.length,this.updateSelection());break;case`Enter`:e.preventDefault(),this.select(this.selectedIndex);break}}categoryLabel(e){switch(e){case`indicator`:return`Indicators`;case`chartType`:return`Chart Types`;case`drawing`:return`Drawing Tools`;case`timeframe`:return`Timeframes`;case`action`:return`Actions`;default:return e}}destroy(){this.close()}},x=class{backdrop=null;modal=null;input=null;list=null;symbols=[];current=``;filtered=[];selectedIndex=0;callbacks;boundKeydown;pickOverride=null;constructor(e){this.callbacks=e,this.boundKeydown=this.handleKeydown.bind(this)}open(e,t,n){if(this.backdrop)return;this.pickOverride=n??null,this.symbols=e,this.current=t,this.filtered=e.map(e=>({symbol:e,score:0})),this.selectedIndex=Math.max(0,e.indexOf(t)),this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>this.close()),this.modal=document.createElement(`div`),this.modal.className=`tcw-cmd-palette`;let r=document.createElement(`div`);r.className=`tcw-cmd-header`;let i=document.createElement(`span`);i.className=`tcw-cmd-icon`,i.innerHTML=T(),r.appendChild(i),this.input=document.createElement(`input`),this.input.className=`tcw-cmd-input`,this.input.type=`text`,this.input.placeholder=`Search symbol… (e.g. BTC, ETH, AAPL)`,this.input.autocomplete=`off`,this.input.spellcheck=!1,this.input.addEventListener(`input`,()=>this.filter()),r.appendChild(this.input);let a=document.createElement(`span`);a.className=`tcw-cmd-hint`,a.textContent=`ESC`,r.appendChild(a),this.modal.appendChild(r),this.list=document.createElement(`div`),this.list.className=`tcw-cmd-list`,this.modal.appendChild(this.list);let o=document.createElement(`div`);o.className=`tcw-cmd-footer`,o.innerHTML=`<span>↑↓ Navigate</span><span>⏎ Open</span><span>Esc Close</span>`,this.modal.appendChild(o),document.body.appendChild(this.backdrop),document.body.appendChild(this.modal),this.renderList(),this.input.focus(),document.addEventListener(`keydown`,this.boundKeydown)}close(){document.removeEventListener(`keydown`,this.boundKeydown),this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.input=null,this.list=null,this.pickOverride=null,this.callbacks.onClose()}isOpen(){return this.backdrop!==null}destroy(){this.close()}filter(){let e=(this.input?.value??``).toUpperCase().trim();e?this.filtered=this.symbols.map(t=>({symbol:t,score:S(t.toUpperCase(),e)})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score):this.filtered=this.symbols.map(e=>({symbol:e,score:0})),this.selectedIndex=0,this.renderList()}renderList(){if(!this.list)return;if(this.list.innerHTML=``,this.filtered.length===0){let e=document.createElement(`div`);e.className=`tcw-cmd-empty`,e.textContent=`No symbols match`,this.list.appendChild(e);return}let e=(this.input?.value??``).toUpperCase().trim();for(let t=0;t<this.filtered.length;t++){let{symbol:n}=this.filtered[t],r=document.createElement(`button`);r.className=`tcw-cmd-item`,t===this.selectedIndex&&r.classList.add(`tcw-selected`),n===this.current&&r.classList.add(`tcw-active`);let i=document.createElement(`span`);if(i.className=`tcw-cmd-item-label`,i.innerHTML=C(n,e),r.appendChild(i),n===this.current){let e=document.createElement(`span`);e.className=`tcw-cmd-check`,e.textContent=`✓`,r.appendChild(e)}r.addEventListener(`click`,()=>this.pick(t)),r.addEventListener(`mouseenter`,()=>{this.selectedIndex=t,this.updateSelection()}),this.list.appendChild(r)}}updateSelection(){if(!this.list)return;let e=this.list.querySelectorAll(`.tcw-cmd-item`);e.forEach((e,t)=>e.classList.toggle(`tcw-selected`,t===this.selectedIndex)),e[this.selectedIndex]?.scrollIntoView({block:`nearest`})}pick(e){let t=this.filtered[e];if(!t)return;let n=this.pickOverride;n?n(t.symbol):this.callbacks.onPick(t.symbol),this.close()}handleKeydown(e){switch(e.key){case`Escape`:e.preventDefault(),this.close();break;case`ArrowDown`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex+1)%this.filtered.length,this.updateSelection());break;case`ArrowUp`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex-1+this.filtered.length)%this.filtered.length,this.updateSelection());break;case`Enter`:e.preventDefault(),this.pick(this.selectedIndex);break}}};function S(e,t){if(e===t)return 1e3;if(e.startsWith(t))return 500+(50-Math.min(50,e.length-t.length));if(e.includes(t))return 200+(50-Math.min(50,e.length-t.length));let n=0,r=-1,i=0;for(let a=0;a<e.length&&n<t.length;a++)e[a]===t[n]&&(r>=0&&(i+=a-r-1),r=a,n++);return n<t.length?0:100-Math.min(99,i)}function C(e,t){if(!t)return w(e);let n=e.toUpperCase(),r=``,i=0;for(let a=0;a<e.length;a++)i<t.length&&n[a]===t[i]?(r+=`<mark style="background:transparent;color:var(--tcw-accent);font-weight:700">${w(e[a])}</mark>`,i++):r+=w(e[a]);return r}function w(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}function T(){return`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>`}var E={"Search & navigation":`hotkeys.group.searchNavigation`,"Chart manipulation":`hotkeys.group.chartManipulation`,"Touch (mobile / tablet)":`hotkeys.group.touch`,Keyboard:`hotkeys.group.keyboard`,Drawing:`hotkeys.group.drawing`},D=typeof navigator<`u`&&/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent)?`⌘`:`Ctrl`,O=[{title:`Search & navigation`,entries:[{keys:[D,`K`],label:`Command palette`},{keys:[D,`P`],label:`Symbol search`},{keys:[`?`],label:`Show this sheet`}]},{title:`Chart manipulation`,entries:[{keys:[`Drag`],label:`Pan — past the last bar into empty future space`},{keys:[D,`Drag`],label:`Select drawings in a box`},{keys:[D,`Click`],label:`Add / remove a drawing from the selection`},{keys:[`Shift`,`Drag`],label:`Measure tool (bars × price Δ)`},{keys:[`Drag`,`Price axis`],label:`Compress / expand vertical scale`},{keys:[`Drag`,`Time axis`],label:`Zoom time axis`},{keys:[`Double-click`,`Price axis`],label:`Re-enable auto-scale`},{keys:[`Double-click`,`Time axis`],label:`Fit content`},{keys:[`Scroll`],label:`Zoom around cursor`}]},{title:`Touch (mobile / tablet)`,entries:[{keys:[`1 finger`,`Drag`],label:`Pan / move crosshair`},{keys:[`2 fingers`,`Pinch`],label:`Zoom around midpoint`},{keys:[`Long-press`],label:`Pin OHLC tooltip at bar`},{keys:[`Drag`,`Axis strip`],label:`Scale price / time axis`}]},{title:`Keyboard`,entries:[{keys:[`←`,`→`],label:`Pan one bar`},{keys:[`+`,`−`],label:`Zoom in / out`},{keys:[`Home`],label:`Scroll to start`},{keys:[`End`],label:`Scroll to end (live edge)`},{keys:[`F`],label:`Fit content`}]},{title:`Drawing`,entries:[{keys:[D,`Z`],label:`Undo`},{keys:[D,`Shift`,`Z`],label:`Redo`},{keys:[`Esc`],label:`Cancel active drawing`}]}],k=class{backdrop=null;modal=null;callbacks;t;boundKeydown;constructor(e,t){this.callbacks=e,this.t=t,this.boundKeydown=e=>{e.key===`Escape`&&(e.preventDefault(),this.close())}}open(){if(this.backdrop)return;this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>this.close()),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal tcw-hotkey-sheet`,this.modal.style.width=`640px`;let e=document.createElement(`div`);e.className=`tcw-modal-header`,e.innerHTML=`<h3>${this.t(`hotkeys.title`)}</h3>`;let t=document.createElement(`button`);t.className=`tcw-modal-close`,t.setAttribute(`aria-label`,this.t(`hotkeys.close`)),t.innerHTML=`×`,t.addEventListener(`click`,()=>this.close()),e.appendChild(t),this.modal.appendChild(e);let n=document.createElement(`div`);n.className=`tcw-modal-body`;let r=document.createElement(`div`);r.className=`tcw-hotkey-grid`;for(let e of O){let t=document.createElement(`section`);t.className=`tcw-hotkey-section`;let n=document.createElement(`div`);n.className=`tcw-settings-section-title`;let i=E[e.title];n.textContent=i?this.t(i):e.title,t.appendChild(n);for(let n of e.entries){let e=document.createElement(`div`);e.className=`tcw-hotkey-row`;let r=document.createElement(`div`);r.className=`tcw-hotkey-keys`;for(let e=0;e<n.keys.length;e++){if(e>0){let e=document.createElement(`span`);e.className=`tcw-hotkey-sep`,e.textContent=`+`,r.appendChild(e)}let t=document.createElement(`kbd`);t.className=`tcw-cmd-kbd`,t.textContent=n.keys[e],r.appendChild(t)}e.appendChild(r);let i=document.createElement(`span`);i.className=`tcw-hotkey-label`,i.textContent=n.label,e.appendChild(i),t.appendChild(e)}r.appendChild(t)}n.appendChild(r),this.modal.appendChild(n);let i=document.createElement(`div`);i.className=`tcw-modal-footer`,i.innerHTML=`<span style="font-size:11px;color:var(--tcw-text-muted)">Press ? anytime to show this sheet</span>`;let a=document.createElement(`button`);a.className=`tcw-done-btn`,a.textContent=this.t(`hotkeys.gotIt`),a.addEventListener(`click`,()=>this.close()),i.appendChild(a),this.modal.appendChild(i),document.body.appendChild(this.backdrop),document.body.appendChild(this.modal),document.addEventListener(`keydown`,this.boundKeydown)}close(){document.removeEventListener(`keydown`,this.boundKeydown),this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.callbacks.onClose()}isOpen(){return this.backdrop!==null}destroy(){this.close()}},A=[.5,1,2,5,10,20,50,100],j=class{root=null;scrubber=null;progressLabel=null;playBtn=null;state=`stopped`;total=0;speed=5;callbacks;constructor(e){this.callbacks=e}mount(e,t){this.root||(this.total=Math.max(0,t.total),this.speed=t.speed??5,this.state=`paused`,this.root=document.createElement(`div`),this.root.className=`tcw-replay-bar`,this.root.innerHTML=this.markup(),e.appendChild(this.root),this.wireEvents(),this.syncUi())}unmount(){this.root?.remove(),this.root=null,this.scrubber=null,this.progressLabel=null,this.playBtn=null,this.state=`stopped`}isMounted(){return this.root!==null}setState(e){this.state=e,this.syncUi()}setProgress(e,t){this.total=t,this.scrubber&&(this.scrubber.max=String(Math.max(0,t-1)),this.scrubber.value=String(e)),this.progressLabel&&(this.progressLabel.textContent=`${e+1} / ${t}`)}destroy(){this.unmount()}markup(){let e=A.map(e=>`<option value="${e}"${e===this.speed?` selected`:``}>${e}× bars/s</option>`).join(``);return`
|
|
2554
|
-
<
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
<
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
`}wireEvents(){this.root&&(this.scrubber=this.root.querySelector(`input[data-act="seek"]`),this.progressLabel=this.root.querySelector(`[data-tcw="progress"]`),this.playBtn=this.root.querySelector(`button[data-act="play"]`),this.root.querySelector(`[data-act="close"]`)?.addEventListener(`click`,()=>this.callbacks.onClose()),this.root.querySelector(`[data-act="stepBack"]`)?.addEventListener(`click`,()=>this.callbacks.onStepBack()),this.root.querySelector(`[data-act="stepForward"]`)?.addEventListener(`click`,()=>this.callbacks.onStepForward()),this.playBtn?.addEventListener(`click`,()=>{this.state===`playing`?this.callbacks.onPause():this.callbacks.onPlay()}),this.scrubber?.addEventListener(`input`,()=>{let e=Number(this.scrubber.value);this.callbacks.onSeek(e)}),this.root.querySelector(`[data-act="speed"]`)?.addEventListener(`change`,e=>{let t=Number(e.target.value);this.speed=t,this.callbacks.onSpeedChange(t)}))}syncUi(){this.playBtn&&(this.playBtn.innerHTML=this.state===`playing`?N():M(),this.playBtn.title=this.state===`playing`?`Pause`:`Play`)}};function M(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7L8 5z"/></svg>`}function N(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M6 5h4v14H6zM14 5h4v14h-4z"/></svg>`}function P(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M6 6h2v12H6zM20 6L9 12l11 6V6z"/></svg>`}function F(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M4 6l11 6L4 18V6zM16 6h2v12h-2z"/></svg>`}function I(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg>`}var L=class{el;listEl;rowMap=new Map;entries=new Map;active=null;callbacks;locale;constructor(e,t,n,r=`Watchlist`){this.callbacks=n,this.el=document.createElement(`div`),this.el.className=`tcw-watchlist`;let i=document.createElement(`div`);i.className=`tcw-watchlist-header`,i.textContent=r,this.el.appendChild(i),this.listEl=document.createElement(`div`),this.listEl.className=`tcw-watchlist-list`,this.el.appendChild(this.listEl);for(let e of t)this.entries.set(e,{symbol:e}),this.appendRow(e);e.appendChild(this.el)}setLocale(e){this.locale=e;for(let e of this.entries.keys())this.renderRow(e)}setSymbols(e){let t=new Set(e);for(let e of this.rowMap.keys())t.has(e)||this.removeRow(e);for(let t of e)this.rowMap.has(t)||(this.entries.set(t,this.entries.get(t)??{symbol:t}),this.appendRow(t))}setActive(e){if(this.active===e)return;this.active&&this.rowMap.has(this.active)&&this.rowMap.get(this.active).row.classList.remove(`tcw-watchlist-active`),this.active=e;let t=this.rowMap.get(e);t&&t.row.classList.add(`tcw-watchlist-active`)}setEntry(e,t){let n={...this.entries.get(e)??{symbol:e},...t};this.entries.set(e,n),this.renderRow(e)}destroy(){this.el.remove(),this.rowMap.clear(),this.entries.clear()}appendRow(e){let t=document.createElement(`div`);t.className=`tcw-watchlist-row`,t.tabIndex=0;let n=document.createElement(`div`);n.className=`tcw-watchlist-symbol`,n.textContent=R(e);let r=document.createElement(`canvas`);r.className=`tcw-watchlist-spark`,r.width=64,r.height=22;let i=document.createElement(`div`);i.className=`tcw-watchlist-stats`;let a=document.createElement(`span`);a.className=`tcw-watchlist-price`,a.textContent=`—`;let o=document.createElement(`span`);o.className=`tcw-watchlist-change`,o.textContent=``,i.appendChild(a),i.appendChild(o),t.appendChild(n),t.appendChild(r),t.appendChild(i),t.addEventListener(`click`,()=>this.callbacks.onSelect(e)),t.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),this.callbacks.onSelect(e))}),this.listEl.appendChild(t),this.rowMap.set(e,{row:t,priceEl:a,changeEl:o,sparkCanvas:r}),e===this.active&&t.classList.add(`tcw-watchlist-active`)}removeRow(e){let t=this.rowMap.get(e);t&&(t.row.remove(),this.rowMap.delete(e))}renderRow(e){let t=this.rowMap.get(e),n=this.entries.get(e);if(!(!t||!n)){if(n.lastPrice!==void 0&&(t.priceEl.textContent=z(n.lastPrice,this.locale)),n.lastPrice!==void 0&&n.refPrice!==void 0&&n.refPrice!==0){let e=n.lastPrice-n.refPrice,r=e/n.refPrice*100,i=e>=0?`+`:`-`,a=Math.abs(r).toLocaleString(this.locale,{minimumFractionDigits:2,maximumFractionDigits:2});t.changeEl.textContent=`${i}${a}%`,t.changeEl.className=`tcw-watchlist-change ${e>=0?`tcw-up`:`tcw-down`}`}else t.changeEl.textContent=``;n.sparkline&&n.sparkline.length>=2&&B(t.sparkCanvas,n.sparkline,n.refPrice??n.sparkline[0])}}};function R(e){for(let t of[`USDT`,`USD`,`BTC`,`ETH`,`EUR`])if(e.length>t.length&&e.endsWith(t))return e.slice(0,-t.length)+`/`+t;return e}function z(e,t){if(e===0)return`0`;let n=Math.abs(e);return n>=1e3?e.toLocaleString(t,{minimumFractionDigits:2,maximumFractionDigits:2}):n>=1?e.toLocaleString(t,{minimumFractionDigits:4,maximumFractionDigits:4}):Number(e.toPrecision(4)).toLocaleString(t,{maximumFractionDigits:10})}function B(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=window.devicePixelRatio||1;e.width!==e.clientWidth*i&&(e.width=(e.clientWidth||64)*i,e.height=(e.clientHeight||22)*i);let a=e.width,o=e.height,s=1/0,c=-1/0;for(let e of t)e<s&&(s=e),e>c&&(c=e);let l=Math.max(c-s,1e-9),u=t[t.length-1]>=n?`#1fa874`:`#e8505b`;r.clearRect(0,0,a,o),r.lineWidth=1.4*i,r.strokeStyle=u,r.beginPath();let d=a/(t.length-1);for(let e=0;e<t.length;e++){let n=e*d,i=o-(t[e]-s)/l*(o-4)-2;e===0?r.moveTo(n,i):r.lineTo(n,i)}r.stroke()}var V=[{value:`crossing`,label:`Crossing`},{value:`crossingUp`,label:`Crossing up`},{value:`crossingDown`,label:`Crossing down`},{value:`greaterThan`,label:`Greater than`},{value:`lessThan`,label:`Less than`}],H=new Map(V.map(e=>[e.value,e.label]));function U(e){return Math.round(e*1e6)/1e6}function W(e){let t=Math.abs(e);return t>=1e3||t>=1?e.toFixed(2):e.toPrecision(4)}var G=class{el;listEl;priceInput;conditionSelect;sourceSelect;messageInput;emptyEl;callbacks;open=!1;alerts=[];sources=[{channel:`price`,label:`Price`}];constructor(e,t){this.callbacks=t,this.el=document.createElement(`div`),this.el.className=`tcw-alerts-panel`,this.el.hidden=!0;let n=document.createElement(`div`);n.className=`tcw-alerts-header`;let r=document.createElement(`span`);r.textContent=`Price Alerts`;let i=document.createElement(`button`);i.className=`tcw-alerts-close`,i.type=`button`,i.setAttribute(`aria-label`,`Close alerts`),i.innerHTML=_(`x`,14),i.addEventListener(`click`,()=>this.close()),n.appendChild(r),n.appendChild(i),this.el.appendChild(n);let a=document.createElement(`form`);a.className=`tcw-alerts-form`,this.sourceSelect=document.createElement(`select`),this.sourceSelect.className=`tcw-alerts-source`,this.sourceSelect.addEventListener(`change`,()=>this.prefillPrice()),this.priceInput=document.createElement(`input`),this.priceInput.type=`number`,this.priceInput.step=`any`,this.priceInput.placeholder=`Value`,this.priceInput.className=`tcw-alerts-price`,this.priceInput.required=!0,this.conditionSelect=document.createElement(`select`),this.conditionSelect.className=`tcw-alerts-condition`;for(let e of V){let t=document.createElement(`option`);t.value=e.value,t.textContent=e.label,this.conditionSelect.appendChild(t)}this.messageInput=document.createElement(`input`),this.messageInput.type=`text`,this.messageInput.placeholder=`Note (optional)`,this.messageInput.className=`tcw-alerts-message`;let o=document.createElement(`button`);o.type=`submit`,o.className=`tcw-alerts-add`,o.innerHTML=`${_(`plus`,14)}<span>Add alert</span>`,a.appendChild(this.sourceSelect),a.appendChild(this.priceInput),a.appendChild(this.conditionSelect),a.appendChild(this.messageInput),a.appendChild(o),a.addEventListener(`submit`,e=>{e.preventDefault(),this.submitForm()}),this.el.appendChild(a),this.listEl=document.createElement(`div`),this.listEl.className=`tcw-alerts-list`,this.el.appendChild(this.listEl),this.emptyEl=document.createElement(`div`),this.emptyEl.className=`tcw-alerts-empty`,this.emptyEl.textContent=`No alerts yet. Add one above, or right-click the chart.`,this.listEl.appendChild(this.emptyEl),this.renderSources(),e.appendChild(this.el)}setSources(e){this.sources=e.length>0?e:[{channel:`price`,label:`Price`}],this.renderSources()}renderSources(){let e=this.sourceSelect.value||`price`;this.sourceSelect.replaceChildren();for(let e of this.sources){let t=document.createElement(`option`);t.value=e.channel,t.textContent=e.label,this.sourceSelect.appendChild(t)}this.sourceSelect.value=this.sources.some(t=>t.channel===e)?e:`price`}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1,this.priceInput.value===``&&this.prefillPrice()}prefillPrice(){let e=this.callbacks.getChannelValue(this.sourceSelect.value||`price`);this.priceInput.value=e===null?``:String(U(e))}close(){this.open=!1,this.el.hidden=!0}setAlerts(e){this.alerts=e,this.renderList()}destroy(){this.el.remove()}submitForm(){let e=Number(this.priceInput.value);if(!Number.isFinite(e))return;let t=this.conditionSelect.value,n=this.messageInput.value.trim()||void 0,r=this.sourceSelect.value||`price`,i=this.sources.find(e=>e.channel===r)?.label??`Price`;this.callbacks.onAdd(e,t,n,r,i),this.messageInput.value=``,this.prefillPrice()}renderList(){if(this.listEl.replaceChildren(),this.alerts.length===0){this.listEl.appendChild(this.emptyEl);return}for(let e of[...this.alerts].reverse()){let t=document.createElement(`div`);t.className=`tcw-alerts-row`+(e.triggered?` tcw-alerts-triggered`:``);let n=document.createElement(`div`);n.className=`tcw-alerts-info`;let r=document.createElement(`div`);r.className=`tcw-alerts-row-main`;let i=H.get(e.condition)??e.condition,a=e.channel&&e.channel!==`price`,o=a?W(e.price):this.callbacks.formatPrice(e.price);if(r.textContent=`${a&&e.label?`${e.label} `:``}${i} ${o}`,n.appendChild(r),e.message){let t=document.createElement(`div`);t.className=`tcw-alerts-row-note`,t.textContent=e.message,n.appendChild(t)}if(e.triggered){let e=document.createElement(`span`);e.className=`tcw-alerts-badge`,e.textContent=`triggered`,r.appendChild(e)}let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-alerts-del`,s.setAttribute(`aria-label`,`Delete alert`),s.innerHTML=_(`trash`,14),s.addEventListener(`click`,()=>this.callbacks.onRemove(e.id)),t.appendChild(n),t.appendChild(s),this.listEl.appendChild(t)}}},K=class{el;indicatorsEl;drawingsEl;compareEl=null;callbacks;open=!1;constructor(e,t){this.callbacks=t,this.el=document.createElement(`div`),this.el.className=`tcw-tree-panel`,this.el.hidden=!0;let n=document.createElement(`div`);n.className=`tcw-tree-header`;let r=document.createElement(`span`);r.textContent=`Objects`;let i=document.createElement(`button`);i.type=`button`,i.className=`tcw-tree-close`,i.setAttribute(`aria-label`,`Close objects`),i.innerHTML=_(`x`,14),i.addEventListener(`click`,()=>this.close()),n.appendChild(r),n.appendChild(i),this.el.appendChild(n),this.indicatorsEl=this.makeSection(`Indicators`),this.drawingsEl=this.makeSection(`Drawings`),this.callbacks.onAddCompare&&(this.compareEl=this.makeSection(`Compare`,()=>this.callbacks.onAddCompare?.())),e.appendChild(this.el)}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1}close(){this.open=!1,this.el.hidden=!0}destroy(){this.el.remove()}setObjects(e,t,n=[]){this.renderIndicators(e),this.renderDrawings(t),this.renderCompares(n)}makeSection(e,t){let n=document.createElement(`div`);n.className=`tcw-tree-section`;let r=document.createElement(`div`);r.className=`tcw-tree-section-head`;let i=document.createElement(`span`);if(i.textContent=e,r.appendChild(i),t){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-tree-add`,n.setAttribute(`aria-label`,`Add ${e.toLowerCase()}`),n.title=`Add ${e.toLowerCase()}`,n.innerHTML=_(`plus`,13),n.addEventListener(`click`,t),r.appendChild(n)}let a=document.createElement(`div`);return a.className=`tcw-tree-list`,n.appendChild(r),n.appendChild(a),this.el.appendChild(n),a}renderIndicators(e){if(this.indicatorsEl.replaceChildren(),e.length===0){this.indicatorsEl.appendChild(this.emptyRow(`No indicators`));return}for(let t of e){let e=this.row(t.name);t.visible||e.classList.add(`tcw-tree-hidden`);let n=document.createElement(`div`);n.className=`tcw-tree-actions`,this.callbacks.onToggleIndicatorVisible&&n.appendChild(this.iconButton(t.visible?`eye`:`eyeOff`,t.visible?`Hide`:`Show`,``,()=>this.callbacks.onToggleIndicatorVisible?.(t.instanceId,!t.visible))),this.callbacks.onConfigureIndicator&&n.appendChild(this.iconButton(`settings`,`Indicator settings`,``,()=>this.callbacks.onConfigureIndicator?.(t.instanceId))),n.appendChild(this.iconButton(`trash`,`Remove indicator`,`tcw-tree-del`,()=>this.callbacks.onRemoveIndicator(t.instanceId))),e.appendChild(n),this.indicatorsEl.appendChild(e)}}renderDrawings(e){if(this.drawingsEl.replaceChildren(),e.length===0){this.drawingsEl.appendChild(this.emptyRow(`No drawings`));return}for(let t of e){let e=this.row(t.label);t.visible||e.classList.add(`tcw-tree-hidden`);let n=document.createElement(`div`);n.className=`tcw-tree-actions`,n.appendChild(this.iconButton(t.visible?`eye`:`eyeOff`,t.visible?`Hide`:`Show`,``,()=>this.callbacks.onToggleDrawingVisible(t.id,!t.visible))),n.appendChild(this.iconButton(t.locked?`lock`:`unlock`,t.locked?`Unlock`:`Lock`,t.locked?`tcw-tree-on`:``,()=>this.callbacks.onToggleDrawingLocked(t.id,!t.locked))),n.appendChild(this.iconButton(`trash`,`Remove drawing`,`tcw-tree-del`,()=>this.callbacks.onRemoveDrawing(t.id))),e.appendChild(n),this.drawingsEl.appendChild(e)}}renderCompares(e){if(this.compareEl){if(this.compareEl.replaceChildren(),e.length===0){this.compareEl.appendChild(this.emptyRow(`No comparisons`));return}for(let t of e){let e=this.row(t.label),n=document.createElement(`span`);n.className=`tcw-tree-dot`,n.style.background=t.color,e.insertBefore(n,e.firstChild),this.callbacks.onRemoveCompare&&e.appendChild(this.iconButton(`trash`,`Remove comparison`,`tcw-tree-del`,()=>this.callbacks.onRemoveCompare?.(t.id))),this.compareEl.appendChild(e)}}}row(e){let t=document.createElement(`div`);t.className=`tcw-tree-row`;let n=document.createElement(`span`);return n.className=`tcw-tree-name`,n.textContent=e,n.title=e,t.appendChild(n),t}emptyRow(e){let t=document.createElement(`div`);return t.className=`tcw-tree-empty`,t.textContent=e,t}iconButton(e,t,n,r){let i=document.createElement(`button`);return i.type=`button`,i.className=`tcw-tree-btn ${n}`.trim(),i.setAttribute(`aria-label`,t),i.title=t,i.innerHTML=_(e,14),i.addEventListener(`click`,r),i}},ce={trendLine:`Trend Line`,ray:`Ray`,extendedLine:`Extended Line`,horizontalLine:`Horizontal Line`,horizontalRay:`Horizontal Ray`,crossLine:`Cross Line`,infoLine:`Info Line`,trendAngle:`Trend Angle`,circle:`Circle`,fibChannel:`Fib Channel`,fibSpeedResistanceFan:`Fib Speed Resistance Fan`,schiffPitchfork:`Schiff Pitchfork`,modifiedSchiffPitchfork:`Modified Schiff Pitchfork`,xabcdPattern:`XABCD Pattern`,abcdPattern:`ABCD Pattern`,headAndShoulders:`Head and Shoulders`,dateAndPriceRange:`Date and Price Range`,cyclicLines:`Cyclic Lines`,priceLabel:`Price Label`,verticalLine:`Vertical Line`,rectangle:`Rectangle`,ellipse:`Ellipse`,triangle:`Triangle`,arrow:`Arrow`,parallelChannel:`Parallel Channel`,regressionChannel:`Regression Channel`,pitchfork:`Pitchfork`,fibRetracement:`Fib Retracement`,fibExtension:`Fib Extension`,fibTimeZones:`Fib Time Zones`,gannBox:`Gann Box`,gannFan:`Gann Fan`,elliottWave:`Elliott Wave`,priceRange:`Price Range`,dateRange:`Date Range`,measure:`Measure`,text:`Text`,textAnnotation:`Text`,anchoredVWAP:`Anchored VWAP`,volumeProfileRange:`Volume Profile`,riskReward:`Long/Short Position`};function le(e){return ce[e]??e}var ue=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function de(e){return e.replace(/_/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}var fe=class{backdrop;modal;bodyEl;titleEl;callbacks;target=null;draft={};constructor(e,t){this.callbacks=t,this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.hidden=!0,this.backdrop.addEventListener(`click`,e=>{e.target===this.backdrop&&this.close()}),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal tcw-modal-narrow`;let n=document.createElement(`div`);n.className=`tcw-modal-header`,this.titleEl=document.createElement(`h3`),this.titleEl.textContent=`Indicator`;let r=document.createElement(`button`);r.className=`tcw-modal-close`,r.setAttribute(`aria-label`,`Close`),r.innerHTML=_(`x`,16),r.addEventListener(`click`,()=>this.close()),n.appendChild(this.titleEl),n.appendChild(r),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-modal-body`;let i=document.createElement(`div`);i.className=`tcw-modal-footer`;let a=document.createElement(`button`);a.className=`tcw-reset-link`,a.textContent=`Reset to defaults`,a.addEventListener(`click`,()=>this.resetDefaults());let o=document.createElement(`button`);o.className=`tcw-done-btn`,o.textContent=`Done`,o.addEventListener(`click`,()=>this.close()),i.appendChild(a),i.appendChild(o),this.modal.appendChild(n),this.modal.appendChild(this.bodyEl),this.modal.appendChild(i),this.backdrop.appendChild(this.modal),e.appendChild(this.backdrop)}open(e){this.target=e,this.titleEl.textContent=`${e.name} settings`,this.draft={},this.renderFields(),this.backdrop.hidden=!1}close(){this.backdrop.hidden=!0,this.target=null,this.callbacks.onClose()}isOpen(){return!this.backdrop.hidden}destroy(){this.backdrop.remove()}currentValue(e){if(e in this.draft)return this.draft[e];let t=this.target?.params[e],n=this.target?.defaults[e];return t??n}setValue(e,t){this.target&&(this.draft[e]=t,this.callbacks.onApply(this.target.instanceId,{...this.draft}))}resetDefaults(){if(!this.target)return;let e={};for(let[t,n]of Object.entries(this.target.defaults))e[t]=n;this.draft=e,this.callbacks.onApply(this.target.instanceId,{...e}),this.renderFields()}renderFields(){if(this.bodyEl.replaceChildren(),!this.target)return;let e=document.createElement(`div`);e.className=`tcw-settings-section`;let t=Object.keys(this.target.defaults);if(t.length===0){let t=document.createElement(`div`);t.className=`tcw-settings-label`,t.textContent=`This indicator has no adjustable parameters.`,e.appendChild(t)}for(let n of t)e.appendChild(this.fieldRow(n));this.bodyEl.appendChild(e)}fieldRow(e){let t=document.createElement(`div`);t.className=`tcw-settings-row`;let n=document.createElement(`span`);n.className=`tcw-settings-label`,n.textContent=de(e),t.appendChild(n);let r=this.currentValue(e),i=typeof(this.target?.defaults[e]??r);return i===`boolean`?t.appendChild(this.toggleControl(e,!!r)):i===`number`?t.appendChild(this.numberControl(e,Number(r))):typeof r==`string`&&ue.test(r)?t.appendChild(this.colorControl(e,r)):t.appendChild(this.textControl(e,String(r??``))),t}toggleControl(e,t){let n=document.createElement(`button`);return n.className=`tcw-toggle${t?` tcw-on`:``}`,n.type=`button`,n.addEventListener(`click`,()=>{let t=!n.classList.contains(`tcw-on`);n.classList.toggle(`tcw-on`,t),this.setValue(e,t)}),n}numberControl(e,t){let n=document.createElement(`input`);return n.type=`number`,n.className=`tcw-indi-input`,n.value=String(t),n.step=Number.isInteger(t)?`1`:`0.1`,n.addEventListener(`change`,()=>{let t=Number(n.value);Number.isFinite(t)&&this.setValue(e,t)}),n}colorControl(e,t){let n=document.createElement(`input`);return n.type=`color`,n.className=`tcw-indi-color`,n.value=t.length===4?pe(t):t,n.addEventListener(`input`,()=>this.setValue(e,n.value)),n}textControl(e,t){let n=document.createElement(`input`);return n.type=`text`,n.className=`tcw-indi-input`,n.value=t,n.addEventListener(`change`,()=>this.setValue(e,n.value)),n}};function pe(e){let t=e[1],n=e[2],r=e[3];return`#${t}${t}${n}${n}${r}${r}`}function me(){try{return typeof localStorage<`u`?localStorage:null}catch{return null}}var he=[`color`,`lineWidth`,`lineStyle`,`fillColor`,`fillOpacity`,`fontSize`];function q(e){if(!e||typeof e!=`object`)return{};let t={},n=e;for(let e of he)n[e]!==void 0&&(t[e]=n[e]);return t}var ge=class{templates=[];constructor(e=`tcw:draw-templates`,t=me()){this.storageKey=e,this.storage=t,this.load()}list(){return this.templates.map(e=>({name:e.name,style:{...e.style}}))}get(e){let t=this.templates.find(t=>t.name===e);return t?{name:t.name,style:{...t.style}}:null}save(e,t){let n=e.trim();if(!n)return;let r=q(t);this.templates=this.templates.filter(e=>e.name!==n),this.templates.push({name:n,style:r}),this.persist()}remove(e){let t=this.templates.filter(t=>t.name!==e);t.length!==this.templates.length&&(this.templates=t,this.persist())}clear(){this.templates=[],this.persist()}load(){if(this.storage)try{let e=this.storage.getItem(this.storageKey);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;this.templates=t.filter(e=>e&&typeof e.name==`string`).map(e=>({name:e.name,style:q(e.style)}))}catch{}}persist(){if(this.storage)try{this.storage.setItem(this.storageKey,JSON.stringify(this.templates))}catch{}}},_e=[`#4c8dff`,`#1fa874`,`#e8505b`,`#f2a93b`,`#a57cff`,`#1398a8`,`#ffffff`,`#7d8696`],ve=[1,2,3,4],ye=[`solid`,`dashed`,`dotted`],be=class{el;templatesEl;nameInput;callbacks;store;open=!1;constructor(e,t,n){this.callbacks=t,this.store=n,this.el=document.createElement(`div`),this.el.className=`tcw-style-panel`,this.el.hidden=!0;let r=document.createElement(`div`);r.className=`tcw-style-header`;let i=document.createElement(`span`);i.textContent=`Drawing Style`;let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-style-close`,a.setAttribute(`aria-label`,`Close`),a.innerHTML=_(`x`,14),a.addEventListener(`click`,()=>this.close()),r.appendChild(i),r.appendChild(a),this.el.appendChild(r),this.el.appendChild(this.colorRow()),this.el.appendChild(this.widthRow()),this.el.appendChild(this.lineStyleRow());let o=document.createElement(`div`);o.className=`tcw-style-subhead`,o.textContent=`Templates`,this.el.appendChild(o);let s=document.createElement(`div`);s.className=`tcw-style-save`,this.nameInput=document.createElement(`input`),this.nameInput.type=`text`,this.nameInput.placeholder=`Template name`,this.nameInput.className=`tcw-style-name`;let c=document.createElement(`button`);c.type=`button`,c.className=`tcw-style-savebtn`,c.innerHTML=`${_(`plus`,13)}<span>Save</span>`,c.addEventListener(`click`,()=>this.saveTemplate()),s.appendChild(this.nameInput),s.appendChild(c),this.el.appendChild(s),this.templatesEl=document.createElement(`div`),this.templatesEl.className=`tcw-style-templates`,this.el.appendChild(this.templatesEl),e.appendChild(this.el),this.renderTemplates()}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1,this.syncActiveControls(),this.renderTemplates()}close(){this.open=!1,this.el.hidden=!0}destroy(){this.el.remove()}colorRow(){let e=document.createElement(`div`);e.className=`tcw-style-row tcw-style-colors`;for(let t of _e){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-swatch`,n.style.background=t,n.dataset.color=t,n.setAttribute(`aria-label`,t),n.addEventListener(`click`,()=>this.applyStyle({color:t})),e.appendChild(n)}let t=document.createElement(`input`);return t.type=`color`,t.className=`tcw-style-picker`,t.addEventListener(`input`,()=>this.applyStyle({color:t.value})),e.appendChild(t),e}widthRow(){let e=document.createElement(`div`);e.className=`tcw-style-row tcw-style-widths`;for(let t of ve){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-width`,n.dataset.width=String(t);let r=document.createElement(`span`);r.style.height=`${t}px`,n.appendChild(r),n.addEventListener(`click`,()=>this.applyStyle({lineWidth:t})),e.appendChild(n)}return e}lineStyleRow(){let e=document.createElement(`div`);e.className=`tcw-style-row tcw-style-dashes`;for(let t of ye){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-dash`,n.dataset.linestyle=t,n.textContent=t===`solid`?`──`:t===`dashed`?`╌╌`:`┄┄`,n.title=t,n.addEventListener(`click`,()=>this.applyStyle({lineStyle:t})),e.appendChild(n)}return e}applyStyle(e){this.callbacks.onStyleChange(e),this.syncActiveControls()}syncActiveControls(){let e=this.callbacks.getStyle();this.el.querySelectorAll(`.tcw-style-swatch`).forEach(t=>{t.classList.toggle(`tcw-on`,t.dataset.color?.toLowerCase()===e.color?.toLowerCase())}),this.el.querySelectorAll(`.tcw-style-width`).forEach(t=>{t.classList.toggle(`tcw-on`,Number(t.dataset.width)===e.lineWidth)}),this.el.querySelectorAll(`.tcw-style-dash`).forEach(t=>{t.classList.toggle(`tcw-on`,t.dataset.linestyle===e.lineStyle)})}saveTemplate(){let e=this.nameInput.value.trim();e&&(this.store.save(e,this.callbacks.getStyle()),this.nameInput.value=``,this.renderTemplates())}renderTemplates(){this.templatesEl.replaceChildren();let e=this.store.list();if(e.length===0){let e=document.createElement(`div`);e.className=`tcw-style-empty`,e.textContent=`No saved templates`,this.templatesEl.appendChild(e);return}for(let t of e){let e=document.createElement(`div`);e.className=`tcw-style-template`;let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-apply`;let r=document.createElement(`span`);r.className=`tcw-style-tdot`,r.style.background=t.style.color??`var(--tcw-text-muted)`;let i=document.createElement(`span`);i.textContent=t.name,n.appendChild(r),n.appendChild(i),n.addEventListener(`click`,()=>{this.callbacks.onStyleChange({...t.style}),this.syncActiveControls()});let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-style-tdel`,a.setAttribute(`aria-label`,`Delete template`),a.innerHTML=_(`trash`,13),a.addEventListener(`click`,()=>{this.store.remove(t.name),this.renderTemplates()}),e.appendChild(n),e.appendChild(a),this.templatesEl.appendChild(e)}}};function xe(){try{return typeof localStorage<`u`?localStorage:null}catch{return null}}var Se=class{favorites=[];constructor(e=`tcw:draw-favorites`,t=xe()){this.storageKey=e,this.storage=t,this.load()}list(){return[...this.favorites]}has(e){return this.favorites.includes(e)}add(e){!e||this.favorites.includes(e)||(this.favorites=[...this.favorites,e],this.persist())}remove(e){this.favorites.includes(e)&&(this.favorites=this.favorites.filter(t=>t!==e),this.persist())}toggle(e){return this.has(e)?(this.remove(e),!1):(this.add(e),!0)}seedDefaults(e){this.favorites.length>0||(this.favorites=[...new Set(e.filter(Boolean))],this.persist())}load(){if(this.storage)try{let e=this.storage.getItem(this.storageKey);if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&(this.favorites=[...new Set(t.filter(e=>typeof e==`string`))])}catch{}}persist(){if(this.storage)try{this.storage.setItem(this.storageKey,JSON.stringify(this.favorites))}catch{}}},Ce=class{el;labelEl;callbacks;visible=!1;constructor(e,t){this.callbacks=t,this.el=document.createElement(`div`),this.el.className=`tcw-bracket-bar`,this.el.hidden=!0,this.labelEl=document.createElement(`span`),this.labelEl.className=`tcw-bracket-label`,this.el.appendChild(this.labelEl);let n=document.createElement(`span`);n.className=`tcw-bracket-hint`,n.textContent=`drag lines to adjust`,this.el.appendChild(n);let r=document.createElement(`button`);r.type=`button`,r.className=`tcw-bracket-cancel`,r.innerHTML=`${_(`x`,14)}<span>Cancel</span>`,r.addEventListener(`click`,()=>this.callbacks.onCancel());let i=document.createElement(`button`);i.type=`button`,i.className=`tcw-bracket-confirm`,i.innerHTML=`${_(`check`,14)}<span>Place</span>`,i.addEventListener(`click`,()=>this.callbacks.onConfirm()),this.el.appendChild(r),this.el.appendChild(i),e.appendChild(this.el)}show(e){this.visible=!0,this.labelEl.textContent=e===`buy`?`Long bracket`:`Short bracket`,this.labelEl.dataset.side=e,this.el.hidden=!1}hide(){this.visible=!1,this.el.hidden=!0}isVisible(){return this.visible}destroy(){this.el.remove()}},we=class{options;audioCtx=null;audioEl=null;permissionAsked=!1;constructor(e={}){if(this.options=e,typeof e.sound==`string`)try{this.audioEl=new Audio(e.sound),this.audioEl.preload=`auto`}catch{this.audioEl=null}e.desktop&&this.ensurePermission()}setOptions(e){this.options={...this.options,...e}}notify(e){this.options.sound&&this.playSound(),this.options.desktop&&this.showDesktop(e)}playSound(){if(this.audioEl){this.audioEl.currentTime=0,this.audioEl.play().catch(()=>{});return}this.beep()}beep(){try{let e=window.AudioContext??window.webkitAudioContext;if(!e)return;this.audioCtx||=new e;let t=this.audioCtx,n=t.currentTime,r=t.createGain();r.gain.setValueAtTime(1e-4,n),r.gain.exponentialRampToValueAtTime(.2,n+.01),r.gain.exponentialRampToValueAtTime(1e-4,n+.35),r.connect(t.destination);let i=t.createOscillator();i.type=`sine`,i.frequency.setValueAtTime(880,n),i.frequency.setValueAtTime(1320,n+.16),i.connect(r),i.start(n),i.stop(n+.36)}catch{}}ensurePermission(){this.permissionAsked||(this.permissionAsked=!0,!(typeof Notification>`u`)&&Notification.permission===`default`&&Notification.requestPermission().catch(()=>{}))}showDesktop(e){if(!(typeof Notification>`u`)){if(Notification.permission!==`granted`){this.ensurePermission();return}try{new Notification(this.options.title??`Price alert`,{body:e})}catch{}}}destroy(){try{this.audioCtx?.close()}catch{}this.audioCtx=null,this.audioEl=null}};function Te(e,t=12){let n=[...e.asks].sort((e,t)=>e.price-t.price).slice(0,t),r=[...e.bids].sort((e,t)=>t.price-e.price).slice(0,t),i=n.length>0?n[0].price:null,a=r.length>0?r[0].price:null,o=i!==null&&a!==null?(i+a)/2:null,s=new Map,c=e=>{let t=s.get(e);return t||(t={price:e,bidVolume:0,askVolume:0},s.set(e,t)),t};for(let e of n)c(e.price).askVolume+=e.volume;for(let e of r)c(e.price).bidVolume+=e.volume;let l=[...s.values()].sort((e,t)=>t.price-e.price),u=0;for(let e of l)u=Math.max(u,e.bidVolume,e.askVolume);return{rows:l,maxVolume:u,mid:o}}var Ee=class{el;bodyEl;callbacks;open=!1;levels;constructor(e,t,n=12){this.callbacks=t,this.levels=n,this.el=document.createElement(`div`),this.el.className=`tcw-ladder`,this.el.hidden=!0;let r=document.createElement(`div`);r.className=`tcw-ladder-header`;let i=document.createElement(`span`);i.textContent=`Depth Ladder`;let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-ladder-close`,a.setAttribute(`aria-label`,`Close`),a.innerHTML=_(`x`,14),a.addEventListener(`click`,()=>this.close()),r.appendChild(i),r.appendChild(a),this.el.appendChild(r);let o=document.createElement(`div`);o.className=`tcw-ladder-cols`,o.innerHTML=`<span>Bid</span><span>Price</span><span>Ask</span>`,this.el.appendChild(o),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-ladder-body`,this.el.appendChild(this.bodyEl),e.appendChild(this.el)}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1}close(){this.open=!1,this.el.hidden=!0}setData(e){if(!e){this.renderEmpty();return}this.render(Te(e,this.levels))}destroy(){this.el.remove()}renderEmpty(){this.bodyEl.replaceChildren();let e=document.createElement(`div`);e.className=`tcw-ladder-empty`,e.textContent=`No order-book data`,this.bodyEl.appendChild(e)}render(e){if(this.bodyEl.replaceChildren(),e.rows.length===0){this.renderEmpty();return}let t=e.maxVolume>0?1/e.maxVolume:0;for(let n of e.rows){let e=n.askVolume>0,r=document.createElement(`div`);r.className=`tcw-ladder-row`;let i=document.createElement(`button`);i.type=`button`,i.className=`tcw-ladder-cell tcw-ladder-bid`,n.bidVolume>0?(i.textContent=J(n.bidVolume),i.style.setProperty(`--w`,`${(n.bidVolume*t*100).toFixed(1)}%`),i.title=`Sell @ ${this.callbacks.formatPrice(n.price)}`,i.addEventListener(`click`,()=>this.callbacks.onTrade(`sell`,n.price))):i.disabled=!0;let a=document.createElement(`div`);a.className=`tcw-ladder-price ${e?`tcw-ask`:`tcw-bid`}`,a.textContent=this.callbacks.formatPrice(n.price);let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-ladder-cell tcw-ladder-ask`,n.askVolume>0?(o.textContent=J(n.askVolume),o.style.setProperty(`--w`,`${(n.askVolume*t*100).toFixed(1)}%`),o.title=`Buy @ ${this.callbacks.formatPrice(n.price)}`,o.addEventListener(`click`,()=>this.callbacks.onTrade(`buy`,n.price))):o.disabled=!0,r.appendChild(i),r.appendChild(a),r.appendChild(o),this.bodyEl.appendChild(r)}}};function J(e){return e>=1e3?(e/1e3).toFixed(1)+`k`:e>=1?e.toFixed(2).replace(/\.00$/,``):e.toPrecision(2)}var De=class{el;bodyEl;callbacks;open=!1;constructor(e,t){this.callbacks=t,this.el=document.createElement(`div`),this.el.className=`tcw-datawin`,this.el.hidden=!0;let n=document.createElement(`div`);n.className=`tcw-datawin-header`;let r=document.createElement(`span`);r.textContent=`Data Window`;let i=document.createElement(`button`);i.type=`button`,i.className=`tcw-datawin-close`,i.setAttribute(`aria-label`,`Close`),i.innerHTML=_(`x`,14),i.addEventListener(`click`,()=>this.close()),n.appendChild(r),n.appendChild(i),this.el.appendChild(n),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-datawin-body`,this.el.appendChild(this.bodyEl),e.appendChild(this.el)}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1}close(){this.open=!1,this.el.hidden=!0}destroy(){this.el.remove()}render(e){if(!this.open)return;if(this.bodyEl.replaceChildren(),!e.ohlc){let e=document.createElement(`div`);e.className=`tcw-datawin-empty`,e.textContent=`Hover the chart`,this.bodyEl.appendChild(e);return}let t=this.callbacks.formatPrice,n=e.ohlc;this.bodyEl.appendChild(this.row(`Open`,t(n.open))),this.bodyEl.appendChild(this.row(`High`,t(n.high))),this.bodyEl.appendChild(this.row(`Low`,t(n.low))),this.bodyEl.appendChild(this.row(`Close`,t(n.close)));let r=e.change>0?`up`:e.change<0?`down`:``,i=e.change>0?`+`:``;this.bodyEl.appendChild(this.row(`Change`,`${i}${t(e.change)} (${i}${e.changePct.toFixed(2)}%)`,r)),this.bodyEl.appendChild(this.row(`Volume`,ke(n.volume)));for(let t of e.indicators){let e=document.createElement(`div`);e.className=`tcw-datawin-sub`,e.textContent=t.name,this.bodyEl.appendChild(e);for(let e of t.values)this.bodyEl.appendChild(this.row(e.key,Oe(e.value)))}}row(e,t,n=``){let r=document.createElement(`div`);r.className=`tcw-datawin-row`;let i=document.createElement(`span`);i.className=`tcw-datawin-label`,i.textContent=e;let a=document.createElement(`span`);return a.className=`tcw-datawin-value${n?` tcw-${n}`:``}`,a.textContent=t,r.appendChild(i),r.appendChild(a),r}};function Oe(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e3?e.toFixed(2):t>=1?e.toFixed(4):e.toPrecision(4)}function ke(e){return e>=1e9?(e/1e9).toFixed(2)+`B`:e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(2)+`K`:e.toFixed(0)}var Y=globalThis.Buffer;function Ae(e){if(Y)return Y.from(e,`utf8`).toString(`base64`);let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n)}function je(e){if(Y)return Y.from(e,`base64`).toString(`utf8`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return new TextDecoder().decode(n)}function Me(e){return e.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Ne(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+(t.length%4==0?``:`=`.repeat(4-t.length%4))}function Pe(e){return Me(Ae(JSON.stringify(e)))}function Fe(e){if(!e)return null;try{let t=je(Ne(e)),n=JSON.parse(t);return!n||n.v!==1||typeof n.symbol!=`string`?null:{v:1,symbol:n.symbol,timeframe:n.timeframe,chartType:n.chartType,scaleMode:n.scaleMode??`regular`,indicators:Array.isArray(n.indicators)?n.indicators:[],drawings:Array.isArray(n.drawings)?n.drawings:[]}}catch{return null}}var X=`tcw`;function Ie(e){let t=e.startsWith(`#`)?e.slice(1):e;for(let e of t.split(`&`)){let t=e.indexOf(`=`);if(t>0&&e.slice(0,t)===X)return decodeURIComponent(e.slice(t+1))}return null}function Z(e,t){let[n]=e.split(`#`);return`${n}#${X}=${t}`}var Q={"toolbar.indicators":`Indicators`,"toolbar.indicators.popular":`Popular`,"toolbar.indicators.all":`All`,"indicatorType.overlay":`overlay`,"indicatorType.panel":`panel`,"toolbar.replay":`Bar replay`,"toolbar.longBracket":`Long bracket`,"toolbar.shortBracket":`Short bracket`,"toolbar.depthLadder":`Depth ladder`,"toolbar.objects":`Objects`,"toolbar.priceAlerts":`Price alerts`,"toolbar.screenshot":`Screenshot`,"toolbar.settings":`Chart Settings`,"toolbar.toggleTheme":`Toggle theme`,"chartType.candlestick":`Candlestick`,"chartType.line":`Line`,"chartType.area":`Area`,"chartType.bar":`Bar`,"chartType.heikinAshi":`Heikin-Ashi`,"chartType.hollowCandle":`Hollow Candle`,"chartType.baseline":`Baseline`,"chartType.volumeCandles":`Volume Candles`,"chartType.equivolume":`Equivolume`,"chartType.hlcArea":`HLC Area`,"chartType.stepLine":`Step Line`,"chartType.lineWithMarkers":`Line + Markers`,"watchlist.title":`Watchlist`,"status.connecting":`Connecting...`,"status.live":`Live`,"status.connectionFailed":`Connection failed`,"status.loading":`Loading chart...`,"settings.title":`Chart Settings`,"settings.tab.style":`style`,"settings.tab.display":`display`,"settings.tab.scale":`scale`,"settings.resetToDefaults":`Reset to defaults`,"settings.done":`Done`,"settings.section.candleColors":`Candle Colors`,"settings.section.background":`Background`,"hotkeys.title":`Keyboard shortcuts`,"hotkeys.close":`Close`,"hotkeys.gotIt":`Got it`,"hotkeys.group.searchNavigation":`Search & navigation`,"hotkeys.group.chartManipulation":`Chart manipulation`,"hotkeys.group.touch":`Touch (mobile / tablet)`,"hotkeys.group.keyboard":`Keyboard`,"hotkeys.group.drawing":`Drawing`},Le={en:Q,vi:{"toolbar.indicators":`Chỉ báo`,"toolbar.indicators.popular":`Phổ biến`,"toolbar.indicators.all":`Tất cả`,"indicatorType.overlay":`phủ lên`,"indicatorType.panel":`bảng riêng`,"toolbar.replay":`Phát lại`,"toolbar.longBracket":`Lệnh Long`,"toolbar.shortBracket":`Lệnh Short`,"toolbar.depthLadder":`Sổ lệnh`,"toolbar.objects":`Đối tượng`,"toolbar.priceAlerts":`Cảnh báo giá`,"toolbar.screenshot":`Chụp màn hình`,"toolbar.settings":`Cài đặt biểu đồ`,"toolbar.toggleTheme":`Đổi giao diện`,"chartType.candlestick":`Nến`,"chartType.line":`Đường`,"chartType.area":`Vùng`,"chartType.bar":`Thanh`,"chartType.heikinAshi":`Heikin-Ashi`,"chartType.hollowCandle":`Nến rỗng`,"chartType.baseline":`Đường cơ sở`,"chartType.volumeCandles":`Nến khối lượng`,"chartType.equivolume":`Equivolume`,"chartType.hlcArea":`Vùng HLC`,"chartType.stepLine":`Đường bậc thang`,"chartType.lineWithMarkers":`Đường + điểm đánh dấu`,"watchlist.title":`Danh mục theo dõi`,"status.connecting":`Đang kết nối...`,"status.live":`Trực tiếp`,"status.connectionFailed":`Kết nối thất bại`,"status.loading":`Đang tải biểu đồ...`,"settings.title":`Cài đặt biểu đồ`,"settings.tab.style":`Giao diện`,"settings.tab.display":`Hiển thị`,"settings.tab.scale":`Thang giá`,"settings.resetToDefaults":`Khôi phục mặc định`,"settings.done":`Xong`,"settings.section.candleColors":`Màu nến`,"settings.section.background":`Nền`,"hotkeys.title":`Phím tắt`,"hotkeys.close":`Đóng`,"hotkeys.gotIt":`Đã hiểu`,"hotkeys.group.searchNavigation":`Tìm kiếm & điều hướng`,"hotkeys.group.chartManipulation":`Thao tác biểu đồ`,"hotkeys.group.touch":`Cảm ứng (di động / máy tính bảng)`,"hotkeys.group.keyboard":`Bàn phím`,"hotkeys.group.drawing":`Vẽ`}};function Re(e,t){let n={...Q},r=e?Le[e]:void 0;return r&&Object.assign(n,r),t&&Object.assign(n,t),n}function ze(e){return t=>e[t]??Q[t]??t}var Be=[[34,16,28,26,!1],[30,14,24,26,!0],[26,18,20,30,!0],[30,10,24,22,!1],[20,16,14,28,!0],[14,18,8,30,!0],[18,10,12,20,!1],[8,18,2,30,!0]],Ve=class{el;label;showTimer=null;phase=`loading`;constructor(e,t){this.loadingText=t,this.el=document.createElement(`div`),this.el.className=`tcw-loading-overlay`,this.el.setAttribute(`role`,`status`),this.el.setAttribute(`aria-live`,`polite`);let n=document.createElement(`div`);n.className=`tcw-loading-card`;let r=document.createElement(`div`);r.className=`tcw-loading-candles`,r.setAttribute(`aria-hidden`,`true`),Be.forEach(([e,t,n,i,a],o)=>{let s=document.createElement(`span`);s.className=a?`tcw-loading-candle tcw-loading-candle--up`:`tcw-loading-candle`,s.style.setProperty(`--tcw-body-top`,`${e}px`),s.style.setProperty(`--tcw-body-h`,`${t}px`),s.style.setProperty(`--tcw-wick-top`,`${n}px`),s.style.setProperty(`--tcw-wick-h`,`${i}px`),s.style.animationDelay=`${o*110}ms`,r.appendChild(s)}),n.appendChild(r);let i=document.createElement(`div`);i.className=`tcw-loading-track`,i.setAttribute(`aria-hidden`,`true`),i.appendChild(document.createElement(`span`)),n.appendChild(i),this.label=document.createElement(`div`),this.label.className=`tcw-loading-label`,this.label.textContent=t,n.appendChild(this.label),this.el.appendChild(n),e.appendChild(this.el)}begin(e,t=!1){if(this.phase=`loading`,this.clearTimer(),this.label.textContent=this.loadingText,this.el.classList.remove(`tcw-loading-overlay--error`),this.el.classList.toggle(`tcw-loading-overlay--veil`,e),!e||t||this.isShown()){this.el.classList.remove(`tcw-loading-overlay--hidden`);return}this.showTimer=setTimeout(()=>{this.showTimer=null,this.el.classList.remove(`tcw-loading-overlay--hidden`)},200)}end(){this.phase=`idle`,this.clearTimer(),this.el.classList.add(`tcw-loading-overlay--hidden`)}fail(e){this.phase!==`idle`&&(this.phase=`failed`,this.clearTimer(),this.label.textContent=e,this.el.classList.add(`tcw-loading-overlay--error`),this.el.classList.remove(`tcw-loading-overlay--hidden`))}isActive(){return this.phase!==`idle`}hasFailed(){return this.phase===`failed`}isShown(){return!this.el.classList.contains(`tcw-loading-overlay--hidden`)}destroy(){this.clearTimer(),this.el.remove()}clearTimer(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null)}},He=48,Ue=5e4,We=100;function Ge(){return new Promise(e=>{if(typeof requestAnimationFrame!=`function`||document.hidden){setTimeout(e,0);return}let t=setTimeout(e,We);requestAnimationFrame(()=>setTimeout(()=>{clearTimeout(t),e()},0))})}var $=[`#4c8dff`,`#a57cff`,`#1398a8`,`#e25592`,`#8a93a3`,`#62c895`],Ke=class{chart;state;toolbar=null;sidebar=null;settings=null;statusBar=null;commandPalette=null;symbolSearch=null;hotkeySheet=null;replayBar=null;dragDrop=null;alertsPanel=null;objectTree=null;indicatorSettings=null;drawingStyle=null;bracketBar=null;alertNotifier=null;depthLadder=null;dataWindow=null;lastHoverIndex=null;favoritesStore=new Se;watchlist=null;watchlistSparkBuffer=new Map;sessionRefPrice=null;hostWatchlistRefPrice=new Map;watchlistInterval=null;replayOriginalData=null;replayPollInterval=null;replaySpeed=5;layoutKeyPrefix=null;layoutDebounceMs=1500;activeLayoutKey=null;root;chartContainer;loading;connectSeq=0;localSeq=0;lastLocalSwitchMs=0;destroyed=!1;options;symbols;settingsState;t;adapter=null;boundGlobalKeydown=null;baseSeries=null;baseTimeframeMs=0;compares=[];constructor(t,n={}){if(this.options=n,this.symbols=n.symbols??l,this.settingsState={...u,...n.chartOptions?.numberLocale?{numberLocale:n.chartOptions.numberLocale}:{}},this.t=ze(Re(n.locale,n.messages)),n.persistLayouts){let e=n.persistLayouts===!0?{}:n.persistLayouts;this.layoutKeyPrefix=e.keyPrefix??`tcw:layout:`,this.layoutDebounceMs=e.debounceMs??1500}let r=this.resolveIsDark(n.theme),d=this.resolveTheme(n.theme);this.state={symbol:n.symbol??this.symbols[0]??`BTCUSDT`,timeframe:n.timeframe??`5m`,chartType:n.chartOptions?.chartType??`candlestick`,isDark:r,activeIndicators:new Map,activeTool:null,magnetEnabled:!0,connectionState:n.adapter?`connecting`:`disconnected`,connectionMessage:n.adapter?this.t(`status.connecting`):``},m(),this.root=document.createElement(`div`),this.root.className=`tcw-root`,this.root.dataset.tcwTheme=r?`dark`:`light`,t.appendChild(this.root),n.toolbar!==!1&&(this.toolbar=new y(this.root,{symbols:this.symbols,timeframes:n.timeframes?i.filter(e=>n.timeframes.includes(e.value)):i,chartTypes:n.chartTypes?a.filter(e=>n.chartTypes.includes(e.value)):a,indicators:s,popularIndicatorIds:c},{onSymbolClick:()=>this.handleSymbolClick(),onTimeframe:e=>this.handleTimeframe(e),onChartType:e=>this.handleChartType(e),onAddIndicator:e=>this.handleAddIndicator(e),onRemoveIndicator:e=>this.handleRemoveIndicator(e),onScreenshot:()=>this.chart.screenshot(),onSettings:()=>this.openSettings(),onToggleTheme:()=>this.handleToggleTheme(),onToggleReplay:()=>this.toggleReplay(),onToggleAlerts:n.alerts===!1?void 0:()=>this.toggleAlerts(),onToggleObjects:n.objectTree===!1?void 0:()=>this.toggleObjects(),onBracket:n.trading===!1?void 0:e=>this.startBracket(e),onToggleLadder:n.trading!==!1&&n.depthLadder?()=>this.depthLadder?.toggle():void 0},this.t));let f=document.createElement(`div`);if(f.className=`tcw-body`,n.drawingTools!==!1&&(n.drawingFavorites&&this.favoritesStore.seedDefaults(n.drawingFavorites),this.sidebar=new ie(f,{drawingToolGroups:o,favorites:this.favoritesStore.list()},{onDrawingTool:e=>this.handleDrawingTool(e),onCancelDrawing:()=>this.handleCancelDrawing(),onToggleMagnet:()=>this.handleToggleMagnet(),onToggleFavorite:e=>this.handleToggleFavorite(e),onUndo:()=>this.chart.undo(),onRedo:()=>this.chart.redo(),onClearDrawings:()=>{this.chart.clearDrawings(),this.state={...this.state,activeTool:null},this.updateUI()},onToggleStyle:()=>this.drawingStyle?.toggle()})),this.chartContainer=document.createElement(`div`),this.chartContainer.className=`tcw-chart-container`,f.appendChild(this.chartContainer),this.loading=new Ve(this.chartContainer,this.t(`status.loading`)),n.watchlist&&(this.watchlist=new L(f,this.symbols,{onSelect:e=>{this.setSymbol(e)}},this.t(`watchlist.title`)),this.watchlist.setActive(this.state.symbol),this.watchlist.setLocale(this.settingsState.numberLocale||void 0)),this.root.appendChild(f),this.chart=new e.r(this.chartContainer,{chartType:this.state.chartType,theme:d,autoScale:!0,crosshair:{mode:`magnet`},...n.chartOptions,features:{drawings:!0,drawingMagnet:!0,drawingUndoRedo:!0,indicators:!0,trading:n.trading!==!1,tradingContextMenu:!1,volume:!0,legend:!0,crosshair:!0,crosshairTooltip:!1,keyboard:!0,screenshot:!0,alerts:!0,barCountdown:!0,logScale:!0,watermark:!0,...n.chartOptions?.features}}),this.chart.on(`dataUpdate`,e=>this.handleDataUpdate(e.payload)),n.dragDropImport!==!1&&(this.dragDrop=new e.t(this.chartContainer,{onData:(e,t,n)=>{this.setData(e),this.toast(`Loaded ${t.data.length} bars from ${n.name}`+(t.skipped>0?` (${t.skipped} skipped)`:``))},onError:(e,t)=>{this.toast(`${t.name}: ${e.message}`,`error`)}}),this.dragDrop.attach()),n.statusBar!==!1&&(this.statusBar=new se(this.root)),n.settings!==!1&&(this.settings=new oe({onChange:e=>this.applySettings(e),onReset:()=>this.resetSettings(),onClose:()=>{}},this.t)),this.symbolSearch=new x({onPick:e=>{this.setSymbol(e)},onClose:()=>{}}),this.hotkeySheet=new k({onClose:()=>{}},this.t),this.chart.on(`barClick`,e=>{if(!this.replayBar?.isMounted())return;let t=e.payload.barIndex;typeof t==`number`&&(this.chart.getReplayState()===`playing`&&this.chart.replayPause(),this.chart.replaySeek(t),this.replayBar.setState(`paused`))}),this.dataWindow=new De(this.root,{formatPrice:e=>this.formatAlertPrice(e)}),this.chart.on(`crosshairMove`,e=>{let t=e.payload;this.lastHoverIndex=typeof t.barIndex==`number`?t.barIndex:null,this.dataWindow?.isOpen()&&this.dataWindow.render(this.buildDataWindowModel())}),n.drawingTools!==!1&&(this.drawingStyle=new be(this.root,{onStyleChange:e=>{this.chart.setDrawingStyle(e),this.chart.setSelectedDrawingStyle(e)},getStyle:()=>this.chart.getDrawingStyle()},new ge)),n.trading!==!1&&(this.bracketBar=new Ce(this.root,{onConfirm:()=>this.chart.confirmBracket(),onCancel:()=>{this.chart.cancelBracket(),this.bracketBar?.hide()}}),this.chart.on(`bracketPlace`,e=>{let t=e.payload;this.bracketBar?.hide(),this.toast(`${t.side===`buy`?`Long`:`Short`} bracket placed · ${t.riskReward.toFixed(2)}R`)}),n.depthLadder&&(this.depthLadder=new Ee(this.root,{onTrade:(e,t)=>{this.chart.placeOrderIntent({side:e,type:`limit`,price:t}),this.toast(`${e===`buy`?`Buy`:`Sell`} limit @ ${this.formatAlertPrice(t)}`)},formatPrice:e=>this.formatAlertPrice(e)})),this.chart.on(`dataUpdate`,e=>{let t=e.payload;t&&t.bracket===`cancelled`&&this.bracketBar?.hide()})),n.alerts!==!1&&(this.alertsPanel=new G(this.root,{onAdd:(e,t,n,r,i)=>{this.chart.addAlert(e,t,n,r,i)},onRemove:e=>this.chart.removeAlert(e),onClear:()=>this.chart.clearAlerts(),getChannelValue:e=>this.getAlertChannelValue(e),formatPrice:e=>this.formatAlertPrice(e)}),this.chart.on(`alertAdd`,()=>this.refreshAlerts()),this.chart.on(`alertRemove`,()=>this.refreshAlerts()),this.chart.on(`alertUpdate`,()=>this.refreshAlerts()),n.alertNotifications&&(this.alertNotifier=new we(n.alertNotifications)),this.chart.on(`alertTriggered`,e=>{let t=e.payload,n=`Price ${this.formatAlertPrice(t.price)}${t.message?` — ${t.message}`:``}`;this.toast(`🔔 Alert: ${n}`,`info`),this.alertNotifier?.notify(n),this.refreshAlerts()})),n.objectTree!==!1){this.indicatorSettings=new fe(this.root,{onApply:(e,t)=>this.chart.updateIndicator(e,t),onClose:()=>{}}),this.objectTree=new K(this.root,{onRemoveIndicator:e=>this.handleRemoveIndicator(e),onConfigureIndicator:e=>this.openIndicatorSettings(e),onToggleIndicatorVisible:(e,t)=>{this.chart.setIndicatorVisible(e,t),this.refreshObjects()},onRemoveDrawing:e=>{this.chart.removeDrawing(e),this.refreshObjects()},onToggleDrawingVisible:(e,t)=>{this.chart.setDrawingVisible(e,t),this.refreshObjects()},onToggleDrawingLocked:(e,t)=>{this.chart.setDrawingLocked(e,t),this.refreshObjects()},onAddCompare:()=>this.handleAddCompare(),onRemoveCompare:e=>this.handleRemoveCompare(e)});let e=()=>{this.objectTree?.isOpen()&&this.refreshObjects()};this.chart.on(`drawingCreate`,e),this.chart.on(`drawingRemove`,e),this.chart.on(`indicatorAdd`,e),this.chart.on(`indicatorRemove`,e)}if(this.commandPalette=new b({onIndicator:e=>this.handleAddIndicator(e),onChartType:e=>this.handleChartType(e),onDrawingTool:e=>this.handleDrawingTool(e),onTimeframe:e=>this.handleTimeframe(e),onAction:e=>this.handleAction(e),onClose:()=>{}}),this.boundGlobalKeydown=e=>{if((e.ctrlKey||e.metaKey)&&e.key===`k`)e.preventDefault(),this.toggleCommandPalette();else if((e.ctrlKey||e.metaKey)&&(e.key===`p`||e.key===`P`))e.preventDefault(),this.symbolSearch?.open(this.symbols,this.state.symbol);else if(e.key===`?`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;e.preventDefault(),this.hotkeySheet?.open()}},document.addEventListener(`keydown`,this.boundGlobalKeydown),n.adapter&&(this.adapter=n.adapter,this.connectStream()),this.watchlist&&(this.watchlistInterval=setInterval(()=>this.tickWatchlist(),1e3)),this.updateUI(),n.onReady?.(this.chart),n.shareUrl&&typeof location<`u`){let e=Ie(location.hash);e&&this.importState(e)}}setSymbols(e){this.symbols=e,this.watchlist?.setSymbols(e)}async setSymbol(e){this.flushActiveLayout(),this.state={...this.state,symbol:e},this.sessionRefPrice=null,this.options.onSymbolChange?.(e),this.updateUI(),this.watchlist?.setActive(e),this.adapter&&await this.connectStream()}setWatchlistEntry(e,t){t.refPrice!==void 0&&this.hostWatchlistRefPrice.set(e,t.refPrice),this.watchlist?.setEntry(e,t)}tickWatchlist(){if(!this.watchlist)return;let e=this.chart.getData();if(e.length===0)return;let t=e[e.length-1],n=this.hostWatchlistRefPrice.get(this.state.symbol);n===void 0&&this.sessionRefPrice===null&&(this.sessionRefPrice=e[0].open);let r=this.watchlistSparkBuffer.get(this.state.symbol)??[];r.push(t.close),r.length>40&&r.shift(),this.watchlistSparkBuffer.set(this.state.symbol,r),this.watchlist.setEntry(this.state.symbol,{lastPrice:t.close,refPrice:n??this.sessionRefPrice??e[0].open,sparkline:r.slice()})}async setTimeframe(e){if(this.state={...this.state,timeframe:e},this.options.onTimeframeChange?.(e),this.updateUI(),this.adapter){await this.connectStream();return}if(this.options.resampleTimeframes!==!1){if(!this.baseSeries){let e=this.chart.getData();e.length>0&&(this.baseSeries=e,this.baseTimeframeMs=r(e))}await this.switchLocalTimeframe()}}setTheme(e){let t=this.resolveIsDark(e),n=this.resolveTheme(e);this.state={...this.state,isDark:t},this.root.dataset.tcwTheme=t?`dark`:`light`,this.chart.setTheme(n),this.updateUI()}getChart(){return this.chart}destroy(){this.destroyed||(this.destroyed=!0,this.boundGlobalKeydown&&document.removeEventListener(`keydown`,this.boundGlobalKeydown),this.flushActiveLayout(),this.commandPalette?.destroy(),this.symbolSearch?.destroy(),this.hotkeySheet?.destroy(),this.replayPollInterval&&clearInterval(this.replayPollInterval),this.replayBar?.destroy(),this.dragDrop?.detach(),this.alertsPanel?.destroy(),this.objectTree?.destroy(),this.indicatorSettings?.destroy(),this.drawingStyle?.destroy(),this.bracketBar?.destroy(),this.alertNotifier?.destroy(),this.depthLadder?.destroy(),this.dataWindow?.destroy(),this.watchlistInterval&&clearInterval(this.watchlistInterval),this.watchlist?.destroy(),this.toolbar?.destroy(),this.sidebar?.destroy(),this.settings?.destroy(),this.statusBar?.destroy(),this.loading.destroy(),this.chart.destroy(),this.root.remove(),h())}handleSymbolClick(){this.symbolSearch?.open(this.symbols,this.state.symbol)}handleTimeframe(e){this.setTimeframe(e)}setData(e){this.localSeq++,this.baseSeries=e,this.baseTimeframeMs=r(e),this.applyTimeframeData(),this.adapter||this.loading.end()}async switchLocalTimeframe(){if(!this.baseSeries)return;let e=++this.localSeq,t=this.lastLocalSwitchMs>=He||this.baseSeries.length>=Ue;try{if(t&&(this.loading.begin(this.chart.getData().length>0,!0),await Ge(),e!==this.localSeq||this.destroyed))return;this.applyTimeframeData()}finally{e===this.localSeq&&this.loading.end()}}applyTimeframeData(){if(!this.baseSeries)return;let e=performance.now(),r=(0,t.timeframeToMs)(this.state.timeframe);if(this.baseTimeframeMs>0&&r>this.baseTimeframeMs){let e=this.options.weekStartsOn??1;this.chart.setData(n(this.baseSeries,this.state.timeframe,{weekStartsOn:e}))}else this.chart.setData(this.baseSeries);this.lastLocalSwitchMs=performance.now()-e}handleDataUpdate(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.length==`number`){t.length>0&&this.loading.isActive()&&(this.loading.end(),this.state.connectionState===`error`&&this.setConnectionState(`connected`,this.t(`status.live`)));return}if(t.error!==void 0){this.loading.isActive()&&(this.loading.fail(this.t(`status.connectionFailed`)),this.setConnectionState(`error`,t.error||this.t(`status.connectionFailed`)));return}switch(t.connection?.state){case`connected`:this.loading.hasFailed()&&this.loading.end(),!this.loading.isActive()&&this.state.connectionState!==`connected`&&this.setConnectionState(`connected`,this.t(`status.live`));break;case`reconnecting`:this.loading.isActive()||this.setConnectionState(`connecting`,this.t(`status.connecting`));break;case`error`:this.loading.isActive()||this.setConnectionState(`error`,this.t(`status.connectionFailed`));break}}setConnectionState(e,t){this.state={...this.state,connectionState:e,connectionMessage:t},this.updateUI()}toggleAlerts(){this.alertsPanel&&(this.alertsPanel.toggle(),this.alertsPanel.isOpen()&&this.refreshAlerts())}handleToggleFavorite(e){let t=this.favoritesStore.toggle(e);this.sidebar?.setFavorites(this.favoritesStore.list()),this.toast(t?`Pinned to favorites`:`Unpinned`)}exportState(){let e=this.chart.getActiveIndicators().map(e=>({id:e.id,params:e.params}));return Pe({v:1,symbol:this.state.symbol,timeframe:this.state.timeframe,chartType:this.state.chartType,scaleMode:this.chart.getScaleMode(),indicators:e,drawings:this.chart.getDrawings()})}async importState(e){let t=Fe(e);if(!t)return!1;t.symbol&&t.symbol!==this.state.symbol&&await this.setSymbol(t.symbol),t.timeframe&&t.timeframe!==this.state.timeframe&&await this.setTimeframe(t.timeframe),t.chartType&&this.handleChartType(t.chartType),this.chart.setScaleMode(t.scaleMode);for(let[,e]of this.state.activeIndicators)this.chart.removeIndicator(e);let n=new Map;for(let e of t.indicators){let t=this.chart.addIndicator(e.id,e.params);t&&n.set(e.id,t)}return this.state={...this.state,activeIndicators:n},this.chart.setDrawings(t.drawings),this.updateUI(),!0}async copyChartImage(){let e=await this.chart.copyScreenshot();this.toast(e?`Chart image copied`:`Copy failed — image clipboard unavailable`,e?`info`:`error`)}async copyShareLink(){let e=Z(typeof location<`u`?location.href:``,this.exportState());try{await navigator.clipboard.writeText(e),this.toast(`Share link copied`)}catch{this.toast(`Copy failed — clipboard unavailable`,`error`)}}setDepth(e){this.chart.setDepthData(e),this.depthLadder?.setData(e),e&&this.chart.pushDepthSnapshot(e)}startBracket(e){this.chart.startBracket(e)&&this.bracketBar?.show(e)}buildDataWindowModel(){let e=this.chart.getData(),t=this.lastHoverIndex;if(t===null||t<0||t>=e.length)return{ohlc:null,change:0,changePct:0,indicators:[]};let n=e[t],r=t>0?e[t-1].close:n.open,i=n.close-r,a=r===0?0:i/r*100,o=this.chart.getActiveIndicators().map(e=>{let n=this.chart.getIndicatorOutput(e.instanceId)?.series?.[t]??null,r=n?Object.entries(n).filter(([,e])=>typeof e==`number`&&Number.isFinite(e)).map(([e,t])=>({key:e,value:t})):[];return{name:e.descriptor.name,values:r}}).filter(e=>e.values.length>0);return{ohlc:{open:n.open,high:n.high,low:n.low,close:n.close,volume:n.volume},change:i,changePct:a,indicators:o}}toggleDataWindow(){this.dataWindow&&(this.dataWindow.toggle(),this.dataWindow.isOpen()&&this.dataWindow.render(this.buildDataWindowModel()))}toggleObjects(){this.objectTree&&(this.objectTree.toggle(),this.objectTree.isOpen()&&this.refreshObjects())}openIndicatorSettings(e){if(!this.indicatorSettings)return;let t=this.chart.getActiveIndicators().find(t=>t.instanceId===e);t&&this.indicatorSettings.open({instanceId:e,name:t.descriptor.name,defaults:t.descriptor.defaultConfig,params:t.params})}refreshObjects(){if(!this.objectTree)return;let e=this.chart.getActiveIndicators().map(e=>({instanceId:e.instanceId,name:e.descriptor.name,visible:e.visible})),t=this.chart.getDrawings().map(e=>({id:e.id,label:le(e.type),visible:e.visible,locked:e.locked})),n=this.compares.map(e=>({id:e.id,label:e.symbol,color:e.color}));this.objectTree.setObjects(e,t,n)}async handleAddCompare(){if(!this.adapter){this.toast(`Comparison needs a live data adapter`,`error`);return}let e=new Set([this.state.symbol,...this.compares.map(e=>e.symbol)]),t=this.symbols.filter(t=>!e.has(t));this.symbolSearch?.open(t.length?t:this.symbols,this.state.symbol,e=>{this.addCompareSymbol(e)})}async addCompareSymbol(e){if(!this.adapter||this.compares.some(t=>t.symbol===e))return;let t=$[this.compares.length%$.length],n=`cmp_${e}`;try{let r=await this.adapter.fetchHistory(e,this.state.timeframe,this.options.historyLimit??500);this.compares.length===0&&this.chart.setCompareMode(`percent`),this.chart.addCompareSymbol(n,e,r,t),this.compares=[...this.compares,{id:n,symbol:e,color:t}],this.refreshObjects(),this.toast(`Comparing ${e}`)}catch(t){this.toast(`${e}: ${t instanceof Error?t.message:`failed to load`}`,`error`)}}handleRemoveCompare(e){this.chart.removeCompareSymbol(e),this.compares=this.compares.filter(t=>t.id!==e),this.refreshObjects()}async refetchCompares(){if(!this.adapter||this.compares.length===0)return;let e=this.compares.filter(e=>e.symbol===this.state.symbol);for(let t of e)this.handleRemoveCompare(t.id);for(let e of this.compares)try{let t=await this.adapter.fetchHistory(e.symbol,this.state.timeframe,this.options.historyLimit??500);this.chart.updateCompareData(e.id,t)}catch{}}refreshAlerts(){this.alertsPanel&&(this.alertsPanel.setSources(this.buildAlertSources()),this.alertsPanel.setAlerts(this.chart.getAlerts().map(e=>({id:e.id,price:e.price,condition:e.condition,message:e.message,triggered:e.triggered,channel:e.channel,label:e.label}))))}buildAlertSources(){let e=[{channel:`price`,label:`Price`}];for(let t of this.chart.getActiveIndicators()){let n=this.chart.getIndicatorOutput(t.instanceId)?.series,r=n&&n.length>0?n[n.length-1]:null,i=r?Object.keys(r).filter(e=>typeof r[e]==`number`):[];for(let n of i){let r=i.length>1?`${t.descriptor.name} ${n}`:t.descriptor.name;e.push({channel:`${t.instanceId}:${n}`,label:r})}}return e}getAlertChannelValue(e){let t=this.chart.getData();if(e===`price`)return t.length>0?t[t.length-1].close:null;let n=e.indexOf(`:`);if(n<0||t.length===0)return null;let r=e.slice(0,n),i=e.slice(n+1),a=this.chart.getIndicatorOutput(r)?.series?.[t.length-1]?.[i];return typeof a==`number`&&Number.isFinite(a)?a:null}formatAlertPrice(e){let t=Math.abs(e),n=t>=1e3?2:t>=1?4:6,r=this.settingsState.numberLocale||void 0;return e.toLocaleString(r,{minimumFractionDigits:2,maximumFractionDigits:n})}handleChartType(e){this.state={...this.state,chartType:e},this.chart.setChartType(e),this.updateUI()}handleAddIndicator(e){if(this.state.activeIndicators.has(e)){let t=this.state.activeIndicators.get(e);this.chart.removeIndicator(t);let n=new Map(this.state.activeIndicators);n.delete(e),this.state={...this.state,activeIndicators:n}}else{let t=this.chart.addIndicator(e);if(t){let n=new Map(this.state.activeIndicators);n.set(e,t),this.state={...this.state,activeIndicators:n}}}this.updateUI()}handleRemoveIndicator(e){this.chart.removeIndicator(e);let t=new Map(this.state.activeIndicators);for(let[n,r]of t.entries())if(r===e){t.delete(n);break}this.state={...this.state,activeIndicators:t},this.updateUI()}toggleCommandPalette(){if(this.commandPalette?.isOpen()){this.commandPalette.close();return}this.commandPalette?.open(this.buildCommandItems())}buildCommandItems(){let e=[];for(let t of s)e.push({id:t.id,label:t.name,category:`indicator`,active:this.state.activeIndicators.has(t.id)});for(let t of a)e.push({id:t.value,label:t.label,category:`chartType`,active:this.state.chartType===t.value});for(let t of o)for(let n of t.tools)e.push({id:n.value,label:n.label,category:`drawing`,active:this.state.activeTool===n.value});for(let t of i)e.push({id:t.value,label:t.label,category:`timeframe`,active:this.state.timeframe===t.value});return e.push({id:`screenshot`,label:`Screenshot`,category:`action`,shortcut:``},{id:`copyImage`,label:`Copy Chart Image`,category:`action`},{id:`toggleTheme`,label:`Toggle Theme`,category:`action`},{id:`settings`,label:`Settings`,category:`action`},{id:`shareView`,label:`Share View (copy link)`,category:`action`},{id:`autoFib`,label:`Auto Fibonacci (visible swing)`,category:`action`},{id:`dataWindow`,label:`Toggle Data Window`,category:`action`},{id:`clearDrawings`,label:`Clear All Drawings`,category:`action`}),e}handleAction(e){switch(e){case`screenshot`:this.chart.screenshot();break;case`toggleTheme`:this.handleToggleTheme();break;case`settings`:this.openSettings();break;case`copyImage`:this.copyChartImage();break;case`shareView`:this.copyShareLink();break;case`autoFib`:{let e=this.chart.autoFib();this.toast(e?`Auto Fibonacci added`:`No clear swing in view`);break}case`dataWindow`:this.toggleDataWindow();break;case`clearDrawings`:this.chart.clearDrawings(),this.state={...this.state,activeTool:null},this.updateUI();break}}handleDrawingTool(e){this.state={...this.state,activeTool:e},this.chart.setDrawingTool(e),this.updateUI()}handleCancelDrawing(){this.state={...this.state,activeTool:null},this.chart.setDrawingTool(null),this.updateUI()}handleToggleMagnet(){let e=!this.state.magnetEnabled;this.state={...this.state,magnetEnabled:e},this.chart.setDrawingMagnet(e),this.updateUI()}handleToggleTheme(){let e=!this.state.isDark;this.state={...this.state,isDark:e},this.root.dataset.tcwTheme=e?`dark`:`light`,this.chart.setTheme(e?t.DARK_THEME:t.LIGHT_THEME),this.chart.setWatermark(this.state.symbol.replace(`USDT`,` / USDT`),{fontSize:48,color:e?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.03)`}),this.updateUI()}openSettings(){this.settings?.open(this.settingsState)}toast(e,t=`info`){let n=document.createElement(`div`);n.className=`tcw-toast ${t===`error`?`tcw-toast-error`:``}`,n.textContent=e,this.root.appendChild(n),requestAnimationFrame(()=>n.classList.add(`tcw-toast-in`)),setTimeout(()=>{n.classList.remove(`tcw-toast-in`),n.addEventListener(`transitionend`,()=>n.remove(),{once:!0}),setTimeout(()=>n.remove(),400)},3500)}clearSavedLayout(e){if(!this.layoutKeyPrefix)return;let t=e??this.state.symbol;try{localStorage.removeItem(this.layoutKeyPrefix+t)}catch{}}applySymbolLayout(e){if(!this.layoutKeyPrefix)return;let t=this.layoutKeyPrefix+e;this.activeLayoutKey=t;try{this.chart.loadStateFromStorage(t)&&this.rebuildActiveIndicatorsMapFromChart()}catch{}this.chart.setAutoSave(t,this.layoutDebounceMs)}flushActiveLayout(){if(this.activeLayoutKey){try{this.chart.saveState(this.activeLayoutKey)}catch{}this.chart.disableAutoSave(),this.activeLayoutKey=null}}rebuildActiveIndicatorsMapFromChart(){let e=new Map;for(let t of this.chart.getActiveIndicators())e.set(t.id,t.instanceId);this.state={...this.state,activeIndicators:e},this.updateUI()}toggleReplay(){this.replayBar?.isMounted()?this.exitReplay():this.enterReplay()}enterReplay(){let e=this.chart.getData();e.length<2||(this.replayOriginalData=e.slice(),this.replayBar=new j({onPlay:()=>{this.chart.getReplayState()===`paused`?this.chart.replayResume():this.chart.replayStart({speed:this.replaySpeed,interval:200}),this.replayBar?.setState(`playing`)},onPause:()=>{this.chart.replayPause(),this.replayBar?.setState(`paused`)},onStop:()=>{this.chart.replayStop(),this.replayBar?.setState(`paused`)},onStepBack:()=>{let e=this.chart.getReplayProgress();this.chart.getReplayState()===`playing`&&this.chart.replayPause(),this.chart.replaySeek(Math.max(0,e.current-1)),this.replayBar?.setState(`paused`)},onStepForward:()=>{let e=this.chart.getReplayProgress();this.chart.getReplayState()===`playing`&&this.chart.replayPause(),this.chart.replaySeek(Math.min(e.total-1,e.current+1)),this.replayBar?.setState(`paused`)},onSeek:e=>{this.chart.getReplayState()===`playing`&&this.chart.replayPause(),this.chart.replaySeek(e),this.replayBar?.setState(`paused`)},onSpeedChange:e=>{this.replaySpeed=e,this.chart.setReplaySpeed(e)},onClose:()=>this.exitReplay()}),this.replayBar.mount(this.chartContainer,{total:e.length,speed:this.replaySpeed}),this.chart.replayStart({speed:this.replaySpeed,interval:200,startIndex:1}),this.chart.replayPause(),this.replayBar.setState(`paused`),this.replayPollInterval=setInterval(()=>{if(!this.replayBar?.isMounted())return;let e=this.chart.getReplayProgress();this.replayBar.setProgress(e.current,e.total);let t=this.chart.getReplayState();t===`stopped`?this.replayBar.setState(`paused`):this.replayBar.setState(t)},150))}exitReplay(){this.replayPollInterval&&=(clearInterval(this.replayPollInterval),null),this.chart.replayStop(),this.replayBar?.unmount(),this.replayBar=null,this.replayOriginalData&&=(this.chart.setData(this.replayOriginalData),null)}applySettings(e){this.settingsState={...this.settingsState,...e},e.gridVisible!==void 0&&this.chart.setGridVisible(e.gridVisible),e.volumeVisible!==void 0&&this.chart.setVolumeVisible(e.volumeVisible),e.volumeProfileVisible!==void 0&&this.chart.setVolumeProfileVisible(e.volumeProfileVisible),e.marketProfileVisible!==void 0&&this.chart.setMarketProfileVisible(e.marketProfileVisible),e.marketProfileSplit!==void 0&&this.chart.setMarketProfileConfig({splitBySession:e.marketProfileSplit}),e.marketProfileLetters!==void 0&&this.chart.setMarketProfileConfig({letters:e.marketProfileLetters}),e.marketProfileBuckets!==void 0&&this.chart.setMarketProfileConfig({buckets:e.marketProfileBuckets}),e.marketProfileOpacity!==void 0&&this.chart.setMarketProfileConfig({opacity:e.marketProfileOpacity}),e.depthHeatmapVisible!==void 0&&this.chart.setDepthHeatmapVisible(e.depthHeatmapVisible),e.depthHeatmapOpacity!==void 0&&this.chart.setDepthHeatmapConfig({opacity:e.depthHeatmapOpacity}),e.sessionShadingVisible!==void 0&&this.chart.setSessionShadingVisible(e.sessionShadingVisible),e.pivotMarkersVisible!==void 0&&this.chart.setPivotMarkersVisible(e.pivotMarkersVisible),e.pivotStrength!==void 0&&this.chart.setPivotMarkersConfig({left:e.pivotStrength,right:e.pivotStrength}),e.pivotStructureLabels!==void 0&&this.chart.setPivotMarkersConfig({structureLabels:e.pivotStructureLabels}),e.periodLevelsVisible!==void 0&&this.chart.setPeriodLevelsVisible(e.periodLevelsVisible),e.periodLevelsPeriod!==void 0&&this.chart.setPeriodLevelsPeriod(e.periodLevelsPeriod),e.crosshairMode!==void 0&&this.chart.setCrosshairMode(e.crosshairMode),e.autoScale!==void 0&&this.chart.setAutoScale(e.autoScale),e.scaleMode===void 0?e.logScale!==void 0&&(this.chart.setLogScale(e.logScale),this.settingsState={...this.settingsState,scaleMode:e.logScale?`logarithmic`:`regular`}):(this.chart.setScaleMode(e.scaleMode),this.settingsState={...this.settingsState,logScale:e.scaleMode===`logarithmic`}),e.numberLocale!==void 0&&(this.chart.setNumberLocale(e.numberLocale),this.watchlist?.setLocale(e.numberLocale||void 0)),e.timezone!==void 0&&this.chart.setTimezoneOffset(e.timezone===`local`?null:Number(e.timezone));let t={...this.chart.getTheme()},n=!1;e.candleUpColor!==void 0&&(t.candleUp=e.candleUpColor,n=!0),e.candleDownColor!==void 0&&(t.candleDown=e.candleDownColor,n=!0),e.candleUpWick!==void 0&&(t.candleUpWick=e.candleUpWick,n=!0),e.candleDownWick!==void 0&&(t.candleDownWick=e.candleDownWick,n=!0),e.backgroundColor!==void 0&&(t.background=e.backgroundColor,n=!0),e.gridColor!==void 0&&(t.grid=e.gridColor,n=!0),n&&this.chart.setTheme(t)}resetSettings(){this.settingsState={...u},this.applySettings(this.settingsState)}async connectStream(){if(!this.adapter)return;let e=++this.connectSeq;this.state={...this.state,connectionState:`connecting`,connectionMessage:this.t(`status.connecting`)},this.updateUI(),this.loading.begin(this.chart.getData().length>0);try{if(this.chart.disconnectStream(),await this.chart.connect({adapter:this.adapter,symbol:this.state.symbol,timeframe:this.state.timeframe,historyLimit:this.options.historyLimit??500}),e!==this.connectSeq||this.destroyed)return;this.chart.setWatermark(this.state.symbol.replace(`USDT`,` / USDT`),{fontSize:48,color:this.state.isDark?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.03)`}),this.applySymbolLayout(this.state.symbol),this.loading.hasFailed()?this.state={...this.state,connectionState:`error`}:(this.loading.end(),this.state={...this.state,connectionState:`connected`,connectionMessage:this.t(`status.live`)}),this.refetchCompares()}catch(t){if(e!==this.connectSeq||this.destroyed)return;this.loading.fail(this.t(`status.connectionFailed`)),this.state={...this.state,connectionState:`error`,connectionMessage:t instanceof Error?t.message:this.t(`status.connectionFailed`)}}this.updateUI()}updateUI(){this.toolbar?.update(this.state),this.sidebar?.update(this.state),this.statusBar?.update({connectionState:this.state.connectionState,message:this.state.connectionMessage,symbol:this.state.symbol,timeframe:this.state.timeframe})}resolveIsDark(e){return e===void 0||e===`dark`?!0:e===`light`?!1:typeof e==`object`&&e.background?this.isColorDark(e.background):!0}resolveTheme(e){return e===void 0||e===`dark`?t.DARK_THEME:e===`light`?t.LIGHT_THEME:typeof e==`object`?e:t.DARK_THEME}isColorDark(e){if(e.startsWith(`#`)&&e.length>=7){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return t+n+r<384}return!0}};exports.ChartWidget=Ke;
|
|
4286
|
+
`,m=0,h=`tcw-styles`;function g(){if(m++,m>1||document.getElementById(h))return;let e=document.createElement(`style`);e.id=h,e.textContent=p,document.head.insertBefore(e,document.head.firstChild)}function _(){if(m--,m>0)return;let e=document.getElementById(h);e&&e.remove()}var v={cursor:{d:`M6 3.5L18.5 12.5L12.6 13.6L9.7 19.4z`},trendingUp:{d:`M3 17L9 11L13 14.5L21 6.5M15 6.5H21V12.5`},trendingDown:{d:`M3 7L9 13L13 9.5L21 17.5M15 17.5H21V11.5`},minus:{d:`M5 12H19`},plus:{d:`M12 5V19M5 12H19`},penLine:{d:`M14.5 5.5L18.5 9.5M4 20L5 15.5L15.8 4.7a2 2 0 0 1 2.83 0l.67.67a2 2 0 0 1 0 2.83L8.5 19z`},zigzag:{d:`M3 17L8 9L13 15L21 6`},hash:{d:`M5 9H19M5 15H19M10 4L8.5 20M15.5 4L14 20`},square:{d:`M6.5 4.5h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2h-11a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2z`},gitBranch:{d:`M6 3V15M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 9a9 9 0 0 1-9 9`},ruler:{d:`M3.5 16.5L16.5 3.5L20.5 7.5L7.5 20.5zM6.5 13.5L8 15M9.5 10.5L11.5 12.5M12.5 7.5L14 9`},type:{d:`M6 6V4.5H18V6M12 4.5V19.5M9.5 19.5H14.5`},magnet:{d:`M6 4V11a6 6 0 0 0 12 0V4M6 4h3.5v7a2.5 2.5 0 0 0 5 0V4H18M6 8h3.5M14.5 8H18`},magnetStrong:{d:`M6 4V11a6 6 0 0 0 12 0V4M6 4h3.5v7a2.5 2.5 0 0 0 5 0V4H18`,fills:[`M6 4h3.5v4H6z`,`M14.5 4H18v4h-3.5z`]},eraser:{d:`M8.5 19.5L3.9 14.9a1.5 1.5 0 0 1 0-2.1l8.5-8.5a1.5 1.5 0 0 1 2.1 0l5.2 5.2a1.5 1.5 0 0 1 0 2.1L12 19.5zM8 9l7 7M12 19.5H20`},zoomIn:{d:`M16.5 10.5a6 6 0 1 1-12 0 6 6 0 0 1 12 0zM15 15L20.5 20.5M10.5 7.5V13.5M7.5 10.5H13.5`},undo:{d:`M9 14L4 9L9 4M4 9H14.5a5.5 5.5 0 0 1 0 11H11`},redo:{d:`M15 14L20 9L15 4M20 9H9.5a5.5 5.5 0 0 0 0 11H13`},trash:{d:`M4 7H20M9.5 7V4.5h5V7M6.5 7l.8 12.2A1.5 1.5 0 0 0 8.8 20.6h6.4a1.5 1.5 0 0 0 1.5-1.4L17.5 7M10 11v6M14 11v6`},camera:{d:`M4.5 7.5h3L9 5h6l1.5 2.5h3A1.5 1.5 0 0 1 21 9v9.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 18.5V9a1.5 1.5 0 0 1 1.5-1.5zM15.5 13.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z`},settings:{d:`M4 7H14M18 7H20M4 17H8M12 17H20M18 7a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM12 17a2 2 0 1 1-4 0 2 2 0 0 1 4 0z`},moon:{d:`M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z`},sun:{d:`M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0zM12 2.5v2M12 19.5v2M4.6 4.6l1.4 1.4M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4L6 18M18 6l1.4-1.4`},chevronDown:{d:`M6 9L12 15L18 9`},chevronUp:{d:`M6 15L12 9L18 15`},barChart:{d:`M5 20V13M12 20V5M19 20V10`},x:{d:`M6 6L18 18M18 6L6 18`},play:{d:`M7 4.5v15L19.5 12z`},pause:{d:`M8 5V19M16 5V19`},stop:{d:`M7.5 6h9A1.5 1.5 0 0 1 18 7.5v9a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 6 16.5v-9A1.5 1.5 0 0 1 7.5 6z`},receipt:{d:`M6 3.5h12v17l-2-1.25-2 1.25-2-1.25-2 1.25-2-1.25-2 1.25zM9 8h6M9 12h6M9 16h3`},bell:{d:`M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 2H4.5zM10 20.5a2.2 2.2 0 0 0 4 0`},layers:{d:`M12 3.5L21 8.5L12 13.5L3 8.5zM3 12.5L12 17.5L21 12.5M3 16.5L12 21.5L21 16.5`},eye:{d:`M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z`},eyeOff:{d:`M4 4L20 20M9.9 5.8A9.6 9.6 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-2.3 3.1M6.6 7.1C3.9 8.9 2.5 12 2.5 12S6 18.5 12 18.5a9.3 9.3 0 0 0 4.7-1.3M10 10.1a3 3 0 0 0 4 4`},lock:{d:`M7 10.5h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM8 10.5V7.5a4 4 0 0 1 8 0v3`},unlock:{d:`M7 10.5h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM8 10.5V7.5a4 4 0 0 1 7.7-1.5`},palette:{d:`M12 3.5a8.5 8.5 0 0 0 0 17c1.1 0 1.6-.8 1.6-1.6 0-.5-.2-.9-.5-1.2a1.6 1.6 0 0 1 1.2-2.7h1.9a4.3 4.3 0 0 0 4.3-4.3C20.5 6.9 16.7 3.5 12 3.5z`,dots:[[7.5,11.5,1.25],[9.5,7.75,1.25],[14,7.25,1.25]]},check:{d:`M5 12.5L10 17.5L19 7`},maximize:{d:`M8 4H5a1 1 0 0 0-1 1v3M16 4h3a1 1 0 0 1 1 1v3M20 16v3a1 1 0 0 1-1 1h-3M8 20H5a1 1 0 0 1-1-1v-3`},minimize:{d:`M4 8h3a1 1 0 0 0 1-1V4M16 4v3a1 1 0 0 0 1 1h3M20 16h-3a1 1 0 0 0-1 1v3M8 20v-3a1 1 0 0 0-1-1H4`},repeat:{d:`M17 3.5L20.5 7L17 10.5M3.5 11.5V10a3 3 0 0 1 3-3h14M7 20.5L3.5 17L7 13.5M20.5 12.5V14a3 3 0 0 1-3 3h-14`},info:{d:`M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0zM12 11V16.5`,dots:[[12,7.75,1.25]]},chevronLeft:{d:`M15 5L8 12L15 19`},chevronRight:{d:`M9 5L16 12L9 19`},reset:{d:`M4.5 12a7.5 7.5 0 1 0 2.2-5.3M4.5 4v4.5H9`},calendar:{d:`M5.5 5h13a2 2 0 0 1 2 2v11.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3.5 10H20.5M8 3V7M16 3V7`},star:{d:`M12 3.5L14.6 9L20.5 9.6L16 13.6L17.3 19.5L12 16.5L6.7 19.5L8 13.6L3.5 9.6L9.4 9z`},ladder:{d:`M4 6H11M13 6H17M6 10H11M13 10H20M8 14H11M13 14H15M5 18H11M13 18H19`},save:{d:`M5.5 3.5h10.5l4.5 4.5v10.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2v-13a2 2 0 0 1 2-2zM8 3.5v5h7v-5M7.5 20.5v-6h9v6`},folder:{d:`M3.5 7a2 2 0 0 1 2-2h4l2 2.5h7a2 2 0 0 1 2 2V17a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z`},link:{d:`M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1.2 1.2M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1.2-1.2`},arrowUp:{d:`M12 19V5M6 11L12 5L18 11`},arrowDown:{d:`M12 5V19M6 13L12 19L18 13`},more:{dots:[[6,12,1.6],[12,12,1.6],[18,12,1.6]]},layoutGrid:{d:`M5 4.5h4.5a.5.5 0 0 1 .5.5v4.5a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5zM14.5 4.5H19a.5.5 0 0 1 .5.5v4.5a.5.5 0 0 1-.5.5h-4.5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5zM5 14h4.5a.5.5 0 0 1 .5.5V19a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5v-4.5A.5.5 0 0 1 5 14zM14.5 14H19a.5.5 0 0 1 .5.5V19a.5.5 0 0 1-.5.5h-4.5a.5.5 0 0 1-.5-.5v-4.5a.5.5 0 0 1 .5-.5z`}},y={trendLine:{d:`M5 18L19 6`,dots:[[5,18],[19,6]]},ray:{d:`M5 17L21 5M17.5 4.81L21 5L20.2 8.41`,dots:[[5,17],[11,12.5]]},extendedLine:{d:`M3 18.5L21 5M17.5 4.81L21 5L20.2 8.41M6.5 18.69L3 18.5L3.8 15.09`,dots:[[9,14],[15,9.5]]},infoLine:{d:`M5 20L19 10M4.5 3.5h9a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1zM6.5 6.5h5`,dots:[[5,20],[19,10]]},trendAngle:{d:`M5 18L19 7M5 18H20M11 18A6 6 0 0 0 9.71 14.29`,dots:[[5,18],[19,7]]},horizontalLine:{d:`M3 12H21`,dots:[[12,12]]},horizontalRay:{d:`M7 12H21M18.5 9.5L21 12L18.5 14.5`,dots:[[7,12]]},verticalLine:{d:`M12 3V21`,dots:[[12,12]]},crossLine:{d:`M3 12H21M12 3V21`,dots:[[12,12]]},parallelChannel:{d:`M3 15L15 5M9 19L21 9`,dots:[[3,15],[15,5],[9,19]]},regressionChannel:{d:`M3 12L21 4M3 20L21 12`,dash:`M3 16L21 8`,dots:[[3,16],[21,8]]},fibRetracement:{d:`M3 4H21M3 9H21M3 13H21M3 20H21`,dots:[[5,20],[19,4]]},fibExtension:{d:`M3 20L8 10L12 16M14 4H21M14 8H21M14 12H21`,dots:[[3,20],[8,10],[12,16]]},fibChannel:{d:`M3 9L21 3M3 13L21 7M3 16L21 10M3 21L21 15`,dots:[[3,21],[21,15],[3,9]]},fibTimeZones:{d:`M3 4V20M6 4V20M9.5 4V20M14 4V20M20.5 4V20`,dots:[[3,20],[6,20]]},fibSpeedResistanceFan:{d:`M4 20L20 4M4 20L20 11M4 20L20 16M4 20L11 4`,dash:`M4 4H20V20`,dots:[[4,20],[20,4]]},rectangle:{d:`M5.5 6h13A1.5 1.5 0 0 1 20 7.5v9a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 16.5v-9A1.5 1.5 0 0 1 5.5 6z`,dots:[[4,6],[20,18]]},circle:{d:`M19.5 12a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0z`,dots:[[12,12],[19.5,12]]},ellipse:{d:`M20.5 12c0 3-3.8 5.5-8.5 5.5S3.5 15 3.5 12 7.3 6.5 12 6.5s8.5 2.5 8.5 5.5z`,dots:[[3.5,12],[20.5,12]]},triangle:{d:`M12 4.5L20 19H4z`,dots:[[12,4.5],[20,19],[4,19]]},pitchfork:{d:`M4 20L16.75 3M7 9L11.5 3M13 15L21 4.33M7 9L13 15`,dots:[[4,20],[7,9],[13,15]]},schiffPitchfork:{d:`M4 14.5L21 7.42M7 9L21 3.17M13 15L21 11.67M7 9L13 15`,dash:`M4 20V14.5`,dots:[[4,14.5],[7,9],[13,15]]},modifiedSchiffPitchfork:{d:`M5.5 14.5L21 5.89M7 9L17.8 3M13 15L21 10.56M7 9L13 15`,dash:`M4 20L5.5 14.5`,dots:[[5.5,14.5],[7,9],[13,15]]},gannFan:{d:`M4 20L20 4M4 20L20 12M4 20L12 4M4 20L20 16.5M4 20L7.5 4`,dots:[[4,20],[20,4]]},gannBox:{d:`M4 4H20V20H4zM4 20L20 4M4 4L20 20M12 4V20`,dots:[[4,20],[20,4]]},cyclicLines:{d:`M4 4V20M9 4V20M14 4V20M19 4V20`,dots:[[4,20],[9,20]]},xabcdPattern:{d:`M3 18L7 6L11 13L15 8L21 19`,dash:`M3 18L11 13L21 19`,dots:[[3,18],[7,6],[11,13],[15,8],[21,19]]},abcdPattern:{d:`M4 19L9 8L13 14L20 4`,dots:[[4,19],[9,8],[13,14],[20,4]]},headAndShoulders:{d:`M3 19L6 11L8.5 15L12 5L15.5 15L18 11L21 19`,dash:`M4.5 15H19.5`,dots:[[6,11],[12,5],[18,11]]},elliottWave:{d:`M3 19L6 13L8.5 16L14 6L16 10L21 4`,dots:[[3,19],[21,4]]},priceRange:{d:`M5 4H19M5 20H19M12 6.5V17.5M9 9.5L12 6.5L15 9.5M9 14.5L12 17.5L15 14.5`},dateRange:{d:`M4 5V19M20 5V19M6.5 12H17.5M9.5 9L6.5 12L9.5 15M14.5 9L17.5 12L14.5 15`},dateAndPriceRange:{d:`M6 18V4M3 7L6 4L9 7M6 18H20M17 15L20 18L17 21`,dash:`M6 4H20V18`},measure:{d:`M3.5 16.5L16.5 3.5L20.5 7.5L7.5 20.5zM6.5 13.5L8 15M9.5 10.5L11.5 12.5M12.5 7.5L14 9`},text:{d:`M6 6V4.5H18V6M12 4.5V19.5M9.5 19.5H14.5`},priceLabel:{d:`M9 5H19a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 19 19H9L3.5 12zM11 12H17`},arrow:{d:`M5 19L19 5M10 5H19V14`},riskReward:{d:`M5 12V4H19V12M3 12H21`,dash:`M5 12V18H19V12`,dots:[[5,12]]},anchoredVWAP:{d:`M4 18C9 17 12 10 20 7M4 20.5V18`,dots:[[4,18]]},volumeProfileRange:{d:`M6 7H12M6 10.5H17M6 14H15M6 17.5H10`,dash:`M3.5 4V20M20.5 4V20`,dots:[[3.5,20],[20.5,20]]},note:{d:`M5.5 4.5h13v9l-5 5h-8zM13.5 18.5v-5h5M8.5 8.5h7M8.5 11.5h4`},callout:{d:`M10.5 4h9a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM12 12L5 19M12.5 8h5`,dots:[[5,19]]},flag:{d:`M6 21V4M6 4.5h11l-2.5 3.75L17 12H6`,soft:`M6 4.5h11l-2.5 3.75L17 12H6z`,dots:[[6,21]]},arrowMark:{d:`M12 4L18 11H14.5V20H9.5V11H6z`},icon:{d:`M12 3.5l2.6 5.3 5.9.85-4.25 4.15 1 5.85L12 16.9l-5.25 2.75 1-5.85L3.5 9.65l5.9-.85z`},brush:{d:`M3.5 17c2.5 0 3-5 6-5s2.5 5 5.5 5 3.5-6 5.5-9`},highlighter:{d:`M14.5 4.5l5 5L11 18H6v-5zM12 7l5 5M4 21h8`},path:{d:`M4 18L9 10L14 14L20 6M16.2 6.6L20 6L19.6 9.8`,dots:[[4,18],[9,10],[14,14]]},polyline:{d:`M5 17L8 6L16 4L20 14L12 20z`,soft:`M5 17L8 6L16 4L20 14L12 20z`,dots:[[5,17],[8,6],[16,4],[20,14],[12,20]]},curve:{d:`M4 18C8 4 16 4 20 18`,dots:[[4,18],[20,18],[12,7.5]]},arc:{d:`M4 17a8 8 0 0 1 16 0`,dots:[[4,17],[20,17],[12,9]]},fibCircles:{d:`M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16.5 12a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0zM20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0z`,dots:[[12,12],[20,12]]},fibSpiral:{d:`M12 12a1.5 1.5 0 0 1 1.5 1.5 3 3 0 0 1-3 3A4.5 4.5 0 0 1 6 12a6 6 0 0 1 6-6 8 8 0 0 1 8 8`,dots:[[12,12]]},fibArcs:{d:`M10 20a6 6 0 0 0-6-6M14 20a10 10 0 0 0-10-10M18 20a14 14 0 0 0-14-14`,dash:`M4 20L18 6`,dots:[[4,20],[18,6]]},fibWedge:{d:`M4 19L20 7M4 19L20 16M10.4 14.2A8 8 0 0 1 11.86 17.53M14.4 11.2A13 13 0 0 1 16.78 16.6`,dots:[[4,19],[20,7],[20,16]]},pitchfan:{d:`M4 20L14 4M4 20L20 14M4 20L17 9`,dash:`M14 4L20 14`,dots:[[4,20],[14,4],[20,14]]},gannSquare:{d:`M4 4H20V20H4zM4 20L20 4M4 12H20M12 4V20M4 12a8 8 0 0 1 8 8`,dots:[[4,20],[20,4]]},elliottImpulse:{d:`M3 19L7 12L10 15L15 5L17.5 9L21 3`,dots:[[3,19],[21,3]]},elliottCorrection:{d:`M4 5L10 17L14 11L20 20`,dots:[[4,5],[20,20]]},elliottTriangle:{d:`M3 6L7 17L11 9L15 15L18 11L21 13`,dots:[[3,6],[21,13]]},elliottDoubleCombo:{d:`M4 5L9 14L13 9L20 19`,dots:[[4,5],[9,14],[13,9],[20,19]]},elliottTripleCombo:{d:`M3 5L7 13L10 9L14 16L17 12L21 20`,dots:[[3,5],[21,20]]},threeDrives:{d:`M3 20L7 12L9.5 15L14 7L16.5 10L21 3`,dash:`M7 12L14 7L21 3`,dots:[[7,12],[14,7],[21,3]]},cypherPattern:{d:`M3 19L7 9L10 14L15 5L20 16`,dash:`M3 19L10 14L20 16`,dots:[[3,19],[7,9],[10,14],[15,5],[20,16]]},timeCycles:{d:`M3 18a4.5 4.5 0 0 1 9 0a4.5 4.5 0 0 1 9 0`,dots:[[3,18],[12,18]]},sineLine:{d:`M3 12C5 5 7.5 5 9 12S13 19 15 12 19.5 5 21 12`,dots:[[6,6.75],[12,17.25]]},forecast:{d:`M4 18L15.2 7.8M19.5 6a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z`,dots:[[4,18]]},projection:{d:`M12 19L18 11M15.2 11.3L18 11L17.8 13.8`,dash:`M3 17L9 9`,dots:[[3,17],[9,9],[12,19]]},barsPattern:{d:`M5 6V14M9 9V18M15 4V12M19 7V16`,fills:[`M4 8h2v4H4z`,`M8 11h2v5H8z`,`M14 6h2v4h-2z`,`M18 9h2v5h-2z`],dash:`M12 3V21`}},b={candlestick:{d:`M8 3.5V7M8 16V20.5M16 5V8.5M16 15.5V19`,fills:[`M6.5 7h3a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1z`,`M14.5 8.5h3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1z`]},hollowCandle:{d:`M8 3.5V7M8 16V20.5M16 5V8.5M16 15.5V19M6.5 7h3a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zM14.5 8.5h3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1z`},heikinAshi:{d:`M5.5 9.5V12M5.5 18V20M12 5.5V8M12 14V16M18.5 3V4.5M18.5 10.5V12.5`,fills:[`M4 12h3a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5H4a.5.5 0 0 1-.5-.5v-5A.5.5 0 0 1 4 12z`,`M10.5 8h3a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-5a.5.5 0 0 1 .5-.5z`,`M17 4.5h3a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5z`]},bar:{d:`M8 4V20M5 8H8M8 16H11M16 6V18M13 15H16M16 9H19`},volumeCandles:{d:`M6.5 5V8M6.5 16V19M15.5 3.5V6M15.5 16V20`,fills:[`M5.5 8h2a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-7a.5.5 0 0 1 .5-.5z`,`M11.5 6h8a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5z`]},equivolume:{d:`M4.5 10h2a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM10 6h5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zM18.5 4h1a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z`},line:{d:`M3 17L8 11L12 14L21 5`},area:{d:`M3 17L8 11L12 14L21 5`,soft:`M3 17L8 11L12 14L21 5V20H3z`},baseline:{d:`M3 16L7 9L11 14L15 7L21 15`,dash:`M3 12H21`},hlcArea:{d:`M3 9L8 6L13 9L21 4M3 15L8 13L13 16L21 11`,dash:`M3 12L8 9.5L13 12.5L21 7.5`,soft:`M3 9L8 6L13 9L21 4V11L13 16L8 13L3 15z`},stepLine:{d:`M3 18H8V12H12V15H16V7H21`},lineWithMarkers:{d:`M4 17L9 10L14 14L20 6`,dots:[[4,17],[9,10],[14,14],[20,6]]},hiLo:{d:`M6 7V17M12 4V14M18 9V20`,fills:[`M5 7h2v10H5z`,`M11 4h2v10h-2z`,`M17 9h2v11h-2z`]},renko:{d:`M3.5 15.5h4v4h-4zM7.5 11.5h4v4h-4zM11.5 7.5h4v4h-4zM15.5 11.5h4v4h-4z`},lineBreak:{d:`M4 14h4v5H4zM8 10h4v4H8zM16 9h4v8h-4z`,fills:[`M12 5h4v5h-4z`]},kagi:{d:`M4 19V11H9V16H14V5H20V13`},pointAndFigure:{d:`M5.5 5.5l3 3M8.5 5.5l-3 3M5.5 10.5l3 3M8.5 10.5l-3 3M5.5 15.5l3 3M8.5 15.5l-3 3M14.5 9a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M14.5 14a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0`},rangeBars:{d:`M6.5 11V12M6.5 18V19M12 7V8M12 14V15M17.5 3.5V4.5M17.5 10.5V11.5`,fills:[`M5 12h3v6H5z`,`M10.5 8h3v6h-3z`,`M16 4.5h3v6h-3z`]}},re=1.75,ie=.22,ae=new WeakMap;function oe(e){let t=ae.get(e);if(t)return t;let n=``;e.soft&&(n+=`<path d="${e.soft}" fill="currentColor" fill-opacity="${ie}" stroke="none"/>`);for(let t of e.fills??[])n+=`<path d="${t}" fill="currentColor" stroke="none"/>`;e.d&&(n+=`<path d="${e.d}"/>`),e.dash&&(n+=`<path d="${e.dash}" stroke-dasharray="2 2.5"/>`);for(let[t,r,i=re]of e.dots??[])n+=`<circle cx="${t}" cy="${r}" r="${i}" fill="currentColor" stroke="none"/>`;return ae.set(e,n),n}function x(e,t){return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${oe(e)}</svg>`}var se=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;function S(e,t=14){let n=se(v,e);return n?x(n,t):``}function C(e,t=16){return x(se(y,e)??v.penLine,t)}function ce(e,t=14){return x(se(b,e)??v.barChart,t)}function w(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var le=class{trigger;panel;_isOpen=!1;onOutsideClick;onEscapeKey;onTriggerClick;constructor(e,t={}){this.trigger=e,this.panel=document.createElement(`div`),this.panel.className=`tcw-dropdown`,this.panel.style.minWidth=t.width??`200px`,t.align===`right`?this.panel.style.insetInlineEnd=`0px`:this.panel.style.insetInlineStart=`0px`,this.panel.style.display=`none`,e.style.position=`relative`,e.appendChild(this.panel),this.onTriggerClick=()=>{this._isOpen?this.close():this.open()},this.onOutsideClick=e=>{this.trigger.contains(e.target)||this.close()},this.onEscapeKey=e=>{e.key===`Escape`&&this.close()},e.addEventListener(`click`,this.onTriggerClick)}setContent(e){this.panel.innerHTML=e}open(){this._isOpen||(this._isOpen=!0,this.panel.style.display=``,document.addEventListener(`mousedown`,this.onOutsideClick),document.addEventListener(`keydown`,this.onEscapeKey))}close(){this._isOpen&&(this._isOpen=!1,this.panel.style.display=`none`,document.removeEventListener(`mousedown`,this.onOutsideClick),document.removeEventListener(`keydown`,this.onEscapeKey))}isOpen(){return this._isOpen}destroy(){this.trigger.removeEventListener(`click`,this.onTriggerClick),document.removeEventListener(`mousedown`,this.onOutsideClick),document.removeEventListener(`keydown`,this.onEscapeKey),this.panel.remove()}},ue=[`en-US`,`en-GB`,`en-IN`,`de-DE`,`fr-FR`,`es-ES`,`it-IT`,`pt-BR`,`ru-RU`,`tr-TR`,`vi-VN`,`id-ID`,`th-TH`,`zh-CN`,`zh-TW`,`ja-JP`,`ko-KR`],de=65234;function fe(e){return(e&&!ue.includes(e)?[e,...ue]:ue).map(e=>{let t;try{t=new Intl.NumberFormat(e,{minimumFractionDigits:2,maximumFractionDigits:2}).format(de)}catch{t=``}return{value:e,label:t?`${e} (${t})`:e}})}var pe={Lines:`toolGroup.lines`,"Horizontal/Vertical":`toolGroup.horizontalVertical`,Channels:`toolGroup.channels`,Fibonacci:`toolGroup.fibonacci`,Shapes:`toolGroup.shapes`,"Gann & Pitchforks":`toolGroup.gannPitchforks`,Patterns:`toolGroup.patterns`,Measure:`toolGroup.measure`,Annotation:`toolGroup.annotation`,Forecasting:`toolGroup.forecasting`,Brushes:`toolGroup.brushes`,Cycles:`toolGroup.cycles`,"Elliott Waves":`toolGroup.elliott`};function me(e,t){let n=`chartType.${e.value}`,r=t(n);return r===n?e.label:r}function he(e,t){return e.map(e=>({label:pe[e.label]?t(pe[e.label]):e.label,tools:e.tools.map(e=>{let n=`tool.${e.value}`,r=t(n);return{...e,label:r===n?e.label:r}})}))}var ge=0;function _e(e,t){let n=e.querySelector(`.tcw-host-btn-text`)?.textContent??``;n===t?e.removeAttribute(`aria-label`):e.setAttribute(`aria-label`,n?`${t}: ${n}`:t)}var ve=class{config;callbacks;t;el;chartTypeDropdown=null;indicatorDropdown=null;tfGroup=null;tfDropdown=null;tfFavorites=[];uid=(ge++).toString(36);tfRendered=``;themeBtn=null;indicatorTemplates=[];fullscreenBtn=null;hostLeft=null;hostRight=null;constructor(e,t,n,r){this.config=t,this.callbacks=n,this.t=r,this.el=document.createElement(`div`),this.el.className=`tcw-toolbar`,this.build(),e.appendChild(this.el)}build(){let{config:e,callbacks:t,el:n}=this,r=document.createElement(`button`);if(r.className=`tcw-toolbar-symbol`,r.dataset.role=`symbol`,r.addEventListener(`click`,t.onSymbolClick),n.appendChild(r),t.onSymbolInfo){let e=this.iconBtn(`info`,this.t(`symbolInfo.title`),t.onSymbolInfo);e.dataset.role=`symbolInfo`,n.appendChild(e)}if(n.appendChild(this.sep()),this.tfFavorites=[...e.timeframeFavorites??e.timeframes.map(e=>e.value)],this.tfGroup=document.createElement(`div`),this.tfGroup.className=`tcw-toolbar-group tcw-tf-group`,n.appendChild(this.tfGroup),t.onToggleTimeframeFavorite&&e.timeframes.length>0){let e=document.createElement(`div`);e.style.position=`relative`,e.style.display=`inline-flex`;let t=document.createElement(`button`);t.className=`tcw-btn tcw-tf-more`,t.dataset.role=`timeframes`,t.title=this.t(`toolbar.timeframes`),t.setAttribute(`aria-label`,this.t(`toolbar.timeframes`)),t.innerHTML=S(`chevronDown`,12),e.appendChild(t),n.appendChild(e),this.tfDropdown=new le(e,{width:`150px`}),this.buildTimeframeMenu()}n.appendChild(this.sep());let i=document.createElement(`div`);i.style.position=`relative`,i.style.display=`inline-flex`;let a=document.createElement(`button`);a.className=`tcw-dropdown-trigger`,a.dataset.role=`charttype`,i.appendChild(a),n.appendChild(i),this.chartTypeDropdown=new le(i,{width:`160px`}),this.buildChartTypeMenu(),n.appendChild(this.sep());let o=document.createElement(`div`);o.style.position=`relative`,o.style.display=`inline-flex`;let s=document.createElement(`button`);if(s.className=`tcw-dropdown-trigger`,s.dataset.role=`indicators`,o.appendChild(s),n.appendChild(o),this.indicatorDropdown=new le(o,{width:`280px`}),this.buildIndicatorMenu(),this.hostLeft=this.hostGroup(),n.appendChild(this.hostLeft),n.appendChild(this.spacer()),t.onLayouts){let e=t.onLayouts,r=document.createElement(`button`);r.type=`button`,r.className=`tcw-dropdown-trigger tcw-layouts-btn`,r.dataset.role=`layouts`,r.setAttribute(`aria-haspopup`,`menu`),r.addEventListener(`click`,()=>e(r)),n.appendChild(r),this.setLayout(null,!1)}if(this.hostRight=this.hostGroup(),n.appendChild(this.hostRight),t.onToggleReplay){let e=this.iconBtn(`play`,this.t(`toolbar.replay`),t.onToggleReplay);e.dataset.role=`replay`,n.appendChild(e)}if(t.onBracket){let e=t.onBracket,r=this.iconBtn(`trendingUp`,this.t(`toolbar.longBracket`),()=>e(`buy`));r.dataset.role=`long`,r.classList.add(`tcw-btn-long`),n.appendChild(r);let i=this.iconBtn(`trendingDown`,this.t(`toolbar.shortBracket`),()=>e(`sell`));i.dataset.role=`short`,i.classList.add(`tcw-btn-short`),n.appendChild(i)}if(t.onToggleLadder){let e=this.iconBtn(`ladder`,this.t(`toolbar.depthLadder`),t.onToggleLadder);e.dataset.role=`ladder`,n.appendChild(e)}if(t.onToggleAccount){let e=this.iconBtn(`receipt`,this.t(`toolbar.account`),t.onToggleAccount);e.dataset.role=`account`,e.setAttribute(`aria-pressed`,`false`),n.appendChild(e)}if(t.onToggleObjects){let e=this.iconBtn(`layers`,this.t(`toolbar.objects`),t.onToggleObjects);e.dataset.role=`objects`,n.appendChild(e)}if(t.onToggleAlerts){let e=this.iconBtn(`bell`,this.t(`toolbar.priceAlerts`),t.onToggleAlerts);e.dataset.role=`alerts`,n.appendChild(e)}let c=this.iconBtn(`camera`,this.t(`toolbar.screenshot`),t.onScreenshot);n.appendChild(c);let l=this.iconBtn(`settings`,this.t(`toolbar.settings`),t.onSettings);n.appendChild(l),this.themeBtn=this.iconBtn(`moon`,this.t(`toolbar.toggleTheme`),t.onToggleTheme),this.themeBtn.dataset.role=`theme`,n.appendChild(this.themeBtn),t.onToggleFullscreen&&(this.fullscreenBtn=this.iconBtn(`maximize`,this.t(`toolbar.fullscreen`),t.onToggleFullscreen),this.fullscreenBtn.dataset.role=`fullscreen`,this.fullscreenBtn.setAttribute(`aria-pressed`,`false`),n.appendChild(this.fullscreenBtn))}addHostButton(e){let t=document.createElement(`button`);t.type=`button`,t.className=e.text||!e.icon?`tcw-btn tcw-host-btn`:`tcw-btn-icon tcw-host-btn`,t.dataset.hostButton=e.id,t.title=e.label,e.toggle&&t.setAttribute(`aria-pressed`,`false`),typeof e.icon==`string`?t.innerHTML=S(e.icon,14):e.icon&&t.appendChild(e.icon);let n=e.text??(e.icon?``:e.label);if(n){let e=document.createElement(`span`);e.className=`tcw-host-btn-text`,e.textContent=n,t.appendChild(e)}return _e(t,e.label),t.addEventListener(`click`,()=>e.onClick(t)),(e.side===`left`?this.hostLeft:this.hostRight)?.appendChild(t),t}hostGroup(){let e=document.createElement(`div`);return e.className=`tcw-toolbar-host`,e}setActive(e,t){let n=this.el.querySelector(`[data-role="${e}"]`);n&&(n.classList.toggle(`tcw-active`,t),n.setAttribute(`aria-pressed`,String(t)))}setLayout(e,t){let n=this.el.querySelector(`[data-role="layouts"]`);if(!n)return;let r=e??this.t(`layouts.unnamed`),i=`${this.t(`toolbar.layouts`)}: ${r}${t?` (${this.t(`layouts.unsavedChanges`)})`:``}`;n.innerHTML=`${S(`save`,14)}<span class="tcw-layouts-label">${w(r)}</span>`+(t?`<span class="tcw-layouts-dirty" aria-hidden="true"></span>`:``)+S(`chevronDown`,12),n.title=i,n.setAttribute(`aria-label`,i)}setFullscreen(e){if(!this.fullscreenBtn)return;let t=this.t(e?`toolbar.exitFullscreen`:`toolbar.fullscreen`);this.fullscreenBtn.innerHTML=S(e?`minimize`:`maximize`,14),this.fullscreenBtn.title=t,this.fullscreenBtn.setAttribute(`aria-pressed`,String(e))}chartTypeLabel(e){return me(e,this.t)}buildChartTypeMenu(){if(!this.chartTypeDropdown)return;let e=this.config.chartTypes.map(e=>`<button class="tcw-dropdown-item tcw-dropdown-item--icon" data-ct="${w(e.value)}">${ce(e.value,16)}<span>${w(this.chartTypeLabel(e))}</span></button>`).join(``);this.chartTypeDropdown.setContent(e),this.chartTypeDropdown.panel.querySelectorAll(`.tcw-dropdown-item`).forEach(e=>{e.addEventListener(`click`,e=>{let t=e.currentTarget.dataset.ct;this.callbacks.onChartType(t),this.chartTypeDropdown?.close()})})}setSymbolDescription(e){let t=this.el.querySelector(`[data-role="symbol"]`);t&&(e?t.title=e:t.removeAttribute(`title`))}setTimeframes(e,t){this.config={...this.config,timeframes:e},this.setTimeframeFavorites(t)}setTimeframeFavorites(e){this.tfFavorites=[...e],this.tfRendered=``,this.buildTimeframeMenu()}buildTimeframeMenu(){if(!this.tfDropdown)return;let e=w(this.t(`toolbar.timeframes.pin`)),t=w(this.t(`toolbar.timeframes.remove`)),n=`<div class="tcw-dropdown-label">${w(this.t(`toolbar.timeframes`))}</div>`;for(let r of this.config.timeframes){let i=this.tfFavorites.includes(r.value),[a,o]=[w(r.value),w(r.label)];n+=`<div class="tcw-tf-row"><button class="tcw-dropdown-item" data-tf-pick="${a}">${o}</button>`+(r.custom&&this.callbacks.onRemoveTimeframe?`<button class="tcw-tf-remove" data-tf-remove="${a}" title="${t}" aria-label="${t}: ${o}">${S(`x`,12)}</button>`:``)+`<button class="tcw-tf-star${i?` tcw-active`:``}" data-tf-star="${a}" aria-pressed="${i}" title="${e}" aria-label="${e}: ${o}">${S(`star`,12)}</button></div>`}if(this.callbacks.onAddTimeframe){let e=w(this.t(`toolbar.timeframes.custom`)),t=w(this.t(`toolbar.timeframes.add`));n+=`<form class="tcw-tf-custom" novalidate><input class="tcw-tf-custom-input" type="text" autocomplete="off" spellcheck="false" maxlength="6" placeholder="7m, 90m, 2h…" aria-label="${e}" aria-describedby="tcw-tf-hint-${this.uid}"><button type="submit" class="tcw-tf-custom-add" title="${t}" aria-label="${t}">${S(`plus`,12)}</button><div class="tcw-tf-custom-hint" id="tcw-tf-hint-${this.uid}" role="status"></div></form>`}this.tfDropdown.setContent(n);let r=this.tfDropdown.panel;r.querySelectorAll(`[data-tf-pick]`).forEach(e=>{e.addEventListener(`click`,()=>this.callbacks.onTimeframe(e.dataset.tfPick))}),r.querySelectorAll(`[data-tf-star]`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.onToggleTimeframeFavorite?.(e.dataset.tfStar)})}),r.querySelectorAll(`[data-tf-remove]`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.onRemoveTimeframe?.(e.dataset.tfRemove)})});let i=r.querySelector(`.tcw-tf-custom`);i&&this.wireCustomTimeframe(i)}wireCustomTimeframe(e){let t=e.querySelector(`.tcw-tf-custom-input`),n=e.querySelector(`.tcw-tf-custom-hint`);e.addEventListener(`click`,e=>e.stopPropagation()),t.addEventListener(`input`,()=>{t.removeAttribute(`aria-invalid`),n.textContent=``}),e.addEventListener(`submit`,e=>{e.preventDefault(),e.stopPropagation(),this.callbacks.onAddTimeframe?.(t.value)?(t.value=``,n.textContent=``,this.tfDropdown?.close(),this.el.querySelector(`[data-role="timeframes"]`)?.focus()):(t.setAttribute(`aria-invalid`,`true`),n.textContent=this.t(`toolbar.timeframes.invalid`))})}renderTimeframes(e){if(!this.tfGroup)return;let t=this.config.timeframes.filter(t=>this.tfFavorites.includes(t.value)||t.value===e),n=`${t.map(e=>e.value).join(`,`)}|${e}`;n!==this.tfRendered&&(this.tfRendered=n,this.tfGroup.replaceChildren(...t.map(t=>{let n=document.createElement(`button`);return n.className=`tcw-btn`,n.textContent=t.label,n.dataset.tf=t.value,n.classList.toggle(`tcw-active`,t.value===e),n.addEventListener(`click`,()=>this.callbacks.onTimeframe(t.value)),n})),(this.tfDropdown?.panel)?.querySelectorAll(`[data-tf-pick]`).forEach(t=>{t.classList.toggle(`tcw-active`,t.dataset.tfPick===e)}))}setIndicatorTemplates(e,t=!1){this.indicatorTemplates=[...e],this.buildIndicatorMenu(),t&&(this.indicatorDropdown?.panel)?.querySelector(`[data-tpl-save]`)?.focus()}templatesMenuHtml(){if(!this.callbacks.onSaveIndicatorTemplate)return``;let e=this.t(`templates.delete`),n=`<div class="tcw-dropdown-label">${w(this.t(`toolbar.indicators.templates`))}</div>`;for(let r of this.indicatorTemplates){let i=w(r);n+=`<div class="tcw-tf-row"><button class="tcw-dropdown-item" data-tpl-apply="${i}">${S(`layers`,14)}<span>${i}</span></button><button class="tcw-tf-remove" data-tpl-delete="${i}" title="${w(t.r(e,{name:r}))}" aria-label="${w(t.r(e,{name:r}))}">${S(`x`,12)}</button></div>`}return n+=`<button class="tcw-dropdown-item" data-tpl-save>${S(`save`,14)}<span>${w(this.t(`templates.save`))}</span></button>`,n+`<div class="tcw-dropdown-divider"></div>`}buildIndicatorMenu(){if(!this.indicatorDropdown)return;let{indicators:e,popularIndicatorIds:t}=this.config,n=e.filter(e=>t.includes(e.id)),r=e.filter(e=>!t.includes(e.id)),i=e=>this.t(`indicatorType.${e}`),a=e=>`<button class="tcw-dropdown-item" data-ind="${w(e.id)}"><span>${w(e.name)}</span><span class="tcw-tag">${w(i(e.type))}</span></button>`,o=this.templatesMenuHtml();o+=`<div class="tcw-dropdown-label">${w(this.t(`toolbar.indicators.popular`))}</div>`;for(let e of n)o+=a(e);o+=`<div class="tcw-dropdown-divider"></div>`,o+=`<div class="tcw-dropdown-label">${w(this.t(`toolbar.indicators.all`))}</div>`;for(let e of r)o+=a(e);this.indicatorDropdown.setContent(o);let s=this.indicatorDropdown.panel;s.querySelectorAll(`.tcw-dropdown-item[data-ind]`).forEach(e=>{e.addEventListener(`click`,e=>{let t=e.currentTarget.dataset.ind;this.callbacks.onAddIndicator(t)})}),s.querySelectorAll(`[data-tpl-apply]`).forEach(e=>{e.addEventListener(`click`,()=>{this.indicatorDropdown?.close(),this.callbacks.onApplyIndicatorTemplate?.(e.dataset.tplApply)})}),s.querySelectorAll(`[data-tpl-delete]`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.onDeleteIndicatorTemplate?.(e.dataset.tplDelete)})}),s.querySelector(`[data-tpl-save]`)?.addEventListener(`click`,()=>{this.indicatorDropdown?.close(),this.callbacks.onSaveIndicatorTemplate?.()})}update(e){let t=this.el.querySelector(`[data-role="symbol"]`);t&&(t.textContent=e.symbol),this.renderTimeframes(e.timeframe);let n=this.el.querySelector(`[data-role="charttype"]`);if(n){let t=this.config.chartTypes.find(t=>t.value===e.chartType),r=t?this.chartTypeLabel(t):e.chartType;n.innerHTML=`${ce(e.chartType,14)} ${w(r)} ${S(`chevronDown`,12)}`}let r=this.el.querySelector(`[data-role="indicators"]`);if(r){let t=e.activeIndicators.size,n=`${S(`trendingUp`,14)} ${this.t(`toolbar.indicators`)}`;t>0&&(n+=` <span class="tcw-badge-count">${t}</span>`),r.innerHTML=n}this.themeBtn&&(this.themeBtn.innerHTML=e.isDark?S(`moon`,14):S(`sun`,14))}sep(){let e=document.createElement(`span`);return e.className=`tcw-toolbar-sep`,e}spacer(){let e=document.createElement(`span`);return e.className=`tcw-toolbar-spacer`,e}iconBtn(e,t,n){let r=document.createElement(`button`);return r.className=`tcw-btn-icon`,r.title=t,r.innerHTML=S(e,14),r.addEventListener(`click`,n),r}destroy(){this.chartTypeDropdown?.destroy(),this.indicatorDropdown?.destroy(),this.el.remove()}},T=16,ye=150,be=4;function xe(e,t){for(let n of e){let e=n.tools.find(e=>e.value===t);if(e)return e.label}return t}var Se=class{config;callbacks;el;groupWraps=[];groupButtons=[];groupIcons=[];groupTools=[];cursorBtn=null;magnetBtn=null;eraserBtn=null;zoomBtn=null;stayBtn=null;flyoutEl=null;flyoutIdx=-1;flyoutHideTimer=null;favoritesEl=null;favoritesDivider=null;favorites=[];constructor(e,n,r,i=t.t){this.host=e,this.t=i,this.config=n,this.callbacks=r,this.el=document.createElement(`div`),this.el.className=`tcw-sidebar`,this.build(),this.el.addEventListener(`scroll`,()=>this.hideFlyout(),{passive:!0}),e.appendChild(this.el)}build(){let{config:e,callbacks:t,el:n}=this;this.cursorBtn=document.createElement(`button`),this.cursorBtn.className=`tcw-sidebar-btn`,this.cursorBtn.title=this.t(`drawing.cursor`),this.cursorBtn.innerHTML=S(`cursor`,14),this.cursorBtn.addEventListener(`click`,t.onCancelDrawing),n.appendChild(this.cursorBtn),n.appendChild(this.divider()),t.onToggleFavorite&&(this.favorites=[...e.favorites??[]],this.favoritesEl=document.createElement(`div`),this.favoritesEl.className=`tcw-sidebar-favorites`,n.appendChild(this.favoritesEl),this.favoritesDivider=this.divider(),n.appendChild(this.favoritesDivider),this.renderFavorites()),e.drawingToolGroups.forEach((e,r)=>{let i=document.createElement(`div`);i.className=`tcw-tool-group-wrap`;let a=document.createElement(`button`);a.className=`tcw-sidebar-btn`;let o=e.tools[0]?.value;if(!o)return;e.tools.length>1?a.setAttribute(`aria-label`,`${e.label}: ${e.tools[0].label}`):a.title=e.label;let s=document.createElement(`span`);if(s.className=`tcw-sidebar-icon`,s.innerHTML=C(o,T),a.appendChild(s),this.groupIcons.push(s),this.groupTools.push(o),e.tools.length>1){let e=document.createElement(`span`);e.className=`tcw-multi-dot`,a.appendChild(e)}a.addEventListener(`click`,()=>t.onDrawingTool(this.groupTools[r])),i.appendChild(a),i.addEventListener(`mouseenter`,()=>this.showFlyout(r)),i.addEventListener(`mouseleave`,()=>this.scheduleHideFlyout()),e.tools.length>1&&(a.setAttribute(`aria-haspopup`,`menu`),a.setAttribute(`aria-expanded`,`false`),a.addEventListener(`keydown`,e=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),this.showFlyout(r),this.focusFlyoutItem(0)):e.key===`Escape`&&this.flyoutEl&&(e.stopPropagation(),this.hideFlyout())})),i.addEventListener(`focusout`,e=>{let t=e.relatedTarget;!i.contains(t)&&!this.flyoutEl?.contains(t)&&this.scheduleHideFlyout()}),n.appendChild(i),this.groupWraps.push(i),this.groupButtons.push(a)});let r=document.createElement(`div`);if(r.className=`tcw-sidebar-spacer`,n.appendChild(r),n.appendChild(this.divider()),t.onToggleStyle){let e=document.createElement(`button`);e.className=`tcw-sidebar-btn`,e.title=this.t(`drawing.style`),e.dataset.role=`style`,e.innerHTML=S(`palette`,14),e.addEventListener(`click`,t.onToggleStyle),n.appendChild(e)}t.onToggleMagnet&&(this.magnetBtn=document.createElement(`button`),this.magnetBtn.className=`tcw-sidebar-btn`,this.magnetBtn.title=this.t(`drawing.magnet`),this.magnetBtn.innerHTML=S(`magnet`,14),this.magnetBtn.addEventListener(`click`,t.onToggleMagnet),n.appendChild(this.magnetBtn)),t.onToggleEraser&&(this.eraserBtn=this.toggleButton(`eraser`,this.t(`drawing.eraser`),t.onToggleEraser),n.appendChild(this.eraserBtn)),t.onToggleZoomArea&&(this.zoomBtn=this.toggleButton(`zoomIn`,this.t(`drawing.zoomArea`),t.onToggleZoomArea),n.appendChild(this.zoomBtn)),t.onToggleStayInDrawing&&(this.stayBtn=document.createElement(`button`),this.stayBtn.className=`tcw-sidebar-btn`,this.stayBtn.dataset.role=`stay`,this.stayBtn.title=this.t(`drawing.stay`),this.stayBtn.setAttribute(`aria-pressed`,`false`),this.stayBtn.innerHTML=S(`repeat`,14),this.stayBtn.addEventListener(`click`,t.onToggleStayInDrawing),n.appendChild(this.stayBtn));let i=document.createElement(`button`);i.className=`tcw-sidebar-btn`,i.title=this.t(`drawing.undo`),i.innerHTML=S(`undo`,14),i.addEventListener(`click`,t.onUndo),n.appendChild(i);let a=document.createElement(`button`);a.className=`tcw-sidebar-btn`,a.title=this.t(`drawing.redo`),a.innerHTML=S(`redo`,14),a.addEventListener(`click`,t.onRedo),n.appendChild(a);let o=document.createElement(`button`);o.className=`tcw-sidebar-btn tcw-danger`,o.title=this.t(`drawing.clearAll`),o.innerHTML=S(`trash`,14),o.addEventListener(`click`,t.onClearDrawings),n.appendChild(o)}setFavorites(e){this.favorites=[...e],this.renderFavorites()}renderFavorites(){if(!this.favoritesEl)return;this.favoritesEl.replaceChildren();let e=this.favorites.length>0;this.favoritesEl.style.display=e?``:`none`,this.favoritesDivider&&(this.favoritesDivider.style.display=e?``:`none`);for(let e of this.favorites){let n=document.createElement(`button`);n.className=`tcw-sidebar-btn`,n.title=t.r(this.t(`sidebar.unpinHint`),{tool:xe(this.config.drawingToolGroups,e)}),n.dataset.toolValue=e,n.innerHTML=C(e,T),n.addEventListener(`click`,()=>this.callbacks.onDrawingTool(e)),n.addEventListener(`contextmenu`,t=>{t.preventDefault(),this.callbacks.onToggleFavorite?.(e)}),this.favoritesEl.appendChild(n)}}showFlyout(e){if(this.cancelHideFlyout(),this.flyoutEl&&this.flyoutIdx===e)return;let t=this.config.drawingToolGroups[e];if(!t||t.tools.length<=1){this.hideFlyout();return}this.hideFlyout();let n=document.createElement(`div`);n.className=`tcw-flyout`,n.setAttribute(`role`,`menu`),n.setAttribute(`aria-label`,t.label),n.addEventListener(`keydown`,t=>this.onFlyoutKey(t,e));let r=document.createElement(`div`);r.className=`tcw-flyout-header`,r.textContent=t.label,n.appendChild(r);for(let e of t.tools){let t=document.createElement(`button`);t.className=`tcw-flyout-item`,t.setAttribute(`role`,`menuitem`),t.tabIndex=-1,t.innerHTML=C(e.value,T);let r=document.createElement(`span`);r.textContent=e.label,t.appendChild(r),t.dataset.toolValue=e.value,t.addEventListener(`click`,()=>{this.callbacks.onDrawingTool(e.value),this.hideFlyout()}),this.callbacks.onToggleFavorite&&(this.favorites.includes(e.value)&&t.classList.add(`tcw-flyout-faved`),t.addEventListener(`contextmenu`,t=>{t.preventDefault(),this.callbacks.onToggleFavorite?.(e.value)})),n.appendChild(t)}if(this.callbacks.onToggleFavorite){let e=document.createElement(`div`);e.className=`tcw-flyout-hint`,e.textContent=this.t(`drawing.pinHint`),n.appendChild(e)}n.addEventListener(`mouseenter`,()=>this.cancelHideFlyout()),n.addEventListener(`mouseleave`,()=>this.scheduleHideFlyout()),n.addEventListener(`focusout`,t=>{let r=t.relatedTarget;!n.contains(r)&&!this.groupWraps[e].contains(r)&&this.scheduleHideFlyout()}),this.flyoutEl=n,this.flyoutIdx=e,this.host.appendChild(n),this.placeFlyout(n,this.groupButtons[e]),this.groupButtons[e].setAttribute(`aria-expanded`,`true`)}flyoutItems(){return this.flyoutEl?[...this.flyoutEl.querySelectorAll(`.tcw-flyout-item`)]:[]}focusFlyoutItem(e){let t=this.flyoutItems();t.length!==0&&t[(e+t.length)%t.length].focus()}onFlyoutKey(e,t){let n=this.flyoutItems(),r=n.indexOf(document.activeElement);switch(e.key){case`ArrowDown`:this.focusFlyoutItem(r+1);break;case`ArrowUp`:this.focusFlyoutItem(r-1);break;case`Home`:this.focusFlyoutItem(0);break;case`End`:this.focusFlyoutItem(n.length-1);break;case`Escape`:case`ArrowLeft`:e.stopPropagation(),this.hideFlyout(),this.groupButtons[t]?.focus();break;case`Tab`:this.hideFlyout(),this.groupButtons[t]?.focus();return;default:return}e.preventDefault()}placeFlyout(e,t){let n=this.host.getBoundingClientRect(),r=t.getBoundingClientRect();e.style.maxHeight=`${Math.max(0,this.host.clientHeight-be*2)}px`;let i=this.host.clientHeight-e.offsetHeight-be;this.host.closest(`[dir]`)?.getAttribute(`dir`)===`rtl`?(e.style.left=``,e.style.right=`${n.right-r.left}px`):(e.style.right=``,e.style.left=`${r.right-n.left}px`),e.style.top=`${Math.max(0,Math.min(r.top-n.top,i))}px`}scheduleHideFlyout(){this.cancelHideFlyout(),this.flyoutHideTimer=setTimeout(()=>{this.flyoutHideTimer=null,this.hideFlyout()},ye)}cancelHideFlyout(){this.flyoutHideTimer!==null&&(clearTimeout(this.flyoutHideTimer),this.flyoutHideTimer=null)}hideFlyout(){this.cancelHideFlyout(),this.flyoutEl&&=(this.flyoutEl.remove(),null),this.groupButtons[this.flyoutIdx]?.setAttribute(`aria-expanded`,`false`),this.flyoutIdx=-1}update(e){this.cursorBtn&&this.cursorBtn.classList.toggle(`tcw-active`,e.activeTool===null);let{drawingToolGroups:t}=this.config;for(let n=0;n<t.length;n++){let r=t[n].tools.some(t=>t.value===e.activeTool);this.groupButtons[n].classList.toggle(`tcw-active`,r),r&&e.activeTool&&e.activeTool!==this.groupTools[n]&&(this.groupTools[n]=e.activeTool,this.groupIcons[n].innerHTML=C(e.activeTool,T),t[n].tools.length>1&&this.groupButtons[n].setAttribute(`aria-label`,`${t[n].label}: ${xe(t,e.activeTool)}`))}if(this.flyoutEl&&this.flyoutEl.querySelectorAll(`.tcw-flyout-item`).forEach(t=>{let n=t;n.classList.toggle(`tcw-active`,n.dataset.toolValue===e.activeTool)}),this.magnetBtn){let t=e.magnetEnabled&&e.magnetStrong;this.magnetBtn.classList.toggle(`tcw-active`,e.magnetEnabled),this.magnetBtn.innerHTML=S(t?`magnetStrong`:`magnet`,14),this.magnetBtn.title=t?this.t(`drawing.magnetStrong`):e.magnetEnabled?this.t(`drawing.magnetOn`):this.t(`drawing.magnetOff`),this.magnetBtn.setAttribute(`aria-label`,this.magnetBtn.title)}for(let[t,n]of[[this.eraserBtn,e.eraser],[this.zoomBtn,e.zoomArea]])t&&(t.classList.toggle(`tcw-active`,n),t.setAttribute(`aria-pressed`,String(n)));this.stayBtn&&(this.stayBtn.classList.toggle(`tcw-active`,e.stayInDrawing),this.stayBtn.setAttribute(`aria-pressed`,String(e.stayInDrawing)))}toggleButton(e,t,n){let r=document.createElement(`button`);return r.className=`tcw-sidebar-btn`,r.title=t,r.setAttribute(`aria-label`,t),r.setAttribute(`aria-pressed`,`false`),r.innerHTML=S(e,14),r.addEventListener(`click`,n),r}divider(){let e=document.createElement(`div`);return e.className=`tcw-sidebar-divider`,e}destroy(){this.hideFlyout(),this.el.remove()}},Ce=[`style`,`display`,`scale`],we=class{callbacks;t;backdrop=null;modal=null;currentTab=`style`;currentSettings=null;bodyEl=null;tabButtons=[];chartType=null;constructor(e,t,n={},r=()=>document.body){this.available=n,this.host=r,this.callbacks=e,this.t=t}open(e,t=null){this.currentSettings={...e},this.chartType=t,this.currentTab=`style`,this.buildModal()}isOpen(){return this.modal!==null}refresh(e){this.modal&&(this.currentSettings={...e},this.renderTabContent())}close(){this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.bodyEl=null,this.tabButtons=[]}buildModal(){this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>{this.callbacks.onClose(),this.close()}),this.host().appendChild(this.backdrop),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal`;let e=document.createElement(`div`);e.className=`tcw-modal-header`;let t=document.createElement(`h3`);t.textContent=this.t(`settings.title`),e.appendChild(t);let n=document.createElement(`button`);n.className=`tcw-modal-close`,n.innerHTML=S(`x`,16),n.addEventListener(`click`,()=>{this.callbacks.onClose(),this.close()}),e.appendChild(n),this.modal.appendChild(e);let r=document.createElement(`div`);r.className=`tcw-modal-tabs`,this.tabButtons=[];for(let e of Ce){let t=document.createElement(`button`);t.className=`tcw-modal-tab`,t.textContent=this.t(`settings.tab.${e}`),t.dataset.tab=e,e===this.currentTab&&t.classList.add(`tcw-active`),t.addEventListener(`click`,()=>{this.currentTab=e,this.tabButtons.forEach(t=>t.classList.toggle(`tcw-active`,t.dataset.tab===e)),this.renderTabContent()}),r.appendChild(t),this.tabButtons.push(t)}this.modal.appendChild(r),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-modal-body`,this.modal.appendChild(this.bodyEl),this.renderTabContent();let i=document.createElement(`div`);i.className=`tcw-modal-footer`;let a=document.createElement(`button`);a.className=`tcw-reset-link`,a.textContent=this.t(`settings.resetToDefaults`),a.addEventListener(`click`,()=>this.callbacks.onReset()),i.appendChild(a);let o=document.createElement(`button`);o.className=`tcw-done-btn`,o.textContent=this.t(`settings.done`),o.addEventListener(`click`,()=>{this.callbacks.onClose(),this.close()}),i.appendChild(o),this.modal.appendChild(i),this.host().appendChild(this.modal);let s=e=>{e.key===`Escape`&&(document.removeEventListener(`keydown`,s),this.callbacks.onClose(),this.close())};document.addEventListener(`keydown`,s)}renderTabContent(){if(!(!this.bodyEl||!this.currentSettings))switch(this.bodyEl.innerHTML=``,this.currentTab){case`style`:this.renderStyleTab();break;case`display`:this.renderDisplayTab();break;case`scale`:this.renderScaleTab();break}}renderStyleTab(){if(!this.bodyEl||!this.currentSettings)return;let e=this.currentSettings;this.renderChartTypeSection();let t=this.section(this.t(`settings.section.candleColors`));t.appendChild(this.colorRow(this.t(`settings.upBody`),e.candleUpColor,e=>this.patch({candleUpColor:e}))),t.appendChild(this.colorRow(this.t(`settings.downBody`),e.candleDownColor,e=>this.patch({candleDownColor:e}))),t.appendChild(this.colorRow(this.t(`settings.upWick`),e.candleUpWick,e=>this.patch({candleUpWick:e}))),t.appendChild(this.colorRow(this.t(`settings.downWick`),e.candleDownWick,e=>this.patch({candleDownWick:e}))),this.bodyEl.appendChild(t);let n=this.section(this.t(`settings.section.background`));n.appendChild(this.colorRow(this.t(`settings.background`),e.backgroundColor,e=>this.patch({backgroundColor:e}))),n.appendChild(this.colorRow(this.t(`settings.grid`),e.gridColor,e=>this.patch({gridColor:e}))),this.bodyEl.appendChild(n)}renderDisplayTab(){if(!this.bodyEl||!this.currentSettings)return;let e=this.currentSettings,t=this.section();t.appendChild(this.toggleRow(this.t(`settings.mainSeries`),e.mainSeriesVisible,e=>this.patch({mainSeriesVisible:e}))),t.appendChild(this.toggleRow(this.t(`settings.highLowLines`),e.highLowLines,e=>this.patch({highLowLines:e}))),t.appendChild(this.toggleRow(this.t(`settings.extendedHours`),e.extendedHours,e=>this.patch({extendedHours:e}))),t.appendChild(this.toggleRow(this.t(`settings.gridLines`),e.gridVisible,e=>this.patch({gridVisible:e}))),t.appendChild(this.toggleRow(this.t(`settings.volume`),e.volumeVisible,e=>this.patch({volumeVisible:e}))),t.appendChild(this.toggleRow(this.t(`settings.volumeProfile`),e.volumeProfileVisible,e=>this.patch({volumeProfileVisible:e}))),t.appendChild(this.toggleRow(this.t(`settings.marketProfile`),e.marketProfileVisible,e=>this.patch({marketProfileVisible:e}))),t.appendChild(this.toggleRow(this.t(`settings.marketProfileSplit`),e.marketProfileSplit,e=>this.patch({marketProfileSplit:e}))),t.appendChild(this.toggleRow(this.t(`settings.marketProfileLetters`),e.marketProfileLetters,e=>this.patch({marketProfileLetters:e}))),t.appendChild(this.rangeRow(this.t(`settings.marketProfileBuckets`),e.marketProfileBuckets,8,200,1,e=>this.patch({marketProfileBuckets:e}))),t.appendChild(this.rangeRow(this.t(`settings.marketProfileOpacity`),e.marketProfileOpacity,.05,1,.05,e=>this.patch({marketProfileOpacity:e}),e=>`${Math.round(e*100)}%`)),t.appendChild(this.toggleRow(this.t(`settings.depthHeatmap`),e.depthHeatmapVisible,e=>this.patch({depthHeatmapVisible:e}))),t.appendChild(this.rangeRow(this.t(`settings.depthHeatmapOpacity`),e.depthHeatmapOpacity,.1,1,.05,e=>this.patch({depthHeatmapOpacity:e}),e=>`${Math.round(e*100)}%`)),t.appendChild(this.toggleRow(this.t(`settings.swingMarkers`),e.pivotMarkersVisible,e=>this.patch({pivotMarkersVisible:e}))),t.appendChild(this.rangeRow(this.t(`settings.swingStrength`),e.pivotStrength,2,20,1,e=>this.patch({pivotStrength:e}))),t.appendChild(this.toggleRow(this.t(`settings.swingStructure`),e.pivotStructureLabels,e=>this.patch({pivotStructureLabels:e}))),t.appendChild(this.toggleRow(this.t(`settings.sessionShading`),e.sessionShadingVisible,e=>this.patch({sessionShadingVisible:e}))),t.appendChild(this.toggleRow(this.t(`settings.periodLevels`),e.periodLevelsVisible,e=>this.patch({periodLevelsVisible:e}))),t.appendChild(this.selectRow(this.t(`settings.periodLevelsBasis`),e.periodLevelsPeriod,[{value:`day`,label:this.t(`settings.priorDay`)},{value:`week`,label:this.t(`settings.priorWeek`)}],e=>this.patch({periodLevelsPeriod:e}))),t.appendChild(this.toggleRow(this.t(`settings.ohlcLegend`),e.legendVisible,e=>this.patch({legendVisible:e}))),t.appendChild(this.toggleRow(this.t(`settings.indicatorValues`),e.indicatorValueLabels,e=>this.patch({indicatorValueLabels:e}))),this.available.barCountdown!==!1&&t.appendChild(this.toggleRow(this.t(`settings.barCountdown`),e.barCountdown,e=>this.patch({barCountdown:e}))),t.appendChild(this.selectRow(this.t(`settings.crosshairMode`),e.crosshairMode,[{label:this.t(`settings.crosshair.magnet`),value:`magnet`},{label:this.t(`settings.crosshair.normal`),value:`normal`},{label:this.t(`settings.crosshair.hidden`),value:`hidden`}],e=>this.patch({crosshairMode:e}))),t.appendChild(this.selectRow(this.t(`settings.timezone`),e.timezone,l(e.timezone,Date.now(),this.t(`settings.timezone.local`),this.available.exchangeZone?{label:this.t(`settings.timezone.exchange`),zone:this.available.exchangeZone()}:void 0),e=>this.patch({timezone:e}))),t.appendChild(this.selectRow(this.t(`settings.numberLocale`),e.numberLocale,fe(e.numberLocale),e=>this.patch({numberLocale:e}))),this.bodyEl.appendChild(t)}renderScaleTab(){if(!this.bodyEl||!this.currentSettings)return;let e=this.currentSettings,t=this.section();t.appendChild(this.toggleRow(this.t(`settings.autoScale`),e.autoScale,e=>this.patch({autoScale:e}))),t.appendChild(this.toggleRow(this.t(`settings.invertScale`),e.invertScale,e=>this.patch({invertScale:e}))),t.appendChild(this.toggleRow(this.t(`settings.leftScale`),e.leftPriceScale,e=>this.patch({leftPriceScale:e})));let n=[{value:`regular`,label:this.t(`settings.scale.regular`)},{value:`logarithmic`,label:this.t(`settings.scale.logarithmic`)},{value:`percentage`,label:this.t(`settings.scale.percentage`)},{value:`indexedTo100`,label:this.t(`settings.scale.indexedTo100`)}].filter(e=>e.value!==`logarithmic`||this.available.logScale!==!1);t.appendChild(this.selectRow(this.t(`settings.priceScale`),e.scaleMode,n,e=>this.patch({scaleMode:e}))),this.bodyEl.appendChild(t)}renderChartTypeSection(){if(!this.bodyEl||!this.currentSettings||!this.chartType)return;let e=this.chartType,t=this.currentSettings.chartTypeOptions??{},n=u.find(t=>t.value===e),r=this.section(n?me(n,this.t):e),i=(e,t)=>this.patch({chartTypeOptions:{...this.currentSettings?.chartTypeOptions??{},[e]:t}});switch(e){case`renko`:{let e=t.renko??{};r.appendChild(this.numberRow(this.t(`settings.boxSize`),typeof e.boxSize==`number`?e.boxSize:null,`any`,1/0,e=>i(`renko`,{...this.currentSettings?.chartTypeOptions?.renko??{},boxSize:e??`atr`}))),r.appendChild(this.numberRow(this.t(`settings.atrPeriod`),e.atrPeriod??null,`1`,500,e=>i(`renko`,Te(this.currentSettings?.chartTypeOptions?.renko,`atrPeriod`,e))));break}case`lineBreak`:r.appendChild(this.numberRow(this.t(`settings.lineBreakLines`),t.lineBreak?.lines??null,`1`,10,e=>i(`lineBreak`,Te(this.currentSettings?.chartTypeOptions?.lineBreak,`lines`,e))));break;case`kagi`:r.appendChild(this.numberRow(this.t(`settings.reversal`),t.kagi?.reversal??null,`any`,1/0,e=>i(`kagi`,Te(this.currentSettings?.chartTypeOptions?.kagi,`reversal`,e)))),r.appendChild(this.selectRow(this.t(`settings.reversalType`),t.kagi?.reversalType??`percent`,[{value:`percent`,label:this.t(`settings.reversalType.percent`)},{value:`price`,label:this.t(`settings.reversalType.price`)}],e=>i(`kagi`,{...this.currentSettings?.chartTypeOptions?.kagi??{},reversalType:e===`price`?`price`:`percent`})));break;case`pointAndFigure`:r.appendChild(this.numberRow(this.t(`settings.boxSize`),typeof t.pointAndFigure?.boxSize==`number`?t.pointAndFigure.boxSize:null,`any`,1/0,e=>i(`pointAndFigure`,{...this.currentSettings?.chartTypeOptions?.pointAndFigure??{},boxSize:e??`auto`}))),r.appendChild(this.numberRow(this.t(`settings.reversalBoxes`),t.pointAndFigure?.reversal??null,`1`,10,e=>i(`pointAndFigure`,Te(this.currentSettings?.chartTypeOptions?.pointAndFigure,`reversal`,e))));break;case`rangeBars`:r.appendChild(this.numberRow(this.t(`settings.barRange`),typeof t.rangeBars?.range==`number`?t.rangeBars.range:null,`any`,1/0,e=>i(`rangeBars`,{range:e??`auto`})));break;default:return}this.bodyEl.appendChild(r)}numberRow(e,t,n,r,i){let a=document.createElement(`div`);a.className=`tcw-settings-row`;let o=document.createElement(`label`);o.className=`tcw-settings-label`,o.textContent=e,a.appendChild(o);let s=document.createElement(`input`);return s.type=`number`,s.className=`tcw-settings-number`,s.min=`0`,s.step=n,Number.isFinite(r)&&(s.max=String(r)),s.placeholder=this.t(`settings.auto`),s.value=t===null?``:String(t),s.setAttribute(`aria-label`,e),s.addEventListener(`change`,()=>{if(s.value.trim()===``){s.removeAttribute(`aria-invalid`),i(null);return}let e=Number(s.value),t=Number.isFinite(e)&&e>0&&e<=r&&(n!==`1`||Number.isInteger(e));s.toggleAttribute(`aria-invalid`,!t),t&&i(e)}),a.appendChild(s),a}patch(e){this.currentSettings&&Object.assign(this.currentSettings,e),this.callbacks.onChange(e)}section(e){let t=document.createElement(`div`);if(t.className=`tcw-settings-section`,e){let n=document.createElement(`div`);n.className=`tcw-settings-section-title`,n.textContent=e,t.appendChild(n)}return t}colorRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-settings-row`;let i=document.createElement(`span`);i.className=`tcw-settings-label`,i.textContent=e,r.appendChild(i);let a=document.createElement(`div`);a.className=`tcw-color-picker-wrap`;let o=document.createElement(`input`);o.type=`color`,o.value=t;let s=document.createElement(`span`);return s.className=`tcw-color-hex`,s.textContent=t,o.addEventListener(`input`,()=>{s.textContent=o.value,n(o.value)}),a.appendChild(o),a.appendChild(s),r.appendChild(a),r}toggleRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-settings-row`;let i=document.createElement(`span`);i.className=`tcw-settings-label`,i.textContent=e,r.appendChild(i);let a=document.createElement(`button`);return a.className=`tcw-toggle${t?` tcw-on`:``}`,a.addEventListener(`click`,()=>{let e=!a.classList.contains(`tcw-on`);a.classList.toggle(`tcw-on`,e),n(e)}),r.appendChild(a),r}selectRow(e,t,n,r){let i=document.createElement(`div`);i.className=`tcw-settings-row`;let a=document.createElement(`span`);a.className=`tcw-settings-label`,a.textContent=e,i.appendChild(a);let o=document.createElement(`select`);o.className=`tcw-settings-select`;for(let e of n){let n=document.createElement(`option`);n.value=e.value,n.textContent=e.label,e.value===t&&(n.selected=!0),o.appendChild(n)}return o.addEventListener(`change`,()=>r(o.value)),i.appendChild(o),i}rangeRow(e,t,n,r,i,a,o=e=>String(e)){let s=document.createElement(`div`);s.className=`tcw-settings-row`;let c=document.createElement(`span`);c.className=`tcw-settings-label`,c.textContent=e,s.appendChild(c);let l=document.createElement(`div`);l.className=`tcw-settings-range`;let u=document.createElement(`input`);u.type=`range`,u.min=String(n),u.max=String(r),u.step=String(i),u.value=String(t);let d=document.createElement(`span`);return d.className=`tcw-settings-range-val`,d.textContent=o(t),u.addEventListener(`input`,()=>{let e=Number(u.value);d.textContent=o(e),a(e)}),l.appendChild(u),l.appendChild(d),s.appendChild(l),s}destroy(){this.close()}};function Te(e,t,n){let r={...e??{}};return n===null?delete r[t]:r[t]=n,r}var Ee=class{el;dotEl;messageEl;infoEl;marketEl;constructor(e,t){this.el=document.createElement(`div`),this.el.className=`tcw-statusbar`,t&&this.el.appendChild(this.buildRange(t));let n=document.createElement(`div`);n.className=`tcw-status-right`;let r=document.createElement(`div`);r.className=`tcw-status-indicator`,this.dotEl=document.createElement(`span`),this.dotEl.className=`tcw-status-dot`,r.appendChild(this.dotEl),this.messageEl=document.createElement(`span`),r.appendChild(this.messageEl),this.marketEl=document.createElement(`span`),this.marketEl.className=`tcw-status-market`,this.marketEl.hidden=!0,n.appendChild(this.marketEl),n.appendChild(r),this.infoEl=document.createElement(`span`),this.infoEl.className=`tcw-status-info`,n.appendChild(this.infoEl),this.el.appendChild(n),e.appendChild(this.el)}update(e){this.dotEl.className=`tcw-status-dot`,e.connectionState===`connected`?this.dotEl.classList.add(`tcw-connected`):e.connectionState===`error`&&this.dotEl.classList.add(`tcw-error`),this.messageEl.textContent=e.message,this.infoEl.textContent=`${e.symbol} ${e.timeframe}`}setMarket(e,t){this.marketEl.hidden=e===`always`,this.marketEl.dataset.state=e,this.marketEl.textContent=e===`always`?``:t}destroy(){this.el.remove()}buildRange(e){let t=document.createElement(`div`);t.className=`tcw-range-bar`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,e.groupLabel);for(let n of e.presets){let r=document.createElement(`button`);r.type=`button`,r.className=`tcw-range-btn`,r.dataset.range=n,r.textContent=e.presetLabels?.[n]??n,r.addEventListener(`click`,()=>e.onPreset(n)),t.appendChild(r)}let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-range-btn tcw-range-goto`,n.dataset.role=`goto`,n.title=`${e.goToLabel} (Alt+G)`,n.setAttribute(`aria-label`,e.goToLabel),n.innerHTML=S(`calendar`,13),n.addEventListener(`click`,e.onGoTo),t.appendChild(n),t}},De=class{backdrop=null;modal=null;input=null;list=null;items=[];filtered=[];selectedIndex=0;callbacks;boundKeydown;constructor(e,n=()=>document.body,r=t.t){this.host=n,this.t=r,this.callbacks=e,this.boundKeydown=this.handleKeydown.bind(this)}open(e){if(this.backdrop)return;this.items=e,this.filtered=e,this.selectedIndex=0,this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>this.close()),this.modal=document.createElement(`div`),this.modal.className=`tcw-cmd-palette`;let t=document.createElement(`div`);t.className=`tcw-cmd-header`;let n=document.createElement(`span`);n.className=`tcw-cmd-icon`,n.textContent=`⌕`,t.appendChild(n),this.input=document.createElement(`input`),this.input.className=`tcw-cmd-input`,this.input.type=`text`,this.input.placeholder=this.t(`palette.placeholder`),this.input.addEventListener(`input`,()=>this.filter()),t.appendChild(this.input);let r=document.createElement(`span`);r.className=`tcw-cmd-hint`,r.textContent=`ESC`,t.appendChild(r),this.modal.appendChild(t),this.list=document.createElement(`div`),this.list.className=`tcw-cmd-list`,this.modal.appendChild(this.list);let i=document.createElement(`div`);i.className=`tcw-cmd-footer`,i.innerHTML=`<span>↑↓ ${w(this.t(`common.navigate`))}</span><span>⏎ ${w(this.t(`common.select`))}</span><span>Esc ${w(this.t(`common.close`))}</span>`,this.modal.appendChild(i),this.host().append(this.backdrop,this.modal),this.renderList(),this.input.focus(),document.addEventListener(`keydown`,this.boundKeydown)}close(){document.removeEventListener(`keydown`,this.boundKeydown),this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.input=null,this.list=null,this.callbacks.onClose()}isOpen(){return this.backdrop!==null}filter(){let e=this.input?.value.toLowerCase().trim()??``;e?this.filtered=this.items.filter(t=>t.label.toLowerCase().includes(e)||t.category.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)):this.filtered=this.items,this.selectedIndex=0,this.renderList()}renderList(){if(!this.list)return;if(this.list.innerHTML=``,this.filtered.length===0){let e=document.createElement(`div`);e.className=`tcw-cmd-empty`,e.textContent=this.t(`palette.empty`),this.list.appendChild(e);return}let e=``;for(let t=0;t<this.filtered.length;t++){let n=this.filtered[t];if(n.category!==e){e=n.category;let t=document.createElement(`div`);t.className=`tcw-cmd-category`,t.textContent=this.categoryLabel(e),this.list.appendChild(t)}let r=document.createElement(`button`);r.className=`tcw-cmd-item`,t===this.selectedIndex&&r.classList.add(`tcw-selected`),n.active&&r.classList.add(`tcw-active`),r.dataset.index=String(t);let i=document.createElement(`span`);if(i.className=`tcw-cmd-item-label`,i.textContent=n.label,r.appendChild(i),n.active){let e=document.createElement(`span`);e.className=`tcw-cmd-check`,e.textContent=`✓`,r.appendChild(e)}if(n.shortcut){let e=document.createElement(`kbd`);e.className=`tcw-cmd-kbd`,e.textContent=n.shortcut,r.appendChild(e)}r.addEventListener(`click`,()=>this.select(t)),r.addEventListener(`mouseenter`,()=>{this.selectedIndex=t,this.updateSelection()}),this.list.appendChild(r)}}updateSelection(){if(!this.list)return;let e=this.list.querySelectorAll(`.tcw-cmd-item`);e.forEach((e,t)=>{e.classList.toggle(`tcw-selected`,t===this.selectedIndex)}),e[this.selectedIndex]?.scrollIntoView({block:`nearest`})}select(e){let t=this.filtered[e];if(t){switch(t.category){case`indicator`:this.callbacks.onIndicator(t.id);break;case`chartType`:this.callbacks.onChartType(t.id);break;case`drawing`:this.callbacks.onDrawingTool(t.id);break;case`timeframe`:this.callbacks.onTimeframe(t.id);break;case`action`:this.callbacks.onAction(t.id);break}this.close()}}handleKeydown(e){switch(e.key){case`Escape`:e.preventDefault(),this.close();break;case`ArrowDown`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex+1)%this.filtered.length,this.updateSelection());break;case`ArrowUp`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex-1+this.filtered.length)%this.filtered.length,this.updateSelection());break;case`Enter`:e.preventDefault(),this.select(this.selectedIndex);break}}categoryLabel(e){switch(e){case`indicator`:return this.t(`palette.group.indicator`);case`chartType`:return this.t(`palette.group.chartType`);case`drawing`:return this.t(`palette.group.drawing`);case`timeframe`:return this.t(`palette.group.timeframe`);case`action`:return this.t(`palette.group.action`);default:return e}}destroy(){this.close()}},Oe=class{backdrop=null;modal=null;input=null;list=null;symbols=[];current=``;filtered=[];selectedIndex=0;callbacks;boundKeydown;pickOverride=null;searchFn=null;searchTimer=null;searchAbort=null;status=`idle`;pickOnResults=!1;constructor(e,n=()=>document.body,r=t.t){this.host=n,this.t=r,this.callbacks=e,this.boundKeydown=this.handleKeydown.bind(this)}open(e,t,n,r){if(this.backdrop)return;this.pickOverride=n??null,this.searchFn=r??null,this.status=`idle`,this.symbols=e,this.current=t,this.filtered=e.map(e=>({symbol:e,score:0})),this.selectedIndex=Math.max(0,e.indexOf(t)),this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>this.close()),this.modal=document.createElement(`div`),this.modal.className=`tcw-cmd-palette`;let i=document.createElement(`div`);i.className=`tcw-cmd-header`;let a=document.createElement(`span`);a.className=`tcw-cmd-icon`,a.innerHTML=je(),i.appendChild(a),this.input=document.createElement(`input`),this.input.className=`tcw-cmd-input`,this.input.type=`text`,this.input.placeholder=this.t(`symbolSearch.placeholder`),this.input.autocomplete=`off`,this.input.spellcheck=!1,this.input.addEventListener(`input`,()=>this.filter()),i.appendChild(this.input);let o=document.createElement(`span`);o.className=`tcw-cmd-hint`,o.textContent=`ESC`,i.appendChild(o),this.modal.appendChild(i),this.list=document.createElement(`div`),this.list.className=`tcw-cmd-list`,this.modal.appendChild(this.list);let s=document.createElement(`div`);s.className=`tcw-cmd-footer`,s.innerHTML=`<span>↑↓ ${w(this.t(`common.navigate`))}</span><span>⏎ ${w(this.t(`common.open`))}</span><span>Esc ${w(this.t(`common.close`))}</span>`,this.modal.appendChild(s),this.host().append(this.backdrop,this.modal),this.renderList(),this.input.focus(),document.addEventListener(`keydown`,this.boundKeydown)}close(){document.removeEventListener(`keydown`,this.boundKeydown),this.cancelSearch(),this.pickOnResults=!1,this.searchFn=null,this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.input=null,this.list=null,this.pickOverride=null,this.callbacks.onClose()}isOpen(){return this.backdrop!==null}destroy(){this.close()}filter(){this.pickOnResults=!1;let e=(this.input?.value??``).toUpperCase().trim();if(this.searchFn&&e){this.scheduleSearch(this.input?.value.trim()??``);return}this.cancelSearch(),this.status=`idle`,e?this.filtered=this.symbols.map(t=>({symbol:t,score:ke(t.toUpperCase(),e)})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score):this.filtered=this.symbols.map(e=>({symbol:e,score:0})),this.selectedIndex=0,this.renderList()}scheduleSearch(e){this.searchTimer!==null&&clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>{this.searchTimer=null,this.runSearch(e)},150)}searchNow(){this.searchTimer!==null&&clearTimeout(this.searchTimer),this.searchTimer=null,this.runSearch(this.input?.value.trim()??``)}async runSearch(e){let t=this.searchFn;if(!t)return;this.searchAbort?.abort();let n=new AbortController;this.searchAbort=n,this.status=`searching`,this.filtered=[],this.renderList();try{let r=await t(e,n.signal);if(n.signal.aborted)return;this.filtered=r.map(e=>({symbol:e.symbol,score:0,description:e.description,meta:[e.exchange,e.type].filter(Boolean).join(` · `)||void 0})),this.status=`idle`}catch{if(n.signal.aborted)return;this.filtered=[],this.status=`failed`}this.selectedIndex=0,this.renderList(),this.pickOnResults&&(this.pickOnResults=!1,this.pick(0))}cancelSearch(){this.searchTimer!==null&&clearTimeout(this.searchTimer),this.searchTimer=null,this.searchAbort?.abort(),this.searchAbort=null}renderList(){if(!this.list)return;if(this.list.innerHTML=``,this.filtered.length===0){let e=document.createElement(`div`);e.className=`tcw-cmd-empty`,e.setAttribute(`role`,`status`),e.textContent=this.status===`searching`?this.t(`symbolSearch.searching`):this.status===`failed`?this.t(`symbolSearch.failed`):this.t(`symbolSearch.empty`),this.list.appendChild(e);return}let e=(this.input?.value??``).toUpperCase().trim();for(let t=0;t<this.filtered.length;t++){let{symbol:n,description:r,meta:i}=this.filtered[t],a=document.createElement(`button`);a.className=`tcw-cmd-item`,t===this.selectedIndex&&a.classList.add(`tcw-selected`),n===this.current&&a.classList.add(`tcw-active`);let o=document.createElement(`span`);if(o.className=`tcw-cmd-item-label`,o.innerHTML=Ae(n,e),a.appendChild(o),r&&r!==n){let e=document.createElement(`span`);e.className=`tcw-cmd-item-desc`,e.textContent=r,a.appendChild(e)}if(i){let e=document.createElement(`span`);e.className=`tcw-cmd-item-meta`,e.textContent=i,a.appendChild(e)}if(n===this.current){let e=document.createElement(`span`);e.className=`tcw-cmd-check`,e.textContent=`✓`,a.appendChild(e)}a.addEventListener(`click`,()=>this.pick(t)),a.addEventListener(`mouseenter`,()=>{this.selectedIndex=t,this.updateSelection()}),this.list.appendChild(a)}}updateSelection(){if(!this.list)return;let e=this.list.querySelectorAll(`.tcw-cmd-item`);e.forEach((e,t)=>e.classList.toggle(`tcw-selected`,t===this.selectedIndex)),e[this.selectedIndex]?.scrollIntoView?.({block:`nearest`})}pick(e){let t=this.filtered[e];if(!t)return;let n=this.pickOverride;n?n(t.symbol):this.callbacks.onPick(t.symbol),this.close()}handleKeydown(e){switch(e.key){case`Escape`:e.preventDefault(),this.close();break;case`ArrowDown`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex+1)%this.filtered.length,this.updateSelection());break;case`ArrowUp`:e.preventDefault(),this.filtered.length>0&&(this.selectedIndex=(this.selectedIndex-1+this.filtered.length)%this.filtered.length,this.updateSelection());break;case`Enter`:if(e.preventDefault(),this.searchTimer!==null||this.status===`searching`){this.pickOnResults=!0,this.searchTimer!==null&&this.searchNow();break}this.pick(this.selectedIndex);break}}};function ke(e,t){if(e===t)return 1e3;if(e.startsWith(t))return 500+(50-Math.min(50,e.length-t.length));if(e.includes(t))return 200+(50-Math.min(50,e.length-t.length));let n=0,r=-1,i=0;for(let a=0;a<e.length&&n<t.length;a++)e[a]===t[n]&&(r>=0&&(i+=a-r-1),r=a,n++);return n<t.length?0:100-Math.min(99,i)}function Ae(e,t){if(!t)return w(e);let n=e.toUpperCase(),r=``,i=0;for(let a=0;a<e.length;a++)i<t.length&&n[a]===t[i]?(r+=`<mark style="background:transparent;color:var(--tcw-accent);font-weight:700">${w(e[a])}</mark>`,i++):r+=w(e[a]);return r}function je(){return`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>`}var Me={"Search & navigation":`hotkeys.group.searchNavigation`,"Chart manipulation":`hotkeys.group.chartManipulation`,"Touch (mobile / tablet)":`hotkeys.group.touch`,Keyboard:`hotkeys.group.keyboard`,Drawing:`hotkeys.group.drawing`},E=typeof navigator<`u`&&/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent)?`⌘`:`Ctrl`,Ne=[{title:`Search & navigation`,entries:[{keys:[E,`K`],label:`hotkeys.commandPalette`},{keys:[E,`P`],label:`hotkeys.symbolSearch`},{keys:[`Alt`,`G`],label:`hotkeys.goToDate`},{keys:[`Alt`,`I`],label:`hotkeys.invertScale`},{keys:[E,`S`],label:`hotkeys.saveLayout`},{keys:[`0–9`],label:`hotkeys.typeInterval`},{keys:[`?`],label:`hotkeys.showSheet`}]},{title:`Chart manipulation`,entries:[{keys:[`key.drag`],label:`hotkeys.pan`},{keys:[E,`key.drag`],label:`hotkeys.boxSelect`},{keys:[E,`key.click`],label:`hotkeys.toggleSelect`},{keys:[`Shift`,`key.drag`],label:`hotkeys.measure`},{keys:[`key.drag`,`key.priceAxis`],label:`hotkeys.scalePrice`},{keys:[`key.drag`,`key.timeAxis`],label:`hotkeys.zoomTime`},{keys:[`key.doubleClick`,`key.priceAxis`],label:`hotkeys.autoScale`},{keys:[`key.doubleClick`,`key.timeAxis`],label:`hotkeys.fit`},{keys:[`key.scroll`],label:`hotkeys.zoomCursor`}]},{title:`Touch (mobile / tablet)`,entries:[{keys:[`key.oneFinger`,`key.drag`],label:`hotkeys.touchPan`},{keys:[`key.twoFingers`,`key.pinch`],label:`hotkeys.pinch`},{keys:[`key.longPress`],label:`hotkeys.longPress`},{keys:[`key.drag`,`key.axisStrip`],label:`hotkeys.touchAxis`}]},{title:`Keyboard`,entries:[{keys:[`←`,`→`],label:`hotkeys.panBar`},{keys:[`+`,`−`],label:`hotkeys.zoomInOut`},{keys:[`Home`],label:`hotkeys.toStart`},{keys:[`End`],label:`hotkeys.toEnd`},{keys:[`F`],label:`hotkeys.fit`}]},{title:`Drawing`,entries:[{keys:[E,`Z`],label:`hotkeys.undo`},{keys:[E,`Shift`,`Z`],label:`hotkeys.redo`},{keys:[`Esc`],label:`hotkeys.cancelDrawing`},{keys:[E,`C`],label:`hotkeys.copy`},{keys:[E,`V`],label:`hotkeys.paste`},{keys:[`key.rightClick`],label:`hotkeys.drawingMenu`},{keys:[`key.doubleClick`],label:`hotkeys.drawingSettings`},{keys:[E,`G`],label:`hotkeys.group`},{keys:[E,`Shift`,`G`],label:`hotkeys.ungroup`},{keys:[E,`]`,`[`],label:`hotkeys.orderStep`},{keys:[E,`Shift`,`]`,`[`],label:`hotkeys.orderEnd`},{keys:[`Enter`],label:`hotkeys.finishPath`},{keys:[`Alt`,`T`],label:`tool.trendLine`},{keys:[`Alt`,`H`],label:`tool.horizontalLine`},{keys:[`Alt`,`J`],label:`tool.horizontalRay`},{keys:[`Alt`,`V`],label:`tool.verticalLine`},{keys:[`Alt`,`C`],label:`tool.crossLine`},{keys:[`Alt`,`F`],label:`tool.fibRetracement`}]}],Pe=class{backdrop=null;modal=null;callbacks;t;boundKeydown;constructor(e,t,n=()=>document.body){this.host=n,this.callbacks=e,this.t=t,this.boundKeydown=e=>{e.key===`Escape`&&(e.preventDefault(),this.close())}}open(){if(this.backdrop)return;this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.addEventListener(`click`,()=>this.close()),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal tcw-hotkey-sheet`,this.modal.style.width=`640px`;let e=document.createElement(`div`);e.className=`tcw-modal-header`;let t=document.createElement(`h3`);t.textContent=this.t(`hotkeys.title`),e.appendChild(t);let n=document.createElement(`button`);n.className=`tcw-modal-close`,n.setAttribute(`aria-label`,this.t(`hotkeys.close`)),n.innerHTML=`×`,n.addEventListener(`click`,()=>this.close()),e.appendChild(n),this.modal.appendChild(e);let r=document.createElement(`div`);r.className=`tcw-modal-body`;let i=document.createElement(`div`);i.className=`tcw-hotkey-grid`;for(let e of Ne){let t=document.createElement(`section`);t.className=`tcw-hotkey-section`;let n=document.createElement(`div`);n.className=`tcw-settings-section-title`;let r=Me[e.title];n.textContent=r?this.t(r):e.title,t.appendChild(n);for(let n of e.entries){let e=document.createElement(`div`);e.className=`tcw-hotkey-row`;let r=document.createElement(`div`);r.className=`tcw-hotkey-keys`;for(let e=0;e<n.keys.length;e++){if(e>0){let e=document.createElement(`span`);e.className=`tcw-hotkey-sep`,e.textContent=`+`,r.appendChild(e)}let t=document.createElement(`kbd`);t.className=`tcw-cmd-kbd`;let i=n.keys[e];t.textContent=i.startsWith(`key.`)?this.t(i):i,r.appendChild(t)}e.appendChild(r);let i=document.createElement(`span`);i.className=`tcw-hotkey-label`,i.textContent=this.t(n.label),e.appendChild(i),t.appendChild(e)}i.appendChild(t)}r.appendChild(i),this.modal.appendChild(r);let a=document.createElement(`div`);a.className=`tcw-modal-footer`;let o=document.createElement(`span`);o.style.cssText=`font-size:11px;color:var(--tcw-text-muted)`,o.textContent=this.t(`hotkeys.footer`),a.appendChild(o);let s=document.createElement(`button`);s.className=`tcw-done-btn`,s.textContent=this.t(`hotkeys.gotIt`),s.addEventListener(`click`,()=>this.close()),a.appendChild(s),this.modal.appendChild(a),this.host().append(this.backdrop,this.modal),document.addEventListener(`keydown`,this.boundKeydown)}close(){document.removeEventListener(`keydown`,this.boundKeydown),this.backdrop?.remove(),this.modal?.remove(),this.backdrop=null,this.modal=null,this.callbacks.onClose()}isOpen(){return this.backdrop!==null}destroy(){this.close()}},Fe={selectHint:`Click a bar to start the replay`,random:`Random bar`,realtime:`Back to realtime`,barsPerSecond:`bars/s`,play:`Play`,pause:`Pause`,stepBack:`Step back (Shift+←)`,stepForward:`Step forward (Shift+→)`,replay:`Replay`,position:`Replay position`,speed:`Speed`,step:`Step`},Ie=[1,2,3,5,10,25,50],Le=class{root=null;scrubber=null;progressLabel=null;playBtn=null;realtimeBtn=null;state=`stopped`;mode=`select`;ended=!1;total=0;speed=5;steps=[];step=`bar`;labels;constructor(e,t={}){this.callbacks=e,this.labels={...Fe,...t}}mount(e,t){this.root||(this.total=Math.max(0,t.total),this.speed=t.speed??5,this.steps=t.steps??[],this.step=t.step??`bar`,this.state=`paused`,this.mode=t.mode??`select`,this.root=document.createElement(`div`),this.root.className=`tcw-replay-bar`,this.root.setAttribute(`role`,`toolbar`),this.root.setAttribute(`aria-label`,this.labels.replay),this.root.innerHTML=this.markup(),e.appendChild(this.root),this.wireEvents(),this.syncUi())}unmount(){this.root?.remove(),this.root=null,this.scrubber=null,this.progressLabel=null,this.playBtn=null,this.realtimeBtn=null,this.state=`stopped`,this.ended=!1}isMounted(){return this.root!==null}getMode(){return this.mode}setMode(e){let t=!!this.root?.contains(document.activeElement);this.mode=e,this.syncUi(),t&&e===`replay`&&this.playBtn?.focus()}setState(e){this.state=e,this.syncUi()}setEnded(e){this.ended!==e&&(this.ended=e,this.syncUi())}setProgress(e,t){this.total=t,this.scrubber&&(this.scrubber.max=String(Math.max(0,t-1)),this.scrubber.value=String(e)),this.progressLabel&&(this.progressLabel.textContent=`${Math.min(e+1,t)} / ${t}`)}destroy(){this.unmount()}markup(){let e=this.labels,t=Ie.map(t=>`<option value="${t}"${t===this.speed?` selected`:``}>${t} ${w(e.barsPerSecond)}</option>`).join(``);return`
|
|
4287
|
+
<span class="tcw-replay-group" data-mode="select">
|
|
4288
|
+
<span class="tcw-replay-hint" role="status">${He()}${w(e.selectHint)}</span>
|
|
4289
|
+
<button class="tcw-replay-text-btn" data-act="random">${w(e.random)}</button>
|
|
4290
|
+
</span>
|
|
4291
|
+
<span class="tcw-replay-group" data-mode="replay">
|
|
4292
|
+
<button class="tcw-replay-btn" data-act="stepBack" title="${w(e.stepBack)}" aria-label="${w(e.stepBack)}">${Be()}</button>
|
|
4293
|
+
<button class="tcw-replay-btn tcw-replay-play" data-act="play" title="${w(e.play)}" aria-label="${w(e.play)}">${Re()}</button>
|
|
4294
|
+
<button class="tcw-replay-btn" data-act="stepForward" title="${w(e.stepForward)}" aria-label="${w(e.stepForward)}">${Ve()}</button>
|
|
4295
|
+
<input type="range" class="tcw-replay-scrubber" data-act="seek" min="0" max="${Math.max(0,this.total-1)}" value="0" step="1" aria-label="${w(this.labels.position)}" />
|
|
4296
|
+
<span class="tcw-replay-progress" data-tcw="progress">1 / ${this.total}</span>
|
|
4297
|
+
<select class="tcw-replay-speed" data-act="speed" aria-label="${w(this.labels.speed)}">${t}</select>
|
|
4298
|
+
</span>
|
|
4299
|
+
${this.steps.length>1?`<select class="tcw-replay-speed tcw-replay-step" data-act="step" aria-label="${w(e.step)}" title="${w(e.step)}">${this.steps.map(e=>`<option value="${w(e.value)}"${e.value===this.step?` selected`:``}>${w(e.label)}</option>`).join(``)}</select>`:``}
|
|
4300
|
+
<button class="tcw-replay-text-btn tcw-replay-realtime" data-act="realtime">${w(e.realtime)}</button>
|
|
4301
|
+
`}wireEvents(){let e=this.root;e&&(this.scrubber=e.querySelector(`input[data-act="seek"]`),this.progressLabel=e.querySelector(`[data-tcw="progress"]`),this.playBtn=e.querySelector(`button[data-act="play"]`),this.realtimeBtn=e.querySelector(`button[data-act="realtime"]`),this.realtimeBtn?.addEventListener(`click`,()=>this.callbacks.onClose()),e.querySelector(`[data-act="random"]`)?.addEventListener(`click`,()=>this.callbacks.onRandomStart()),e.querySelector(`[data-act="stepBack"]`)?.addEventListener(`click`,()=>this.callbacks.onStepBack()),e.querySelector(`[data-act="stepForward"]`)?.addEventListener(`click`,()=>this.callbacks.onStepForward()),this.playBtn?.addEventListener(`click`,()=>{this.state===`playing`?this.callbacks.onPause():this.callbacks.onPlay()}),this.scrubber?.addEventListener(`input`,()=>this.callbacks.onSeek(Number(this.scrubber.value))),e.querySelector(`[data-act="speed"]`)?.addEventListener(`change`,e=>{let t=Number(e.target.value);this.speed=t,this.callbacks.onSpeedChange(t)}),e.querySelector(`[data-act="step"]`)?.addEventListener(`change`,e=>{this.step=e.target.value,this.callbacks.onStepChange?.(this.step)}))}syncUi(){let e=this.root;if(e){for(let t of e.querySelectorAll(`.tcw-replay-group`))t.hidden=t.dataset.mode!==this.mode;if(e.classList.toggle(`tcw-replay-bar--ended`,this.ended),this.playBtn){let e=this.state===`playing`;this.playBtn.innerHTML=e?ze():Re(),this.playBtn.title=e?this.labels.pause:this.labels.play,this.playBtn.setAttribute(`aria-label`,this.playBtn.title);let t=this.ended&&!e;t&&document.activeElement===this.playBtn&&this.realtimeBtn?.focus(),this.playBtn.disabled=t}}}};function Re(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7L8 5z"/></svg>`}function ze(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M6 5h4v14H6zM14 5h4v14h-4z"/></svg>`}function Be(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M6 6h2v12H6zM20 6L9 12l11 6V6z"/></svg>`}function Ve(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M4 6l11 6L4 18V6zM16 6h2v12h-2z"/></svg>`}function He(){return`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M12 3v18M8 7l4-4 4 4M8 17l4 4 4-4"/></svg>`}var Ue=class{el;headerEl;nameBtn;menuEl;listEl;rowMap=new Map;entries=new Map;lists=[];activeList=``;active=null;locale;dragging=null;onOutside=e=>{this.headerEl.contains(e.target)||this.closeMenu()};constructor(e,t,n){this.callbacks=t,this.labels=n,this.el=document.createElement(`div`),this.el.className=`tcw-watchlist`,this.el.setAttribute(`aria-label`,n.title),this.headerEl=document.createElement(`div`),this.headerEl.className=`tcw-watchlist-header`,this.nameBtn=document.createElement(`button`),this.nameBtn.type=`button`,this.nameBtn.className=`tcw-watchlist-name`,this.nameBtn.setAttribute(`aria-haspopup`,`menu`),this.nameBtn.setAttribute(`aria-expanded`,`false`),this.nameBtn.title=n.lists,this.nameBtn.addEventListener(`click`,()=>this.menuEl.hidden?this.openMenu():this.closeMenu());let r=document.createElement(`button`);r.type=`button`,r.className=`tcw-watchlist-add`,r.textContent=`+`,r.title=n.add,r.setAttribute(`aria-label`,n.add),r.hidden=!t.onAdd,r.addEventListener(`click`,()=>t.onAdd?.()),this.menuEl=document.createElement(`div`),this.menuEl.className=`tcw-dropdown tcw-watchlist-menu`,this.menuEl.setAttribute(`role`,`menu`),this.menuEl.hidden=!0,this.headerEl.append(this.nameBtn,r,this.menuEl),this.el.appendChild(this.headerEl),this.listEl=document.createElement(`div`),this.listEl.className=`tcw-watchlist-list`,this.listEl.setAttribute(`role`,`list`),this.el.appendChild(this.listEl),e.appendChild(this.el)}setLists(e,t){this.lists=e.map(e=>({...e,symbols:[...e.symbols]})),this.activeList=e.some(e=>e.id===t)?t:e[0]?.id??``;let n=this.shownList();this.nameBtn.textContent=n?.name??this.labels.title,this.renderRows(n?.symbols??[]),this.menuEl.hidden||this.renderMenu()}setLocale(e){this.locale=e;for(let e of this.rowMap.keys())this.renderRow(e)}setActive(e){this.active=e;for(let[t,n]of this.rowMap){let r=t===e;n.row.classList.toggle(`tcw-watchlist-active`,r),r?n.row.setAttribute(`aria-current`,`true`):n.row.removeAttribute(`aria-current`)}}setEntry(e,t){let n=this.entries.get(e)??{symbol:e};this.entries.set(e,{...n,...t,symbol:e}),this.renderRow(e)}destroy(){this.closeMenu(),this.el.remove(),this.rowMap.clear(),this.entries.clear()}shownList(){return this.lists.find(e=>e.id===this.activeList)}renderRows(e){for(let t of[...this.rowMap.keys()])e.includes(t)||(this.rowMap.get(t).row.remove(),this.rowMap.delete(t));for(let t of e)this.rowMap.has(t)||this.makeRow(t);if(this.listEl.replaceChildren(...e.map(e=>this.rowMap.get(e).row)),e.length===0){let e=document.createElement(`div`);e.className=`tcw-watchlist-empty`,e.textContent=this.labels.empty,this.listEl.appendChild(e)}this.active&&this.setActive(this.active)}makeRow(e){let n=document.createElement(`div`);n.className=`tcw-watchlist-row`,n.setAttribute(`role`,`listitem`),n.dataset.symbol=e,n.tabIndex=0,n.draggable=!!this.callbacks.onMove;let r=document.createElement(`div`);r.className=`tcw-watchlist-symbol`,r.textContent=We(e);let i=document.createElement(`canvas`);i.className=`tcw-watchlist-spark`,i.width=64,i.height=22;let a=document.createElement(`div`);a.className=`tcw-watchlist-stats`;let o=document.createElement(`span`);o.className=`tcw-watchlist-price`,o.textContent=`—`;let s=document.createElement(`span`);if(s.className=`tcw-watchlist-change`,a.append(o,s),n.append(r,i,a),this.callbacks.onRemove){let r=document.createElement(`button`);r.type=`button`,r.className=`tcw-watchlist-remove`,r.textContent=`×`,r.tabIndex=-1;let i=t.r(this.labels.remove,{symbol:e});r.title=i,r.setAttribute(`aria-label`,i),r.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.onRemove?.(e)}),n.appendChild(r)}n.addEventListener(`click`,()=>this.callbacks.onSelect(e)),n.addEventListener(`keydown`,t=>this.onRowKey(t,e)),n.addEventListener(`dragstart`,t=>{this.dragging=e,t.dataTransfer?.setData(`text/plain`,e),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`),n.classList.add(`tcw-watchlist-dragging`)}),n.addEventListener(`dragend`,()=>{this.dragging=null,n.classList.remove(`tcw-watchlist-dragging`)}),n.addEventListener(`dragover`,t=>{this.dragging&&this.dragging!==e&&t.preventDefault()}),n.addEventListener(`drop`,t=>{t.preventDefault();let n=this.dragging;if(this.dragging=null,!n||n===e)return;let r=this.shownList()?.symbols??[];this.callbacks.onMove?.(n,r.indexOf(e))}),this.rowMap.set(e,{row:n,priceEl:o,changeEl:s,sparkCanvas:i}),this.renderRow(e)}onRowKey(e,t){let n=this.shownList()?.symbols??[],r=n.indexOf(t);if([`Enter`,` `,`Delete`,`Backspace`,`ArrowDown`,`ArrowUp`].includes(e.key)&&e.stopPropagation(),e.key===`Enter`||e.key===` `)e.preventDefault(),this.callbacks.onSelect(t);else if((e.key===`Delete`||e.key===`Backspace`)&&this.callbacks.onRemove){e.preventDefault();let i=n[r+1]??n[r-1];this.callbacks.onRemove(t),i&&this.rowMap.get(i)?.row.focus()}else if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let i=r+(e.key===`ArrowDown`?1:-1);if(i<0||i>=n.length)return;e.altKey?(this.callbacks.onMove?.(t,i),this.rowMap.get(t)?.row.focus()):this.rowMap.get(n[i])?.row.focus()}}renderRow(e){let t=this.rowMap.get(e),n=this.entries.get(e);if(!(!t||!n)){if(n.lastPrice!==void 0&&(t.priceEl.textContent=Ge(n.lastPrice,this.locale)),n.lastPrice!==void 0&&n.refPrice!==void 0&&n.refPrice!==0){let e=n.lastPrice-n.refPrice,r=e/n.refPrice*100,i=e>=0?`+`:`-`,a=Math.abs(r).toLocaleString(this.locale,{minimumFractionDigits:2,maximumFractionDigits:2});t.changeEl.textContent=`${i}${a}%`,t.changeEl.className=`tcw-watchlist-change ${e>=0?`tcw-up`:`tcw-down`}`}else t.changeEl.textContent=``;n.sparkline&&n.sparkline.length>=2&&Ke(t.sparkCanvas,n.sparkline,n.refPrice??n.sparkline[0])}}openMenu(){this.renderMenu(),this.menuEl.hidden=!1,this.nameBtn.setAttribute(`aria-expanded`,`true`),document.addEventListener(`mousedown`,this.onOutside)}closeMenu(){this.menuEl.hidden=!0,this.nameBtn.setAttribute(`aria-expanded`,`false`),document.removeEventListener(`mousedown`,this.onOutside)}renderMenu(){let e=(e,t)=>{let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-dropdown-item`,n.setAttribute(`role`,`menuitem`),n.textContent=e,n.addEventListener(`click`,t),n},n=this.lists.map(t=>{let n=e(``,()=>{this.closeMenu(),this.callbacks.onPickList?.(t.id)});n.dataset.list=t.id,n.classList.toggle(`tcw-active`,t.id===this.activeList);let r=document.createElement(`span`);r.textContent=t.name;let i=document.createElement(`span`);return i.className=`tcw-watchlist-count`,i.textContent=String(t.symbols.length),n.append(r,i),n}),r=document.createElement(`div`);if(r.className=`tcw-dropdown-divider`,n.push(r),this.callbacks.onCreateList){let t=e(this.labels.newList,()=>this.editName(``,e=>this.callbacks.onCreateList?.(e)));t.dataset.action=`new`,n.push(t)}let i=this.shownList();if(i&&this.callbacks.onRenameList){let t=e(this.labels.rename,()=>this.editName(i.name,e=>this.callbacks.onRenameList?.(i.id,e)));t.dataset.action=`rename`,n.push(t)}if(i&&this.callbacks.onDeleteList&&this.lists.length>1){let r=!1,a=e(this.labels.deleteList,()=>{if(!r){r=!0,a.textContent=t.r(this.labels.confirmDelete,{name:i.name}),a.classList.add(`tcw-danger`);return}this.closeMenu(),this.callbacks.onDeleteList?.(i.id)});a.dataset.action=`delete`,n.push(a)}this.menuEl.replaceChildren(...n)}editName(e,t){this.closeMenu();let n=document.createElement(`input`);n.className=`tcw-watchlist-input`,n.type=`text`,n.maxLength=60,n.value=e,n.placeholder=this.labels.listName,n.setAttribute(`aria-label`,this.labels.listName),this.nameBtn.hidden=!0,this.headerEl.insertBefore(n,this.nameBtn);let r=!1,i=i=>{if(r)return;r=!0;let a=n.value.trim();n.remove(),this.nameBtn.hidden=!1,i&&a&&a!==e&&t(a),this.nameBtn.focus()};n.addEventListener(`keydown`,e=>{e.stopPropagation(),e.key===`Enter`?(e.preventDefault(),i(!0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i(!1))}),n.addEventListener(`blur`,()=>i(!1)),n.focus()}};function We(e){for(let t of[`USDT`,`USD`,`BTC`,`ETH`,`EUR`])if(e.length>t.length&&e.endsWith(t))return e.slice(0,-t.length)+`/`+t;return e}function Ge(e,t){if(e===0)return`0`;let n=Math.abs(e);return n>=1e3?e.toLocaleString(t,{minimumFractionDigits:2,maximumFractionDigits:2}):n>=1?e.toLocaleString(t,{minimumFractionDigits:4,maximumFractionDigits:4}):Number(e.toPrecision(4)).toLocaleString(t,{maximumFractionDigits:10})}function Ke(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=window.devicePixelRatio||1;e.width!==e.clientWidth*i&&(e.width=(e.clientWidth||64)*i,e.height=(e.clientHeight||22)*i);let a=e.width,o=e.height,s=1/0,c=-1/0;for(let e of t)e<s&&(s=e),e>c&&(c=e);let l=Math.max(c-s,1e-9),u=t[t.length-1]>=n?`#1fa874`:`#e8505b`;r.clearRect(0,0,a,o),r.lineWidth=1.4*i,r.strokeStyle=u,r.beginPath();let d=a/(t.length-1);for(let e=0;e<t.length;e++){let n=e*d,i=o-(t[e]-s)/l*(o-4)-2;e===0?r.moveTo(n,i):r.lineTo(n,i)}r.stroke()}var qe=50,Je=500,Ye=60,Xe=64,D=e=>typeof e==`string`&&e.trim().slice(0,Ye)||null,Ze=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t&&t.length<=Xe?t:null};function Qe(e){let t=[];for(let n of e){let e=Ze(n);if(e&&!t.includes(e)&&t.push(e),t.length===Je)break}return t}function O(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.lists))return null;let n=[];for(let e of t.lists){if(n.length===qe)break;if(!e||typeof e!=`object`)continue;let t=e,r=typeof t.id==`string`&&t.id&&t.id.length<=Xe?t.id:null,i=D(t.name);!r||!i||n.some(e=>e.id===r)||n.push({id:r,name:i,symbols:Array.isArray(t.symbols)?Qe(t.symbols):[]})}return n.length===0?null:{lists:n,active:typeof t.active==`string`&&n.some(e=>e.id===t.active)?t.active:n[0].id}}var $e=e=>({...e,symbols:[...e.symbols]}),et=class{lists;active;listeners=new Set;storage;storageKey;constructor(e){this.storage=e.storage??null,this.storageKey=e.storageKey??`tcw:watchlists`;let t=this.load(),n=e.lists?O({lists:e.lists,active:e.activeList}):null,r=t??n??{lists:[{id:`default`,name:D(e.defaultName)??`Watchlist`,symbols:Qe(e.symbols??[])}],active:`default`};this.lists=r.lists,this.active=r.active}getLists(){return this.lists.map($e)}getActive(){return $e(this.activeList())}setActive(e){e===this.active||!this.lists.some(t=>t.id===e)||(this.active=e,this.changed())}replace(e,t){let n=O({lists:e,active:t??this.active});n&&(this.lists=n.lists,this.active=n.active,this.changed())}create(e){let t=D(e);if(!t||this.lists.length>=qe)return null;let n=this.lists.length+1;for(;this.lists.some(e=>e.id===`list-${n}`);)n++;let r={id:`list-${n}`,name:t,symbols:[]};return this.lists=[...this.lists,r],this.active=r.id,this.changed(),$e(r)}rename(e,t){let n=D(t);n&&this.update(e,e=>({...e,name:n}))}remove(e){this.lists.length<=1||!this.lists.some(t=>t.id===e)||(this.lists=this.lists.filter(t=>t.id!==e),this.active===e&&(this.active=this.lists[0].id),this.changed())}add(e,t=this.active){let n=Ze(e),r=this.lists.find(e=>e.id===t);return!n||!r||r.symbols.includes(n)||r.symbols.length>=Je?!1:(this.update(t,e=>({...e,symbols:[...e.symbols,n]})),!0)}removeSymbol(e,t=this.active){this.lists.find(e=>e.id===t)?.symbols.includes(e)&&this.update(t,t=>({...t,symbols:t.symbols.filter(t=>t!==e)}))}move(e,t,n=this.active){let r=this.lists.find(e=>e.id===n);if(!r)return;let i=r.symbols.indexOf(e);if(i<0)return;let a=r.symbols.filter(t=>t!==e),o=Math.max(0,Math.min(Math.round(t),a.length));o!==i&&this.update(n,t=>({...t,symbols:[...a.slice(0,o),e,...a.slice(o)]}))}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}activeList(){return this.lists.find(e=>e.id===this.active)??this.lists[0]}update(e,t){this.lists=this.lists.map(n=>n.id===e?t(n):n),this.changed()}changed(){this.save();for(let e of this.listeners)e()}load(){if(!this.storage)return null;try{let e=this.storage.getItem(this.storageKey);return e?O(JSON.parse(e)):null}catch{return null}}save(){if(this.storage)try{this.storage.setItem(this.storageKey,JSON.stringify({lists:this.lists,active:this.active}))}catch{}}},tt=class{el;bodyEl;newsEl;shown=!1;constructor(e,n=t.t,r={}){this.t=n,this.callbacks=r,this.el=document.createElement(`div`),this.el.className=`tcw-syminfo`,this.el.setAttribute(`role`,`dialog`),this.el.setAttribute(`aria-label`,n(`symbolInfo.title`)),this.el.hidden=!0;let i=document.createElement(`div`);i.className=`tcw-syminfo-header`;let a=document.createElement(`span`);a.textContent=n(`symbolInfo.title`);let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-syminfo-close`,o.setAttribute(`aria-label`,n(`common.close`)),o.innerHTML=S(`x`,14),o.addEventListener(`click`,()=>this.close()),i.append(a,o),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-syminfo-body`,this.newsEl=document.createElement(`div`),this.newsEl.className=`tcw-syminfo-news`,this.newsEl.hidden=!0,this.el.append(i,this.bodyEl,this.newsEl),e.appendChild(this.el)}isOpen(){return this.shown}toggle(){this.shown?this.close():this.open()}open(){this.shown||(this.shown=!0,this.el.hidden=!1,this.callbacks.onToggle?.(!0))}close(){this.shown&&(this.shown=!1,this.el.hidden=!0,this.callbacks.onToggle?.(!1))}render(e){let t=document.createElement(`div`);t.className=`tcw-syminfo-head`,t.append(k(`div`,`tcw-syminfo-symbol`,e.symbol)),e.description&&t.append(k(`div`,`tcw-syminfo-desc`,e.description)),e.meta&&t.append(k(`div`,`tcw-syminfo-meta`,e.meta));let n=document.createElement(`div`);if(n.className=`tcw-syminfo-quote`,e.price&&n.append(k(`span`,`tcw-syminfo-price`,e.price)),e.change){let t=k(`span`,`tcw-syminfo-change`,e.change.text);t.classList.add(e.change.up?`tcw-up`:`tcw-down`),n.append(t)}let r=k(`div`,`tcw-syminfo-status`,e.status.text);r.dataset.state=e.status.state;let i=document.createElement(`dl`);i.className=`tcw-syminfo-stats`;for(let t of e.stats){let e=document.createElement(`div`);e.className=`tcw-syminfo-stat`,e.append(k(`dt`,``,t.label),k(`dd`,``,t.value)),i.append(e)}this.bodyEl.replaceChildren(t,n,r,i)}renderNews(e){if(this.newsEl.hidden=e.kind===`none`,e.kind===`none`){this.newsEl.replaceChildren();return}let t=k(`div`,`tcw-syminfo-news-title`,this.t(`symbolInfo.news`));if(e.kind===`loading`||e.kind===`failed`||e.items.length===0){let t=e.kind===`loading`?`symbolInfo.loading`:e.kind===`failed`?`symbolInfo.newsFailed`:`symbolInfo.noNews`;this.newsEl.replaceChildren(k(`div`,`tcw-syminfo-news-note`,this.t(t)));return}let n=document.createElement(`ul`);n.className=`tcw-syminfo-news-list`;for(let t of e.items){let e=document.createElement(`li`);if(e.className=`tcw-syminfo-news-item`,t.url){let n=document.createElement(`a`);n.href=t.url,n.target=`_blank`,n.rel=`noopener noreferrer`,n.textContent=t.title,e.append(n)}else e.append(k(`span`,``,t.title));t.meta&&e.append(k(`div`,`tcw-syminfo-news-meta`,t.meta)),n.append(e)}this.newsEl.replaceChildren(t,n)}destroy(){this.el.remove()}};function k(e,t,n){let r=document.createElement(e);return t&&(r.className=t),r.textContent=n,r}var nt=300,rt=80,it=class{el;holdTimer=null;repeatTimer=null;onMove=e=>{e.pointerType!==`touch`&&(this.el.classList.contains(`tcw-nav-shown`)||this.place(),this.el.classList.add(`tcw-nav-shown`))};onLeave=()=>{this.el.classList.remove(`tcw-nav-shown`),this.stopHold()};constructor(e,n,r=t.t){this.host=e,this.actions=n,this.el=document.createElement(`div`),this.el.className=`tcw-nav`,this.el.setAttribute(`role`,`toolbar`),this.el.setAttribute(`aria-label`,r(`nav.label`));let i=[[`zoomOut`,`minus`,r(`nav.zoomOut`)],[`zoomIn`,`plus`,r(`nav.zoomIn`)],[`scrollLeft`,`chevronLeft`,r(`nav.scrollLeft`)],[`scrollRight`,`chevronRight`,r(`nav.scrollRight`)],[`reset`,`reset`,r(`nav.reset`)]];for(let[e,t,r]of i){let i=document.createElement(`button`);if(i.type=`button`,i.className=`tcw-nav-btn`,i.dataset.nav=e,i.title=r,i.setAttribute(`aria-label`,r),i.innerHTML=S(t,16),e===`scrollLeft`||e===`scrollRight`){let t=e===`scrollRight`?1:-1;i.addEventListener(`pointerdown`,e=>{if(e.button===0){e.preventDefault();try{i.setPointerCapture(e.pointerId)}catch{}this.startHold(t)}});for(let e of[`pointerup`,`pointercancel`,`pointerleave`])i.addEventListener(e,()=>this.stopHold());i.addEventListener(`click`,e=>{e.detail===0&&n.scroll(t)})}else i.addEventListener(`click`,()=>{e===`zoomIn`?n.zoomIn():e===`zoomOut`?n.zoomOut():n.reset()});this.el.appendChild(i)}for(let e of[`dblclick`,`contextmenu`,`pointerdown`,`mousedown`])this.el.addEventListener(e,e=>e.stopPropagation());this.el.addEventListener(`focusin`,()=>{this.place(),this.el.classList.add(`tcw-nav-shown`)}),this.el.addEventListener(`focusout`,e=>{this.el.contains(e.relatedTarget)||this.el.classList.remove(`tcw-nav-shown`)}),e.appendChild(this.el),e.addEventListener(`pointermove`,this.onMove),e.addEventListener(`pointerleave`,this.onLeave)}destroy(){this.stopHold(),this.host.removeEventListener(`pointermove`,this.onMove),this.host.removeEventListener(`pointerleave`,this.onLeave),this.el.remove()}place(){let e=this.actions.plotRect();this.el.style.left=`${Math.round(e.x+e.width/2)}px`,this.el.style.top=`${Math.round(e.y+e.height)}px`}startHold(e){this.stopHold(),this.actions.scroll(e),this.holdTimer=setTimeout(()=>{this.repeatTimer=setInterval(()=>this.actions.scroll(e),rt)},nt)}stopHold(){this.holdTimer&&clearTimeout(this.holdTimer),this.repeatTimer&&clearInterval(this.repeatTimer),this.holdTimer=null,this.repeatTimer=null}};function at(e,n,r,i=!1){let a=e.label??n(`alerts.source.price`),o=lt.get(e.condition),s=o?n(o):e.condition;if(st.includes(e.condition))return`${a} ${s} ${t.r(n(`alerts.moveSummary`),{percent:e.percent??0,bars:e.bars??0})}`;if(e.target)return`${a} ${s} ${e.targetLabel??e.target}`;let c=e.channel&&e.channel!==`price`,l=Number.isFinite(e.price)?c?dt(e.price):r(e.price):`—`;return`${(c||e.drawingId)&&e.label?`${e.label} `:i?`${a} `:``}${s} ${l}`}var ot=[{value:`crossing`,key:`alerts.condition.crossing`},{value:`crossingUp`,key:`alerts.condition.crossingUp`},{value:`crossingDown`,key:`alerts.condition.crossingDown`},{value:`greaterThan`,key:`alerts.condition.greaterThan`},{value:`lessThan`,key:`alerts.condition.lessThan`},{value:`movesUp`,key:`alerts.condition.movesUp`},{value:`movesDown`,key:`alerts.condition.movesDown`}],st=[`movesUp`,`movesDown`],ct={hour:36e5,day:864e5,week:7*864e5,month:30*864e5},A=``,lt=new Map(ot.map(e=>[e.value,e.key]));function ut(e){return Math.round(e*1e6)/1e6}function dt(e){let t=Math.abs(e);return t>=1e3||t>=1?e.toFixed(2):e.toPrecision(4)}var ft=class{el;listEl;priceInput;conditionSelect;sourceSelect;targetSelect;percentInput;barsInput;levelRow;moveRow;closeCheck;expirySelect;messageInput;emptyEl;callbacks;open=!1;alerts=[];sources;constructor(e,n,i=t.t){this.t=i,this.callbacks=n,this.sources=[{channel:`price`,label:this.t(`alerts.source.price`)}],this.el=document.createElement(`div`),this.el.className=`tcw-alerts-panel`,this.el.hidden=!0;let a=document.createElement(`div`);a.className=`tcw-alerts-header`;let o=document.createElement(`span`);o.textContent=this.t(`alerts.title`);let s=document.createElement(`button`);s.className=`tcw-alerts-close`,s.type=`button`,s.setAttribute(`aria-label`,this.t(`alerts.close`)),s.innerHTML=S(`x`,14),s.addEventListener(`click`,()=>this.close()),a.appendChild(o),a.appendChild(s),this.el.appendChild(a);let c=document.createElement(`form`);c.className=`tcw-alerts-form`,c.noValidate=!0,this.sourceSelect=document.createElement(`select`),this.sourceSelect.className=`tcw-alerts-source`,this.sourceSelect.setAttribute(`aria-label`,this.t(`alerts.source`)),this.sourceSelect.addEventListener(`change`,()=>{this.renderTargets(),this.prefillPrice()}),this.conditionSelect=document.createElement(`select`),this.conditionSelect.className=`tcw-alerts-condition`,this.conditionSelect.setAttribute(`aria-label`,this.t(`alerts.conditionLabel`));for(let e of ot){let t=document.createElement(`option`);t.value=e.value,t.textContent=this.t(e.key),this.conditionSelect.appendChild(t)}this.conditionSelect.addEventListener(`change`,()=>this.showFields()),this.levelRow=document.createElement(`div`),this.levelRow.className=`tcw-alerts-row-fields`,this.targetSelect=document.createElement(`select`),this.targetSelect.className=`tcw-alerts-target`,this.targetSelect.setAttribute(`aria-label`,this.t(`alerts.compareWith`)),this.targetSelect.addEventListener(`change`,()=>this.showFields()),this.priceInput=document.createElement(`input`),this.priceInput.type=`number`,this.priceInput.step=`any`,this.priceInput.placeholder=this.t(`alerts.value`),this.priceInput.setAttribute(`aria-label`,this.t(`alerts.value`)),this.priceInput.className=`tcw-alerts-price`,this.levelRow.append(this.targetSelect,this.priceInput),this.moveRow=document.createElement(`div`),this.moveRow.className=`tcw-alerts-row-fields`,this.percentInput=this.numberField(`tcw-alerts-percent`,this.t(`alerts.percent`),`1`,`0.01`),this.barsInput=this.numberField(`tcw-alerts-bars`,this.t(`alerts.bars`),`10`,`1`),this.barsInput.min=String(r.MIN_ALERT_BARS),this.barsInput.max=String(r.MAX_ALERT_BARS),this.moveRow.append(this.percentInput,this.barsInput);let l=document.createElement(`div`);l.className=`tcw-alerts-row-fields tcw-alerts-options`;let u=document.createElement(`label`);u.className=`tcw-alerts-check`,this.closeCheck=document.createElement(`input`),this.closeCheck.type=`checkbox`,u.append(this.closeCheck,document.createTextNode(this.t(`alerts.onBarClose`))),this.expirySelect=document.createElement(`select`),this.expirySelect.className=`tcw-alerts-expiry`,this.expirySelect.setAttribute(`aria-label`,this.t(`alerts.expires`));for(let e of[`never`,`hour`,`day`,`week`,`month`]){let t=document.createElement(`option`);t.value=e,t.textContent=this.t(`alerts.expires.${e}`),this.expirySelect.appendChild(t)}l.append(u,this.expirySelect),this.messageInput=document.createElement(`input`),this.messageInput.type=`text`,this.messageInput.placeholder=this.t(`alerts.note`),this.messageInput.setAttribute(`aria-label`,this.t(`alerts.note`)),this.messageInput.className=`tcw-alerts-message`;let d=document.createElement(`button`);d.type=`submit`,d.className=`tcw-alerts-add`,d.innerHTML=`${S(`plus`,14)}<span>${w(this.t(`alerts.add`))}</span>`,c.append(this.sourceSelect,this.conditionSelect,this.levelRow,this.moveRow,l,this.messageInput,d),c.addEventListener(`submit`,e=>{e.preventDefault(),this.submitForm()}),this.el.appendChild(c),this.listEl=document.createElement(`div`),this.listEl.className=`tcw-alerts-list`,this.el.appendChild(this.listEl),this.emptyEl=document.createElement(`div`),this.emptyEl.className=`tcw-alerts-empty`,this.emptyEl.textContent=this.t(`alerts.empty`),this.listEl.appendChild(this.emptyEl),this.renderSources(),this.showFields(),e.appendChild(this.el)}numberField(e,t,n,r){let i=document.createElement(`input`);return i.type=`number`,i.step=r,i.min=`0`,i.value=n,i.className=e,i.placeholder=t,i.setAttribute(`aria-label`,t),i}showFields(){let e=st.includes(this.conditionSelect.value);this.moveRow.hidden=!e,this.levelRow.hidden=e,this.priceInput.hidden=this.targetSelect.value!==A}renderTargets(){let e=this.targetSelect.value,t=this.sourceSelect.value||`price`;this.targetSelect.replaceChildren();let n=document.createElement(`option`);n.value=A,n.textContent=this.t(`alerts.compare.value`),this.targetSelect.appendChild(n);for(let e of this.sources){if(e.channel===t)continue;let n=document.createElement(`option`);n.value=e.channel,n.textContent=e.label,this.targetSelect.appendChild(n)}this.targetSelect.value=[...this.targetSelect.options].some(t=>t.value===e)?e:A,this.showFields()}setSources(e){this.sources=e.length>0?e:[{channel:`price`,label:this.t(`alerts.source.price`)}],this.renderSources()}renderSources(){let e=this.sourceSelect.value||`price`;this.sourceSelect.replaceChildren();for(let e of this.sources){let t=document.createElement(`option`);t.value=e.channel,t.textContent=e.label,this.sourceSelect.appendChild(t)}this.sourceSelect.value=this.sources.some(t=>t.channel===e)?e:`price`,this.renderTargets()}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1,this.priceInput.value===``&&this.prefillPrice()}prefillPrice(){let e=this.callbacks.getChannelValue(this.sourceSelect.value||`price`);this.priceInput.value=e===null?``:String(ut(e))}close(){this.open=!1,this.el.hidden=!0}setAlerts(e){this.alerts=e,this.renderList()}destroy(){this.el.remove()}submitForm(){let e=this.conditionSelect.value,t=this.messageInput.value.trim()||void 0,n=this.sourceSelect.value||`price`,i=this.sources.find(e=>e.channel===n)?.label??this.t(`alerts.source.price`),a={},o=NaN;if(st.includes(e)){a.percent=Number(this.percentInput.value),a.bars=Number(this.barsInput.value);let e=Number.isInteger(a.bars)&&a.bars>=r.MIN_ALERT_BARS&&a.bars<=r.MAX_ALERT_BARS;if(!(a.percent>0)||!e){this.markInvalid(a.percent>0?this.barsInput:this.percentInput);return}}else if(this.targetSelect.value!==A)a.target=this.targetSelect.value;else if(o=Number(this.priceInput.value),this.priceInput.value.trim()===``||!Number.isFinite(o)){this.markInvalid(this.priceInput);return}this.closeCheck.checked&&(a.onBarClose=!0);let s=ct[this.expirySelect.value];s&&(a.expiresAt=(this.callbacks.now??Date.now)()+s),this.callbacks.onAdd({price:o,condition:e,message:t,channel:n,label:i,options:a})!==!1&&(this.messageInput.value=``,this.prefillPrice())}markInvalid(e){e.setAttribute(`aria-invalid`,`true`),e.focus(),e.addEventListener(`input`,()=>e.removeAttribute(`aria-invalid`),{once:!0})}describe(e){return at(e,this.t,this.callbacks.formatPrice)}renderList(){if(this.listEl.replaceChildren(),this.alerts.length===0){this.listEl.appendChild(this.emptyEl);return}for(let e of[...this.alerts].reverse()){let n=document.createElement(`div`);n.className=`tcw-alerts-row`+(e.triggered?` tcw-alerts-triggered`:``)+(e.expired?` tcw-alerts-expired`:``);let r=document.createElement(`div`);r.className=`tcw-alerts-info`;let i=document.createElement(`div`);i.className=`tcw-alerts-row-main`,i.textContent=this.describe(e),r.appendChild(i);let a=[];if(e.onBarClose&&a.push(this.t(`alerts.onClose`)),e.expiresAt!==void 0&&!e.expired){let n=this.callbacks.formatTime?.(e.expiresAt)??new Date(e.expiresAt).toISOString();a.push(t.r(this.t(`alerts.until`),{time:n}))}if(a.length>0){let e=document.createElement(`div`);e.className=`tcw-alerts-row-meta`,e.textContent=a.join(` · `),r.appendChild(e)}if(e.message){let t=document.createElement(`div`);t.className=`tcw-alerts-row-note`,t.textContent=e.message,r.appendChild(t)}if(e.triggered||e.expired){let t=document.createElement(`span`);t.className=`tcw-alerts-badge`,t.textContent=this.t(e.expired?`alerts.expired`:`alerts.triggered`),i.appendChild(t)}let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-alerts-del`,o.setAttribute(`aria-label`,this.t(`alerts.delete`)),o.innerHTML=S(`trash`,14),o.addEventListener(`click`,()=>this.callbacks.onRemove(e.id)),n.appendChild(r),n.appendChild(o),this.listEl.appendChild(n)}}},pt=`system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif`,mt=`'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', ui-monospace, monospace`,ht={studio:{radius:{xs:3,sm:5,md:7,lg:11,xl:16},components:{toolbar:0,sidebar:0},sizes:{toolbar:46,control:30,controlSmall:24,icon:18,sidebar:48,menuItem:30},font:{family:`'Manrope', 'Inter', ${pt}`,mono:mt,size:13,weight:500,strongWeight:600,labelCase:`none`,labelTracking:0},borders:{width:1,separators:!1},shadows:{menu:`var(--tcw-shadow-lg)`,dialog:`var(--tcw-shadow-xl)`,tooltip:`var(--tcw-shadow-md)`},blur:0,active:`tint`,toolbar:`docked`,sidebar:`docked`,intervals:`segmented`,tagRadius:4},terminal:{radius:{xs:1,sm:2,md:2,lg:2,xl:3},components:{tag:0,toolbar:0,sidebar:0},sizes:{toolbar:36,control:26,controlSmall:20,icon:16,sidebar:40,menuItem:26},font:{family:`'IBM Plex Sans Condensed', 'Roboto Condensed', 'Arial Narrow', ${pt}`,mono:`'IBM Plex Mono', ui-monospace, monospace`,size:12,weight:500,strongWeight:600,labelCase:`uppercase`,labelTracking:.08},borders:{width:1,separators:!0},shadows:{menu:`0 0 0 1px var(--tcw-border-strong)`,dialog:`0 0 0 1px var(--tcw-border-strong), var(--tcw-shadow-lg)`,tooltip:`none`},blur:0,active:`underline`,toolbar:`docked`,sidebar:`docked`,intervals:`plain`,tagRadius:0},capsule:{radius:{xs:6,sm:10,md:999,lg:18,xl:24},components:{tooltip:10,toolbar:999,sidebar:999,toast:999,tag:999},sizes:{toolbar:44,control:32,controlSmall:26,icon:18,sidebar:48,menuItem:34},font:{family:`'Sora', 'Manrope', ${pt}`,mono:mt,size:13,weight:500,strongWeight:600,labelCase:`none`,labelTracking:0},borders:{width:1,separators:!1},shadows:{menu:`0 0 0 1px var(--tcw-divider), var(--tcw-shadow-xl)`,dialog:`0 0 0 1px var(--tcw-divider), var(--tcw-shadow-xl)`,tooltip:`var(--tcw-shadow-lg)`},blur:16,active:`solid`,toolbar:`floating`,sidebar:`floating`,intervals:`segmented`,tagRadius:999}},gt={compact:{toolbar:38,control:26,controlSmall:20,icon:16,sidebar:40,menuItem:26},spacious:{toolbar:52,control:34,controlSmall:28,icon:20,sidebar:54,menuItem:34}};function _t(e,t){return{control:e.md,input:e.md,menu:e.lg,dialog:e.xl,panel:e.lg,tooltip:e.sm,tag:e.sm,toast:e.lg,toolbar:0,sidebar:0,...t}}var vt=Object.freeze(Object.fromEntries(Object.keys(ht).map(e=>[e,bt(yt(e))])));function yt(e){let t=ht[e];return{...t,preset:e,radius:{...t.radius},components:_t(t.radius,t.components),sizes:{...t.sizes},font:{...t.font},borders:{...t.borders},shadows:{...t.shadows}}}function bt(e){for(let t of Object.values(e))t&&typeof t==`object`&&bt(t);return Object.freeze(e)}var xt=e=>e===`studio`||e===`terminal`||e===`capsule`,j=(e,t,n)=>typeof e==`number`&&Number.isFinite(e)&&e>=t&&e<=n,St=e=>typeof e==`string`&&e.trim().length>0&&e.length<=300&&!/[;{}<>\\]|url\s*\(|expression\s*\(|\/\*/i.test(e)&&Ct(e);function Ct(e){let t=0,n=``;for(let r of e)if(n)r===n&&(n=``);else if(r===`"`||r===`'`)n=r;else if(r===`(`)t++;else if(r===`)`&&--t<0)return!1;return t===0&&!n}var wt=(e,t)=>typeof e==`string`&&t.includes(e);function M(e,t,n){let r={...e};if(!t||typeof t!=`object`)return r;for(let i of Object.keys(e)){let e=t[i];e!==void 0&&n(i,e)&&(r[i]=e)}return r}function N(e){let t=typeof e==`string`?{preset:e}:e??{},n=xt(t.preset)?t.preset:`studio`,r=ht[n],i=M(r.radius,t.radius,(e,t)=>j(t,0,999)),a=M(t.density===`compact`||t.density===`spacious`?gt[t.density]:r.sizes,t.sizes,(e,t)=>e===`icon`?j(t,10,32):j(t,16,80)),o=M(r.font,t.font,(e,t)=>e===`family`||e===`mono`?St(t):e===`size`?j(t,11,20):e===`weight`||e===`strongWeight`?j(t,100,900):e===`labelCase`?t===`none`||t===`uppercase`:j(t,0,.5));return{preset:n,radius:i,components:M(_t(i,r.components),t.components,(e,t)=>j(t,0,999)),sizes:a,font:o,borders:M(r.borders,t.borders,(e,t)=>e===`width`?j(t,0,4):typeof t==`boolean`),shadows:M(r.shadows,t.shadows,(e,t)=>St(t)),blur:j(t.blur,0,40)?t.blur:r.blur,active:wt(t.active,[`tint`,`solid`,`underline`])?t.active:r.active,toolbar:wt(t.toolbar,[`docked`,`floating`])?t.toolbar:r.toolbar,sidebar:wt(t.sidebar,[`docked`,`floating`])?t.sidebar:r.sidebar,intervals:wt(t.intervals,[`plain`,`segmented`])?t.intervals:r.intervals,tagRadius:j(t.tagRadius,0,999)?t.tagRadius:r.tagRadius}}function Tt(e){let t=e=>`${e}px`,n=e.radius,r=e.components,i=e.sizes,a=e.font;return{"--tcw-radius-xs":t(n.xs),"--tcw-radius-sm":t(n.sm),"--tcw-radius":t(n.md),"--tcw-radius-lg":t(n.lg),"--tcw-radius-xl":t(n.xl),"--tcw-control-radius":t(r.control),"--tcw-input-radius":t(r.input),"--tcw-menu-radius":t(r.menu),"--tcw-dialog-radius":t(r.dialog),"--tcw-panel-radius":t(r.panel),"--tcw-tooltip-radius":t(r.tooltip),"--tcw-tag-radius":t(r.tag),"--tcw-toast-radius":t(r.toast),"--tcw-toolbar-radius":t(r.toolbar),"--tcw-sidebar-radius":t(r.sidebar),"--tcw-toolbar-h":t(i.toolbar),"--tcw-control-h":t(i.control),"--tcw-control-h-sm":t(i.controlSmall),"--tcw-icon":t(i.icon),"--tcw-sidebar-w":t(i.sidebar),"--tcw-menu-item-h":t(i.menuItem),"--tcw-font":a.family,"--tcw-font-mono":a.mono,"--tcw-font-size":t(a.size),"--tcw-font-size-sm":t(a.size-1),"--tcw-font-size-xs":t(a.size-2),"--tcw-font-size-lg":t(a.size+2),"--tcw-weight":String(a.weight),"--tcw-weight-strong":String(a.strongWeight),"--tcw-label-case":a.labelCase,"--tcw-label-tracking":`${a.labelTracking}em`,"--tcw-border-w":t(e.borders.width),"--tcw-sep-w":e.borders.separators?t(Math.max(1,e.borders.width)):`0px`,"--tcw-menu-shadow":e.shadows.menu,"--tcw-dialog-shadow":e.shadows.dialog,"--tcw-tooltip-shadow":e.shadows.tooltip,"--tcw-blur":t(e.blur),"--tcw-surface-opacity":e.blur>0?`82%`:`100%`}}function P(e,t,n={}){let r=n.variables!==!1;for(let[n,i]of Object.entries(Tt(t)))r?e.style.setProperty(n,i):e.style.removeProperty(n);e.dataset.tcwUi=t.preset,e.dataset.tcwActive=t.active,e.dataset.tcwToolbar=t.toolbar,e.dataset.tcwSidebar=t.sidebar,e.dataset.tcwIntervals=t.intervals,e.dataset.tcwSeparators=t.borders.separators?`on`:`off`}var Et=class{el;indicatorsEl;drawingsEl;compareEl=null;callbacks;open=!1;constructor(e,n,r=t.t){this.t=r,this.callbacks=n,this.el=document.createElement(`div`),this.el.className=`tcw-tree-panel`,this.el.hidden=!0;let i=document.createElement(`div`);i.className=`tcw-tree-header`;let a=document.createElement(`span`);a.textContent=this.t(`objects.title`);let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-tree-close`,o.setAttribute(`aria-label`,this.t(`objects.close`)),o.innerHTML=S(`x`,14),o.addEventListener(`click`,()=>this.close()),i.appendChild(a),i.appendChild(o),this.el.appendChild(i),this.indicatorsEl=this.makeSection(this.t(`objects.indicators`)),this.drawingsEl=this.makeSection(this.t(`objects.drawings`)),this.callbacks.onAddCompare&&(this.compareEl=this.makeSection(this.t(`objects.compare`),{label:this.t(`objects.addCompare`),run:()=>this.callbacks.onAddCompare?.()})),e.appendChild(this.el)}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1}close(){this.open=!1,this.el.hidden=!0}destroy(){this.el.remove()}setObjects(e,t,n=[]){this.renderIndicators(e),this.renderDrawings(t),this.renderCompares(n)}makeSection(e,t){let n=document.createElement(`div`);n.className=`tcw-tree-section`;let r=document.createElement(`div`);r.className=`tcw-tree-section-head`;let i=document.createElement(`span`);if(i.textContent=e,r.appendChild(i),t){let e=document.createElement(`button`);e.type=`button`,e.className=`tcw-tree-add`,e.setAttribute(`aria-label`,t.label),e.title=t.label,e.innerHTML=S(`plus`,13),e.addEventListener(`click`,t.run),r.appendChild(e)}let a=document.createElement(`div`);return a.className=`tcw-tree-list`,n.appendChild(r),n.appendChild(a),this.el.appendChild(n),a}renderIndicators(e){if(this.indicatorsEl.replaceChildren(),e.length===0){this.indicatorsEl.appendChild(this.emptyRow(this.t(`objects.noIndicators`)));return}for(let t of e){let e=this.row(t.name);t.visible||e.classList.add(`tcw-tree-hidden`);let n=document.createElement(`div`);n.className=`tcw-tree-actions`,this.callbacks.onToggleIndicatorVisible&&n.appendChild(this.iconButton(t.visible?`eye`:`eyeOff`,t.visible?this.t(`common.hide`):this.t(`common.show`),``,()=>this.callbacks.onToggleIndicatorVisible?.(t.instanceId,!t.visible))),this.callbacks.onConfigureIndicator&&n.appendChild(this.iconButton(`settings`,this.t(`objects.indicatorSettings`),``,()=>this.callbacks.onConfigureIndicator?.(t.instanceId))),n.appendChild(this.iconButton(`trash`,this.t(`objects.removeIndicator`),`tcw-tree-del`,()=>this.callbacks.onRemoveIndicator(t.instanceId))),e.appendChild(n),this.indicatorsEl.appendChild(e)}}renderDrawings(e){if(this.drawingsEl.replaceChildren(),e.length===0){this.drawingsEl.appendChild(this.emptyRow(this.t(`objects.noDrawings`)));return}let t=new Set;for(let n of e){if(!n.group){this.drawingsEl.appendChild(this.drawingRow(n));continue}if(t.has(n.group.id))continue;t.add(n.group.id);let r=n.group.id,i=e.filter(e=>e.group?.id===r);this.drawingsEl.appendChild(this.groupRow(r,n.group.name,i));for(let e of i){let t=this.drawingRow(e);t.classList.add(`tcw-tree-member`),this.drawingsEl.appendChild(t)}}}groupRow(e,t,n){let r=this.row(t);r.classList.add(`tcw-tree-group`);let i=n.some(e=>e.visible),a=n.every(e=>e.locked);i||r.classList.add(`tcw-tree-hidden`);let o=r.querySelector(`.tcw-tree-name`);o.innerHTML=S(`layers`,13),o.append(` ${t}`);let s=document.createElement(`div`);return s.className=`tcw-tree-actions`,this.callbacks.onRenameGroup&&(o.addEventListener(`dblclick`,()=>this.renameGroup(o,e,t)),s.appendChild(this.iconButton(`penLine`,this.t(`objects.renameGroup`),``,()=>this.renameGroup(o,e,t)))),this.callbacks.onToggleGroupVisible&&s.appendChild(this.iconButton(i?`eye`:`eyeOff`,i?this.t(`common.hide`):this.t(`common.show`),``,()=>this.callbacks.onToggleGroupVisible?.(e,!i))),this.callbacks.onToggleGroupLocked&&s.appendChild(this.iconButton(a?`lock`:`unlock`,a?this.t(`common.unlock`):this.t(`common.lock`),a?`tcw-tree-on`:``,()=>this.callbacks.onToggleGroupLocked?.(e,!a))),this.callbacks.onUngroup&&s.appendChild(this.iconButton(`x`,this.t(`drawingMenu.ungroup`),``,()=>this.callbacks.onUngroup?.(e))),r.appendChild(s),r}renameGroup(e,t,n){if(!e.isConnected)return;let r=document.createElement(`input`);r.type=`text`,r.className=`tcw-tree-rename`,r.value=n,r.maxLength=80,r.setAttribute(`aria-label`,this.t(`objects.renameGroup`));let i=!1,a=a=>{if(i)return;i=!0;let o=r.value.trim();r.isConnected&&r.replaceWith(e),a&&o&&o!==n&&this.callbacks.onRenameGroup?.(t,o)};r.addEventListener(`keydown`,e=>{e.key===`Enter`?a(!0):e.key===`Escape`&&(e.stopPropagation(),a(!1))}),r.addEventListener(`blur`,()=>a(!0)),e.replaceWith(r),r.focus(),r.select()}drawingRow(e){let t=this.row(e.label);e.visible||t.classList.add(`tcw-tree-hidden`);let n=document.createElement(`div`);return n.className=`tcw-tree-actions`,n.appendChild(this.iconButton(e.visible?`eye`:`eyeOff`,e.visible?this.t(`common.hide`):this.t(`common.show`),``,()=>this.callbacks.onToggleDrawingVisible(e.id,!e.visible))),n.appendChild(this.iconButton(e.locked?`lock`:`unlock`,e.locked?this.t(`common.unlock`):this.t(`common.lock`),e.locked?`tcw-tree-on`:``,()=>this.callbacks.onToggleDrawingLocked(e.id,!e.locked))),this.callbacks.onConfigureDrawing&&n.appendChild(this.iconButton(`settings`,this.t(`objects.drawingSettings`),``,()=>this.callbacks.onConfigureDrawing?.(e.id))),n.appendChild(this.iconButton(`trash`,this.t(`objects.removeDrawing`),`tcw-tree-del`,()=>this.callbacks.onRemoveDrawing(e.id))),t.appendChild(n),t}renderCompares(e){if(this.compareEl){if(this.compareEl.replaceChildren(),e.length===0){this.compareEl.appendChild(this.emptyRow(this.t(`objects.noComparisons`)));return}for(let t of e){let e=this.row(t.label),n=document.createElement(`span`);n.className=`tcw-tree-dot`,n.style.background=t.color,e.insertBefore(n,e.firstChild),this.callbacks.onRemoveCompare&&e.appendChild(this.iconButton(`trash`,this.t(`objects.removeComparison`),`tcw-tree-del`,()=>this.callbacks.onRemoveCompare?.(t.id))),this.compareEl.appendChild(e)}}}row(e){let t=document.createElement(`div`);t.className=`tcw-tree-row`;let n=document.createElement(`span`);return n.className=`tcw-tree-name`,n.textContent=e,n.title=e,t.appendChild(n),t}emptyRow(e){let t=document.createElement(`div`);return t.className=`tcw-tree-empty`,t.textContent=e,t}iconButton(e,t,n,r){let i=document.createElement(`button`);return i.type=`button`,i.className=`tcw-tree-btn ${n}`.trim(),i.setAttribute(`aria-label`,t),i.title=t,i.innerHTML=S(e,14),i.addEventListener(`click`,r),i}},Dt={trendLine:`Trend Line`,ray:`Ray`,extendedLine:`Extended Line`,horizontalLine:`Horizontal Line`,horizontalRay:`Horizontal Ray`,crossLine:`Cross Line`,infoLine:`Info Line`,trendAngle:`Trend Angle`,circle:`Circle`,fibChannel:`Fib Channel`,fibSpeedResistanceFan:`Fib Speed Resistance Fan`,schiffPitchfork:`Schiff Pitchfork`,modifiedSchiffPitchfork:`Modified Schiff Pitchfork`,xabcdPattern:`XABCD Pattern`,abcdPattern:`ABCD Pattern`,headAndShoulders:`Head and Shoulders`,dateAndPriceRange:`Date and Price Range`,cyclicLines:`Cyclic Lines`,priceLabel:`Price Label`,verticalLine:`Vertical Line`,rectangle:`Rectangle`,ellipse:`Ellipse`,triangle:`Triangle`,arrow:`Arrow`,parallelChannel:`Parallel Channel`,regressionChannel:`Regression Channel`,pitchfork:`Pitchfork`,fibRetracement:`Fib Retracement`,fibExtension:`Fib Extension`,fibTimeZones:`Fib Time Zones`,gannBox:`Gann Box`,gannFan:`Gann Fan`,elliottWave:`Elliott Wave`,priceRange:`Price Range`,dateRange:`Date Range`,measure:`Measure`,text:`Text`,textAnnotation:`Text`,anchoredVWAP:`Anchored VWAP`,volumeProfileRange:`Volume Profile`,riskReward:`Long/Short Position`};function Ot(e,t){let n=`tool.${e}`,r=t?.(n);return r&&r!==n?r:Dt[e]??e}var kt=`button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function F(e,t){if(e.key!==`Tab`)return;let n=[...t.querySelectorAll(kt)].filter(e=>e.getClientRects().length>0||e===document.activeElement);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===i||!t.contains(a))&&(e.preventDefault(),r.focus())}var At=1,jt=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,Mt=[1,1.5,2,3,4];function Nt(e){return e.replace(/_/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}var Pt=class{backdrop;modal;bodyEl;titleEl;tabsEl;resetBtn;callbacks;target=null;draft={};colors=[];levels=[];tab=`inputs`;tabButtons=[];returnFocus=null;uid=At++;t;constructor(e,n,r){this.callbacks=n,this.t=r??(e=>t.c[e]),this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.hidden=!0,this.backdrop.addEventListener(`click`,e=>{e.target===this.backdrop&&this.close()}),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal tcw-modal-narrow`,this.modal.setAttribute(`role`,`dialog`),this.modal.setAttribute(`aria-modal`,`true`),this.modal.setAttribute(`aria-labelledby`,`tcw-indi-title-${this.uid}`),this.modal.tabIndex=-1,this.modal.addEventListener(`keydown`,e=>this.onKeyDown(e));let i=document.createElement(`div`);i.className=`tcw-modal-header`,this.titleEl=document.createElement(`h3`),this.titleEl.id=`tcw-indi-title-${this.uid}`,this.titleEl.textContent=`Indicator`;let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-modal-close`,a.setAttribute(`aria-label`,this.t(`indicatorSettings.close`)),a.innerHTML=S(`x`,16),a.addEventListener(`click`,()=>this.close()),i.append(this.titleEl,a),this.tabsEl=document.createElement(`div`),this.tabsEl.className=`tcw-modal-tabs`,this.tabsEl.setAttribute(`role`,`tablist`),this.tabsEl.addEventListener(`keydown`,e=>this.onTabKey(e)),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-modal-body`,this.bodyEl.id=`tcw-indi-panel-${this.uid}`,this.bodyEl.setAttribute(`role`,`tabpanel`);let o=document.createElement(`div`);o.className=`tcw-modal-footer`,this.resetBtn=document.createElement(`button`),this.resetBtn.type=`button`,this.resetBtn.className=`tcw-reset-link`,this.resetBtn.textContent=this.t(`settings.resetToDefaults`),this.resetBtn.addEventListener(`click`,()=>this.resetTab());let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-done-btn`,s.textContent=this.t(`settings.done`),s.addEventListener(`click`,()=>this.close()),o.append(this.resetBtn,s),this.modal.append(i,this.tabsEl,this.bodyEl,o),this.backdrop.appendChild(this.modal),e.appendChild(this.backdrop)}open(e){this.backdrop.hidden&&(this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null),this.target=e,this.titleEl.textContent=this.t(`indicatorSettings.title`).replace(`{name}`,e.name),this.draft={},this.colors=[...e.colors??[]],this.levels=[...e.levels??[]],this.tab=`inputs`,this.renderTabs(),this.renderBody(),this.backdrop.hidden=!1;let t=this.tabsEl.hidden?null:this.tabButtons[0]??null;(this.bodyEl.querySelector(`button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??t??this.modal).focus()}close(){let e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLSelectElement)&&this.modal.contains(e)&&e.dispatchEvent(new Event(`change`)),this.backdrop.hidden=!0,this.target=null,this.callbacks.onClose(),this.returnFocus?.isConnected&&this.returnFocus.focus(),this.returnFocus=null}isOpen(){return!this.backdrop.hidden}destroy(){this.backdrop.remove()}tabs(){let e=this.target;if(!e)return[];let t=[`inputs`];return e.plots?.length&&e.colors&&this.callbacks.onStyle&&t.push(`style`),e.levels&&this.callbacks.onLevels&&t.push(`levels`),t}renderTabs(){let e=this.tabs();this.tabsEl.hidden=e.length<2,this.tabButtons=e.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`tcw-modal-tab`,t.id=`tcw-indi-tab-${this.uid}-${e}`,t.setAttribute(`role`,`tab`),t.setAttribute(`aria-controls`,this.bodyEl.id),t.dataset.tab=e,t.textContent=this.t(`indicatorSettings.tab.${e}`),t.addEventListener(`click`,()=>this.selectTab(e)),t}),this.tabsEl.replaceChildren(...this.tabButtons),this.markTabs()}markTabs(){for(let e of this.tabButtons){let t=e.dataset.tab===this.tab;e.classList.toggle(`tcw-active`,t),e.setAttribute(`aria-selected`,String(t)),e.tabIndex=t?0:-1,t&&this.bodyEl.setAttribute(`aria-labelledby`,e.id)}}selectTab(e,t=!1){this.tab=e,this.markTabs(),this.renderBody(),t&&this.tabButtons.find(t=>t.dataset.tab===e)?.focus()}onTabKey(e){let t=this.tabButtons.map(e=>e.dataset.tab),n=t.indexOf(this.tab),r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:-1;r<0||t.length===0||(e.preventDefault(),this.selectTab(t[r],!0))}onKeyDown(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this.close();return}F(e,this.modal)}renderBody(){if(this.bodyEl.replaceChildren(),!this.target)return;let e=document.createElement(`div`);e.className=`tcw-settings-section`,this.tab===`style`?this.renderStyle(e):this.tab===`levels`?this.renderLevels(e):this.renderInputs(e),this.resetBtn.hidden=this.tab===`style`,this.bodyEl.appendChild(e)}currentValue(e){if(e in this.draft)return this.draft[e];let t=this.target?.params[e],n=this.target?.defaults[e];return t??n}setValue(e,t){this.target&&(this.draft[e]=t,this.callbacks.onApply(this.target.instanceId,{...this.draft}))}renderInputs(e){let t=Object.keys(this.target.defaults);if(t.length===0){e.appendChild(this.note(this.t(`indicatorSettings.noInputs`)));return}for(let n of t)e.appendChild(this.fieldRow(n))}fieldRow(e){let t=this.target?.inputs?.[e],n=this.currentValue(e),r=typeof(this.target?.defaults[e]??n),i;return i=t?.source?this.sourceControl(e,String(n??`close`)):t?.options?this.choiceControl(e,t.options,n):r===`boolean`?this.toggleControl(e,!!n):r===`number`?this.numberControl(e,Number(n),t):typeof n==`string`&&jt.test(n)?this.colorInput(n,t=>this.setValue(e,t)):this.textControl(e,String(n??``)),this.row(t?.label??Nt(e),i)}sourceControl(e,t){let r=document.createElement(`select`);r.className=`tcw-indi-input tcw-indi-select`;let i=document.createElement(`optgroup`);i.label=this.t(`indicatorSettings.source.prices`);for(let e of n.PRICE_SOURCES)i.appendChild(this.option(e,e));r.appendChild(i);let a=this.target?.lineSources??[];if(a.length){let e=document.createElement(`optgroup`);e.label=this.t(`indicatorSettings.source.indicators`);for(let t of a)e.appendChild(this.option(t.value,t.label));r.appendChild(e)}return r.value=t,r.value!==t&&(r.value=`close`),r.addEventListener(`change`,()=>this.setValue(e,r.value)),r}choiceControl(e,t,n){let r=document.createElement(`select`);r.className=`tcw-indi-input tcw-indi-select`;for(let e of t)r.appendChild(this.option(String(e),String(e)));return r.value=String(n),r.addEventListener(`change`,()=>{let n=t.find(e=>String(e)===r.value);n!==void 0&&this.setValue(e,n)}),r}toggleControl(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-toggle${t?` tcw-on`:``}`,n.setAttribute(`role`,`switch`),n.setAttribute(`aria-checked`,String(t)),n.addEventListener(`click`,()=>{let t=!n.classList.contains(`tcw-on`);n.classList.toggle(`tcw-on`,t),n.setAttribute(`aria-checked`,String(t)),this.setValue(e,t)}),n}numberControl(e,t,n){let r=document.createElement(`input`);return r.type=`number`,r.className=`tcw-indi-input`,r.value=String(t),r.step=String(n?.step??(Number.isInteger(t)?1:.1)),n?.min!==void 0&&(r.min=String(n.min)),n?.max!==void 0&&(r.max=String(n.max)),r.addEventListener(`change`,()=>{let t=Number(r.value);Number.isFinite(t)&&(n?.min!==void 0&&(t=Math.max(n.min,t)),n?.max!==void 0&&(t=Math.min(n.max,t)),r.value=String(t),this.setValue(e,t))}),r}textControl(e,t){let n=document.createElement(`input`);return n.type=`text`,n.className=`tcw-indi-input`,n.value=t,n.addEventListener(`change`,()=>this.setValue(e,n.value)),n}renderStyle(e){let t=this.target,n=new Map,r=(e,t)=>{let r=n.get(e)??[];r.includes(t)||r.push(t),n.set(e,r)};for(let e of t.plots??[]){let t=e.tone!==void 0&&e.downColor!==void 0;r(e.color,t?`${e.title} ${this.t(`indicatorSettings.up`)}`:e.title),t&&r(e.downColor,`${e.title} ${this.t(`indicatorSettings.down`)}`)}for(let[r,i]of[...n].sort((e,t)=>e[0]-t[0])){let n=this.colors[r]??this.colors[0]??`#4c8dff`;e.appendChild(this.row(i.join(` · `),this.colorInput(n,e=>{let n=[...this.colors];for(;n.length<=r;)n.push(n[0]??e);n[r]=e,this.colors=n,this.callbacks.onStyle?.(t.instanceId,{colors:[...n]})})))}let i=document.createElement(`select`);i.className=`tcw-indi-input tcw-indi-select`;for(let e of Mt)i.appendChild(this.option(String(e),`${e} px`));if(i.value=String(t.lineWidth??1.5),i.addEventListener(`change`,()=>this.callbacks.onStyle?.(t.instanceId,{lineWidths:[Number(i.value)]})),e.appendChild(this.row(this.t(`indicatorSettings.lineWidth`),i)),t.scale&&this.callbacks.onScale){let n=document.createElement(`select`);n.className=`tcw-indi-input tcw-indi-select`,n.appendChild(this.option(`right`,this.t(`indicatorSettings.scale.right`))),n.appendChild(this.option(`left`,this.t(`indicatorSettings.scale.left`))),n.value=t.scale,n.addEventListener(`change`,()=>{let e=n.value===`left`?`left`:`right`;this.target={...t,scale:e},this.callbacks.onScale?.(t.instanceId,e)}),e.appendChild(this.row(this.t(`indicatorSettings.scale`),n))}}renderLevels(e){this.levels.length===0&&e.appendChild(this.note(this.t(`indicatorSettings.noLevels`))),this.levels.forEach((t,n)=>{let r=document.createElement(`input`);r.type=`number`,r.className=`tcw-indi-input`,r.id=`tcw-indi-level-${this.uid}-${n}`,r.value=String(t),r.step=`any`,r.addEventListener(`change`,()=>{let e=Number(r.value);!Number.isFinite(e)||r.value.trim()===``||(this.levels=this.levels.map((t,r)=>r===n?e:t),this.applyLevels())});let i=document.createElement(`button`);i.type=`button`,i.className=`tcw-indi-remove`,i.innerHTML=S(`x`,12);let a=this.t(`indicatorSettings.removeLevel`);i.title=a,i.setAttribute(`aria-label`,`${a} ${n+1}`),i.addEventListener(`click`,()=>{this.levels=this.levels.filter((e,t)=>t!==n),this.applyLevels(),this.renderBody(),(this.bodyEl.querySelectorAll(`.tcw-indi-remove`)[n]??this.bodyEl.querySelector(`.tcw-indi-add`))?.focus()});let o=document.createElement(`span`);o.className=`tcw-indi-level`,o.append(r,i);let s=document.createElement(`div`);s.className=`tcw-settings-row`;let c=document.createElement(`label`);c.className=`tcw-settings-label`,c.htmlFor=r.id,c.textContent=`${this.t(`indicatorSettings.level`)} ${n+1}`,s.append(c,o),e.appendChild(s)});let t=document.createElement(`button`);t.type=`button`,t.className=`tcw-reset-link tcw-indi-add`,t.textContent=`+ ${this.t(`indicatorSettings.addLevel`)}`,t.addEventListener(`click`,()=>{let e=this.levels[this.levels.length-1];this.levels=[...this.levels,e===void 0?0:e+10],this.applyLevels(),this.renderBody();let t=this.bodyEl.querySelectorAll(`.tcw-indi-level input`);t[t.length-1]?.focus()}),e.appendChild(t)}applyLevels(){this.target&&this.callbacks.onLevels?.(this.target.instanceId,[...this.levels])}resetTab(){let e=this.target;if(e){if(this.tab===`levels`)this.levels=[...e.defaultLevels??[]],this.callbacks.onLevels?.(e.instanceId,null);else{let t={};for(let[n,r]of Object.entries(e.defaults))t[n]=r;this.draft=t,this.callbacks.onApply(e.instanceId,{...t})}this.renderBody()}}row(e,t){let n=document.createElement(`label`);n.className=`tcw-settings-row`;let r=document.createElement(`span`);return r.className=`tcw-settings-label`,r.textContent=e,n.append(r,t),n}note(e){let t=document.createElement(`div`);return t.className=`tcw-settings-label`,t.textContent=e,t}option(e,t){let n=document.createElement(`option`);return n.value=e,n.textContent=t,n}colorInput(e,t){let n=document.createElement(`input`);return n.type=`color`,n.className=`tcw-indi-color`,n.value=Ft(e),n.addEventListener(`input`,()=>t(n.value)),n}};function Ft(e){let t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase();if(/^#[0-9a-f]{3}$/i.test(t))return`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toLowerCase();let n=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(t);return n?`#${[n[1],n[2],n[3]].map(e=>Math.min(255,Number(e)).toString(16).padStart(2,`0`)).join(``)}`:`#000000`}function It(){try{return typeof localStorage<`u`?localStorage:null}catch{return null}}var Lt=80;function Rt(e){let{text:t,...r}=(0,n.sanitizeDrawingStyle)(e);return r}function zt(e){let t={name:e.name,style:{...e.style}};return e.type&&(t.type=e.type),e.options&&(t.options=structuredClone(e.options)),t}var Bt=class{templates=[];constructor(e=`tcw:draw-templates`,t=It()){this.storageKey=e,this.storage=t,this.load()}list(e){return this.templates.filter(t=>!t.type||t.type===e).map(zt)}get(e,t){let n=this.templates.find(n=>n.name===e&&n.type===t);return n?zt(n):null}save(e,t,n){let r=e.trim().slice(0,Lt);if(!r)return;let i={name:r,style:Rt(t)};n&&(i.type=n.type,i.options=structuredClone(n.options)),this.templates=this.templates.filter(e=>!(e.name===r&&e.type===i.type)),this.templates.push(i),this.persist()}remove(e,t){this.templates=this.templates.filter(n=>!(n.name===e&&n.type===t)),this.persist()}clear(){this.templates=[],this.persist()}load(){if(this.storage)try{let e=this.storage.getItem(this.storageKey);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;this.templates=t.filter(e=>e&&typeof e.name==`string`&&e.name.trim()!==``).map(e=>{let t={name:e.name.trim().slice(0,Lt),style:Rt(e.style)};return typeof e.type==`string`&&(t.type=e.type),e.options&&typeof e.options==`object`&&!Array.isArray(e.options)&&(t.options=e.options),t})}catch{}}persist(){if(this.storage)try{this.storage.setItem(this.storageKey,JSON.stringify(this.templates))}catch{}}},Vt=class{defaults={};constructor(e=`tcw:drawing-defaults`,t=It()){this.storageKey=e,this.storage=t;try{let e=this.storage?.getItem(this.storageKey),t=e?JSON.parse(e):null;if(t&&typeof t==`object`&&!Array.isArray(t))for(let[e,n]of Object.entries(t))n&&typeof n==`object`&&!Array.isArray(n)&&(this.defaults[e]=n)}catch{}}all(){return structuredClone(this.defaults)}set(e,t){t&&Object.keys(t).length>0?this.defaults[e]=structuredClone(t):delete this.defaults[e];try{this.storage?.setItem(this.storageKey,JSON.stringify(this.defaults))}catch{}}},Ht=[`#4c8dff`,`#1fa874`,`#e8505b`,`#f2a93b`,`#a57cff`,`#1398a8`,`#ffffff`,`#7d8696`],Ut=[1,2,3,4],Wt=[`solid`,`dashed`,`dotted`],Gt=class{el;templatesEl;nameInput;callbacks;store;open=!1;constructor(e,n,r,i=t.t){this.t=i,this.callbacks=n,this.store=r,this.el=document.createElement(`div`),this.el.className=`tcw-style-panel`,this.el.hidden=!0;let a=document.createElement(`div`);a.className=`tcw-style-header`;let o=document.createElement(`span`);o.textContent=this.t(`drawingStyle.title`);let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-style-close`,s.setAttribute(`aria-label`,this.t(`common.close`)),s.innerHTML=S(`x`,14),s.addEventListener(`click`,()=>this.close()),a.appendChild(o),a.appendChild(s),this.el.appendChild(a),this.el.appendChild(this.colorRow()),this.el.appendChild(this.widthRow()),this.el.appendChild(this.lineStyleRow());let c=document.createElement(`div`);c.className=`tcw-style-subhead`,c.textContent=this.t(`drawingStyle.templates`),this.el.appendChild(c);let l=document.createElement(`div`);l.className=`tcw-style-save`,this.nameInput=document.createElement(`input`),this.nameInput.type=`text`,this.nameInput.placeholder=this.t(`drawingStyle.templateName`),this.nameInput.className=`tcw-style-name`;let u=document.createElement(`button`);u.type=`button`,u.className=`tcw-style-savebtn`,u.innerHTML=`${S(`plus`,13)}<span>${w(this.t(`common.save`))}</span>`,u.addEventListener(`click`,()=>this.saveTemplate()),l.appendChild(this.nameInput),l.appendChild(u),this.el.appendChild(l),this.templatesEl=document.createElement(`div`),this.templatesEl.className=`tcw-style-templates`,this.el.appendChild(this.templatesEl),e.appendChild(this.el),this.renderTemplates()}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1,this.syncActiveControls(),this.renderTemplates()}close(){this.open=!1,this.el.hidden=!0}destroy(){this.el.remove()}colorRow(){let e=document.createElement(`div`);e.className=`tcw-style-row tcw-style-colors`;for(let t of Ht){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-swatch`,n.style.background=t,n.dataset.color=t,n.setAttribute(`aria-label`,t),n.addEventListener(`click`,()=>this.applyStyle({color:t})),e.appendChild(n)}let t=document.createElement(`input`);return t.type=`color`,t.className=`tcw-style-picker`,t.addEventListener(`input`,()=>this.applyStyle({color:t.value})),e.appendChild(t),e}widthRow(){let e=document.createElement(`div`);e.className=`tcw-style-row tcw-style-widths`;for(let t of Ut){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-width`,n.dataset.width=String(t);let r=document.createElement(`span`);r.style.height=`${t}px`,n.appendChild(r),n.addEventListener(`click`,()=>this.applyStyle({lineWidth:t})),e.appendChild(n)}return e}lineStyleRow(){let e=document.createElement(`div`);e.className=`tcw-style-row tcw-style-dashes`;for(let t of Wt){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-dash`,n.dataset.linestyle=t,n.textContent=t===`solid`?`──`:t===`dashed`?`╌╌`:`┄┄`,n.title=t,n.addEventListener(`click`,()=>this.applyStyle({lineStyle:t})),e.appendChild(n)}return e}applyStyle(e){this.callbacks.onStyleChange(e),this.syncActiveControls()}syncActiveControls(){let e=this.callbacks.getStyle();this.el.querySelectorAll(`.tcw-style-swatch`).forEach(t=>{t.classList.toggle(`tcw-on`,t.dataset.color?.toLowerCase()===e.color?.toLowerCase())}),this.el.querySelectorAll(`.tcw-style-width`).forEach(t=>{t.classList.toggle(`tcw-on`,Number(t.dataset.width)===e.lineWidth)}),this.el.querySelectorAll(`.tcw-style-dash`).forEach(t=>{t.classList.toggle(`tcw-on`,t.dataset.linestyle===e.lineStyle)})}saveTemplate(){let e=this.nameInput.value.trim();e&&(this.store.save(e,this.callbacks.getStyle()),this.nameInput.value=``,this.renderTemplates())}renderTemplates(){this.templatesEl.replaceChildren();let e=this.store.list();if(e.length===0){let e=document.createElement(`div`);e.className=`tcw-style-empty`,e.textContent=this.t(`drawingStyle.noTemplates`),this.templatesEl.appendChild(e);return}for(let t of e){let e=document.createElement(`div`);e.className=`tcw-style-template`;let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-style-apply`;let r=document.createElement(`span`);r.className=`tcw-style-tdot`,r.style.background=t.style.color??`var(--tcw-text-muted)`;let i=document.createElement(`span`);i.textContent=t.name,n.appendChild(r),n.appendChild(i),n.addEventListener(`click`,()=>{this.callbacks.onStyleChange({...t.style}),this.syncActiveControls()});let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-style-tdel`,a.setAttribute(`aria-label`,this.t(`drawingStyle.deleteTemplate`)),a.innerHTML=S(`trash`,13),a.addEventListener(`click`,()=>{this.store.remove(t.name),this.renderTemplates()}),e.appendChild(n),e.appendChild(a),this.templatesEl.appendChild(e)}}};function I(e,t){let n=document.createElement(`label`);n.className=`tcw-settings-row`;let r=document.createElement(`span`);return r.className=`tcw-settings-label`,r.textContent=e,n.append(r,t),n}function Kt(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-toggle${e?` tcw-on`:``}`,n.setAttribute(`role`,`switch`),n.setAttribute(`aria-checked`,String(e)),n.addEventListener(`click`,()=>{let e=!n.classList.contains(`tcw-on`);n.classList.toggle(`tcw-on`,e),n.setAttribute(`aria-checked`,String(e)),t(e)}),n}function L(e,t,n){let r=document.createElement(`input`);return r.type=`number`,r.className=`tcw-indi-input`,r.value=String(e),r.step=String(t.step??(Number.isInteger(e)?1:.001)),t.min!==void 0&&(r.min=String(t.min)),t.max!==void 0&&(r.max=String(t.max)),r.addEventListener(`change`,()=>{if(r.value.trim()===``)return;let e=Number(r.value);Number.isFinite(e)&&(t.min!==void 0&&(e=Math.max(t.min,e)),t.max!==void 0&&(e=Math.min(t.max,e)),r.value=String(e),n(e))}),r}function qt(e,t){let n=document.createElement(`input`);return n.type=`color`,n.className=`tcw-indi-color`,n.value=Jt(e),n.addEventListener(`input`,()=>t(n.value)),n}function R(e,t,n){let r=document.createElement(`select`);r.className=`tcw-indi-input tcw-indi-select`;for(let t of e){let e=document.createElement(`option`);e.value=t.value,e.textContent=t.label,r.appendChild(e)}return r.value=t,r.addEventListener(`change`,()=>n(r.value)),r}function Jt(e){if(typeof e!=`string`)return`#000000`;let t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase();if(/^#[0-9a-f]{3}$/i.test(t))return`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toLowerCase();let n=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(t);return n?`#${[n[1],n[2],n[3]].map(e=>Math.min(255,Number(e)).toString(16).padStart(2,`0`)).join(``)}`:`#000000`}function Yt(e){if(typeof e!=`string`)return 1;let t=/^rgba\([^)]*,\s*([\d.]+)\s*\)$/i.exec(e.trim());return t?Math.max(0,Math.min(1,Number(t[1]))):1}function Xt(e,t){let n=Jt(e),[r,i,a]=[1,3,5].map(e=>parseInt(n.slice(e,e+2),16));return`rgba(${r}, ${i}, ${a}, ${Math.round(t*100)/100})`}var Zt=12,Qt=[1,2,3,4],$t=[`solid`,`dashed`,`dotted`],en=[10,11,12,14,16,18,20,24,28,32],tn=48,nn=1,rn=class{backdrop;modal;titleEl;tabsEl;bodyEl;footerLeft;tabButtons=[];target=null;style;options={};anchors=[];tab=`style`;returnFocus=null;uid=nn++;constructor(e,n,r=t.t){this.callbacks=n,this.t=r,this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.hidden=!0;let i=!1;this.backdrop.addEventListener(`pointerdown`,e=>{i=e.target===this.backdrop}),this.backdrop.addEventListener(`click`,e=>{e.target===this.backdrop&&i&&this.close(!0),i=!1}),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal tcw-modal-narrow tcw-drawing-settings`,this.modal.setAttribute(`role`,`dialog`),this.modal.setAttribute(`aria-modal`,`true`),this.modal.setAttribute(`aria-labelledby`,`tcw-draw-title-${this.uid}`),this.modal.tabIndex=-1,this.modal.addEventListener(`keydown`,e=>this.onKeyDown(e));let a=document.createElement(`div`);a.className=`tcw-modal-header`,this.titleEl=document.createElement(`h3`),this.titleEl.id=`tcw-draw-title-${this.uid}`;let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-modal-close`,o.setAttribute(`aria-label`,this.t(`common.close`)),o.innerHTML=S(`x`,16),o.addEventListener(`click`,()=>this.close(!0)),a.append(this.titleEl,o),this.tabsEl=document.createElement(`div`),this.tabsEl.className=`tcw-modal-tabs`,this.tabsEl.setAttribute(`role`,`tablist`),this.tabsEl.addEventListener(`keydown`,e=>this.onTabKey(e)),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-modal-body`,this.bodyEl.id=`tcw-draw-panel-${this.uid}`,this.bodyEl.setAttribute(`role`,`tabpanel`);let s=document.createElement(`div`);s.className=`tcw-modal-footer`,this.footerLeft=document.createElement(`div`),this.footerLeft.className=`tcw-drawing-settings-tools`;let c=document.createElement(`button`);c.type=`button`,c.className=`tcw-reset-link`,c.textContent=this.t(`common.cancel`),c.addEventListener(`click`,()=>this.close(!0));let l=document.createElement(`button`);l.type=`button`,l.className=`tcw-done-btn`,l.textContent=this.t(`drawingSettings.ok`),l.addEventListener(`click`,()=>this.close(!1)),s.append(this.footerLeft,c,l),this.modal.append(a,this.tabsEl,this.bodyEl,s),this.backdrop.appendChild(this.modal),e.appendChild(this.backdrop)}open(e){this.target&&this.close(!1),this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.target=e,this.style={...e.style},this.options=structuredClone(e.options),this.anchors=e.anchors.map(e=>({...e})),this.titleEl.textContent=e.name,this.tab=`style`,this.callbacks.onBegin(e.id);try{this.renderTabs(),this.renderBody()}catch(t){throw this.target=null,this.callbacks.onEnd(e.id,!0),t}this.backdrop.hidden=!1,(this.tabButtons[0]??this.modal).focus()}close(e){let t=this.target;if(!t)return;let n=document.activeElement;!e&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)&&this.modal.contains(n)&&n.dispatchEvent(new Event(`change`)),this.target=null,this.backdrop.hidden=!0,this.callbacks.onEnd(t.id,e),this.returnFocus?.isConnected&&this.returnFocus.focus(),this.returnFocus=null}isOpen(){return this.target!==null}editing(){return this.target?.id??null}destroy(){this.close(!0),this.backdrop.remove()}tabs(){let e=[`style`];return this.target&&Object.keys(this.target.defs).length>0&&e.push(`options`),this.target&&this.target.anchors.length<=Zt&&e.push(`coordinates`),e}renderTabs(){this.tabButtons=this.tabs().map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`tcw-modal-tab`,t.id=`tcw-draw-tab-${this.uid}-${e}`,t.setAttribute(`role`,`tab`),t.setAttribute(`aria-controls`,this.bodyEl.id),t.dataset.tab=e,t.textContent=this.t(`drawingSettings.tab.${e}`),t.addEventListener(`click`,()=>this.selectTab(e)),t}),this.tabsEl.replaceChildren(...this.tabButtons),this.markTabs()}markTabs(){for(let e of this.tabButtons){let t=e.dataset.tab===this.tab;e.classList.toggle(`tcw-active`,t),e.setAttribute(`aria-selected`,String(t)),e.tabIndex=t?0:-1,t&&this.bodyEl.setAttribute(`aria-labelledby`,e.id)}}selectTab(e,t=!1){this.tab=e,this.markTabs(),this.renderBody(),t&&this.tabButtons.find(t=>t.dataset.tab===e)?.focus()}onTabKey(e){let t=this.tabButtons.map(e=>e.dataset.tab),n=t.indexOf(this.tab),r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:-1;r<0||(e.preventDefault(),this.selectTab(t[r],!0))}onKeyDown(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this.close(!0);return}F(e,this.modal)}renderBody(){if(this.bodyEl.replaceChildren(),this.footerLeft.replaceChildren(),!this.target)return;if(this.target.alertable&&this.callbacks.onAddAlert){let e=document.createElement(`button`);e.type=`button`,e.className=`tcw-reset-link tcw-drawing-alert`,e.innerHTML=`${S(`bell`,13)}<span></span>`,e.querySelector(`span`).textContent=this.t(`drawingSettings.addAlert`),e.addEventListener(`click`,()=>this.callbacks.onAddAlert?.(this.target.id)),this.footerLeft.appendChild(e)}let e=document.createElement(`div`);e.className=`tcw-settings-section`,this.tab===`options`?this.renderOptions(e):this.tab===`coordinates`?this.renderCoordinates(e):this.renderStyle(e),this.bodyEl.appendChild(e)}change(e){this.target&&this.callbacks.onChange(this.target.id,e)}setStyle(e){this.style={...this.style,...e},this.change({style:e})}setOptions(e){this.options={...this.options,...structuredClone(e)},this.change({options:e})}renderStyle(e){let t=this.target;e.appendChild(I(this.t(`drawingSettings.color`),qt(this.style.color,e=>this.setStyle({color:e})))),e.appendChild(I(this.t(`drawingSettings.lineWidth`),R(Qt.map(e=>({value:String(e),label:`${e} px`})),String(this.style.lineWidth),e=>this.setStyle({lineWidth:Number(e)})))),e.appendChild(I(this.t(`drawingSettings.lineStyle`),R($t.map(e=>({value:e,label:this.t(`drawingSettings.lineStyle.${e}`)})),this.style.lineStyle,e=>this.setStyle({lineStyle:e})))),t.fill&&this.renderFill(e),t.text&&this.renderText(e),this.callbacks.templates&&this.renderTemplates(e)}renderFill(e){let t=this.style.fillColor??Xt(this.style.color,.1),n=Jt(t),r=Yt(t),i=()=>this.setStyle({fillColor:Xt(n,r),fillOpacity:r});e.appendChild(I(this.t(`drawingSettings.fill`),qt(n,e=>{n=e,i()}))),e.appendChild(I(this.t(`drawingSettings.opacity`),L(Math.round(r*100),{min:0,max:100,step:5},e=>{r=e/100,i()})))}renderText(e){let t=document.createElement(`textarea`);t.className=`tcw-indi-input tcw-drawing-text`,t.rows=3,t.value=this.style.text??``,t.addEventListener(`input`,()=>this.setStyle({text:t.value})),e.appendChild(I(this.t(`drawingSettings.text`),t)),e.appendChild(I(this.t(`drawingSettings.fontSize`),R(en.map(e=>({value:String(e),label:`${e} px`})),String(this.style.fontSize??12),e=>this.setStyle({fontSize:Number(e)}))))}renderTemplates(e){let t=this.callbacks.templates,r=this.target,i=document.createElement(`div`);i.className=`tcw-style-subhead`,i.textContent=this.t(`drawingStyle.templates`),e.appendChild(i);let a=document.createElement(`div`);a.className=`tcw-drawing-templates`;let o=t.list(r.type);if(o.length===0){let e=document.createElement(`div`);e.className=`tcw-settings-label`,e.textContent=this.t(`drawingStyle.noTemplates`),a.appendChild(e)}for(let e of o){let i=document.createElement(`div`);i.className=`tcw-style-tmpl`;let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-style-tmpl-apply`,o.textContent=e.name,o.addEventListener(`click`,()=>{this.setStyle(e.style),e.options&&this.setOptions((0,n.sanitizeDrawingOptions)(r.defs,e.options)),this.renderBody()});let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-style-tmpl-del`,s.setAttribute(`aria-label`,this.t(`drawingStyle.deleteTemplate`)),s.innerHTML=S(`x`,12),s.addEventListener(`click`,()=>{t.remove(e.name,e.type),this.renderBody()}),i.append(o,s),a.appendChild(i)}e.appendChild(a);let s=document.createElement(`div`);s.className=`tcw-style-save`;let c=document.createElement(`input`);c.type=`text`,c.className=`tcw-style-name`,c.placeholder=this.t(`drawingStyle.templateName`),c.setAttribute(`aria-label`,this.t(`drawingStyle.templateName`));let l=document.createElement(`button`);l.type=`button`,l.className=`tcw-style-savebtn`,l.textContent=this.t(`common.save`),l.addEventListener(`click`,()=>{c.value.trim()&&(t.save(c.value,this.style,{type:r.type,options:this.options}),this.renderBody())}),s.append(c,l),e.appendChild(s)}label(e,t){let n=`drawingOption.${e}`,r=this.t(n);return r===n?t:r}renderOptions(e){let t=this.target;for(let[n,r]of Object.entries(t.defs))r.kind===`levels`?e.appendChild(this.levelsEditor(n,r)):e.appendChild(I(this.label(n,r.label),this.optionControl(n,r)));let n=document.createElement(`button`);if(n.type=`button`,n.className=`tcw-reset-link`,n.textContent=this.t(`settings.resetToDefaults`),n.addEventListener(`click`,()=>{let e={};for(let[n,r]of Object.entries(t.defs))e[n]=structuredClone(r.default);this.setOptions(e),this.renderBody()}),this.footerLeft.appendChild(n),this.callbacks.onSaveDefault){let e=document.createElement(`button`);e.type=`button`,e.className=`tcw-reset-link`,e.textContent=this.t(`drawingSettings.saveDefault`),e.addEventListener(`click`,()=>this.callbacks.onSaveDefault?.(t.type,structuredClone(this.options))),this.footerLeft.appendChild(e)}}optionControl(e,t){let n=this.options[e];switch(t.kind){case`boolean`:return Kt(!!n,t=>this.setOptions({[e]:t}));case`number`:return L(Number(n),{min:t.min,max:t.max,step:t.step},t=>this.setOptions({[e]:t}));case`choice`:return R(t.choices.map(t=>({value:t.value,label:this.label(`${e}.${t.value}`,t.label)})),String(n),t=>this.setOptions({[e]:t}));case`text`:{let t=document.createElement(`input`);return t.type=`text`,t.className=`tcw-indi-input`,t.value=String(n??``),t.addEventListener(`change`,()=>this.setOptions({[e]:t.value})),t}}}levelsEditor(e,t){let n=document.createElement(`div`);n.className=`tcw-levels-editor`;let r=document.createElement(`div`);r.className=`tcw-style-subhead`,r.textContent=this.label(e,t.label),n.appendChild(r);let i=()=>{let t=this.options[e];return Array.isArray(t)?t:[]},a=t=>this.setOptions({[e]:t}),o=document.createElement(`div`);o.className=`tcw-levels-grid`,i().forEach((e,t)=>{let n=document.createElement(`div`);n.className=`tcw-level-row`;let r=document.createElement(`input`);r.type=`checkbox`,r.checked=e.visible;let s=` ${t+1}`;r.setAttribute(`aria-label`,this.t(`drawingSettings.levelVisible`)+s),r.addEventListener(`change`,()=>a(i().map((e,n)=>n===t?{...e,visible:r.checked}:e)));let c=L(e.value,{step:.001},e=>a(i().map((n,r)=>r===t?{...n,value:e}:n)));c.setAttribute(`aria-label`,this.t(`drawingSettings.levelValue`)+s);let l=qt(e.color??this.style.color,e=>a(i().map((n,r)=>r===t?{...n,color:e}:n)));l.setAttribute(`aria-label`,this.t(`drawingSettings.levelColor`)+s);let u=document.createElement(`button`);u.type=`button`,u.className=`tcw-level-remove`,u.setAttribute(`aria-label`,this.t(`drawingSettings.removeLevel`)+s),u.innerHTML=S(`x`,12),u.addEventListener(`click`,()=>{a(i().filter((e,n)=>n!==t)),this.renderBody()}),n.append(r,c,l,u),o.appendChild(n)}),n.appendChild(o);let s=document.createElement(`button`);return s.type=`button`,s.className=`tcw-reset-link tcw-level-add`,s.textContent=this.t(`drawingSettings.addLevel`),s.disabled=i().length>=tn,s.addEventListener(`click`,()=>{let e=i().at(-1)?.value??0;a([...i(),{value:Math.round((e+.5)*1e3)/1e3,visible:!0}]),this.renderBody()}),n.appendChild(s),n}renderCoordinates(e){this.anchors.forEach((n,r)=>{let i=document.createElement(`div`);i.className=`tcw-style-subhead`,i.textContent=t.r(this.t(`drawingSettings.point`),{n:r+1}),e.appendChild(i);let a=this.callbacks.toWallTime(n.time),o=document.createElement(`input`);o.type=`date`,o.className=`tcw-indi-input`,o.value=a.date;let s=document.createElement(`input`);s.type=`time`,s.className=`tcw-indi-input`,s.value=a.time;let c=()=>{let e=this.callbacks.fromWallTime(o.value,s.value);e!==null&&this.setAnchor(r,{time:e})};o.addEventListener(`change`,c),s.addEventListener(`change`,c),e.appendChild(I(this.t(`drawingSettings.date`),o)),e.appendChild(I(this.t(`drawingSettings.time`),s)),e.appendChild(I(this.t(`drawingSettings.price`),L(n.price,{step:`any`},e=>this.setAnchor(r,{price:e}))))})}setAnchor(e,t){this.anchors=this.anchors.map((n,r)=>r===e?{...n,...t}:n),this.change({anchors:this.anchors.map(e=>({...e}))})}},an=4;function on(e,t,n){let r=e+t>n?e-t:e;return Math.max(0,Math.min(r,n-t))}var z=class{el;onPick=null;returnFocus=null;anchor=null;onDocPointer=e=>{let t=e.target;this.el.contains(t)||this.anchor?.contains(t)||this.close()};onAway=()=>this.close();constructor(e,t){this.host=e,this.el=document.createElement(`div`),this.el.className=`tcw-context-menu`,this.el.setAttribute(`role`,`menu`),this.el.setAttribute(`aria-label`,t),this.el.hidden=!0,this.el.addEventListener(`keydown`,e=>this.onKeyDown(e)),e.appendChild(this.el)}open(e,t,n,r,i){this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.onPick=r,this.anchor=i??null,this.el.replaceChildren(...e.map(e=>this.entry(e))),this.el.hidden=!1;let a=this.host.getBoundingClientRect(),o=Math.min(this.host.clientWidth,window.innerWidth-a.left)-an,s=Math.min(this.host.clientHeight,window.innerHeight-a.top)-an;this.el.style.left=`${on(t,this.el.offsetWidth,o)}px`,this.el.style.top=`${on(n,this.el.offsetHeight,s)}px`,document.addEventListener(`pointerdown`,this.onDocPointer,!0),document.addEventListener(`wheel`,this.onAway,{capture:!0,passive:!0}),window.addEventListener(`resize`,this.onAway),window.addEventListener(`blur`,this.onAway),this.items()[0]?.focus({preventScroll:!0})}close(){this.el.hidden||(this.el.hidden=!0,this.onPick=null,this.anchor=null,document.removeEventListener(`pointerdown`,this.onDocPointer,!0),document.removeEventListener(`wheel`,this.onAway,{capture:!0}),window.removeEventListener(`resize`,this.onAway),window.removeEventListener(`blur`,this.onAway),this.returnFocus?.isConnected&&this.returnFocus.focus({preventScroll:!0}),this.returnFocus=null)}isOpen(){return!this.el.hidden}destroy(){this.close(),this.el.remove()}entry(e){if(e===`separator`){let e=document.createElement(`div`);return e.className=`tcw-context-sep`,e.setAttribute(`role`,`separator`),e}let t=document.createElement(`button`);t.type=`button`,t.className=`tcw-context-item${e.danger?` tcw-context-danger`:``}`,t.setAttribute(`role`,e.checked===void 0?`menuitem`:`menuitemcheckbox`),e.checked!==void 0&&t.setAttribute(`aria-checked`,String(e.checked)),t.tabIndex=-1,t.dataset.id=e.id;let n=e.checked===void 0?e.icon??``:e.checked?`check`:``;t.innerHTML=n?S(n,14):`<span class="tcw-context-icon"></span>`;let r=document.createElement(`span`);return r.textContent=e.label,t.appendChild(r),t.addEventListener(`click`,()=>this.pick(e.id)),t}pick(e){let t=this.onPick;this.close(),t?.(e)}items(){return[...this.el.querySelectorAll(`[role=menuitem], [role=menuitemcheckbox]`)]}onKeyDown(e){let t=this.items(),n=t.indexOf(document.activeElement),r=-1;if(e.key===`ArrowDown`)r=(n+1)%t.length;else if(e.key===`ArrowUp`)r=(n-1+t.length)%t.length;else if(e.key===`Home`)r=0;else if(e.key===`End`)r=t.length-1;else if(e.key===`Escape`||e.key===`Tab`){e.preventDefault(),e.stopPropagation(),this.close();return}else return;e.preventDefault(),t[r]?.focus({preventScroll:!0})}};function sn(e,t){let{selected:n}=e,r=n.length===1,i=new Set(n.map(e=>e.groupId)),a=i.size===1&&!i.has(null),o=[];e.canConfigure&&r&&o.push({id:`settings`,label:t(`drawingMenu.settings`),icon:`settings`}),e.canAlert&&r&&o.push({id:`alert`,label:t(`drawingSettings.addAlert`),icon:`bell`}),o.length>0&&o.push(`separator`),r&&o.push({id:`front`,label:t(`drawingMenu.front`)},{id:`forward`,label:t(`drawingMenu.forward`)},{id:`backward`,label:t(`drawingMenu.backward`)},{id:`back`,label:t(`drawingMenu.back`)},`separator`),n.length>1&&!a&&o.push({id:`group`,label:t(`drawingMenu.group`),icon:`layers`}),n.some(e=>e.groupId)&&o.push({id:`ungroup`,label:t(`drawingMenu.ungroup`),icon:`layers`});let s=n.every(e=>e.locked);return o.push(s?{id:`unlock`,label:t(`common.unlock`),icon:`unlock`}:{id:`lock`,label:t(`common.lock`),icon:`lock`},{id:`hide`,label:t(`common.hide`),icon:`eyeOff`}),r&&o.push({id:`duplicate`,label:t(`drawingMenu.duplicate`),icon:`plus`}),s||o.push(`separator`,{id:`delete`,label:t(`drawingMenu.delete`),icon:`trash`,danger:!0}),o}function cn(e,n){if(e.price===void 0||!Number.isFinite(e.price))return[];let r=e.formatPrice(e.price),i=[];if(e.canAlert&&i.push({id:`alert`,label:t.r(n(`chartMenu.addAlert`),{price:r}),icon:`bell`}),e.canTrade){let a=e.lastPrice===null||e.price<=e.lastPrice;i.push(a?{id:`buyLimit`,label:t.r(n(`chartMenu.buyLimit`),{price:r}),icon:`trendingUp`}:{id:`buyStop`,label:t.r(n(`chartMenu.buyStop`),{price:r}),icon:`trendingUp`},a?{id:`sellStop`,label:t.r(n(`chartMenu.sellStop`),{price:r}),icon:`trendingDown`}:{id:`sellLimit`,label:t.r(n(`chartMenu.sellLimit`),{price:r}),icon:`trendingDown`}),e.canOrderTicket&&i.push({id:`orderTicket`,label:n(`chartMenu.orderTicket`),icon:`receipt`})}return e.canDraw&&i.push({id:`horizontalLine`,label:t.r(n(`chartMenu.horizontalLine`),{price:r}),icon:`minus`}),i}function ln(e,t,n){let r=e=>{let r=cn(t,n);return r.length>0?[...r,`separator`,...e]:e},i={id:`settings`,label:n(`chartMenu.settings`),icon:`settings`};switch(e){case`priceAxis`:{let e=cn({...t,canTrade:!1,canDraw:!1},n);return[{id:`autoScale`,label:n(`settings.autoScale`),checked:t.autoScale},{id:`logScale`,label:n(`settings.scale.logarithmic`),checked:t.scaleMode===`logarithmic`},{id:`percentScale`,label:n(`settings.scale.percentage`),checked:t.scaleMode===`percentage`},{id:`invertScale`,label:n(`chartMenu.invertScale`),checked:t.inverted},...e.length>0?[`separator`,...e]:[]]}case`timeAxis`:return[{id:`resetView`,label:n(`chartMenu.resetTimeScale`)},...t.canGoToDate?[{id:`goToDate`,label:n(`chartMenu.goToDate`),icon:`calendar`}]:[]];case`pane`:return[{id:`resetView`,label:n(`chartMenu.resetView`)},...t.pane?[`separator`,{id:`paneLog`,label:n(`chartMenu.paneLog`),checked:t.pane.log},{id:`paneInvert`,label:n(`chartMenu.paneInvert`),checked:t.pane.invert},{id:`panePercent`,label:n(`chartMenu.panePercent`),checked:t.pane.percent}]:[],`separator`,i];default:{let e=t.hasDrawings?[t.drawingsHidden?{id:`showDrawings`,label:n(`chartMenu.showDrawings`),icon:`eye`}:{id:`hideDrawings`,label:n(`chartMenu.hideDrawings`),icon:`eyeOff`},{id:`removeDrawings`,label:n(`chartMenu.removeDrawings`),icon:`trash`,danger:!0}]:[],a=t.canExport?[{id:`exportData`,label:n(`chartMenu.exportData`),icon:`save`}]:[];return r([{id:`resetView`,label:n(`chartMenu.resetView`)},...e,...a,`separator`,i])}}}var B=[`positions`,`orders`,`history`],un=[`order`,`close`,`reverse`,`stopLoss`,`takeProfit`],dn=[`market`,`limit`,`stop`],fn=[`gtc`,`day`];function pn(e,t,n){return e.includes(t??``)?t:n}function mn(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function hn(e,t){if(t===null)return null;let n=e.quantity-(e.closedQuantity??0),r=e.side===`buy`?1:-1;return{pnl:(t-e.entryPrice)*n*r,pct:e.entryPrice===0?0:(t-e.entryPrice)/e.entryPrice*100*r}}function V(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}`}var gn=class{el;tabButtons=new Map;content;tab=`positions`;snapshot={positions:[],orders:[],fills:[],price:null};open=!1;live=[];constructor(e,n,r=t.t){this.callbacks=n,this.t=r,this.el=document.createElement(`section`),this.el.className=`tcw-account`,this.el.hidden=!0,this.el.setAttribute(`aria-label`,this.t(`account.title`));let i=document.createElement(`div`);i.className=`tcw-account-head`;let a=document.createElement(`div`);a.className=`tcw-account-tabs`,a.setAttribute(`role`,`tablist`),a.addEventListener(`keydown`,e=>this.onTabKey(e));for(let e of B){let t=document.createElement(`button`);t.type=`button`,t.className=`tcw-account-tab`,t.setAttribute(`role`,`tab`),t.id=`tcw-account-tab-${e}`,t.addEventListener(`click`,()=>this.selectTab(e)),this.tabButtons.set(e,t),a.appendChild(t)}let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-account-new`,o.innerHTML=S(`plus`,13),o.append(this.t(`account.newOrder`)),o.addEventListener(`click`,()=>this.callbacks.onNewOrder());let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-tree-close`,s.setAttribute(`aria-label`,this.t(`account.close`)),s.innerHTML=S(`x`,14),s.addEventListener(`click`,()=>this.closePanel()),i.append(a,o,s),this.content=document.createElement(`div`),this.content.className=`tcw-account-body`,this.content.setAttribute(`role`,`tabpanel`),this.el.append(i,this.content),e.appendChild(this.el),this.renderTabs()}isOpen(){return this.open}toggle(){this.open?this.closePanel():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1,this.render(),this.callbacks.onToggle?.(!0)}closePanel(){this.open&&(this.open=!1,this.el.hidden=!0,this.callbacks.onToggle?.(!1))}update(e){let t=this.snapshot;if(this.snapshot=e,mn(t.positions,e.positions)&&mn(t.orders,e.orders)&&mn(t.fills,e.fills)&&t.realisedPnl===e.realisedPnl){this.open&&this.tab===`positions`&&t.price!==e.price&&this.patchPrices();return}this.renderTabs(),this.open&&this.render()}destroy(){this.el.remove()}selectTab(e){this.tab=e,this.renderTabs(),this.render()}onTabKey(e){let t=B.indexOf(this.tab),n=e.key===`ArrowRight`?t+1:e.key===`ArrowLeft`?t-1:-2;if(n===-2)return;e.preventDefault();let r=B[(n+B.length)%B.length];this.selectTab(r),this.tabButtons.get(r)?.focus()}renderTabs(){let e={positions:this.snapshot.positions.length,orders:this.snapshot.orders.length,history:this.snapshot.fills.length};for(let[t,n]of this.tabButtons){let r=t===this.tab;n.textContent=`${this.t(`account.${t}`)} (${e[t]})`,n.setAttribute(`aria-selected`,String(r)),n.tabIndex=r?0:-1,r&&this.content.setAttribute(`aria-labelledby`,n.id)}}render(){let e=document.activeElement,t=e instanceof HTMLElement&&this.content.contains(e)?e.dataset.focusKey:void 0;this.live=[],this.tab===`positions`?this.renderPositions():this.tab===`orders`?this.renderOrders():this.renderHistory(),t&&[...this.content.querySelectorAll(`[data-focus-key]`)].find(e=>e.dataset.focusKey===t)?.focus()}patchPrices(){let{price:e}=this.snapshot;for(let t of this.live)t.price.textContent=e===null?`—`:this.callbacks.formatPrice(e),this.writePnl(t.pnl,hn(t.position,e))}writePnl(e,t){e.className=t===null?``:t.pnl>=0?`tcw-account-up`:`tcw-account-down`,e.textContent=t===null?`—`:`${V(t.pnl)} (${V(t.pct)}%)`}table(e,t,n){if(t.length===0){let e=document.createElement(`p`);e.className=`tcw-account-empty`,e.textContent=this.t(n),this.content.replaceChildren(e);return}let r=document.createElement(`table`);r.className=`tcw-account-table`;let i=r.createTHead().insertRow();for(let t of e){let e=document.createElement(`th`);e.scope=`col`,e.textContent=t?this.t(t):``,i.appendChild(e)}r.createTBody().append(...t),this.content.replaceChildren(r)}row(e,t=``){let n=document.createElement(`tr`);t&&(n.className=t);for(let t of e){let e=n.insertCell();typeof t==`string`?e.textContent=t:e.appendChild(t)}return n}sideCell(e,t=`position`){let n=document.createElement(`span`);return n.className=`tcw-account-side tcw-account-${e}`,n.textContent=this.sideText(e,t),n}sideText(e,t){return t===`trade`?this.t(e===`buy`?`ticket.buy`:`ticket.sell`):this.t(e===`buy`?`account.long`:`account.short`)}actions(...e){let t=document.createElement(`div`);t.className=`tcw-account-actions`;for(let n of e){let e=document.createElement(`button`);e.type=`button`,e.className=`tcw-tree-btn${n.danger?` tcw-tree-del`:``}`,e.setAttribute(`aria-label`,n.label),e.title=n.label,e.dataset.focusKey=n.key,e.innerHTML=S(n.icon,14),e.addEventListener(`click`,n.run),t.appendChild(e)}return t}renderPositions(){let{formatPrice:e}=this.callbacks,{price:t}=this.snapshot,n=this.snapshot.positions.map(n=>{let r=n.quantity-(n.closedQuantity??0),i=document.createElement(`span`);this.writePnl(i,hn(n,t));let a=`${this.sideText(n.side,`position`)} ${r} @ ${e(n.entryPrice)}`,o=this.row([this.sideCell(n.side),String(r),e(n.entryPrice),t===null?`—`:e(t),i,n.stopLoss===void 0?`—`:e(n.stopLoss),n.takeProfit===void 0?`—`:e(n.takeProfit),this.actions({icon:`repeat`,label:`${this.t(`account.reverse`)}: ${a}`,key:`reverse:${n.id}`,run:()=>this.callbacks.onReversePosition(n.id)},{icon:`x`,label:`${this.t(`account.closePosition`)}: ${a}`,key:`close:${n.id}`,run:()=>this.callbacks.onClosePosition(n.id),danger:!0})]);return this.live.push({position:n,price:o.cells[3],pnl:i}),o});this.table([`account.side`,`account.quantity`,`account.entry`,`account.price`,`account.pnl`,`account.stopLoss`,`account.takeProfit`,`account.actions`],n,`account.noPositions`)}renderOrders(){let{formatPrice:e}=this.callbacks,t=this.snapshot.orders.map(t=>{let n=pn(dn,t.type===`stopLimit`?`stop`:t.type,`limit`),r=`${this.sideText(t.side,`trade`)} ${t.quantity} @ ${e(t.price)}`;return this.row([this.sideCell(t.side,`trade`),this.t(`ticket.type.${n}`),String(t.quantity),e(t.price),t.stopLoss===void 0?`—`:e(t.stopLoss),t.takeProfit===void 0?`—`:e(t.takeProfit),t.timeInForce?this.t(`ticket.tif.${pn(fn,t.timeInForce,`gtc`)}`):`—`,this.actions({icon:`x`,label:`${this.t(`account.cancelOrder`)}: ${r}`,key:`cancel:${t.id}`,run:()=>this.callbacks.onCancelOrder(t.id),danger:!0})])});this.table([`account.side`,`ticket.type`,`account.quantity`,`account.price`,`account.stopLoss`,`account.takeProfit`,`ticket.timeInForce`,`account.actions`],t,`account.noOrders`)}renderHistory(){let{formatPrice:e,formatTime:n}=this.callbacks,r=[...this.snapshot.fills].reverse().map(t=>{let r=document.createElement(`span`);return t.pnl===void 0?r.textContent=`—`:(r.className=t.pnl>=0?`tcw-account-up`:`tcw-account-down`,r.textContent=V(t.pnl)),this.row([n(t.time),this.sideCell(t.side,`trade`),String(t.quantity),e(t.price),this.t(`account.reason.${pn(un,t.reason,`order`)}`),r])});this.table([`account.time`,`account.side`,`account.quantity`,`account.price`,`account.reason`,`account.pnl`],r,`account.noFills`);let i=this.snapshot.realisedPnl??this.snapshot.fills.reduce((e,t)=>e+(t.pnl??0),0);if(r.length>0){let e=document.createElement(`p`);e.className=`tcw-account-summary`,e.textContent=t.r(this.t(`account.realised`),{pnl:V(i)}),this.content.appendChild(e)}}};function _n(e,t){return e.type===`market`?t:e.price}function vn(e,t){let n=[];(!(e.quantity>0)||!Number.isFinite(e.quantity))&&n.push(`quantity`),e.type!==`market`&&(!(e.price>0)||!Number.isFinite(e.price))&&n.push(`price`),e.type===`market`&&!((t??e.price)>0)&&n.push(`market`);let r=e.side===`buy`;if(t!==null&&e.type!==`market`&&e.price>0){let i=e.price<t;e.type===`limit`&&i!==r&&e.price!==t&&n.push(`limitSide`),e.type===`stop`&&i===r&&e.price!==t&&n.push(`stopSide`)}let i=e=>e===null||Number.isFinite(e)&&e>0;i(e.stopLoss)||n.push(`stopLoss`),i(e.takeProfit)||n.push(`takeProfit`);let a=_n(e,t);return a!==null&&a>0&&(e.stopLoss!==null&&i(e.stopLoss)&&(r?e.stopLoss>=a:e.stopLoss<=a)&&n.push(`stopLossSide`),e.takeProfit!==null&&i(e.takeProfit)&&(r?e.takeProfit<=a:e.takeProfit>=a)&&n.push(`takeProfitSide`)),n}function yn(e,t){let n={side:e.side,type:e.type,price:e.type===`market`?t??e.price:e.price,quantity:e.quantity};return e.type===`stop`&&(n.stopPrice=e.price),e.type!==`market`&&(n.timeInForce=e.timeInForce),e.stopLoss!==null&&(n.stopLoss=e.stopLoss),e.takeProfit!==null&&(n.takeProfit=e.takeProfit),n}function bn(e,t){let n=_n(e,t);if(n===null||e.stopLoss===null||e.takeProfit===null)return null;let r=Math.abs(n-e.stopLoss);return r>0?Math.abs(e.takeProfit-n)/r:null}var xn=0,Sn=class{backdrop;modal;body;problemsEl;submit;draft=null;lastPrice=null;returnFocus=null;uid=++xn;constructor(e,n,r=t.t){this.callbacks=n,this.t=r,this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.hidden=!0;let i=!1;this.backdrop.addEventListener(`pointerdown`,e=>{i=e.target===this.backdrop}),this.backdrop.addEventListener(`click`,e=>{e.target===this.backdrop&&i&&this.close(),i=!1}),this.modal=document.createElement(`div`),this.modal.className=`tcw-modal tcw-modal-narrow tcw-order-ticket`,this.modal.setAttribute(`role`,`dialog`),this.modal.setAttribute(`aria-modal`,`true`),this.modal.setAttribute(`aria-labelledby`,`tcw-ticket-title-${this.uid}`),this.modal.addEventListener(`keydown`,e=>{if(e.key===`Escape`){e.stopPropagation(),this.close();return}F(e,this.modal)});let a=document.createElement(`div`);a.className=`tcw-modal-header`;let o=document.createElement(`h3`);o.id=`tcw-ticket-title-${this.uid}`,o.textContent=this.t(`ticket.title`);let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-modal-close`,s.setAttribute(`aria-label`,this.t(`common.close`)),s.innerHTML=S(`x`,16),s.addEventListener(`click`,()=>this.close()),a.append(o,s),this.body=document.createElement(`div`),this.body.className=`tcw-modal-body`,this.problemsEl=document.createElement(`div`),this.problemsEl.className=`tcw-ticket-problems`,this.problemsEl.setAttribute(`aria-live`,`polite`);let c=document.createElement(`div`);c.className=`tcw-modal-footer`;let l=document.createElement(`button`);l.type=`button`,l.className=`tcw-reset-link`,l.textContent=this.t(`common.cancel`),l.addEventListener(`click`,()=>this.close()),this.submit=document.createElement(`button`),this.submit.type=`button`,this.submit.className=`tcw-done-btn`,this.submit.addEventListener(`click`,()=>this.place()),c.append(l,this.submit),this.modal.append(a,this.body,this.problemsEl,c),this.backdrop.appendChild(this.modal),e.appendChild(this.backdrop)}open(e){this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.lastPrice=e.lastPrice;let t=e.price??e.lastPrice??0,n=e.side??`buy`,r=`market`;e.price!==void 0&&e.lastPrice!==null&&e.price!==e.lastPrice&&(r=e.price<e.lastPrice==(n===`buy`)?`limit`:`stop`),this.draft={side:n,type:r,quantity:1,price:t,stopLoss:null,takeProfit:null,timeInForce:`gtc`},this.render(),this.backdrop.hidden=!1,this.body.querySelector(`button, input, select`)?.focus()}close(){this.backdrop.hidden||(this.backdrop.hidden=!0,this.draft=null,this.returnFocus?.isConnected&&this.returnFocus.focus(),this.returnFocus=null)}isOpen(){return!this.backdrop.hidden}setLastPrice(e){!this.draft||e===this.lastPrice||(this.lastPrice=e,this.check())}destroy(){this.close(),this.backdrop.remove()}place(){let e=this.draft;!e||vn(e,this.lastPrice).length>0||(this.callbacks.onSubmit(yn(e,this.lastPrice)),this.close())}set(e,t=!1){this.draft&&(this.draft={...this.draft,...e},t?this.render():this.check())}render(){let e=this.draft;if(!e)return;let t=document.activeElement,n=t instanceof HTMLElement&&this.body.contains(t)?t.dataset.ticketField:void 0;this.body.replaceChildren(this.sideToggle(e.side),I(this.t(`ticket.type`),H(`type`,R([`market`,`limit`,`stop`].map(e=>({value:e,label:this.t(`ticket.type.${e}`)})),e.type,e=>this.set({type:e},!0)))),I(this.t(`ticket.quantity`),H(`quantity`,this.number(e.quantity,e=>this.set({quantity:e}))))),e.type!==`market`&&this.body.append(I(this.t(`ticket.price`),H(`price`,this.number(e.price,e=>this.set({price:e})))),I(this.t(`ticket.timeInForce`),H(`timeInForce`,R([`gtc`,`day`].map(e=>({value:e,label:this.t(`ticket.tif.${e}`)})),e.timeInForce,e=>this.set({timeInForce:e})))));let r=e.type===`market`?this.lastPrice??e.price:e.price,i=t=>Cn(r*(1+(e.side===`buy`?t:-t)/100),r);this.body.append(this.optionalPrice(`ticket.stopLoss`,e.stopLoss,i(-1),t=>this.set({stopLoss:t},t===null||e.stopLoss===null)),this.optionalPrice(`ticket.takeProfit`,e.takeProfit,i(2),t=>this.set({takeProfit:t},t===null||e.takeProfit===null))),n&&this.body.querySelector(`[data-ticket-field="${n}"]`)?.focus(),this.check()}sideToggle(e){let t=document.createElement(`div`);t.className=`tcw-ticket-side`,t.setAttribute(`role`,`group`);for(let n of[`buy`,`sell`]){let r=document.createElement(`button`);r.type=`button`,r.className=`tcw-ticket-side-btn tcw-ticket-${n}`,r.textContent=this.t(`ticket.${n}`),r.setAttribute(`aria-pressed`,String(e===n)),r.dataset.ticketField=`side-${n}`,r.addEventListener(`click`,()=>this.set({side:n},!0)),t.appendChild(r)}return t}number(e,t){let n=document.createElement(`input`);return n.type=`number`,n.className=`tcw-indi-input`,n.step=`any`,n.min=`0`,n.value=String(e),n.addEventListener(`input`,()=>t(n.value.trim()===``?NaN:Number(n.value))),n}optionalPrice(e,t,n,r){let i=document.createElement(`div`);i.className=`tcw-settings-row tcw-ticket-optional`;let a=document.createElement(`span`);a.textContent=this.t(e);let o=Kt(t!==null,e=>r(e?n:null));if(o.setAttribute(`aria-label`,this.t(e)),o.dataset.ticketField=`${e}-switch`,i.append(a,o),t!==null){let n=this.number(t,e=>r(Number.isFinite(e)?e:NaN));n.setAttribute(`aria-label`,this.t(e)),n.dataset.ticketField=e,i.appendChild(n)}return i}check(){let e=this.draft;if(!e)return;let n=vn(e,this.lastPrice),r=n.map(e=>this.t(`ticket.problem.${e}`)),i=bn(e,this.lastPrice);n.length===0&&i!==null&&r.push(t.r(this.t(`ticket.riskReward`),{rr:i.toFixed(2)})),this.problemsEl.replaceChildren(...r.map(e=>{let t=document.createElement(`p`);return t.textContent=e,t})),this.problemsEl.classList.toggle(`tcw-ticket-bad`,n.length>0),this.submit.disabled=n.length>0,this.submit.classList.toggle(`tcw-ticket-sell`,e.side===`sell`),this.submit.textContent=this.t(e.side===`buy`?`ticket.placeBuy`:`ticket.placeSell`)}};function H(e,t){return t.dataset.ticketField=e,t}function Cn(e,t){let n=Math.abs(t),r=n>=10||n===0?2:n>=1?4:Math.min(10,Math.ceil(-Math.log10(n))+3);return Number(e.toFixed(r))}var wn=0,Tn=class{backdrop;titleEl;input;submit;request=null;returnFocus=null;busy=!1;uid=++wn;constructor(e,n=t.t){this.t=n,this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.hidden=!0;let r=!1;this.backdrop.addEventListener(`pointerdown`,e=>{r=e.target===this.backdrop}),this.backdrop.addEventListener(`click`,e=>{e.target===this.backdrop&&r&&this.close(),r=!1});let i=document.createElement(`form`);i.className=`tcw-modal tcw-modal-narrow tcw-name-prompt`,i.noValidate=!0,i.setAttribute(`role`,`dialog`),i.setAttribute(`aria-modal`,`true`),i.setAttribute(`aria-labelledby`,`tcw-name-title-${this.uid}`),i.addEventListener(`keydown`,e=>{if(e.key===`Escape`){e.stopPropagation(),this.close();return}F(e,i)}),i.addEventListener(`submit`,e=>{e.preventDefault(),this.done()});let a=document.createElement(`div`);a.className=`tcw-modal-header`,this.titleEl=document.createElement(`h3`),this.titleEl.id=`tcw-name-title-${this.uid}`;let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-modal-close`,o.setAttribute(`aria-label`,this.t(`common.close`)),o.innerHTML=S(`x`,16),o.addEventListener(`click`,()=>this.close()),a.append(this.titleEl,o);let s=document.createElement(`div`);s.className=`tcw-modal-body`;let c=document.createElement(`label`);c.className=`tcw-name-field`;let l=document.createElement(`span`);l.textContent=this.t(`layouts.name`),this.input=document.createElement(`input`),this.input.type=`text`,this.input.className=`tcw-indi-input`,this.input.maxLength=80,this.input.autocomplete=`off`,this.input.spellcheck=!1,this.input.placeholder=this.t(`layouts.namePlaceholder`),this.input.addEventListener(`input`,()=>this.check()),c.append(l,this.input),s.appendChild(c);let u=document.createElement(`div`);u.className=`tcw-modal-footer`;let d=document.createElement(`button`);d.type=`button`,d.className=`tcw-reset-link`,d.textContent=this.t(`common.cancel`),d.addEventListener(`click`,()=>this.close()),this.submit=document.createElement(`button`),this.submit.type=`submit`,this.submit.className=`tcw-done-btn`,u.append(d,this.submit),i.append(a,s,u),this.backdrop.appendChild(i),e.appendChild(this.backdrop)}open(e){this.isOpen()||(this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null),this.request=e,this.busy=!1,this.titleEl.textContent=e.title,this.submit.textContent=e.submitLabel,this.input.value=e.value??``,this.input.placeholder=e.placeholder??this.t(`layouts.namePlaceholder`),this.check(),this.backdrop.hidden=!1,this.input.focus(),this.input.select()}close(){this.backdrop.hidden||(this.backdrop.hidden=!0,this.request=null,this.returnFocus?.isConnected&&this.returnFocus.focus(),this.returnFocus=null)}isOpen(){return!this.backdrop.hidden}destroy(){this.close(),this.backdrop.remove()}check(){this.submit.disabled=this.busy||e.r(this.input.value)===null}async done(){let t=this.request,n=e.r(this.input.value);if(!(!t||n===null||this.busy)){this.busy=!0,this.check();try{await t.onSubmit(n),this.request===t&&this.close()}catch{}finally{this.busy=!1,this.check()}}}},En=0,Dn=class{backdrop;search;listEl;layouts=[];confirming=null;returnFocus=null;loadSeq=0;uid=++En;constructor(e,n,r=t.t){this.callbacks=n,this.t=r,this.backdrop=document.createElement(`div`),this.backdrop.className=`tcw-modal-backdrop`,this.backdrop.hidden=!0;let i=!1;this.backdrop.addEventListener(`pointerdown`,e=>{i=e.target===this.backdrop}),this.backdrop.addEventListener(`click`,e=>{e.target===this.backdrop&&i&&this.close(),i=!1});let a=document.createElement(`div`);a.className=`tcw-modal tcw-modal-narrow tcw-layouts-dialog`,a.setAttribute(`role`,`dialog`),a.setAttribute(`aria-modal`,`true`),a.setAttribute(`aria-labelledby`,`tcw-layouts-title-${this.uid}`),a.addEventListener(`keydown`,e=>{if(e.key!==`Escape`){F(e,a);return}e.stopPropagation(),this.confirming?this.setConfirming(null):this.close()});let o=document.createElement(`div`);o.className=`tcw-modal-header`;let s=document.createElement(`h3`);s.id=`tcw-layouts-title-${this.uid}`,s.textContent=this.t(`layouts.dialogTitle`);let c=document.createElement(`button`);c.type=`button`,c.className=`tcw-modal-close`,c.setAttribute(`aria-label`,this.t(`common.close`)),c.innerHTML=S(`x`,16),c.addEventListener(`click`,()=>this.close()),o.append(s,c),this.search=document.createElement(`input`),this.search.type=`search`,this.search.className=`tcw-indi-input tcw-layouts-search`,this.search.placeholder=this.t(`layouts.search`),this.search.setAttribute(`aria-label`,this.t(`layouts.search`)),this.search.addEventListener(`input`,()=>this.render()),this.listEl=document.createElement(`div`),this.listEl.className=`tcw-layouts-list`,this.listEl.setAttribute(`role`,`list`);let l=document.createElement(`div`);l.className=`tcw-modal-body tcw-layouts-body`,l.append(this.search,this.listEl),a.append(o,l),this.backdrop.appendChild(a),e.appendChild(this.backdrop)}async open(){this.isOpen()||(this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null),this.search.value=``,this.confirming=null,this.backdrop.hidden=!1,this.search.focus(),await this.refresh()}async refresh(){let e=++this.loadSeq,t;try{t=await this.callbacks.list()}catch{t=[]}e===this.loadSeq&&(this.layouts=t,this.render())}close(){this.backdrop.hidden||(this.backdrop.hidden=!0,this.confirming=null,this.returnFocus?.isConnected&&this.returnFocus.focus(),this.returnFocus=null)}isOpen(){return!this.backdrop.hidden}destroy(){this.close(),this.backdrop.remove()}shown(){let e=this.search.value.trim().toLowerCase();return e?this.layouts.filter(t=>t.name.toLowerCase().includes(e)||(t.symbol??``).toLowerCase().includes(e)):this.layouts}render(){let e=this.shown();if(e.length===0){let e=document.createElement(`p`);e.className=`tcw-account-empty`,e.textContent=this.t(this.layouts.length===0?`layouts.empty`:`layouts.noMatch`),this.listEl.replaceChildren(e);return}let t=this.callbacks.currentId();this.listEl.replaceChildren(...e.map(e=>this.row(e,e.id===t)))}row(e,n){let r=document.createElement(`div`);r.className=`tcw-layouts-row`,r.setAttribute(`role`,`listitem`),r.dataset.id=e.id;let i=document.createElement(`button`);i.type=`button`,i.className=`tcw-layouts-open`,n&&i.setAttribute(`aria-current`,`true`);let a=document.createElement(`span`);a.className=`tcw-layouts-name`,a.textContent=e.name;let o=document.createElement(`span`);if(o.className=`tcw-layouts-meta`,o.textContent=[[e.symbol,e.timeframe].filter(Boolean).join(` · `),t.r(this.t(`layouts.updated`),{time:this.callbacks.formatTime(e.updatedAt)})].filter(Boolean).join(` — `),i.append(a,o),n){let e=document.createElement(`span`);e.className=`tcw-tag`,e.textContent=this.t(`layouts.current`),a.appendChild(e)}i.addEventListener(`click`,()=>{this.callbacks.onOpen(e.id),this.close()});let s=document.createElement(`div`);if(s.className=`tcw-account-actions`,this.confirming===e.id){let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-layouts-confirm`,n.textContent=this.t(`layouts.deleteConfirm`),n.setAttribute(`aria-label`,t.r(this.t(`layouts.deleteNamed`),{name:e.name})),n.addEventListener(`click`,()=>void this.remove(e.id));let r=this.iconButton(`x`,this.t(`common.cancel`),()=>this.setConfirming(null));s.append(n,r)}else s.append(this.iconButton(`penLine`,t.r(this.t(`layouts.renameNamed`),{name:e.name}),()=>this.callbacks.onRename(e)),this.iconButton(`trash`,t.r(this.t(`layouts.deleteNamed`),{name:e.name}),()=>this.setConfirming(e.id),!0));return r.append(i,s),r}iconButton(e,t,n,r=!1){let i=document.createElement(`button`);return i.type=`button`,i.className=`tcw-tree-btn${r?` tcw-tree-del`:``}`,i.setAttribute(`aria-label`,t),i.title=t,i.innerHTML=S(e,14),i.addEventListener(`click`,n),i}setConfirming(e){let t=this.confirming;this.confirming=e,this.render();let n=e??t;n&&[...this.listEl.querySelectorAll(`.tcw-layouts-row`)].find(e=>e.dataset.id===n)?.querySelector(e?`.tcw-layouts-confirm`:`.tcw-tree-del`)?.focus()}async remove(e){try{await this.callbacks.onDelete(e)}finally{this.confirming=null,await this.refresh(),this.isOpen()&&this.search.focus()}}},On=5,kn=class{menu;prompt;dialog;destroyed=!1;constructor(e,t){this.session=e,this.host=t;let{root:n,t:r}=t;this.menu=new z(n,r(`toolbar.layouts`)),this.prompt=new Tn(n,r),this.dialog=new Dn(n,{list:()=>e.list(),currentId:()=>e.current()?.id??null,onOpen:e=>void this.open(e),onRename:e=>this.promptRename(e),onDelete:async t=>{try{await e.remove(t)}catch{this.host.toast(r(`layouts.deleteFailed`),`error`)}},formatTime:t.formatTime},r)}async save(){if(this.prompt.isOpen())return;if(!this.session.current()){this.promptSaveAs();return}let{t:e,toast:n}=this.host;try{let r=await this.session.save();r&&n(t.r(e(`layouts.saved`),{name:r.name}))}catch{n(e(`layouts.saveFailed`),`error`)}}async open(e){try{if(await this.session.open(e))return!0}catch{}return this.destroyed||this.host.toast(this.host.t(`layouts.openFailed`),`error`),!1}promptSaveAs(){let{t:e,toast:n}=this.host,r=this.session.current();this.prompt.open({title:e(`layouts.saveAsTitle`),value:r?t.r(e(`layouts.copyName`),{name:r.name}):``,submitLabel:e(`common.save`),onSubmit:async r=>{try{let i=await this.session.saveAs(r);n(t.r(e(`layouts.saved`),{name:i.name}))}catch(t){throw n(e(`layouts.saveFailed`),`error`),t}}})}promptRename(e=this.session.current()){if(!e)return;let{t,toast:n}=this.host;this.prompt.open({title:t(`layouts.renameTitle`),value:e.name,submitLabel:t(`layouts.renameSubmit`),onSubmit:async r=>{try{await this.session.rename(e.id,r)}catch(e){throw n(t(`layouts.saveFailed`),`error`),e}this.dialog.isOpen()&&this.dialog.refresh()}})}openDialog(){return this.dialog.open()}async openMenu(e){if(this.menu.isOpen()){this.menu.close();return}let{session:t}=this,{t:n,root:r}=this.host,i=[];try{i=(await t.list()).slice(0,On)}catch{}if(this.destroyed)return;let a=t.current(),o=[{id:`save`,label:n(`layouts.save`),icon:`save`},{id:`saveAs`,label:n(`layouts.saveAs`),icon:`plus`}];a&&o.push({id:`rename`,label:n(`layouts.rename`),icon:`penLine`}),o.push({id:`autoSave`,label:n(`layouts.autoSave`),checked:t.isAutoSave()}),i.length>0&&o.push(`separator`,...i.map(e=>({id:`open:${e.id}`,label:e.name,checked:e.id===a?.id}))),o.push(`separator`,{id:`manage`,label:n(`layouts.open`),icon:`folder`});let s=e.getBoundingClientRect(),c=r.getBoundingClientRect();this.menu.open(o,s.left-c.left,s.bottom-c.top+2,e=>{e===`save`?this.save():e===`saveAs`?this.promptSaveAs():e===`rename`?this.promptRename():e===`autoSave`?t.setAutoSave(!t.isAutoSave()):e===`manage`?this.openDialog():e.startsWith(`open:`)&&this.open(e.slice(5))},e)}destroy(){this.destroyed=!0,this.menu.destroy(),this.prompt.destroy(),this.dialog.destroy()}},An=[`1m`,`3m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`1d`,`1w`,`1M`],jn=[`1m`,`5m`,`15m`,`1h`,`4h`,`1d`],Mn=6;function Nn(e){let t=e.slice(-1);return t===`h`||t===`d`||t===`w`?e.slice(0,-1)+t.toUpperCase():e}var Pn=e=>Number.isFinite((0,n.timeframeToMs)(e))||(0,n.tickBarCount)(e)!==null,Fn=(e,t)=>{let r=(0,n.tickBarCount)(e),i=(0,n.tickBarCount)(t);return r!==null||i!==null?r===null?1:i===null?-1:r-i:(0,n.timeframeToMs)(e)-(0,n.timeframeToMs)(t)};function In(e,t){let n=t?.length?t:null,r=e?.length?e:n??An;return[...new Set(r)].filter(e=>Pn(e)&&(!n||n.includes(e))).sort(Fn)}function Ln(e,t,n=!1){if(t?.length)return e.filter(e=>t.includes(e));if(n)return[...e];let r=e.filter(e=>jn.includes(e));return r.length>0?r:e.slice(0,Mn)}var Rn=9999,zn={"":`m`,s:`s`,S:`s`,m:`m`,h:`h`,H:`h`,d:`d`,D:`d`,w:`w`,W:`w`,M:`M`},Bn={s:[`m`,60],m:[`h`,60],h:[`d`,24]};function Vn(e){let t=/^(\d+)([a-zA-Z]?)$/.exec(e.trim());if(!t)return null;if(t[2]===`T`||t[2]===`t`){let e=`${Number(t[1])}T`;return Number(t[1])<=Rn&&(0,n.tickBarCount)(e)!==null?e:null}let r=Number(t[1]),i=zn[t[2]];if(!i||!Number.isSafeInteger(r)||r<1)return null;for(let e=Bn[i];e&&r%e[1]===0;e=Bn[i])r/=e[1],i=e[0];if(r>Rn)return null;let a=`${r}${i}`;return(0,n.isTimeFrame)(a)?a:null}function Hn(e,t,n){let r=n?.length?n:null,i=t.filter(e=>Pn(e)&&(!r||r.includes(e)));return[...new Set([...e,...i])].sort(Fn)}var Un=0,Wn=class{el;input;hint;returnFocus=null;constructor(e,t,n){this.labels=t,this.onApply=n,this.el=document.createElement(`div`),this.el.className=`tcw-interval-input`,this.el.hidden=!0,this.el.setAttribute(`role`,`dialog`),this.el.setAttribute(`aria-label`,t.title),this.input=document.createElement(`input`),this.input.type=`text`,this.input.className=`tcw-interval-field`,this.input.autocomplete=`off`,this.input.spellcheck=!1,this.input.maxLength=6,this.input.setAttribute(`aria-label`,t.title),this.hint=document.createElement(`div`),this.hint.className=`tcw-interval-hint`,this.hint.setAttribute(`role`,`status`),this.hint.id=`tcw-interval-hint-${++Un}`,this.input.setAttribute(`aria-describedby`,this.hint.id),this.el.append(this.input,this.hint),e.appendChild(this.el),this.input.addEventListener(`input`,()=>this.check()),this.input.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),this.apply()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.close())}),this.input.addEventListener(`blur`,()=>this.close(!1))}open(e){this.isOpen()||(this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null),this.el.hidden=!1,this.input.value=e,this.check(),this.input.focus(),this.input.setSelectionRange(e.length,e.length)}close(e=!0){if(this.el.hidden)return;this.el.hidden=!0;let t=this.returnFocus;this.returnFocus=null,e&&t?.isConnected&&t.focus({preventScroll:!0})}isOpen(){return!this.el.hidden}destroy(){this.el.remove()}check(){let e=Vn(this.input.value)!==null;!e&&this.input.value.trim()!==``?this.input.setAttribute(`aria-invalid`,`true`):this.input.removeAttribute(`aria-invalid`),this.hint.textContent=e||this.input.value.trim()===``?this.labels.hint:this.labels.invalid}apply(){let e=Vn(this.input.value);if(e&&this.onApply(e)){this.close();return}this.input.setAttribute(`aria-invalid`,`true`),this.hint.textContent=this.labels.invalid}},Gn=class{constructor(e=`tcw:indicator-templates`){this.key=e}list(){let e;try{e=JSON.parse(localStorage.getItem(this.key)??`[]`)}catch{return[]}if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let{name:e,indicators:i}=n;if(typeof e!=`string`||!e.trim()||!Array.isArray(i))continue;let a=r.ChartStateManager.deserialize(JSON.stringify({version:2,indicators:i})).indicators;a.length>0&&t.push({name:e.slice(0,60),indicators:a})}return t.sort((e,t)=>e.name.localeCompare(t.name))}get(e){return this.list().find(t=>t.name===e)??null}save(e,t){let n=e.replace(/\s+/g,` `).trim().slice(0,60);if(!n)throw Error(`A template needs a name`);let r=[...this.list().filter(e=>e.name!==n),{name:n,indicators:[...t]}];localStorage.setItem(this.key,JSON.stringify(r))}remove(e){try{localStorage.setItem(this.key,JSON.stringify(this.list().filter(t=>t.name!==e)))}catch{}}},U=[],W=null;function Kn(e){let t=()=>{W=e};return e.addEventListener(`pointerdown`,t,!0),U.push(e),()=>{e.removeEventListener(`pointerdown`,t,!0);let n=U.indexOf(e);n>=0&&U.splice(n,1),W===e&&(W=null)}}function G(e,t=!1){let n=W?.isConnected?W:null;if(!n){let e=document.activeElement;n=e?U.find(t=>t.contains(e))??null:null}return!n&&!t&&(n=U.find(e=>e.isConnected)??null),n!==null&&e.contains(n)}function K(){let e=document.activeElement;return!!e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`||e.isContentEditable)}var qn=[`regular`,`logarithmic`,`percentage`,`indexedTo100`],Jn=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Yn(e){let{theme:t,timestamp:n,...r}=e;return r}function Xn(e){return!Jn(e)||e.v!==1||typeof e.symbol!=`string`||!e.symbol||typeof e.timeframe!=`string`||!((0,n.isTimeFrame)(e.timeframe)||(0,n.tickBarCount)(e.timeframe)!==null)?null:{v:1,symbol:e.symbol,timeframe:e.timeframe,scaleMode:qn.find(t=>t===e.scaleMode)??`regular`,invertScale:e.invertScale===!0,chart:Jn(e.chart)?Yn(e.chart):null}}function Zn(e){try{return JSON.parse(e)}catch{return null}}function Qn(){try{return typeof localStorage<`u`?localStorage:null}catch{return null}}var $n=class{favorites=[];constructor(e=`tcw:draw-favorites`,t=Qn()){this.storageKey=e,this.storage=t,this.load()}list(){return[...this.favorites]}has(e){return this.favorites.includes(e)}add(e){!e||this.favorites.includes(e)||(this.favorites=[...this.favorites,e],this.persist())}remove(e){this.favorites.includes(e)&&(this.favorites=this.favorites.filter(t=>t!==e),this.persist())}toggle(e){return this.has(e)?(this.remove(e),!1):(this.add(e),!0)}seedDefaults(e){this.favorites.length>0||(this.favorites=[...new Set(e.filter(Boolean))],this.persist())}load(){if(this.storage)try{let e=this.storage.getItem(this.storageKey);if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&(this.favorites=[...new Set(t.filter(e=>typeof e==`string`))])}catch{}}persist(){if(this.storage)try{this.storage.setItem(this.storageKey,JSON.stringify(this.favorites))}catch{}}},er=/^(\d{4})-(\d{2})-(\d{2})$/,tr=/^(\d{2}):(\d{2})$/;function nr(e,t,r){let i=er.exec(e),a=t?tr.exec(t):[``,`00`,`00`];if(!i||!a)return null;let[o,s,c,l,u]=[+i[1],+i[2],+i[3],+a[1],+a[2]];if(s<1||s>12||c<1||c>31||l>23||u>59)return null;let d=Date.UTC(o,s-1,c,l,u);return new Date(d).getUTCDate()===c?(0,n.wallToUtc)(d,r):null}function q(e,t){let r=e=>String(e).padStart(2,`0`),i=(0,n.timeParts)(e,t);return{date:`${i.year}-${r(i.month)}-${r(i.day)}`,time:`${r(i.hours)}:${r(i.minutes)}`}}var rr=class{form=null;returnFocus=null;opener=null;onOutside=e=>{let t=e.target;this.form&&!this.form.contains(t)&&!this.opener?.contains(t)&&this.close()};constructor(e,t,n){this.host=e,this.labels=t,this.onSubmit=n}isOpen(){return this.form!==null}open(e,t=null){this.close(),this.opener=t,this.returnFocus=document.activeElement;let n=document.createElement(`form`);n.className=`tcw-goto`,n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-label`,this.labels.title);let r=document.createElement(`div`);r.className=`tcw-goto-title`,r.textContent=this.labels.title;let i=this.field(n,this.labels.date,`date`,e.date);i.required=!0;let a=this.field(n,this.labels.time,`time`,e.time),o=document.createElement(`div`);o.className=`tcw-goto-actions`;let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-btn`,s.textContent=this.labels.cancel,s.addEventListener(`click`,()=>this.close());let c=document.createElement(`button`);c.type=`submit`,c.className=`tcw-btn tcw-goto-submit`,c.textContent=this.labels.submit,o.append(s,c),n.prepend(r),n.append(o),n.addEventListener(`submit`,e=>{if(e.preventDefault(),!i.value)return;let t={date:i.value,time:a.value};this.close(),this.onSubmit(t)}),n.addEventListener(`keydown`,e=>{e.stopPropagation(),e.key===`Escape`&&this.close()}),this.host.appendChild(n),this.form=n,document.addEventListener(`mousedown`,this.onOutside),i.focus()}close(){if(!this.form)return;document.removeEventListener(`mousedown`,this.onOutside),this.form.remove(),this.form=null;let e=this.returnFocus;this.returnFocus=null,e?.isConnected&&e.focus()}destroy(){this.close()}field(e,t,n,r){let i=document.createElement(`label`);i.className=`tcw-goto-field`;let a=document.createElement(`span`);a.textContent=t;let o=document.createElement(`input`);return o.type=n,o.value=r,o.className=`tcw-goto-input`,i.append(a,o),e.appendChild(i),o}},J=8,Y=4,X=3,ir=`[title]:not([title=""]), [data-tip]:not([data-tip=""])`,ar=class{el;target=null;source=null;pressed=null;showTimer=null;watchFrame=0;warmUntil=0;observer;constructor(e){this.root=e,this.el=document.createElement(`div`),this.el.className=`tcw-tooltip`,this.el.setAttribute(`aria-hidden`,`true`),e.appendChild(this.el),e.addEventListener(`pointerover`,this.onOver),e.addEventListener(`pointerout`,this.onOut),e.addEventListener(`pointerdown`,this.onPress,!0),e.addEventListener(`keydown`,this.onPress,!0),e.addEventListener(`focusin`,this.onFocus),e.addEventListener(`focusout`,this.onBlur),e.addEventListener(`wheel`,this.hide,{passive:!0}),this.observer=new MutationObserver(()=>{this.pressed?.hasAttribute(`title`)&&or(this.pressed);let e=this.target;!e||this.source!==`pointer`||!e.hasAttribute(`title`)||(or(e),this.isVisible()&&this.show(e))}),this.observer.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`title`]})}destroy(){this.hide(),this.pressed&&Z(this.pressed),this.observer.disconnect(),this.root.removeEventListener(`pointerover`,this.onOver),this.root.removeEventListener(`pointerout`,this.onOut),this.root.removeEventListener(`pointerdown`,this.onPress,!0),this.root.removeEventListener(`keydown`,this.onPress,!0),this.root.removeEventListener(`focusin`,this.onFocus),this.root.removeEventListener(`focusout`,this.onBlur),this.root.removeEventListener(`wheel`,this.hide),this.el.remove()}onOver=e=>{if(e.pointerType===`touch`)return;let t=this.tipTarget(e.target);!t||t===this.pressed||t===this.target&&this.source===`pointer`||(or(t),this.schedule(t,`pointer`,Date.now()<this.warmUntil||this.isVisible()))};onOut=e=>{let t=e.relatedTarget,n=e=>!!e&&!!t&&e.contains(t);this.pressed&&!n(this.pressed)&&(Z(this.pressed),this.pressed=null),this.source===`pointer`&&!n(this.target)&&this.hide()};onPress=()=>{let e=this.target,t=this.source===`pointer`;this.warmUntil=0,this.clearTimer(),cancelAnimationFrame(this.watchFrame),this.el.classList.remove(`tcw-tooltip--visible`),this.target=null,this.source=null,this.pressed&&this.pressed!==e&&Z(this.pressed),this.pressed=t?e:null};onFocus=e=>{let t=this.tipTarget(e.target);!t||!lr(t)||t===this.pressed||this.schedule(t,`focus`,!0)};onBlur=e=>{if(this.source!==`focus`)return;let t=e.relatedTarget;this.target&&t&&this.target.contains(t)||this.hide()};hide=()=>{this.clearTimer(),cancelAnimationFrame(this.watchFrame),this.isVisible()&&(this.warmUntil=Date.now()+500),this.el.classList.remove(`tcw-tooltip--visible`),this.target&&this.source===`pointer`&&Z(this.target),this.target=null,this.source=null};tipTarget(e){if(!(e instanceof Element))return null;let t=e.closest(ir);return t&&t!==this.el&&this.root.contains(t)?t:null}schedule(e,t,n){let r=this.target;if(this.clearTimer(),cancelAnimationFrame(this.watchFrame),r&&r!==e&&this.source===`pointer`&&Z(r),this.target=e,this.source=t,n){this.show(e);return}this.el.classList.remove(`tcw-tooltip--visible`),this.showTimer=setTimeout(()=>{this.showTimer=null,this.target===e&&this.show(e)},300)}show(e){if(!cr(e)){this.hide();return}this.el.textContent=sr(e),this.place(e),this.el.classList.add(`tcw-tooltip--visible`),this.watch(e)}watch(e){cancelAnimationFrame(this.watchFrame),this.watchFrame=requestAnimationFrame(()=>{this.target===e&&(cr(e)?this.watch(e):this.hide())})}place(e){let t=this.root.getBoundingClientRect(),n=e.getBoundingClientRect(),r=this.el.offsetWidth,i=this.el.offsetHeight,a=n.left-t.left,o=n.top-t.top,s=ur(e);s===`bottom`&&o+n.height+J+i>t.height?s=`top`:s===`top`&&o-J-i<0?s=`bottom`:s===`right`&&a+n.width+J+r>t.width&&(s=`left`);let c,l;s===`top`||s===`bottom`?(c=a+n.width/2-r/2,l=s===`bottom`?o+n.height+J:o-J-i):(c=s===`right`?a+n.width+J:a-J-r,l=o+n.height/2-i/2),c=Math.max(Y,Math.min(t.width-r-Y,c)),l=Math.max(Y,Math.min(t.height-i-Y,l)),this.el.style.left=`${Math.round(c)}px`,this.el.style.top=`${Math.round(l)}px`;let u={top:[0,X],bottom:[0,-X],left:[X,0],right:[-X,0]}[s];this.el.style.setProperty(`--tcw-tip-dx`,`${u[0]}px`),this.el.style.setProperty(`--tcw-tip-dy`,`${u[1]}px`),this.el.dataset.side=s}isVisible(){return this.el.classList.contains(`tcw-tooltip--visible`)}clearTimer(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null)}};function or(e){let t=e.getAttribute(`title`);t!==null&&(e.dataset.tip=t,e.removeAttribute(`title`))}function Z(e){e.dataset.tip!==void 0&&!e.hasAttribute(`title`)&&(e.setAttribute(`title`,e.dataset.tip),delete e.dataset.tip)}function sr(e){return e.dataset.tip??e.getAttribute(`title`)??``}function cr(e){return e.isConnected&&e.getClientRects().length>0&&!e.disabled}function lr(e){try{return e.matches(`:focus-visible`)}catch{return!1}}function ur(e){return e.dataset.tipSide||(e.closest(`.tcw-sidebar`)?`right`:e.closest(`.tcw-statusbar, .tcw-replay-bar`)?`top`:`bottom`)}var dr=2,fr=class{stack;toggle;rows=new Map;panes=new Map;collapsed=!1;toggleKey=``;stackKey=``;constructor(e,t,n){this.host=e,this.callbacks=t,this.labels=n,this.stack=document.createElement(`div`),this.stack.className=`tcw-ind-legend`,this.toggle=document.createElement(`button`),this.toggle.type=`button`,this.toggle.className=`tcw-ind-legend-toggle`,this.toggle.addEventListener(`click`,()=>{this.setCollapsed(!this.collapsed),this.renderToggle(this.overlayCount())}),this.stack.appendChild(this.toggle),e.appendChild(this.stack)}update(e,t,n=[]){this.updatePanes(n);let r=`${Math.round(t.left)},${Math.round(t.top)}`;r!==this.stackKey&&(this.stackKey=r,this.stack.style.left=`${Math.round(t.left)}px`,this.stack.style.top=`${Math.round(t.top)}px`);let i=new Set,a=!1;for(let t of e){i.add(t.instanceId);let e=this.rows.get(t.instanceId)??this.createRow(t.instanceId);this.fill(e,t),t.pane?e.el.parentElement!==this.host&&this.host.appendChild(e.el):e.el.parentElement!==this.stack&&(this.stack.insertBefore(e.el,this.toggle),a=!0),this.place(e,t.pane)}for(let[e,t]of this.rows)i.has(e)||(t.el.remove(),this.rows.delete(e));a&&this.collapsed&&this.setCollapsed(!1),this.renderToggle(e.filter(e=>!e.pane).length)}destroy(){for(let e of this.rows.values())e.el.remove();this.rows.clear();for(let e of this.panes.values())e.el.remove();this.panes.clear(),this.stack.remove()}updatePanes(e){if(!this.callbacks.onPaneAction)return;let t=new Set;for(let n of e){t.add(n.instanceId);let e=this.panes.get(n.instanceId)??this.createPane(n.instanceId),r=`${Math.round(n.x)},${Math.round(n.y)}|${n.label}|${n.collapsed}|${n.maximized}|${n.canMoveUp}|${n.canMoveDown}`;if(r===e.key)continue;e.key=r,e.el.style.left=`${Math.round(n.x)}px`,e.el.style.top=`${Math.round(n.y)}px`;let i=this.labels,a=(t,r,i,a)=>{let o=e.buttons.get(t);!r&&document.activeElement===o&&e.buttons.get(`max`).focus(),o.hidden=!r,o.innerHTML=S(i,12),Q(o,a??t,n.label)};a(`up`,n.canMoveUp&&!n.maximized,`arrowUp`,i.paneUp),a(`down`,n.canMoveDown&&!n.maximized,`arrowDown`,i.paneDown),a(`fold`,!n.maximized,n.collapsed?`chevronDown`:`chevronUp`,n.collapsed?i.paneExpand:i.paneCollapse),a(`max`,!0,n.maximized?`minimize`:`maximize`,n.maximized?i.paneRestore:i.paneMaximize),e.el.dataset.collapsed=String(n.collapsed),e.el.dataset.maximized=String(n.maximized)}for(let[e,n]of this.panes)t.has(e)||(n.el.remove(),this.panes.delete(e))}createPane(e){let t=document.createElement(`div`);t.className=`tcw-pane-controls`,t.dataset.instance=e;let n=new Map,r=e=>e===`up`||e===`down`?e:e===`fold`?t.dataset.collapsed===`true`?`expand`:`collapse`:t.dataset.maximized===`true`?`restore`:`maximize`;for(let i of[`up`,`down`,`fold`,`max`]){let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-pane-btn`,a.dataset.act=i,a.addEventListener(`click`,()=>this.callbacks.onPaneAction?.(e,r(i))),n.set(i,a),t.appendChild(a)}this.host.appendChild(t);let i={el:t,buttons:n,key:``};return this.panes.set(e,i),i}createRow(e){let t=document.createElement(`div`);t.className=`tcw-ind-legend-row`,t.dataset.instance=e;let n=document.createElement(`button`);n.type=`button`,n.className=`tcw-ind-legend-name`,n.addEventListener(`click`,()=>this.callbacks.onSettings(e));let r=document.createElement(`span`);r.className=`tcw-ind-legend-values`;let i=document.createElement(`span`);i.className=`tcw-ind-legend-actions`;let a=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.className=`tcw-ind-legend-act`,r.dataset.act=e,r.innerHTML=S(t,13),r.addEventListener(`click`,n),i.appendChild(r),r},o=a(`visible`,`eye`,()=>{this.callbacks.onToggleVisible(e,!u.visible)}),s=a(`settings`,`settings`,()=>this.callbacks.onSettings(e)),c=this.callbacks.onMore?a(`more`,`more`,()=>this.callbacks.onMore?.(e,c)):null,l=a(`remove`,`x`,()=>this.callbacks.onRemove(e));t.append(n,r,i);let u={el:t,name:n,values:r,eye:o,settings:s,more:c,remove:l,visible:!0,valuesKey:``,state:``,placeKey:``};return this.rows.set(e,u),u}fill(e,t){let n=`${t.label}|${t.visible}`;n!==e.state&&(e.state=n,e.visible=t.visible,e.name.textContent=t.label,e.name.title=this.labels.settings,e.el.classList.toggle(`tcw-ind-legend-row--hidden`,!t.visible),e.eye.innerHTML=S(t.visible?`eye`:`eyeOff`,13),Q(e.eye,t.visible?this.labels.hide:this.labels.show,t.label),Q(e.settings,this.labels.settings,t.label),e.more&&(Q(e.more,this.labels.more??`More`,t.label),e.more.setAttribute(`aria-haspopup`,`menu`)),Q(e.remove,this.labels.remove,t.label));let r=t.values.map(e=>`${e.text}${e.color??``}`).join(``);r!==e.valuesKey&&(e.valuesKey=r,e.values.replaceChildren(...t.values.map(e=>{let t=document.createElement(`span`);return t.textContent=e.text,e.color&&(t.style.color=e.color),t})))}place(e,t){let n=t?`${Math.round(t.x)},${Math.round(t.y)},${Math.round(t.width)}`:``;n!==e.placeKey&&(e.placeKey=n,e.el.classList.toggle(`tcw-ind-legend-row--pane`,t!==null),e.el.style.left=t?`${Math.round(t.x)}px`:``,e.el.style.top=t?`${Math.round(t.y)}px`:``,e.el.style.maxWidth=t?`${Math.max(0,Math.round(t.width))}px`:``)}setCollapsed(e){this.collapsed=e,this.stack.classList.toggle(`tcw-ind-legend--collapsed`,e)}overlayCount(){return this.stack.querySelectorAll(`:scope > .tcw-ind-legend-row`).length}renderToggle(e){let t=e>=dr;!t&&this.collapsed&&this.setCollapsed(!1);let n=`${t}|${this.collapsed}|${e}`;if(n===this.toggleKey||(this.toggleKey=n,this.toggle.hidden=!t,!t))return;let r=this.collapsed?this.labels.expand:this.labels.collapse;Q(this.toggle,r,this.collapsed?`(${e})`:void 0),this.toggle.setAttribute(`aria-expanded`,String(!this.collapsed));let i=S(this.collapsed?`chevronDown`:`chevronUp`,12);this.toggle.innerHTML=this.collapsed?`${i}<span>${e}</span>`:i}};function Q(e,t,n){e.title=t,e.setAttribute(`aria-label`,n?`${t} ${n}`:t)}function pr(e,t,n){if(!t)return[];let i=e.plots;if(!i){let e=[];for(let n in t){let r=t[n];typeof r==`number`&&Number.isFinite(r)&&e.push(r)}let r=e.length===1?n[0]??null:null;return e.map(e=>({value:e,color:r}))}let a={colors:[...n],lineWidths:[],opacity:1},o=[];for(let e of i){let i=t[e.key];typeof i!=`number`||!Number.isFinite(i)||o.push({value:i,color:n.length?(0,r.plotColor)(e,a,t):null})}return o}var mr=new Map;function hr(e){let t=mr.get(e);return t||(t=new Intl.NumberFormat(e,{notation:`compact`,maximumFractionDigits:2}),mr.set(e,t)),t}function gr(e,t=`en-US`){return Math.abs(e)>=1e6?hr(t).format(e):(0,n.formatPrice)(e,(0,r.indicatorValuePrecision)(e),t)}var _r=class{el;labelEl;callbacks;visible=!1;constructor(e,n,r=t.t){this.t=r,this.callbacks=n,this.el=document.createElement(`div`),this.el.className=`tcw-bracket-bar`,this.el.hidden=!0,this.labelEl=document.createElement(`span`),this.labelEl.className=`tcw-bracket-label`,this.el.appendChild(this.labelEl);let i=document.createElement(`span`);i.className=`tcw-bracket-hint`,i.textContent=this.t(`bracket.hint`),this.el.appendChild(i);let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-bracket-cancel`,a.innerHTML=`${S(`x`,14)}<span>${w(this.t(`common.cancel`))}</span>`,a.addEventListener(`click`,()=>this.callbacks.onCancel());let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-bracket-confirm`,o.innerHTML=`${S(`check`,14)}<span>${w(this.t(`bracket.place`))}</span>`,o.addEventListener(`click`,()=>this.callbacks.onConfirm()),this.el.appendChild(a),this.el.appendChild(o),e.appendChild(this.el)}show(e){this.visible=!0,this.labelEl.textContent=e===`buy`?this.t(`toolbar.longBracket`):this.t(`toolbar.shortBracket`),this.labelEl.dataset.side=e,this.el.hidden=!1}hide(){this.visible=!1,this.el.hidden=!0}isVisible(){return this.visible}destroy(){this.el.remove()}},vr=class{options;audioCtx=null;audioEl=null;permissionAsked=!1;constructor(e={}){if(this.options=e,typeof e.sound==`string`)try{this.audioEl=new Audio(e.sound),this.audioEl.preload=`auto`}catch{this.audioEl=null}e.desktop&&this.ensurePermission()}setOptions(e){this.options={...this.options,...e}}notify(e){this.options.sound&&this.playSound(),this.options.desktop&&this.showDesktop(e)}playSound(){if(this.audioEl){this.audioEl.currentTime=0,this.audioEl.play().catch(()=>{});return}this.beep()}beep(){try{let e=window.AudioContext??window.webkitAudioContext;if(!e)return;this.audioCtx||=new e;let t=this.audioCtx,n=t.currentTime,r=t.createGain();r.gain.setValueAtTime(1e-4,n),r.gain.exponentialRampToValueAtTime(.2,n+.01),r.gain.exponentialRampToValueAtTime(1e-4,n+.35),r.connect(t.destination);let i=t.createOscillator();i.type=`sine`,i.frequency.setValueAtTime(880,n),i.frequency.setValueAtTime(1320,n+.16),i.connect(r),i.start(n),i.stop(n+.36)}catch{}}ensurePermission(){this.permissionAsked||(this.permissionAsked=!0,!(typeof Notification>`u`)&&Notification.permission===`default`&&Notification.requestPermission().catch(()=>{}))}showDesktop(e){if(!(typeof Notification>`u`)){if(Notification.permission!==`granted`){this.ensurePermission();return}try{new Notification(this.options.title??`Price alert`,{body:e})}catch{}}}destroy(){try{this.audioCtx?.close()}catch{}this.audioCtx=null,this.audioEl=null}};function yr(e,t=12){let n=[...e.asks].sort((e,t)=>e.price-t.price).slice(0,t),r=[...e.bids].sort((e,t)=>t.price-e.price).slice(0,t),i=n.length>0?n[0].price:null,a=r.length>0?r[0].price:null,o=i!==null&&a!==null?(i+a)/2:null,s=new Map,c=e=>{let t=s.get(e);return t||(t={price:e,bidVolume:0,askVolume:0},s.set(e,t)),t};for(let e of n)c(e.price).askVolume+=e.volume;for(let e of r)c(e.price).bidVolume+=e.volume;let l=[...s.values()].sort((e,t)=>t.price-e.price),u=0;for(let e of l)u=Math.max(u,e.bidVolume,e.askVolume);return{rows:l,maxVolume:u,mid:o}}var br=class{el;bodyEl;callbacks;open=!1;levels;constructor(e,n,r=12,i=t.t){this.t=i,this.callbacks=n,this.levels=r,this.el=document.createElement(`div`),this.el.className=`tcw-ladder`,this.el.hidden=!0;let a=document.createElement(`div`);a.className=`tcw-ladder-header`;let o=document.createElement(`span`);o.textContent=this.t(`ladder.title`);let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-ladder-close`,s.setAttribute(`aria-label`,this.t(`common.close`)),s.innerHTML=S(`x`,14),s.addEventListener(`click`,()=>this.close()),a.appendChild(o),a.appendChild(s),this.el.appendChild(a);let c=document.createElement(`div`);c.className=`tcw-ladder-cols`,c.innerHTML=[this.t(`ladder.bid`),this.t(`ladder.price`),this.t(`ladder.ask`)].map(e=>`<span>${w(e)}</span>`).join(``),this.el.appendChild(c),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-ladder-body`,this.el.appendChild(this.bodyEl),e.appendChild(this.el)}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1}close(){this.open=!1,this.el.hidden=!0}setData(e){if(!e){this.renderEmpty();return}this.render(yr(e,this.levels))}destroy(){this.el.remove()}renderEmpty(){this.bodyEl.replaceChildren();let e=document.createElement(`div`);e.className=`tcw-ladder-empty`,e.textContent=this.t(`ladder.empty`),this.bodyEl.appendChild(e)}render(e){if(this.bodyEl.replaceChildren(),e.rows.length===0){this.renderEmpty();return}let n=e.maxVolume>0?1/e.maxVolume:0;for(let r of e.rows){let e=r.askVolume>0,i=document.createElement(`div`);i.className=`tcw-ladder-row`;let a=document.createElement(`button`);a.type=`button`,a.className=`tcw-ladder-cell tcw-ladder-bid`,r.bidVolume>0?(a.textContent=xr(r.bidVolume),a.style.setProperty(`--w`,`${(r.bidVolume*n*100).toFixed(1)}%`),a.title=t.r(this.t(`ladder.sellAt`),{price:this.callbacks.formatPrice(r.price)}),a.addEventListener(`click`,()=>this.callbacks.onTrade(`sell`,r.price))):a.disabled=!0;let o=document.createElement(`div`);o.className=`tcw-ladder-price ${e?`tcw-ask`:`tcw-bid`}`,o.textContent=this.callbacks.formatPrice(r.price);let s=document.createElement(`button`);s.type=`button`,s.className=`tcw-ladder-cell tcw-ladder-ask`,r.askVolume>0?(s.textContent=xr(r.askVolume),s.style.setProperty(`--w`,`${(r.askVolume*n*100).toFixed(1)}%`),s.title=t.r(this.t(`ladder.buyAt`),{price:this.callbacks.formatPrice(r.price)}),s.addEventListener(`click`,()=>this.callbacks.onTrade(`buy`,r.price))):s.disabled=!0,i.appendChild(a),i.appendChild(o),i.appendChild(s),this.bodyEl.appendChild(i)}}};function xr(e){return e>=1e3?(e/1e3).toFixed(1)+`k`:e>=1?e.toFixed(2).replace(/\.00$/,``):e.toPrecision(2)}var Sr=class{el;bodyEl;callbacks;open=!1;constructor(e,n,r=t.t){this.t=r,this.callbacks=n,this.el=document.createElement(`div`),this.el.className=`tcw-datawin`,this.el.hidden=!0;let i=document.createElement(`div`);i.className=`tcw-datawin-header`;let a=document.createElement(`span`);a.textContent=this.t(`dataWindow.title`);let o=document.createElement(`button`);o.type=`button`,o.className=`tcw-datawin-close`,o.setAttribute(`aria-label`,this.t(`common.close`)),o.innerHTML=S(`x`,14),o.addEventListener(`click`,()=>this.close()),i.appendChild(a),i.appendChild(o),this.el.appendChild(i),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tcw-datawin-body`,this.el.appendChild(this.bodyEl),e.appendChild(this.el)}isOpen(){return this.open}toggle(){this.open?this.close():this.openPanel()}openPanel(){this.open=!0,this.el.hidden=!1}close(){this.open=!1,this.el.hidden=!0}destroy(){this.el.remove()}render(e){if(!this.open)return;if(this.bodyEl.replaceChildren(),!e.ohlc){let e=document.createElement(`div`);e.className=`tcw-datawin-empty`,e.textContent=this.t(`dataWindow.hover`),this.bodyEl.appendChild(e);return}let t=this.callbacks.formatPrice,n=e.ohlc;this.bodyEl.appendChild(this.row(this.t(`dataWindow.open`),t(n.open))),this.bodyEl.appendChild(this.row(this.t(`dataWindow.high`),t(n.high))),this.bodyEl.appendChild(this.row(this.t(`dataWindow.low`),t(n.low))),this.bodyEl.appendChild(this.row(this.t(`dataWindow.close`),t(n.close)));let r=e.change>0?`up`:e.change<0?`down`:``,i=e.change>0?`+`:``;this.bodyEl.appendChild(this.row(this.t(`dataWindow.change`),`${i}${t(e.change)} (${i}${e.changePct.toFixed(2)}%)`,r)),this.bodyEl.appendChild(this.row(this.t(`dataWindow.volume`),wr(n.volume)));for(let t of e.indicators){let e=document.createElement(`div`);e.className=`tcw-datawin-sub`,e.textContent=t.name,this.bodyEl.appendChild(e);for(let e of t.values)this.bodyEl.appendChild(this.row(e.key,Cr(e.value)))}}row(e,t,n=``){let r=document.createElement(`div`);r.className=`tcw-datawin-row`;let i=document.createElement(`span`);i.className=`tcw-datawin-label`,i.textContent=e;let a=document.createElement(`span`);return a.className=`tcw-datawin-value${n?` tcw-${n}`:``}`,a.textContent=t,r.appendChild(i),r.appendChild(a),r}};function Cr(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e3?e.toFixed(2):t>=1?e.toFixed(4):e.toPrecision(4)}function wr(e){return e>=1e9?(e/1e9).toFixed(2)+`B`:e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(2)+`K`:e.toFixed(0)}var Tr=globalThis.Buffer;function Er(e){if(Tr)return Tr.from(e,`utf8`).toString(`base64`);let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n)}function Dr(e){if(Tr)return Tr.from(e,`base64`).toString(`utf8`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return new TextDecoder().decode(n)}function Or(e){return e.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function kr(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t+(t.length%4==0?``:`=`.repeat(4-t.length%4))}function Ar(e){return Or(Er(JSON.stringify(e)))}function jr(e){if(!e)return null;try{let t=Dr(kr(e)),n=JSON.parse(t);return!n||n.v!==1||typeof n.symbol!=`string`?null:{v:1,symbol:n.symbol,timeframe:n.timeframe,chartType:n.chartType,scaleMode:n.scaleMode??`regular`,indicators:Array.isArray(n.indicators)?n.indicators:[],drawings:Array.isArray(n.drawings)?n.drawings:[]}}catch{return null}}var Mr=`tcw`;function Nr(e){let t=e.startsWith(`#`)?e.slice(1):e;for(let e of t.split(`&`)){let t=e.indexOf(`=`);if(t>0&&e.slice(0,t)===Mr)return decodeURIComponent(e.slice(t+1))}return null}function Pr(e,t){let[n]=e.split(`#`);return`${n}#${Mr}=${t}`}var Fr=[[34,16,28,26,!1],[30,14,24,26,!0],[26,18,20,30,!0],[30,10,24,22,!1],[20,16,14,28,!0],[14,18,8,30,!0],[18,10,12,20,!1],[8,18,2,30,!0]],Ir=class{el;label;showTimer=null;phase=`loading`;constructor(e,t){this.loadingText=t,this.el=document.createElement(`div`),this.el.className=`tcw-loading-overlay`,this.el.setAttribute(`role`,`status`),this.el.setAttribute(`aria-live`,`polite`);let n=document.createElement(`div`);n.className=`tcw-loading-card`;let r=document.createElement(`div`);r.className=`tcw-loading-candles`,r.setAttribute(`aria-hidden`,`true`),Fr.forEach(([e,t,n,i,a],o)=>{let s=document.createElement(`span`);s.className=a?`tcw-loading-candle tcw-loading-candle--up`:`tcw-loading-candle`,s.style.setProperty(`--tcw-body-top`,`${e}px`),s.style.setProperty(`--tcw-body-h`,`${t}px`),s.style.setProperty(`--tcw-wick-top`,`${n}px`),s.style.setProperty(`--tcw-wick-h`,`${i}px`),s.style.setProperty(`--tcw-delay`,`${o*110}ms`),r.appendChild(s)}),n.appendChild(r);let i=document.createElement(`div`);i.className=`tcw-loading-track`,i.setAttribute(`aria-hidden`,`true`),i.appendChild(document.createElement(`span`)),n.appendChild(i),this.label=document.createElement(`div`),this.label.className=`tcw-loading-label`,this.label.textContent=t,n.appendChild(this.label),this.el.appendChild(n),e.appendChild(this.el)}begin(e,t=!1){if(this.phase=`loading`,this.clearTimer(),this.label.textContent=this.loadingText,this.el.classList.remove(`tcw-loading-overlay--error`),this.el.classList.toggle(`tcw-loading-overlay--veil`,e),!e||t||this.isShown()){this.el.classList.remove(`tcw-loading-overlay--hidden`);return}this.showTimer=setTimeout(()=>{this.showTimer=null,this.el.classList.remove(`tcw-loading-overlay--hidden`)},200)}end(){this.phase=`idle`,this.clearTimer(),this.el.classList.add(`tcw-loading-overlay--hidden`)}fail(e){this.phase!==`idle`&&(this.phase=`failed`,this.clearTimer(),this.label.textContent=e,this.el.classList.add(`tcw-loading-overlay--error`),this.el.classList.remove(`tcw-loading-overlay--hidden`))}isActive(){return this.phase!==`idle`}hasFailed(){return this.phase===`failed`}isShown(){return!this.el.classList.contains(`tcw-loading-overlay--hidden`)}destroy(){this.clearTimer(),this.el.remove()}clearTimer(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null)}},Lr=4e3,Rr=class{el;text;hideTimer=null;constructor(e,t){this.texts=t,this.el=document.createElement(`div`),this.el.className=`tcw-history-pill tcw-history-pill--hidden`,this.el.setAttribute(`aria-hidden`,`true`),this.el.setAttribute(`role`,`status`),this.el.setAttribute(`aria-live`,`polite`);let n=document.createElement(`span`);n.className=`tcw-history-spinner`,n.setAttribute(`aria-hidden`,`true`),this.text=document.createElement(`span`),this.el.append(n,this.text),e.appendChild(this.el)}update(e){this.clearTimer(),e.state===`loading`?this.show(this.texts.loading,!1):e.state===`error`?(this.show(this.texts.failed,!0),this.hideTimer=setTimeout(()=>this.hide(),Lr)):this.hide()}destroy(){this.clearTimer(),this.el.remove()}show(e,t){this.text.textContent=e,this.el.classList.toggle(`tcw-history-pill--error`,t),this.el.classList.remove(`tcw-history-pill--hidden`),this.el.removeAttribute(`aria-hidden`)}hide(){this.hideTimer=null,this.el.classList.add(`tcw-history-pill--hidden`),this.el.setAttribute(`aria-hidden`,`true`),this.text.textContent=``}clearTimer(){this.hideTimer!==null&&clearTimeout(this.hideTimer),this.hideTimer=null}},zr=48,Br=5e4,Vr=100;function Hr(){return new Promise(e=>{if(typeof requestAnimationFrame!=`function`||document.hidden){setTimeout(e,0);return}let t=setTimeout(e,Vr);requestAnimationFrame(()=>setTimeout(()=>{clearTimeout(t),e()},0))})}var Ur=[`#4c8dff`,`#a57cff`,`#1398a8`,`#e25592`,`#8a93a3`,`#62c895`],Wr=4,Gr=7,Kr=17,qr=3,Jr=[`1m`,`3m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`1d`],Yr=5e3,Xr=()=>{let e=document.activeElement;return e instanceof Element&&e.closest(`[role="dialog"], [aria-modal="true"], [role="menu"]`)!==null},Zr={KeyT:`trendLine`,KeyH:`horizontalLine`,KeyJ:`horizontalRay`,KeyV:`verticalLine`,KeyC:`crossLine`,KeyF:`fibRetracement`},Qr=e=>(e[e.length-1]?.time??0)>0xe8d4a51000?1:1e3,$r=class{chart;state;toolbar=null;sidebar=null;settings=null;statusBar=null;goToDate=null;tooltip;indicatorLegend=null;legendFrame=0;portal=document.createElement(`div`);overlayHost=()=>{let e=document.fullscreenElement===this.root?this.root:document.body;return this.portal.parentElement!==e&&e.appendChild(this.portal),this.portal};unregisterKeys=()=>{};onFullscreenChange=()=>{this.toolbar?.setFullscreen(document.fullscreenElement===this.root),this.portal.isConnected&&this.overlayHost()};commandPalette=null;symbolSearch=null;hotkeySheet=null;replayBar=null;dragDrop=null;alertsPanel=null;objectTree=null;indicatorSettings=null;drawingStyle=null;drawingSettings=null;drawingMenu=null;chartMenu=null;menuPane=null;canExport=!0;symbolLoads=new Map;ui;legendMenu=null;templates=new Gn;templatePrompt=null;intervalInput=null;markerTip=null;accountPanel=null;orderTicket=null;accountFrame=0;layoutSession=null;layoutsUI=null;bracketBar=null;alertNotifier=null;depthLadder=null;dataWindow=null;lastHoverIndex=null;legendHoverIndex=null;favoritesStore=new $n;timeframeFavorites=new $n(`tcw:tf-favorites`);customTimeframes=new $n(`tcw:tf-custom`);timeframes=[];watchlist=null;watchlistSparkBuffer=new Map;sessionRefPrice=null;hostWatchlistRefPrice=new Map;watchlistInterval=null;watchlistStore=null;watchlistFromSymbols=!1;quoteSource=null;stopQuotes=null;quotedKey=``;quotes=new Map;symbolInfoPanel=null;newsRequest=0;newsCache=new Map;marketTimer=null;chartNav=null;visibleBarCount=50;replayPollInterval=null;replaySpeed=5;replayStep=`bar`;replayStartSeq=0;replayStepsCache=null;replayShade=null;layoutKeyPrefix=null;layoutDebounceMs=1500;activeLayoutKey=null;root;chartContainer;loading;historyPill;connectSeq=0;localSeq=0;lastLocalSwitchMs=0;destroyed=!1;options;symbols;settingsState;settingsDefaults;t;adapter=null;boundGlobalKeydown=null;baseSeries=null;baseTimeframeMs=0;compares=[];constructor(i,a={}){this.options=a,this.symbols=a.symbols??te;let o=a.chartOptions;if(this.settingsState={...ne,...o?.numberLocale?{numberLocale:o.numberLocale}:{},...o?.timeZone==null?{}:{timezone:c(o.timeZone)},...o?.leftPriceScale===void 0?{}:{leftPriceScale:o.leftPriceScale},...o?.highLowLines===void 0?{}:{highLowLines:o.highLowLines},...o?.extendedHours===void 0?{}:{extendedHours:o.extendedHours},...o?.chartTypeOptions?{chartTypeOptions:(0,n.readChartTypeOptions)(o.chartTypeOptions)}:{}},this.t=t.n(t.o(a.locale,a.messages)),a.persistLayouts){let e=a.persistLayouts===!0?{}:a.persistLayouts;this.layoutKeyPrefix=e.keyPrefix??`tcw:layout:`,this.layoutDebounceMs=e.debounceMs??1500}let s=this.resolveIsDark(a.theme),l=this.resolveTheme(a.theme),p={drawings:!0,drawingMagnet:!0,drawingUndoRedo:!0,indicators:!0,trading:a.trading!==!1,tradingContextMenu:!1,priceAxisAddButton:a.alerts!==!1||a.trading!==!1||a.drawingTools!==!1,volume:!0,legend:!0,crosshair:!0,crosshairTooltip:!1,keyboard:!0,screenshot:!0,alerts:!0,barCountdown:!0,logScale:!0,watermark:!0,...a.chartOptions?.features};if(this.canExport=p.dataExport!==!1,this.settingsDefaults={...this.settingsState,legendVisible:p.legend!==!1,barCountdown:p.barCountdown!==!1,indicatorValueLabels:p.indicatorValueLabels!==!1},this.settingsState={...this.settingsDefaults},this.timeframes=Hn(In(a.timeframes,p.timeframes),this.customTimeframes.list(),p.timeframes),!this.timeframes.some(e=>this.timeframeFavorites.has(e))){let e=Ln(this.timeframes,p.defaultTimeframeFavorites,!!a.timeframes?.length);for(let t of e)this.timeframeFavorites.add(t)}let m=a.timeframe??`5m`,h=!p.timeframes?.length||p.timeframes.includes(m)?m:this.timeframes[0]??m;this.state={symbol:a.symbol??this.symbols[0]??`BTCUSDT`,timeframe:h,chartType:a.chartOptions?.chartType??`candlestick`,isDark:s,activeIndicators:new Map,activeTool:null,magnetEnabled:p.drawingMagnet!==!1,magnetStrong:!1,eraser:!1,zoomArea:!1,stayInDrawing:!1,connectionState:a.adapter?`connecting`:`disconnected`,connectionMessage:a.adapter?this.t(`status.connecting`):``},g(),this.root=document.createElement(`div`),this.root.className=`tcw-root`,this.root.dataset.tcwTheme=s?`dark`:`light`;let _=a.dir===`ltr`||a.dir===`rtl`?a.dir:li(a.locale)?`rtl`:`ltr`;this.root.dir=_,this.portal.dir=_,i.appendChild(this.root),this.tooltip=new ar(this.root),this.portal.className=`tcw-root tcw-portal`,this.portal.dataset.tcwTheme=this.root.dataset.tcwTheme,this.ui=N(a.ui);let v=a.ui!==void 0;P(this.root,this.ui,{variables:v}),P(this.portal,this.ui,{variables:v}),a.toolbar!==!1&&(this.toolbar=new ve(this.root,{symbols:this.symbols,timeframes:this.timeframeMenu(),timeframeFavorites:this.pinnedTimeframes(),chartTypes:a.chartTypes?u.filter(e=>a.chartTypes.includes(e.value)):u,indicators:ee,popularIndicatorIds:f},{onSymbolClick:()=>this.handleSymbolClick(),onSymbolInfo:a.symbolInfo===!1?void 0:()=>this.toggleSymbolInfo(),onTimeframe:e=>this.handleTimeframe(e),onToggleTimeframeFavorite:e=>this.handleToggleTimeframeFavorite(e),onAddTimeframe:a.customTimeframes===!1?void 0:e=>this.handleAddTimeframe(e),onRemoveTimeframe:e=>this.handleRemoveTimeframe(e),onChartType:e=>this.handleChartType(e),onAddIndicator:e=>this.handleAddIndicator(e),onScreenshot:()=>this.chart.screenshot(),onSettings:()=>this.openSettings(),onToggleTheme:()=>this.handleToggleTheme(),onToggleReplay:()=>this.toggleReplay(),onToggleAlerts:a.alerts===!1?void 0:()=>this.toggleAlerts(),onToggleObjects:a.objectTree===!1?void 0:()=>this.toggleObjects(),onToggleAccount:a.trading!==!1&&a.accountPanel!==!1?()=>this.accountPanel?.toggle():void 0,onLayouts:a.layouts===!1?void 0:e=>void this.layoutsUI?.openMenu(e),...a.indicatorTemplates===!1?{}:{onApplyIndicatorTemplate:e=>this.applyIndicatorTemplate(e),onSaveIndicatorTemplate:()=>this.promptSaveIndicatorTemplate(),onDeleteIndicatorTemplate:e=>{this.templates.remove(e),this.toolbar?.setIndicatorTemplates(this.templates.list().map(e=>e.name),!0)}},onBracket:a.trading===!1?void 0:e=>this.startBracket(e),onToggleLadder:a.trading!==!1&&a.depthLadder?()=>this.depthLadder?.toggle():void 0,onToggleFullscreen:a.fullscreen!==!1&&typeof document<`u`&&document.fullscreenEnabled?()=>this.toggleFullscreen():void 0},this.t));let y=document.createElement(`div`);y.className=`tcw-body`,a.drawingTools!==!1&&(a.drawingFavorites&&this.favoritesStore.seedDefaults(a.drawingFavorites),this.sidebar=new Se(y,{drawingToolGroups:he(d,this.t),favorites:this.favoritesStore.list()},{onDrawingTool:e=>this.handleDrawingTool(e),onCancelDrawing:()=>this.handleCancelDrawing(),onToggleMagnet:p.drawingMagnet===!1?void 0:()=>this.handleToggleMagnet(),onToggleEraser:()=>this.chart.setEraserMode(!this.chart.isEraserMode()),onToggleZoomArea:()=>this.chart.setZoomAreaMode(!this.chart.isZoomAreaMode()),onToggleFavorite:e=>this.handleToggleFavorite(e),onUndo:()=>this.chart.undo(),onRedo:()=>this.chart.redo(),onClearDrawings:()=>{this.chart.clearDrawings(),this.state={...this.state,activeTool:null},this.updateUI()},onToggleStyle:()=>this.drawingStyle?.toggle(),onToggleStayInDrawing:()=>this.handleToggleStayInDrawing()},this.t)),this.chartContainer=document.createElement(`div`),this.chartContainer.className=`tcw-chart-container`,this.chartContainer.dir=`ltr`,y.appendChild(this.chartContainer),this.loading=new Ir(this.chartContainer,this.t(`status.loading`)),this.historyPill=new Rr(this.chartContainer,{loading:this.t(`history.loading`),failed:this.t(`history.failed`)}),a.watchlist&&this.createWatchlist(y,a.watchlist===!0?{}:a.watchlist),this.root.appendChild(y);let b=document.createElement(`div`);if(b.className=`tcw-account-dock`,this.root.appendChild(b),this.chart=new e.c(this.chartContainer,{chartType:this.state.chartType,theme:l,autoScale:!0,crosshair:{mode:`magnet`},a11y:{labels:{role:this.t(`a11y.role`),summary:this.t(`a11y.summary`),empty:this.t(`a11y.empty`),view:this.t(`a11y.view`),bar:this.t(`a11y.bar`),keys:this.t(`a11y.keys`),typeName:e=>{let t=`chartType.${e}`,n=this.t(t);return n===t?e:n}}},...a.chartOptions,features:p}),a.chartOptions?.shapes||this.applyChartShapes(),this.chart.on(`visibleRangeChange`,e=>{let{from:t,to:n}=e.payload;Number.isFinite(t)&&Number.isFinite(n)&&(this.visibleBarCount=Math.max(1,n-t))}),a.navigation!==!1&&(this.chartNav=new it(this.chartContainer,{zoomIn:()=>this.chart.zoomIn(),zoomOut:()=>this.chart.zoomOut(),scroll:e=>this.chart.scrollBars(e*Math.max(1,Math.round(this.visibleBarCount/10))),reset:()=>{this.chart.fitContent(),this.changeSettings({autoScale:!0})},plotRect:()=>this.chart.getPlotRect()},this.t)),this.chart.on(`dataUpdate`,e=>this.handleDataUpdate(e.payload)),this.chart.on(`historyLoad`,e=>this.historyPill.update(e.payload)),this.chart.on(`symbolInfoChange`,e=>{let t=e.payload.info,n=t?[t.description,t.exchange].filter(Boolean).join(` · `):``;this.toolbar?.setSymbolDescription(n||null),this.refreshMarket()}),a.symbolInfo!==!1&&(this.symbolInfoPanel=new tt(this.root,this.t,{onToggle:e=>{this.toolbar?.setActive(`symbolInfo`,e),e&&(this.refreshSymbolInfo(),this.loadNews())}})),this.marketTimer=setInterval(()=>this.refreshMarket(),3e4),a.dragDropImport!==!1&&(this.dragDrop=new e.o(this.chartContainer,{onData:(e,n,r)=>{this.setData(e);let i=t.r(this.t(`toast.fileLoaded`),{count:n.data.length,file:r.name});this.toast(n.skipped>0?`${i} (${t.r(this.t(`toast.fileSkipped`),{count:n.skipped})})`:i)},onError:(e,t)=>{this.toast(`${t.name}: ${e.message}`,`error`)}}),this.dragDrop.attach()),a.statusBar!==!1){let e=a.rangeBar!==!1;this.statusBar=new Ee(this.root,e?{presets:r.RANGE_PRESETS,presetLabels:{All:this.t(`range.all`)},groupLabel:this.t(`range.presets`),goToLabel:this.t(`range.goTo`),onPreset:e=>this.chart.setVisibleRangePreset(e),onGoTo:()=>this.toggleGoToDate()}:void 0),e&&(this.goToDate=new rr(this.root,{title:this.t(`range.goTo`),date:this.t(`range.date`),time:this.t(`range.time`),submit:this.t(`range.goToSubmit`),cancel:this.t(`range.cancel`)},({date:e,time:t})=>this.goToWallTime(e,t)))}if(a.settings!==!1&&(this.settings=new we({onChange:e=>this.changeSettings(e),onReset:()=>this.resetSettings(),onClose:()=>{}},this.t,{barCountdown:p.barCountdown,logScale:p.logScale,exchangeZone:this.adapter?.resolveSymbol?()=>this.chart.getSymbolInfo()?.timezone??null:void 0},this.overlayHost)),this.symbolSearch=new Oe({onPick:e=>{this.setSymbol(e)},onClose:()=>{}},this.overlayHost,this.t),this.hotkeySheet=new Pe({onClose:()=>{}},this.t,this.overlayHost),this.chart.on(`drawingToolChange`,e=>{let t=e.payload.tool;t!==this.state.activeTool&&(this.state={...this.state,activeTool:t},this.updateUI())}),this.chart.on(`toolModeChange`,e=>{let{eraser:t,zoomArea:n}=e.payload;this.state={...this.state,eraser:t??this.state.eraser,zoomArea:n??this.state.zoomArea},this.updateUI()}),this.chart.on(`indicatorAdd`,()=>this.syncIndicatorsFromChart()),this.chart.on(`indicatorRemove`,()=>this.syncIndicatorsFromChart()),a.indicatorLegend!==!1){this.chart.setPaneTitlesVisible(!1),this.indicatorLegend=new fr(this.chartContainer,{onToggleVisible:(e,t)=>{this.chart.setIndicatorVisible(e,t),this.scheduleLegend(),this.objectTree?.isOpen()&&this.refreshObjects()},onSettings:e=>this.openIndicatorSettings(e),onRemove:e=>this.handleRemoveIndicator(e),onMore:(e,t)=>this.openLegendMenu(e,t),onPaneAction:(e,t)=>this.runPaneAction(e,t)},{show:this.t(`legend.show`),hide:this.t(`legend.hide`),settings:this.t(`legend.settings`),remove:this.t(`legend.remove`),collapse:this.t(`legend.collapse`),expand:this.t(`legend.expand`),more:this.t(`legend.more`),paneUp:this.t(`pane.moveUp`),paneDown:this.t(`pane.moveDown`),paneCollapse:this.t(`pane.collapse`),paneExpand:this.t(`pane.expand`),paneMaximize:this.t(`pane.maximize`),paneRestore:this.t(`pane.restore`)}),this.legendMenu=new z(this.root,this.t(`legend.more`)),this.chart.on(`crosshairMove`,e=>{let t=e.payload;this.legendHoverIndex=typeof t.barIndex==`number`?t.barIndex:null,this.scheduleLegend()}),this.chart.on(`crosshairLeave`,()=>{this.legendHoverIndex=null,this.scheduleLegend()});for(let e of[`indicatorUpdate`,`indicatorChange`,`dataUpdate`,`resize`,`paneResize`,`paneChange`,`themeChange`])this.chart.on(e,()=>this.scheduleLegend())}if(this.chart.on(`barClick`,e=>{if(!this.replayBar?.isMounted())return;let t=e.payload.barIndex;if(typeof t==`number`){if(this.replayBar.getMode()===`select`){this.startReplayAt(t);return}this.chart.getReplayState()===`playing`&&this.chart.replayPause(),this.chart.replaySeekToBar(t),this.replayBar.setState(`paused`)}}),this.chart.on(`crosshairMove`,e=>{if(this.replayBar?.getMode()!==`select`||!this.replayBar.isMounted())return;let t=e.payload.point;this.positionReplayShade(t?.x??null)}),this.dataWindow=new Sr(this.root,{formatPrice:e=>this.formatAlertPrice(e)},this.t),this.chart.on(`crosshairMove`,e=>{let t=e.payload;this.lastHoverIndex=typeof t.barIndex==`number`?t.barIndex:null,this.dataWindow?.isOpen()&&this.dataWindow.render(this.buildDataWindowModel())}),a.drawingTools!==!1){let e=new Bt,n=new Vt;for(let[e,t]of Object.entries(n.all()))this.chart.setDrawingToolDefaults(e,t??null);this.drawingSettings=new rn(this.root,{onBegin:e=>this.chart.beginDrawingEdit(e),onChange:(e,t)=>this.chart.updateDrawing(e,t),onEnd:(e,t)=>{this.chart.endDrawingEdit(e,{cancel:t}),this.refreshObjects()},toWallTime:e=>q(e*Qr(this.chart.getData()),this.displayTimezone()),fromWallTime:(e,t)=>{let n=nr(e,t,this.displayTimezone());return n===null?null:n/Qr(this.chart.getData())},onAddAlert:e=>this.addDrawingAlert(e),onSaveDefault:(e,r)=>{this.chart.setDrawingToolDefaults(e,r),n.set(e,this.chart.getDrawingToolDefaults(e)),this.toast(t.r(this.t(`drawingSettings.defaultSaved`),{name:this.drawingToolName(e)}))},templates:e},this.t),this.chart.on(`drawingDoubleClick`,e=>this.openDrawingSettings(e.payload.id)),this.drawingStyle=new Gt(this.root,{onStyleChange:e=>{this.chart.setDrawingStyle(e),this.chart.setSelectedDrawingStyle(e)},getStyle:()=>this.chart.getDrawingStyle()},e,this.t)}if(this.drawingMenu=new z(this.root,this.t(`drawingMenu.label`)),this.chart.on(`drawingContextMenu`,e=>{let{id:t,x:n,y:r}=e.payload;this.openDrawingMenu(t,n,r)}),this.chartMenu=new z(this.root,this.t(`chartMenu.label`)),this.chart.on(`symbolSeriesRequest`,e=>void this.loadSymbolSeries(e.payload.symbol)),this.chart.on(`chartContextMenu`,e=>{let{area:t,x:n,y:r,price:i,time:a,pane:o}=e.payload,s=i===void 0?void 0:this.chart.roundPrice(i),c={...this.chartMenuContext(s),...o?{pane:this.chart.getPaneScale(o)}:{}};this.menuPane=o??null,this.openChartMenu(ln(t,c,this.t),n,r,{area:t,price:s,time:a})}),this.chart.on(`priceAxisAdd`,e=>{let{price:t,x:n,y:r}=e.payload,i=this.chart.roundPrice(t);this.openChartMenu(cn(this.chartMenuContext(i),this.t),n,r,{area:`priceAxisAdd`,price:i})}),this.chart.on(`signalMarkerHover`,e=>this.showMarkerTip(e.payload)),a.intervalTyping!==!1&&(this.intervalInput=new Wn(this.chartContainer,{title:this.t(`interval.title`),hint:this.t(`interval.hint`),invalid:this.t(`interval.invalid`)},e=>this.selectTypedTimeframe(e))),a.indicatorTemplates!==!1&&this.toolbar?.setIndicatorTemplates(this.templates.list().map(e=>e.name)),a.layouts!==!1&&this.setupLayouts(a.layouts===!0||a.layouts===void 0?{}:a.layouts),a.trading!==!1&&a.accountPanel!==!1){this.orderTicket=new Sn(this.root,{onSubmit:e=>{this.chart.placeOrderIntent(e),this.toast(t.r(this.t(`ticket.sent`),{side:this.t(e.side===`buy`?`ticket.buy`:`ticket.sell`),quantity:e.quantity??1,price:this.formatAlertPrice(e.price)}))},formatPrice:e=>this.formatAlertPrice(e)},this.t),this.accountPanel=new gn(b,{onClosePosition:e=>this.chart.closePositionIntent(e),onReversePosition:e=>this.chart.reversePositionIntent(e),onCancelOrder:e=>this.chart.cancelOrderIntent(e),onNewOrder:()=>this.openOrderTicket(),formatPrice:e=>this.formatAlertPrice(e),formatTime:e=>{let{date:t,time:n}=q(e,this.displayTimezone());return`${t} ${n}`},onToggle:e=>{this.toolbar?.setActive(`account`,e),this.refreshAccount()}},this.t);for(let e of[`ordersChange`,`positionsChange`,`executionFill`,`dataUpdate`,`indicatorUpdate`])this.chart.on(e,()=>this.refreshAccountSoon())}if(a.trading!==!1&&(this.bracketBar=new _r(this.root,{onConfirm:()=>this.chart.confirmBracket(),onCancel:()=>{this.chart.cancelBracket(),this.bracketBar?.hide()}},this.t),this.chart.on(`bracketPlace`,e=>{let n=e.payload;this.bracketBar?.hide(),this.toast(t.r(this.t(n.side===`buy`?`bracket.longPlaced`:`bracket.shortPlaced`),{rr:n.riskReward.toFixed(2)}))}),a.depthLadder&&(this.depthLadder=new br(this.root,{onTrade:(e,n)=>{this.chart.placeOrderIntent({side:e,type:`limit`,price:n}),this.toast(t.r(this.t(e===`buy`?`order.buyLimit`:`order.sellLimit`),{price:this.formatAlertPrice(n)}))},formatPrice:e=>this.formatAlertPrice(e)},void 0,this.t)),this.chart.on(`dataUpdate`,e=>{let t=e.payload;t&&t.bracket===`cancelled`&&this.bracketBar?.hide()})),a.alerts!==!1&&(this.alertsPanel=new ft(this.root,{onAdd:({price:e,condition:t,message:n,channel:r,label:i,options:a})=>{try{return this.chart.addAlert(e,t,n,r,i,a),!0}catch{return this.toast(this.t(`alerts.invalid`),`error`),!1}},formatTime:e=>{let{date:t,time:n}=q(e,this.displayTimezone());return`${t} ${n}`},onRemove:e=>this.chart.removeAlert(e),onClear:()=>this.chart.clearAlerts(),getChannelValue:e=>this.getAlertChannelValue(e),formatPrice:e=>this.formatAlertPrice(e)},this.t),this.chart.on(`alertAdd`,()=>this.refreshAlerts()),this.chart.on(`alertRemove`,()=>this.refreshAlerts()),this.chart.on(`alertUpdate`,()=>this.refreshAlerts()),this.chart.on(`alertExpired`,e=>{let n=e.payload;this.toast(t.r(this.t(`alerts.expiredToast`),{text:n.message??this.alertText(n)})),this.refreshAlerts()}),a.alertNotifications&&(this.alertNotifier=new vr(a.alertNotifications)),this.chart.on(`alertTriggered`,e=>{let n=e.payload,r=`${this.alertText(n)}${n.message?` — ${n.message}`:``}`;this.toast(`🔔 ${t.r(this.t(`alerts.fired`),{text:r})}`,`info`),this.alertNotifier?.notify(r),this.refreshAlerts()})),a.objectTree!==!1){this.indicatorSettings=new Pt(this.root,{onApply:(e,t)=>{this.chart.updateIndicator(e,t),this.syncIndicatorsFromChart()},onStyle:(e,t)=>this.chart.updateIndicatorStyle(e,t),onLevels:(e,t)=>this.chart.setIndicatorLevels(e,t),onScale:(e,t)=>this.chart.setIndicatorScale(e,t),onClose:()=>{}},this.t),this.objectTree=new Et(this.root,{onRemoveIndicator:e=>this.handleRemoveIndicator(e),onConfigureIndicator:e=>this.openIndicatorSettings(e),onToggleIndicatorVisible:(e,t)=>{this.chart.setIndicatorVisible(e,t),this.refreshObjects(),this.scheduleLegend()},onRemoveDrawing:e=>{this.drawingSettings?.editing()===e&&this.drawingSettings.close(!0),this.chart.removeDrawing(e),this.refreshObjects()},onConfigureDrawing:this.drawingSettings?e=>this.openDrawingSettings(e):void 0,onToggleDrawingVisible:(e,t)=>{this.chart.setDrawingVisible(e,t),this.refreshObjects()},onToggleDrawingLocked:(e,t)=>{this.chart.setDrawingLocked(e,t),this.refreshObjects()},onToggleGroupVisible:(e,t)=>{this.chart.setDrawingGroupVisible(e,t),this.refreshObjects()},onToggleGroupLocked:(e,t)=>{this.chart.setDrawingGroupLocked(e,t),this.refreshObjects()},onUngroup:e=>{this.chart.ungroupDrawings(e),this.refreshObjects()},onRenameGroup:(e,t)=>{this.chart.renameDrawingGroup(e,t),this.refreshObjects()},onAddCompare:p.compareSymbols===!1?void 0:()=>this.handleAddCompare(),onRemoveCompare:e=>this.handleRemoveCompare(e)},this.t);let e=()=>{this.objectTree?.isOpen()&&this.refreshObjects()},t=0;this.chart.on(`drawingCreate`,e),this.chart.on(`drawingRemove`,e),this.chart.on(`drawingUpdate`,()=>{t||!this.objectTree?.isOpen()||(t=requestAnimationFrame(()=>{t=0,this.destroyed||e()}))}),this.chart.on(`indicatorAdd`,e),this.chart.on(`indicatorRemove`,e),this.chart.on(`indicatorChange`,e)}if(this.commandPalette=new De({onIndicator:e=>this.handleAddIndicator(e),onChartType:e=>this.handleChartType(e),onDrawingTool:e=>this.handleDrawingTool(e),onTimeframe:e=>this.handleTimeframe(e),onAction:e=>this.handleAction(e),onClose:()=>{}},this.overlayHost,this.t),this.boundGlobalKeydown=e=>{if(this.replayBar?.isMounted()&&this.handleReplayKey(e))return;let t=G(this.root);if((e.ctrlKey||e.metaKey)&&e.key===`k`){if(!t)return;e.preventDefault(),this.toggleCommandPalette()}else if((e.ctrlKey||e.metaKey)&&(e.key===`p`||e.key===`P`)){if(!t)return;e.preventDefault(),this.symbolSearch?.open(this.symbols,this.state.symbol,void 0,this.symbolSearchFn())}else if((e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&(e.key===`s`||e.key===`S`)){if(!this.layoutSession||K()||!G(this.root,!0))return;e.preventDefault(),this.saveLayout()}else if(e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&Zr[e.code]){if(e.defaultPrevented||K()||!t||Xr()||this.options.drawingTools===!1)return;e.preventDefault(),this.handleDrawingTool(Zr[e.code])}else if(/^[0-9]$/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(e.defaultPrevented||!this.intervalInput||K()||Xr()||!G(this.root,!0))return;let t=document.activeElement;if(t&&t!==document.body&&!this.root.contains(t))return;e.preventDefault(),this.intervalInput.open(e.key)}else if(e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.code===`KeyI`||e.code===`KeyG`)){if(K()||!t)return;e.code===`KeyI`?(e.preventDefault(),this.changeSettings({invertScale:!this.settingsState.invertScale})):this.goToDate&&(e.preventDefault(),this.toggleGoToDate())}else if(e.key===`?`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(K()||!t)return;e.preventDefault(),this.hotkeySheet?.open()}},document.addEventListener(`keydown`,this.boundGlobalKeydown),document.addEventListener(`fullscreenchange`,this.onFullscreenChange),this.unregisterKeys=Kn(this.root),a.adapter&&(this.adapter=a.adapter,this.connectStream()),this.watchlist&&(this.watchlistInterval=setInterval(()=>this.tickWatchlist(),1e3)),this.refreshMarket(),this.updateUI(),a.onReady?.(this.chart),a.shareUrl&&typeof location<`u`){let e=Nr(location.hash);e&&this.importState(e)}}setSymbols(e){this.symbols=e;let t=this.watchlistStore;t&&this.watchlistFromSymbols&&t.replace(t.getLists().map(t=>t.id===`default`?{...t,symbols:e}:t))}getWatchlists(){return this.watchlistStore?.getLists()??[]}getActiveWatchlist(){return this.watchlistStore?.getActive().id??null}setWatchlists(e,t){this.watchlistFromSymbols=!1,this.watchlistStore?.replace(e,t)}setActiveWatchlist(e){this.watchlistStore?.setActive(e)}addToWatchlist(e,t){this.watchlistStore?.add(e,t)}removeFromWatchlist(e,t){this.watchlistStore?.removeSymbol(e,t)}setQuotes(e){let t=e.map(n.readQuote).filter(e=>e!==null);t.length>0&&this.takeQuotes(t)}getQuote(e){let t=this.quotes.get(e);return t?{...t}:null}toggleSymbolInfo(e){let t=this.symbolInfoPanel;t&&(e===void 0?t.toggle():e?t.open():t.close())}refreshMarket(){let e=(0,n.marketStatus)(this.chart.getSymbolInfo(),Date.now());this.statusBar?.setMarket(e.state,this.t(e.state===`open`?`symbolInfo.open`:`symbolInfo.closed`)),this.refreshSymbolInfo()}refreshSymbolInfo(){let e=this.symbolInfoPanel;!e?.isOpen()||this.destroyed||e.render(this.symbolInfoView())}symbolInfoView(){let e=this.chart.getSymbolInfo(),r=this.state.symbol,i=this.quotes.get(r),a=ai(this.chart.getData(),e?.timezone),o=e=>this.formatAlertPrice(e),s=this.textLocale(),c=i?.last??a?.close,l=i?.prevClose??a?.prevClose,u=i?.change??(c!==void 0&&l!==void 0?c-l:void 0),d=c!==void 0&&u!==void 0?c-u:void 0,ee=i?.changePercent??(u!==void 0&&d?u/d*100:void 0),f=(0,n.marketStatus)(e,Date.now()),te=this.t(f.state===`open`?`symbolInfo.open`:f.state===`closed`?`symbolInfo.closed`:`symbolInfo.always`);if(f.state!==`always`&&f.next!==null){let e=oi(f.next-Date.now(),s);te+=` · ${t.r(this.t(f.state===`open`?`symbolInfo.closesIn`:`symbolInfo.opensIn`),{when:e})}`}let ne=[],p=(e,t)=>{t&&ne.push({label:e,value:t})},m=e=>e===void 0?void 0:o(e);p(this.t(`dataWindow.open`),m(i?.open??a?.open)),p(this.t(`dataWindow.high`),m(i?.high??a?.high)),p(this.t(`dataWindow.low`),m(i?.low??a?.low)),p(this.t(`symbolInfo.prevClose`),m(l));let h=i?.volume??a?.volume;p(this.t(`dataWindow.volume`),h===void 0?void 0:si(h,this.intlLocale())),p(this.t(`symbolInfo.bid`),m(i?.bid)),p(this.t(`symbolInfo.ask`),m(i?.ask)),p(this.t(`symbolInfo.tick`),e?.minTick===void 0?void 0:String(e.minTick)),p(this.t(`symbolInfo.currency`),e?.currency),p(this.t(`symbolInfo.timezone`),e?.timezone),p(this.t(`symbolInfo.hours`),ci(e,s));let g=(u??0)>=0?`+`:`-`;return{symbol:r,description:e?.description,meta:[e?.exchange,e?.type].filter(Boolean).join(` · `)||void 0,price:c===void 0?void 0:o(c),change:u===void 0?void 0:{text:`${g}${o(Math.abs(u))}${ee===void 0?``:` (${g}${Math.abs(ee).toFixed(2)}%)`}`,up:u>=0},status:{state:f.state,text:te},stats:ne}}loadNews(){let e=this.symbolInfoPanel;if(!e?.isOpen())return;let t=this.options.adapter,r=this.options.news??(t?.fetchNews?t.fetchNews.bind(t):null);if(!r){e.renderNews({kind:`none`});return}let i=this.state.symbol,a=++this.newsRequest,o=t=>{let n=this.textLocale();e.renderNews({kind:`items`,items:t.map(e=>({title:e.title,url:e.url,meta:[e.source,oi(e.time-Date.now(),n)].filter(Boolean).join(` · `)}))})},s=this.newsCache.get(i);if(s&&Date.now()-s.at<ri){o(s.items);return}e.renderNews({kind:`loading`}),Promise.resolve().then(()=>r(i,ni)).then(e=>{if(a!==this.newsRequest||this.destroyed)return;let t=(0,n.readNews)(e,ni);this.newsCache.set(i,{at:Date.now(),items:t}),o(t)}).catch(()=>{a===this.newsRequest&&!this.destroyed&&e.renderNews({kind:`failed`})})}intlLocale(){return this.settingsState.numberLocale||this.options.locale||`en`}textLocale(){return this.options.locale||`en`}createWatchlist(e,t){let n=t.persist?ti():null,r=new et({lists:t.lists,activeList:t.activeList,symbols:this.symbols,defaultName:this.t(`watchlist.title`),storage:n,storageKey:t.storageKey});this.watchlistStore=r,this.watchlistFromSymbols=!t.lists&&!t.persist,this.quoteSource=t.quotes===!1?null:t.quotes??(this.options.adapter?.subscribeQuotes?this.options.adapter:null);let i=e=>this.t(e);this.watchlist=new Ue(e,{onSelect:e=>{this.setSymbol(e)},onAdd:()=>this.symbolSearch?.open(this.symbols,this.state.symbol,e=>r.add(e),this.symbolSearchFn()),onRemove:e=>r.removeSymbol(e),onMove:(e,t)=>r.move(e,t),onPickList:e=>r.setActive(e),onCreateList:e=>r.create(e),onRenameList:(e,t)=>r.rename(e,t),onDeleteList:e=>r.remove(e)},{title:i(`watchlist.title`),lists:i(`watchlist.lists`),newList:i(`watchlist.newList`),rename:i(`watchlist.rename`),deleteList:i(`watchlist.deleteList`),confirmDelete:i(`watchlist.confirmDelete`),add:i(`watchlist.add`),remove:i(`watchlist.remove`),empty:i(`watchlist.empty`),listName:i(`watchlist.listName`)}),this.watchlist.setActive(this.state.symbol),this.watchlist.setLocale(this.settingsState.numberLocale||void 0);let a=()=>{this.watchlist?.setLists(r.getLists(),r.getActive().id),this.followQuotes()};r.subscribe(()=>{a(),t.onChange?.(r.getLists(),r.getActive().id)}),a()}followQuotes(){if(!this.quoteSource||!this.watchlistStore||this.destroyed)return;let e=this.watchlistStore.getActive().symbols,t=[...e].sort().join(`\0`);if(t!==this.quotedKey&&(this.quotedKey=t,this.stopQuotes?.(),this.stopQuotes=null,e.length!==0))try{this.stopQuotes=this.quoteSource.subscribeQuotes(e,e=>{if(this.destroyed||!Array.isArray(e))return;let t=e.map(n.readQuote).filter(e=>e!==null);t.length>0&&this.takeQuotes(t)})}catch{this.stopQuotes=null}}takeQuotes(e){for(let t of e){let e={...this.quotes.get(t.symbol),...t};this.quotes.set(e.symbol,e);let n=this.watchlistSparkBuffer.get(e.symbol)??[];n.push(e.last),n.length>40&&n.shift(),this.watchlistSparkBuffer.set(e.symbol,n);let r=this.hostWatchlistRefPrice.get(e.symbol);this.watchlist?.setEntry(e.symbol,{lastPrice:e.last,refPrice:r??(e.change===void 0?void 0:e.last-e.change),sparkline:n.slice()})}e.some(e=>e.symbol===this.state.symbol)&&this.refreshSymbolInfo()}async setSymbol(e){this.flushActiveLayout(),e!==this.state.symbol&&this.chart.clearFills(),this.state={...this.state,symbol:e},this.sessionRefPrice=null,this.options.onSymbolChange?.(e),this.updateUI(),this.watchlist?.setActive(e),this.refreshMarket(),this.loadNews(),this.layoutSession?.changed(),this.adapter&&await this.connectStream()}setWatchlistEntry(e,t){t.refPrice!==void 0&&this.hostWatchlistRefPrice.set(e,t.refPrice),this.watchlist?.setEntry(e,t)}tickWatchlist(){if(!this.watchlist||this.quotes.has(this.state.symbol))return;let e=this.chart.getData();if(e.length===0)return;let t=e[e.length-1],n=this.hostWatchlistRefPrice.get(this.state.symbol);n===void 0&&this.sessionRefPrice===null&&(this.sessionRefPrice=e[0].open);let r=this.watchlistSparkBuffer.get(this.state.symbol)??[];r.push(t.close),r.length>40&&r.shift(),this.watchlistSparkBuffer.set(this.state.symbol,r),this.watchlist.setEntry(this.state.symbol,{lastPrice:t.close,refPrice:n??this.sessionRefPrice??e[0].open,sparkline:r.slice()})}async setTimeframe(e){if(this.chart.isTimeframeAllowed(e)){if(this.state={...this.state,timeframe:e},this.options.onTimeframeChange?.(e),this.updateUI(),this.layoutSession?.changed(),this.adapter){await this.connectStream();return}if(this.options.resampleTimeframes!==!1){if(!this.baseSeries){let e=this.chart.getData();e.length>0&&(this.baseSeries=e,this.baseTimeframeMs=a(e))}await this.switchLocalTimeframe()}}}setTheme(e){let t=this.resolveIsDark(e),n=this.resolveTheme(e);this.state={...this.state,isDark:t},this.root.dataset.tcwTheme=t?`dark`:`light`,this.portal.dataset.tcwTheme=this.root.dataset.tcwTheme,this.chart.setTheme(n),this.updateUI()}getChart(){return this.chart}setUI(e){this.ui=N(e),P(this.root,this.ui),P(this.portal,this.ui),this.applyChartShapes()}getUI(){return N({...this.ui})}applyChartShapes(){this.chart.setShapes({tagRadius:this.ui.tagRadius})}destroy(){this.destroyed||(this.destroyed=!0,this.boundGlobalKeydown&&document.removeEventListener(`keydown`,this.boundGlobalKeydown),document.removeEventListener(`fullscreenchange`,this.onFullscreenChange),this.unregisterKeys(),this.tooltip.destroy(),this.legendFrame&&cancelAnimationFrame(this.legendFrame),this.indicatorLegend?.destroy(),this.portal.remove(),document.fullscreenElement===this.root&&document.exitFullscreen().catch(()=>{}),this.flushActiveLayout(),this.commandPalette?.destroy(),this.symbolSearch?.destroy(),this.hotkeySheet?.destroy(),this.replayPollInterval&&clearInterval(this.replayPollInterval),this.replayShade?.remove(),this.replayBar?.destroy(),this.dragDrop?.detach(),this.alertsPanel?.destroy(),this.objectTree?.destroy(),this.indicatorSettings?.destroy(),this.drawingStyle?.destroy(),this.drawingSettings?.destroy(),this.drawingMenu?.destroy(),this.chartMenu?.destroy(),this.legendMenu?.destroy(),this.templatePrompt?.destroy(),this.intervalInput?.destroy(),this.markerTip?.remove(),this.layoutSession?.destroy(),this.layoutsUI?.destroy(),this.accountPanel?.destroy(),this.orderTicket?.destroy(),this.accountFrame&&cancelAnimationFrame(this.accountFrame),this.bracketBar?.destroy(),this.alertNotifier?.destroy(),this.depthLadder?.destroy(),this.dataWindow?.destroy(),this.watchlistInterval&&clearInterval(this.watchlistInterval),this.marketTimer&&clearInterval(this.marketTimer),this.chartNav?.destroy(),this.symbolInfoPanel?.destroy(),this.stopQuotes?.(),this.stopQuotes=null,this.watchlist?.destroy(),this.toolbar?.destroy(),this.sidebar?.destroy(),this.settings?.destroy(),this.statusBar?.destroy(),this.goToDate?.destroy(),this.loading.destroy(),this.historyPill.destroy(),this.chart.destroy(),this.root.remove(),_())}handleSymbolClick(){this.symbolSearch?.open(this.symbols,this.state.symbol,void 0,this.symbolSearchFn())}symbolSearchFn(){if(this.options.searchSymbols)return this.options.searchSymbols;let e=this.adapter;if(e?.searchSymbols)return(t,n)=>e.searchSymbols(t,{signal:n,limit:50})}handleTimeframe(e){this.setTimeframe(e)}toggleFullscreen(){if(document.fullscreenElement===this.root){document.exitFullscreen().catch(()=>{});return}this.root.requestFullscreen().catch(e=>{this.toast(e instanceof Error?e.message:this.t(`toast.fullscreenUnavailable`),`error`)})}drawingToolName(e){let t=`tool.${e}`,n=this.t(t);return n===t?this.chart.getDrawingToolDescriptor(e)?.name??e:n}openDrawingSettings(e){let t=this.chart.getDrawings().find(t=>t.id===e),n=t?this.chart.getDrawingToolDescriptor(t.type):null;!t||!n||!this.drawingSettings||this.drawingSettings.open({id:e,type:t.type,name:this.drawingToolName(t.type),style:{...t.style},options:this.chart.getDrawingOptions(e),defs:n.options??{},anchors:t.anchors.map(e=>({...e})),fill:n.fill===!0,text:n.text===!0,alertable:this.chart.canAddDrawingAlert(e)})}addDrawingAlert(e){let n=this.chart.getDrawings().find(t=>t.id===e),r=n?this.drawingToolName(n.type):``;this.chart.addDrawingAlert(e,{label:r})&&this.toast(t.r(this.t(`drawingSettings.alertAdded`),{name:r}))}openDrawingMenu(e,t,n){if(!this.drawingMenu)return;let r=new Map(this.chart.getDrawings().map(e=>[e.id,e])),i=this.chart.getSelectedDrawingIds().flatMap(e=>{let t=r.get(e);return t?[{id:t.id,locked:t.locked,groupId:t.group?.id??null}]:[]});if(i.length===0)return;let a=sn({selected:i,canConfigure:this.drawingSettings!==null,canAlert:this.chart.canAddDrawingAlert(e)},this.t),o=this.chartContainer.getBoundingClientRect(),s=this.root.getBoundingClientRect(),c=i.map(e=>e.id);this.drawingMenu.open(a,o.left-s.left+t,o.top-s.top+n,t=>this.runDrawingMenuAction(e,c,t))}runDrawingMenuAction(e,t,n){switch(n){case`settings`:this.openDrawingSettings(e);return;case`alert`:this.addDrawingAlert(e);return;case`front`:case`forward`:case`backward`:case`back`:this.chart.moveDrawing(e,n);break;case`group`:this.chart.groupDrawings(t);break;case`ungroup`:{let e=new Set(this.chart.getDrawings().filter(e=>t.includes(e.id)).map(e=>e.group?.id));for(let t of e)t&&this.chart.ungroupDrawings(t);break}case`lock`:case`unlock`:this.chart.setDrawingsLocked(t,n===`lock`);break;case`hide`:this.chart.setDrawingsVisible(t,!1);break;case`duplicate`:this.chart.duplicateDrawing(e);break;case`delete`:{let e=this.drawingSettings?.editing();e&&t.includes(e)&&this.drawingSettings?.close(!0),this.chart.removeDrawings(t);break}}this.objectTree?.isOpen()&&this.refreshObjects()}chartMenuContext(e){let t=this.chart.getDrawings(),n=this.chart.getData();return{price:e,lastPrice:n.length>0?n[n.length-1].close:null,formatPrice:e=>this.formatAlertPrice(e),canAlert:this.alertsPanel!==null,canTrade:this.options.trading!==!1,canOrderTicket:this.orderTicket!==null,canDraw:this.options.drawingTools!==!1,hasDrawings:t.length>0,drawingsHidden:t.length>0&&t.every(e=>!e.visible),canGoToDate:this.goToDate!==null,canExport:this.canExport,autoScale:this.chart.isAutoScale(),scaleMode:this.settingsState.scaleMode,inverted:this.chart.isInvertScale()}}openChartMenu(e,t,n,r){if(!this.chartMenu)return;let i=this.options.chartMenuItems?.(r)??[],a=[...e,...e.length>0&&i.length>0?[`separator`]:[],...i.map((e,t)=>({id:`host:${t}`,label:e.label,icon:e.icon,danger:e.danger,checked:e.checked}))];if(a.length===0)return;let o=this.chartContainer.getBoundingClientRect(),s=this.root.getBoundingClientRect();this.chartMenu.open(a,o.left-s.left+t,o.top-s.top+n,e=>{e.startsWith(`host:`)?i[Number(e.slice(5))]?.onSelect():this.runChartMenuAction(e,r.price)})}addToolbarButton(e){if(!this.toolbar)return null;let t=this.toolbar.addHostButton(e),n=()=>{let e=t.querySelector(`.tcw-host-btn-text`);if(e)return e;let n=document.createElement(`span`);return n.className=`tcw-host-btn-text`,t.appendChild(n),n};return{element:t,setActive:n=>{t.classList.toggle(`tcw-active`,n),e.toggle&&t.setAttribute(`aria-pressed`,String(n))},setText:r=>{n().textContent=r,_e(t,e.label)},remove:()=>t.remove()}}runChartMenuAction(e,n){let r=n??NaN;switch(e){case`alert`:this.chart.addAlert(r,`crossing`),this.toast(t.r(this.t(`chartMenu.alertAdded`),{price:this.formatAlertPrice(r)}));break;case`buyLimit`:case`sellLimit`:case`buyStop`:case`sellStop`:this.placeOrderAt(e,r);break;case`orderTicket`:this.openOrderTicket(n);break;case`exportData`:this.chart.exportAllData(`csv`,`${this.state.symbol}-${this.state.timeframe}.csv`.replace(/[^\w.-]+/g,`_`));break;case`paneLog`:case`paneInvert`:case`panePercent`:{let t=this.menuPane;if(!t)break;let n=this.chart.getPaneScale(t);this.chart.setPaneScale(t,e===`paneLog`?{log:!n.log}:e===`paneInvert`?{invert:!n.invert}:{percent:!n.percent});break}case`horizontalLine`:{let e=this.chart.getData();e.length>0&&this.chart.addDrawing({type:`horizontalLine`,anchors:[{time:e[e.length-1].time,price:r}]});break}case`resetView`:this.chart.fitContent(),this.changeSettings({autoScale:!0});break;case`hideDrawings`:this.chart.setDrawingsVisible(this.chart.getDrawings().map(e=>e.id),!1);break;case`showDrawings`:this.chart.setDrawingsVisible(this.chart.getDrawings().map(e=>e.id),!0);break;case`removeDrawings`:this.chart.removeDrawings(this.chart.getDrawings().map(e=>e.id));break;case`settings`:this.openSettings();break;case`autoScale`:this.changeSettings({autoScale:!this.chart.isAutoScale()});break;case`logScale`:this.changeSettings({scaleMode:this.settingsState.scaleMode===`logarithmic`?`regular`:`logarithmic`});break;case`percentScale`:this.changeSettings({scaleMode:this.settingsState.scaleMode===`percentage`?`regular`:`percentage`});break;case`invertScale`:this.changeSettings({invertScale:!this.chart.isInvertScale()});break;case`goToDate`:this.toggleGoToDate();break}this.objectTree?.isOpen()&&this.refreshObjects()}toggleAccountPanel(e){let t=this.accountPanel;!t||e===t.isOpen()||t.toggle()}openOrderTicket(e){let t=this.chart.getData();this.orderTicket?.open({price:e,lastPrice:t.length>0?t[t.length-1].close:null})}refreshAccountSoon(){this.accountFrame||!this.accountPanel||(this.accountFrame=requestAnimationFrame(()=>{this.accountFrame=0,this.destroyed||this.refreshAccount()}))}refreshAccount(){if(!this.accountPanel)return;let e=this.chart.getData(),t=e.length>0?e[e.length-1].close:null;this.accountPanel.update({positions:this.chart.getPositions(),orders:this.chart.getOrders(),fills:this.chart.getFills(),price:t,realisedPnl:this.chart.getRealisedPnl()}),this.orderTicket?.setLastPrice(t)}placeOrderAt(e,n){let r=e.startsWith(`buy`)?`buy`:`sell`,i=e.endsWith(`Stop`);this.chart.placeOrderIntent(i?{side:r,type:`stop`,price:n,stopPrice:n,quantity:1}:{side:r,type:`limit`,price:n,quantity:1}),this.toast(t.r(this.t(`order.${e}`),{price:this.formatAlertPrice(n)}))}displayTimezone(){let e=s(this.settingsState.timezone);return e===`exchange`?this.chart.getEffectiveTimezone():e}toggleGoToDate(){if(!this.goToDate)return;if(this.goToDate.isOpen()){this.goToDate.close();return}let e=this.chart.getData();e.length!==0&&this.goToDate.open(q(e[e.length-1].time*Qr(e),this.displayTimezone()),this.root.querySelector(`[data-role="goto"]`))}goToWallTime(e,t){let n=nr(e,t,this.displayTimezone()),r=this.chart.getData();if(n===null||r.length===0)return;let i=n/Qr(r);this.chart.goToTime(i),i<r[0].time&&this.toast(this.t(`range.beforeData`))}pinnedTimeframes(){let e=this.timeframeFavorites.list();return this.timeframes.filter(t=>e.includes(t))}timeframeMenu(){return this.timeframes.map(e=>({value:e,label:Nn(e),custom:this.customTimeframes.has(e)}))}handleAddTimeframe(e){let t=Vn(e);return!t||!this.chart.isTimeframeAllowed(t)||this.adapter&&!(0,r.servesTimeframe)(this.adapter,t)||!this.adapter&&(0,n.tickBarCount)(t)!==null?!1:(this.timeframes.includes(t)||(this.customTimeframes.add(t),this.timeframeFavorites.add(t),this.timeframes=Hn(this.timeframes,[t]),this.toolbar?.setTimeframes(this.timeframeMenu(),this.pinnedTimeframes())),this.handleTimeframe(t),!0)}showMarkerTip(e){let{marker:n}=e;if(!n){this.markerTip&&(this.markerTip.hidden=!0);return}this.markerTip||(this.markerTip=document.createElement(`div`),this.markerTip.className=`tcw-marker-tip`,this.markerTip.setAttribute(`role`,`tooltip`),this.chartContainer.appendChild(this.markerTip));let r=n.direction===`long`?this.t(`account.long`):n.direction===`short`?this.t(`account.short`):this.t(`markers.neutral`),i=document.createElement(`strong`);i.textContent=n.label?`${n.label} · ${n.source}`:n.source;let a=document.createElement(`div`);a.textContent=`${r} · ${this.formatAlertPrice(n.price)} · ${t.r(this.t(`markers.confidence`),{pct:Math.round(n.confidence*100)})}`;let o=document.createElement(`div`),{date:s,time:c}=q(n.time,this.displayTimezone());o.textContent=`${s} ${c}`,this.markerTip.replaceChildren(i,a,o),this.markerTip.hidden=!1;let l=this.chartContainer.getBoundingClientRect(),u=Math.min(e.x+12,Math.max(0,l.width-this.markerTip.offsetWidth-4)),d=Math.max(0,e.y-this.markerTip.offsetHeight-10);this.markerTip.style.left=`${u}px`,this.markerTip.style.top=`${d}px`}selectTypedTimeframe(e){return!this.chart.isTimeframeAllowed(e)||this.adapter&&!(0,r.servesTimeframe)(this.adapter,e)?!1:(this.timeframes.includes(e)||(this.customTimeframes.add(e),this.timeframes=Hn(this.timeframes,[e]),this.toolbar?.setTimeframes(this.timeframeMenu(),this.pinnedTimeframes())),this.handleTimeframe(e),!0)}applyIndicatorTemplate(e){let n=this.templates.get(e);n&&(this.chart.applyIndicatorSetup(n.indicators),this.syncIndicatorsFromChart(),this.updateUI(),this.toast(t.r(this.t(`templates.applied`),{name:n.name})))}promptSaveIndicatorTemplate(){if(this.chart.getActiveIndicators().length===0){this.toast(this.t(`templates.nothing`),`error`);return}this.templatePrompt??=new Tn(this.root,this.t),this.templatePrompt.open({title:this.t(`templates.saveTitle`),submitLabel:this.t(`common.save`),placeholder:this.t(`templates.namePlaceholder`),onSubmit:e=>{try{this.templates.save(e,this.chart.getIndicatorSetup())}catch(e){throw this.toast(this.t(`templates.saveFailed`),`error`),e}this.toolbar?.setIndicatorTemplates(this.templates.list().map(e=>e.name)),this.toast(t.r(this.t(`templates.saved`),{name:e}))}})}handleRemoveTimeframe(e){this.customTimeframes.has(e)&&(this.customTimeframes.remove(e),this.timeframeFavorites.remove(e),this.timeframes=this.timeframes.filter(t=>t!==e),this.toolbar?.setTimeframes(this.timeframeMenu(),this.pinnedTimeframes()),this.updateUI())}handleToggleTimeframeFavorite(e){this.timeframeFavorites.toggle(e),this.toolbar?.setTimeframeFavorites(this.pinnedTimeframes()),this.updateUI()}setData(e){this.localSeq++,this.baseSeries=e,this.baseTimeframeMs=a(e),this.applyTimeframeData(),this.adapter||this.loading.end()}async switchLocalTimeframe(){if(!this.baseSeries)return;let e=++this.localSeq,t=this.lastLocalSwitchMs>=zr||this.baseSeries.length>=Br;try{if(t&&(this.loading.begin(this.chart.getData().length>0,!0),await Hr(),e!==this.localSeq||this.destroyed))return;this.applyTimeframeData()}finally{e===this.localSeq&&this.loading.end()}}applyTimeframeData(){if(!this.baseSeries)return;let e=performance.now(),t=(0,n.timeframeToMs)(this.state.timeframe);if(this.baseTimeframeMs>0&&t>this.baseTimeframeMs){let e=this.options.weekStartsOn??1;this.chart.setData(i(this.baseSeries,this.state.timeframe,{weekStartsOn:e}))}else this.chart.setData(this.baseSeries);this.lastLocalSwitchMs=performance.now()-e}handleDataUpdate(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.length==`number`){t.length>0&&this.loading.isActive()&&(this.loading.end(),this.state.connectionState===`error`&&this.setConnectionState(`connected`,this.t(`status.live`)));return}if(t.error!==void 0){this.loading.isActive()&&(this.loading.fail(this.t(`status.connectionFailed`)),this.setConnectionState(`error`,t.error||this.t(`status.connectionFailed`)));return}switch(t.connection?.state){case`connected`:this.loading.hasFailed()&&this.loading.end(),!this.loading.isActive()&&this.state.connectionState!==`connected`&&this.setConnectionState(`connected`,this.t(`status.live`));break;case`reconnecting`:this.loading.isActive()||this.setConnectionState(`connecting`,this.t(`status.connecting`));break;case`error`:this.loading.isActive()||this.setConnectionState(`error`,this.t(`status.connectionFailed`));break}}setConnectionState(e,t){this.state={...this.state,connectionState:e,connectionMessage:t},this.updateUI()}toggleAlerts(){this.alertsPanel&&(this.alertsPanel.toggle(),this.alertsPanel.isOpen()&&this.refreshAlerts())}handleToggleFavorite(e){let t=this.favoritesStore.toggle(e);this.sidebar?.setFavorites(this.favoritesStore.list()),this.toast(t?this.t(`toast.pinned`):this.t(`toast.unpinned`))}exportState(){let e=this.chart.getActiveIndicators().map(e=>({id:e.id,params:e.params}));return Ar({v:1,symbol:this.state.symbol,timeframe:this.state.timeframe,chartType:this.state.chartType,scaleMode:this.chart.getScaleMode(),indicators:e,drawings:this.chart.getDrawings()})}async importState(e){let t=jr(e);return t?(t.symbol&&t.symbol!==this.state.symbol&&await this.setSymbol(t.symbol),t.timeframe&&t.timeframe!==this.state.timeframe&&await this.setTimeframe(t.timeframe),t.chartType&&this.applyChartType(t.chartType),this.chart.setScaleMode(t.scaleMode),this.chart.applyIndicatorSetup(t.indicators.map((e,t)=>({id:e.id,instanceId:`shared_${t}`,params:e.params}))),this.chart.setDrawings(t.drawings),this.updateUI(),!0):!1}async copyChartImage(){let e=await this.chart.copyScreenshot();this.toast(e?this.t(`toast.imageCopied`):this.t(`toast.imageCopyFailed`),e?`info`:`error`)}async copyShareLink(){let e=Pr(typeof location<`u`?location.href:``,this.exportState());try{await navigator.clipboard.writeText(e),this.toast(this.t(`toast.linkCopied`))}catch{this.toast(this.t(`toast.copyFailed`),`error`)}}setDepth(e){this.chart.setDepthData(e),this.depthLadder?.setData(e),e&&this.chart.pushDepthSnapshot(e)}startBracket(e){this.chart.startBracket(e)&&this.bracketBar?.show(e)}buildDataWindowModel(){let e=this.chart.getData(),t=this.lastHoverIndex;if(t===null||t<0||t>=e.length)return{ohlc:null,change:0,changePct:0,indicators:[]};let n=e[t],r=t>0?e[t-1].close:n.open,i=n.close-r,a=r===0?0:i/r*100,o=this.chart.getActiveIndicators().map(e=>{let n=this.chart.getIndicatorOutput(e.instanceId)?.series?.[t]??null,r=e.descriptor.plots?.map(e=>[e.key,e.title])??Object.keys(n??{}).map(e=>[e,e]),i=n?r.filter(([e])=>typeof n[e]==`number`&&Number.isFinite(n[e])).map(([e,t])=>({key:t,value:n[e]})):[];return{name:e.descriptor.name,values:i}}).filter(e=>e.values.length>0);return{ohlc:{open:n.open,high:n.high,low:n.low,close:n.close,volume:n.volume},change:i,changePct:a,indicators:o}}toggleDataWindow(){this.dataWindow&&(this.dataWindow.toggle(),this.dataWindow.isOpen()&&this.dataWindow.render(this.buildDataWindowModel()))}toggleObjects(){this.objectTree&&(this.objectTree.toggle(),this.objectTree.isOpen()&&this.refreshObjects())}openIndicatorSettings(e){if(!this.indicatorSettings)return;let t=this.chart.getActiveIndicators(),n=t.find(t=>t.instanceId===e);if(!n)return;let r=this.chart.getIndicatorStyle(e),i=n.descriptor.placement===`panel`||!!n.pane;this.indicatorSettings.open({instanceId:e,name:n.descriptor.name,defaults:n.descriptor.defaultConfig,params:n.params,inputs:n.descriptor.inputs,lineSources:ei(e,t),plots:n.descriptor.plots,colors:r?.colors,lineWidth:r?.lineWidths[0],levels:i?this.chart.getIndicatorLevels(e):void 0,defaultLevels:n.descriptor.levels,scale:i?void 0:this.chart.getIndicatorScale(e)})}refreshObjects(){if(!this.objectTree)return;let e=this.chart.getActiveIndicators().map(e=>({instanceId:e.instanceId,name:e.descriptor.name,visible:e.visible})),t=this.chart.getDrawings().map(e=>({id:e.id,label:Ot(e.type,this.t),visible:e.visible,locked:e.locked,group:e.group})),n=this.compares.map(e=>({id:e.id,label:e.symbol,color:e.color}));this.objectTree.setObjects(e,t,n)}async handleAddCompare(){if(!this.adapter){this.toast(this.t(`toast.compareNeedsAdapter`),`error`);return}let e=new Set([this.state.symbol,...this.compares.map(e=>e.symbol)]),t=this.symbols.filter(t=>!e.has(t));this.symbolSearch?.open(t.length?t:this.symbols,this.state.symbol,e=>{this.pickCompareWay(e)},this.symbolSearchFn())}pickCompareWay(e){let n=this.state.symbol,r=[{id:`percent`,label:this.t(`compare.percent`)},{id:`scale`,label:this.t(`compare.ownScale`)},{id:`pane`,label:this.t(`compare.ownPane`)},{id:`spread`,label:t.r(this.t(`compare.spread`),{main:n,other:e})},{id:`ratio`,label:t.r(this.t(`compare.ratio`),{main:n,other:e})}],i=this.chart.getPlotRect();this.chartMenu?.open(r,i.x+24,i.y+24,t=>void this.addCompareSymbol(e,t))}async addCompareSymbol(e,n=`percent`){if(!this.adapter){this.toast(this.t(`toast.compareNeedsAdapter`),`error`);return}if(n!==`percent`){let t=n===`scale`?this.chart.addIndicator(`compareSymbol`,{symbol:e},`bottom`,{scale:`left`}):n===`pane`?this.chart.addIndicator(`compareSymbol`,{symbol:e}):this.chart.addIndicator(`spread`,{symbol:e,mode:n});t&&n===`pane`&&this.chart.moveIndicatorToPane(t,`new`);return}if(this.compares.some(t=>t.symbol===e))return;let i=Ur[this.compares.length%Ur.length],a=`cmp_${e}`;try{let n=await(0,r.withResampling)(this.adapter).fetchHistory(e,this.state.timeframe,this.options.historyLimit??500);this.compares.length===0&&this.chart.setCompareMode(`percent`),this.chart.addCompareSymbol(a,e,n,i),this.compares=[...this.compares,{id:a,symbol:e,color:i}],this.refreshObjects(),this.toast(t.r(this.t(`toast.comparing`),{symbol:e}))}catch(t){this.toast(`${e}: ${t instanceof Error?t.message:this.t(`toast.loadFailed`)}`,`error`)}}handleRemoveCompare(e){this.chart.removeCompareSymbol(e),this.compares=this.compares.filter(t=>t.id!==e),this.refreshObjects()}async loadSymbolSeries(e){if(!this.adapter){this.toast(this.t(`toast.compareNeedsAdapter`),`error`);return}let t=this.state.timeframe,n=(this.symbolLoads.get(e)??0)+1;this.symbolLoads.set(e,n);let i=()=>this.destroyed||t!==this.state.timeframe||this.symbolLoads.get(e)!==n;try{let n=Math.max(this.chart.getData().length,this.options.historyLimit??500),a=await(0,r.withResampling)(this.adapter).fetchHistory(e,t,n);if(i())return;this.chart.setSymbolSeries(e,a)}catch(t){if(i())return;this.chart.setSymbolSeries(e,this.chart.getSymbolSeries(e)),this.toast(`${e}: ${t instanceof Error?t.message:this.t(`toast.loadFailed`)}`,`error`)}}async refetchCompares(){for(let e of this.chart.getRequiredSymbols?.()??[])this.loadSymbolSeries(e);if(!this.adapter||this.compares.length===0)return;let e=this.compares.filter(e=>e.symbol===this.state.symbol);for(let t of e)this.handleRemoveCompare(t.id);for(let e of this.compares)try{let t=await(0,r.withResampling)(this.adapter).fetchHistory(e.symbol,this.state.timeframe,this.options.historyLimit??500);this.chart.updateCompareData(e.id,t)}catch{}}refreshAlerts(){if(!this.alertsPanel)return;let e=this.buildAlertSources();this.alertsPanel.setSources(e),this.alertsPanel.setAlerts(this.chart.getAlerts().map(t=>this.alertListItem(t,e)))}alertListItem(e,t){return{id:e.id,price:e.price,condition:e.condition,message:e.message,triggered:e.triggered,channel:e.channel,label:e.label,drawingId:e.drawingId,target:e.target,targetLabel:e.target?t.find(t=>t.channel===e.target)?.label:void 0,percent:e.percent,bars:e.bars,onBarClose:e.onBarClose,expiresAt:e.expiresAt,expired:e.expired}}alertText(e){return at(this.alertListItem(e,this.buildAlertSources()),this.t,e=>this.formatAlertPrice(e),!0)}buildAlertSources(){let e=[{channel:`price`,label:this.t(`alerts.source.price`)}];for(let t of this.chart.getActiveIndicators()){let n=this.chart.getIndicatorOutput(t.instanceId)?.series,r=n&&n.length>0?n[n.length-1]:null,i=r?Object.keys(r).filter(e=>typeof r[e]==`number`):[];for(let n of i){let r=i.length>1?`${t.descriptor.name} ${n}`:t.descriptor.name;e.push({channel:`${t.instanceId}:${n}`,label:r})}}return e}getAlertChannelValue(e){let t=this.chart.getData();if(e===`price`)return t.length>0?t[t.length-1].close:null;let n=e.indexOf(`:`);if(n<0||t.length===0)return null;let r=e.slice(0,n),i=e.slice(n+1),a=this.chart.getIndicatorOutput(r)?.series?.[t.length-1]?.[i];return typeof a==`number`&&Number.isFinite(a)?a:null}formatAlertPrice(e){let t=this.chart.getPriceFormatter?.();if(t)return t(e);let n=Math.abs(e),r=n>=1e3?2:n>=1?4:6,i=this.settingsState.numberLocale||void 0;return e.toLocaleString(i,{minimumFractionDigits:2,maximumFractionDigits:r})}handleChartType(e){let t=this.state.chartType;e!==t&&(this.applyChartType(e),this.chart.recordUndo({subject:`chartType`,undo:()=>this.applyChartType(t),redo:()=>this.applyChartType(e)}))}applyChartType(e){this.state={...this.state,chartType:e},this.chart.setChartType(e),this.updateUI()}handleAddIndicator(e){this.chart.addIndicator(e)}handleRemoveIndicator(e){this.chart.removeIndicator(e)}toggleCommandPalette(){if(this.commandPalette?.isOpen()){this.commandPalette.close();return}this.commandPalette?.open(this.buildCommandItems())}buildCommandItems(){let e=[];for(let t of ee)e.push({id:t.id,label:t.name,category:`indicator`,active:[...this.state.activeIndicators.values()].some(e=>e.id===t.id)});for(let t of u)e.push({id:t.value,label:me(t,this.t),category:`chartType`,active:this.state.chartType===t.value});for(let t of he(d,this.t))for(let n of t.tools)e.push({id:n.value,label:n.label,category:`drawing`,active:this.state.activeTool===n.value});for(let t of this.timeframes)e.push({id:t,label:Nn(t),category:`timeframe`,active:this.state.timeframe===t});return e.push({id:`screenshot`,label:this.t(`action.screenshot`),category:`action`,shortcut:``},{id:`copyImage`,label:this.t(`action.copyImage`),category:`action`},{id:`toggleTheme`,label:this.t(`action.toggleTheme`),category:`action`},{id:`settings`,label:this.t(`action.settings`),category:`action`},{id:`shareView`,label:this.t(`action.shareView`),category:`action`},{id:`autoFib`,label:this.t(`action.autoFib`),category:`action`},{id:`dataWindow`,label:this.t(`action.dataWindow`),category:`action`},...this.symbolInfoPanel?[{id:`symbolInfo`,label:this.t(`action.symbolInfo`),category:`action`}]:[],{id:`clearDrawings`,label:this.t(`action.clearDrawings`),category:`action`}),e}handleAction(e){switch(e){case`screenshot`:this.chart.screenshot();break;case`toggleTheme`:this.handleToggleTheme();break;case`settings`:this.openSettings();break;case`copyImage`:this.copyChartImage();break;case`shareView`:this.copyShareLink();break;case`autoFib`:{let e=this.chart.autoFib();this.toast(e?this.t(`toast.autoFibAdded`):this.t(`toast.noSwing`));break}case`dataWindow`:this.toggleDataWindow();break;case`symbolInfo`:this.toggleSymbolInfo();break;case`clearDrawings`:this.chart.clearDrawings(),this.state={...this.state,activeTool:null},this.updateUI();break}}handleDrawingTool(e){this.state={...this.state,activeTool:e},this.chart.setDrawingTool(e),this.updateUI()}handleCancelDrawing(){this.state={...this.state,activeTool:null},this.chart.setDrawingTool(null),this.chart.setEraserMode(!1),this.chart.setZoomAreaMode(!1),this.updateUI()}handleToggleStayInDrawing(){let e=!this.state.stayInDrawing;this.state={...this.state,stayInDrawing:e},this.chart.setStayInDrawingMode(e),this.updateUI()}handleToggleMagnet(){let e=this.state.magnetEnabled?this.state.magnetStrong?`off`:`strong`:`weak`;this.state={...this.state,magnetEnabled:e!==`off`,magnetStrong:e===`strong`},this.chart.setDrawingMagnetMode(e),this.updateUI()}handleToggleTheme(){let e=!this.state.isDark;this.state={...this.state,isDark:e},this.root.dataset.tcwTheme=e?`dark`:`light`,this.portal.dataset.tcwTheme=this.root.dataset.tcwTheme,this.chart.setTheme(e?n.DARK_THEME:n.LIGHT_THEME),this.chart.setWatermark(this.state.symbol.replace(`USDT`,` / USDT`),{fontSize:48,color:e?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.03)`}),this.updateUI()}openSettings(){this.settingsState={...this.settingsState,chartTypeOptions:this.chart.getChartTypeOptions?.()??{}},this.settings?.open(this.settingsState,this.state.chartType)}toast(e,t=`info`){let n=document.createElement(`div`);n.className=`tcw-toast ${t===`error`?`tcw-toast-error`:``}`,n.textContent=e,this.root.appendChild(n),requestAnimationFrame(()=>n.classList.add(`tcw-toast-in`)),setTimeout(()=>{n.classList.remove(`tcw-toast-in`),n.addEventListener(`transitionend`,()=>n.remove(),{once:!0}),setTimeout(()=>n.remove(),400)},3500)}getLayoutSession(){return this.layoutSession}getSymbol(){return this.state.symbol}getTimeframe(){return this.state.timeframe}captureLayout(){let e=this.chart.saveState(),t=e?Zn(e):null,n=t&&typeof t==`object`?Yn(t):null;return{v:1,symbol:this.state.symbol,timeframe:this.state.timeframe,scaleMode:this.settingsState.scaleMode,invertScale:this.settingsState.invertScale,chart:n}}async restoreLayout(e){if(e.symbol!==this.state.symbol&&await this.setSymbol(e.symbol),e.timeframe!==this.state.timeframe&&await this.setTimeframe(e.timeframe),!this.destroyed){if(e.chart){this.chart.loadState(JSON.stringify(Yn(e.chart)));let t=e.chart.chartType;typeof t==`string`&&(this.state={...this.state,chartType:t})}this.applySettings({scaleMode:e.scaleMode,invertScale:e.invertScale}),this.syncIndicatorsFromChart(),this.updateUI()}}getLayoutContent(){return JSON.stringify(this.captureLayout())}async applyLayoutContent(e){let t=Xn(Zn(e));return t?(await this.restoreLayout(t),!0):!1}setupLayouts(t){let n=new e.t(t.storage??e.i(),{capture:()=>({content:this.getLayoutContent(),symbol:this.state.symbol,timeframe:this.state.timeframe}),apply:async e=>{if(!await this.applyLayoutContent(e.content))throw Error(`Not a widget layout`)}},{autoSave:t.autoSave,debounceMs:t.debounceMs,onChange:()=>this.toolbar?.setLayout(n.current()?.name??null,n.isDirty()),onError:()=>this.toast(this.t(`layouts.saveFailed`),`error`)});this.layoutSession=n,this.layoutsUI=new kn(n,{root:this.root,t:this.t,toast:(e,t)=>this.toast(e,t),formatTime:e=>{let{date:t,time:n}=q(e,this.displayTimezone());return`${t} ${n}`}}),this.chart.on(`stateChange`,()=>n.changed()),t.openLast&&n.list().then(([e])=>e&&!this.destroyed?this.openLayout(e.id):void 0,()=>void 0)}async saveLayout(){await this.layoutsUI?.save()}async openLayout(e){return await this.layoutsUI?.open(e)??!1}clearSavedLayout(e){if(!this.layoutKeyPrefix)return;let t=e??this.state.symbol;try{localStorage.removeItem(this.layoutKeyPrefix+t)}catch{}}applySymbolLayout(e){if(!this.layoutKeyPrefix)return;let t=this.layoutKeyPrefix+e;this.activeLayoutKey=t;try{this.chart.loadStateFromStorage(t)&&this.syncIndicatorsFromChart()}catch{}this.chart.setAutoSave(t,this.layoutDebounceMs)}flushActiveLayout(){if(this.activeLayoutKey){try{this.chart.saveState(this.activeLayoutKey)}catch{}this.chart.disableAutoSave(),this.activeLayoutKey=null}}syncIndicatorsFromChart(){let t=new Map;for(let n of this.chart.getActiveIndicators())t.set(n.instanceId,{id:n.id,label:e.C(n.id,n.params,n.descriptor.defaultConfig,n.descriptor.shortName)});this.state={...this.state,activeIndicators:t},this.updateUI()}toggleReplay(){this.replayBar?.isMounted()?this.exitReplay():this.enterReplay()}enterReplay(){if(this.replayTotal()<2)return;let e=this.t;this.replayBar=new Le({onPlay:()=>{if(this.replayBar?.getMode()===`select`){this.startReplayAt(Math.max(1,this.replayTotal()-100),!0);return}this.chart.getReplayState()===`paused`&&this.chart.replayResume(),this.replayBar?.setState(`playing`)},onPause:()=>{this.chart.replayPause(),this.replayBar?.setState(`paused`)},onStepBack:()=>this.stepReplay(-1),onStepForward:()=>this.stepReplay(1),onSeek:e=>{this.chart.getReplayState()===`playing`&&this.chart.replayPause(),this.chart.replaySeek(e),this.replayBar?.setState(`paused`)},onSpeedChange:e=>{this.replaySpeed=e,this.chart.setReplaySpeed(e)},onRandomStart:()=>{let e=this.replayTotal(),t=Math.max(1,Math.floor(e*.1)),n=Math.max(t,Math.floor(e*.9));this.startReplayAt(t+Math.floor(Math.random()*(n-t+1)))},onClose:()=>this.exitReplay(),onStepChange:e=>{if(this.replayStep=e,this.replayBar?.getMode()!==`replay`)return;let t=this.chart.getReplayState()===`playing`;this.startReplayAt(Math.max(0,this.chart.getReplayBarIndex()-1),t)}},{selectHint:e(`replay.selectHint`),random:e(`replay.random`),realtime:e(`replay.realtime`),barsPerSecond:e(`replay.barsPerSecond`),play:e(`replay.play`),pause:e(`replay.pause`),stepBack:e(`replay.stepBack`),stepForward:e(`replay.stepForward`),replay:e(`replay.label`),position:e(`replay.position`),speed:e(`replay.speed`),step:e(`replay.step`)});let t=[{value:`bar`,label:e(`replay.step.bar`)},...this.replayStepOptions().map(e=>({value:e,label:e}))];t.some(e=>e.value===this.replayStep)||(this.replayStep=`bar`),this.replayBar.mount(this.chartContainer,{total:this.replayTotal(),speed:this.replaySpeed,mode:`select`,steps:t,step:this.replayStep}),this.replayShade=document.createElement(`div`),this.replayShade.className=`tcw-replay-shade`,this.replayShade.hidden=!0,this.chartContainer.appendChild(this.replayShade),this.chartContainer.addEventListener(`mouseleave`,this.hideReplayShade)}hideReplayShade=()=>this.positionReplayShade(null);replayFrom(e,t=!1){this.replayBar?.isMounted()||this.enterReplay(),this.startReplayAt(e,t)}startReplayAt(e,t=!1){let n=this.replayBar;if(!n)return;let r=this.replayTotal(),i=Math.max(0,Math.min(Number.isFinite(e)?Math.floor(e):0,r-1));this.replayShade?.remove(),this.replayShade=null,this.chartContainer.removeEventListener(`mouseleave`,this.hideReplayShade),n.setMode(`replay`);let a=++this.replayStartSeq,o=e=>{this.destroyed||this.replayBar!==n||!n.isMounted()||a!==this.replayStartSeq||(this.chart.replayStart({speed:this.replaySpeed,interval:1e3,startIndex:i,paused:!0,...e?{steps:e}:{}}),t&&this.chart.replayResume(),n.setState(t?`playing`:`paused`),this.syncReplayBar(),this.replayPollInterval&&clearInterval(this.replayPollInterval),this.replayPollInterval=setInterval(()=>this.syncReplayBar(),150))};if(this.replayStep===`bar`){o(null);return}this.replayStepsFor(this.replayStep).then(e=>{a===this.replayStartSeq&&(e||this.toast(this.t(`replay.stepsFailed`),`error`),o(e))})}replayStepOptions(){let e=(0,n.timeframeToMs)(this.state.timeframe);return Jr.filter(t=>{let i=(0,n.timeframeToMs)(t);return!(i<e)||e%i!==0?!1:this.adapter?(0,r.servesTimeframe)(this.adapter,t):this.baseSeries!==null&&this.baseTimeframeMs>0&&i>=this.baseTimeframeMs&&i%this.baseTimeframeMs===0})}async replayStepsFor(e){let t=`${this.state.symbol}|${this.state.timeframe}|${e}`;if(this.replayStepsCache?.key===t)return this.replayStepsCache.steps;let a=null;if(this.adapter){let t=Math.max(1,Math.round((0,n.timeframeToMs)(this.state.timeframe)/(0,n.timeframeToMs)(e))),i=Math.min(Yr,Math.max(this.chart.getData().length,100)*t);try{a=await(0,r.withResampling)(this.adapter).fetchHistory(this.state.symbol,e,i)}catch{a=null}}else this.baseSeries&&(a=(0,n.timeframeToMs)(e)===this.baseTimeframeMs?this.baseSeries:i(this.baseSeries,e));return!a||a.length===0?null:(this.replayStepsCache={key:t,steps:a},a)}replayTotal(){return this.chart.isReplayActive()?this.chart.getReplayProgress().total:this.chart.getData().length}syncReplayBar(){let e=this.replayBar;if(!e?.isMounted()||e.getMode()!==`replay`)return;if(!this.chart.isReplayActive()){this.teardownReplayUi();return}let t=this.chart.getReplayProgress(),n=this.chart.getReplayState();e.setProgress(t.current,t.total),e.setState(n===`stopped`?`paused`:n),e.setEnded(n!==`playing`&&t.total>0&&t.current>=t.total-1)}stepReplay(e){if(this.replayBar?.getMode()!==`replay`)return;let t=this.chart.getReplayProgress();this.chart.getReplayState()===`playing`&&this.chart.replayPause(),this.chart.replaySeek(Math.max(0,Math.min(t.total-1,t.current+e))),this.replayBar.setState(`paused`),this.syncReplayBar()}handleReplayKey(e){if(e.defaultPrevented)return!1;let t=document.activeElement;return t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)?!1:e.shiftKey&&(e.key===`ArrowRight`||e.key===`ArrowLeft`)&&this.replayBar?.getMode()===`replay`?(e.preventDefault(),e.stopPropagation(),this.stepReplay(e.key===`ArrowRight`?1:-1),!0):e.key===`Escape`&&this.replayBar?.getMode()===`select`?(this.exitReplay(),!0):!1}positionReplayShade(e){let t=this.replayShade;if(!t)return;let n=this.chart.getPlotRect();if(e===null||e<n.x||e>n.x+n.width){t.hidden=!0;return}t.hidden=!1,t.style.left=`${e}px`,t.style.top=`${n.y}px`,t.style.width=`${n.x+n.width-e}px`,t.style.height=`${n.height}px`}exitReplay(){this.teardownReplayUi(),this.chart.replayStop()}teardownReplayUi(){this.replayPollInterval&&=(clearInterval(this.replayPollInterval),null),this.replayShade?.remove(),this.replayShade=null,this.chartContainer.removeEventListener(`mouseleave`,this.hideReplayShade),this.replayBar?.unmount(),this.replayBar=null}applySettings(e){this.settingsState={...this.settingsState,...e},(e.scaleMode!==void 0||e.logScale!==void 0||e.invertScale!==void 0)&&this.layoutSession?.changed(),this.scheduleLegend(),e.gridVisible!==void 0&&this.chart.setGridVisible(e.gridVisible),e.volumeVisible!==void 0&&this.chart.setVolumeVisible(e.volumeVisible),e.volumeProfileVisible!==void 0&&this.chart.setVolumeProfileVisible(e.volumeProfileVisible),e.marketProfileVisible!==void 0&&this.chart.setMarketProfileVisible(e.marketProfileVisible),e.marketProfileSplit!==void 0&&this.chart.setMarketProfileConfig({splitBySession:e.marketProfileSplit}),e.marketProfileLetters!==void 0&&this.chart.setMarketProfileConfig({letters:e.marketProfileLetters}),e.marketProfileBuckets!==void 0&&this.chart.setMarketProfileConfig({buckets:e.marketProfileBuckets}),e.marketProfileOpacity!==void 0&&this.chart.setMarketProfileConfig({opacity:e.marketProfileOpacity}),e.depthHeatmapVisible!==void 0&&this.chart.setDepthHeatmapVisible(e.depthHeatmapVisible),e.depthHeatmapOpacity!==void 0&&this.chart.setDepthHeatmapConfig({opacity:e.depthHeatmapOpacity}),e.sessionShadingVisible!==void 0&&this.chart.setSessionShadingVisible(e.sessionShadingVisible),e.pivotMarkersVisible!==void 0&&this.chart.setPivotMarkersVisible(e.pivotMarkersVisible),e.pivotStrength!==void 0&&this.chart.setPivotMarkersConfig({left:e.pivotStrength,right:e.pivotStrength}),e.pivotStructureLabels!==void 0&&this.chart.setPivotMarkersConfig({structureLabels:e.pivotStructureLabels}),e.periodLevelsVisible!==void 0&&this.chart.setPeriodLevelsVisible(e.periodLevelsVisible),e.periodLevelsPeriod!==void 0&&this.chart.setPeriodLevelsPeriod(e.periodLevelsPeriod),e.legendVisible!==void 0&&this.chart.setLegend({visible:e.legendVisible}),e.barCountdown!==void 0&&this.chart.setBarCountdownVisible(e.barCountdown),e.indicatorValueLabels!==void 0&&this.chart.setIndicatorValueLabelsVisible(e.indicatorValueLabels),e.crosshairMode!==void 0&&this.chart.setCrosshairMode(e.crosshairMode),e.autoScale!==void 0&&this.chart.setAutoScale(e.autoScale),e.invertScale!==void 0&&this.chart.setInvertScale(e.invertScale),e.leftPriceScale!==void 0&&this.chart.setLeftPriceScaleVisible(e.leftPriceScale),e.scaleMode===void 0?e.logScale!==void 0&&(this.chart.setLogScale(e.logScale),this.settingsState={...this.settingsState,scaleMode:e.logScale?`logarithmic`:`regular`}):(this.chart.setScaleMode(e.scaleMode),this.settingsState={...this.settingsState,logScale:e.scaleMode===`logarithmic`}),e.numberLocale!==void 0&&(this.chart.setNumberLocale(e.numberLocale),this.watchlist?.setLocale(e.numberLocale||void 0)),e.timezone!==void 0&&this.chart.setTimezone(s(e.timezone)),e.highLowLines!==void 0&&this.chart.setHighLowLines(e.highLowLines),e.extendedHours!==void 0&&this.chart.setExtendedHours(e.extendedHours),e.mainSeriesVisible!==void 0&&this.chart.setMainSeriesVisible(e.mainSeriesVisible),e.chartTypeOptions!==void 0&&this.chart.setChartTypeOptions({renko:{},lineBreak:{},kagi:{},pointAndFigure:{},rangeBars:{},...e.chartTypeOptions});let t={...this.chart.getTheme()},n=!1;e.candleUpColor!==void 0&&(t.candleUp=e.candleUpColor,n=!0),e.candleDownColor!==void 0&&(t.candleDown=e.candleDownColor,n=!0),e.candleUpWick!==void 0&&(t.candleUpWick=e.candleUpWick,n=!0),e.candleDownWick!==void 0&&(t.candleDownWick=e.candleDownWick,n=!0),e.backgroundColor!==void 0&&(t.background=e.backgroundColor,n=!0),e.gridColor!==void 0&&(t.grid=e.gridColor,n=!0),n&&this.chart.setTheme(t)}resetSettings(){let e={...this.settingsState};this.settingsState={...this.settingsDefaults},this.applySettings(this.settingsState);let t={...this.settingsState};JSON.stringify(e)!==JSON.stringify(t)&&this.chart.recordUndo({undo:()=>this.restoreSettings(e),redo:()=>this.restoreSettings(t)})}changeSettings(e){let t=Object.keys(e);if(t.includes(`scaleMode`)||t.includes(`logScale`))for(let e of[`scaleMode`,`logScale`])t.includes(e)||t.push(e);let n=()=>Object.fromEntries(t.map(e=>[e,this.settingsState[e]])),r=n();this.applySettings(e);let i=n();JSON.stringify(r)!==JSON.stringify(i)&&this.chart.recordUndo({subject:`settings:${Object.keys(e).sort().join(`,`)}`,undo:()=>this.restoreSettings(r),redo:()=>this.restoreSettings(i)})}restoreSettings(e){this.applySettings(e),this.settings?.refresh(this.settingsState)}async connectStream(){if(!this.adapter)return;let e=++this.connectSeq;this.state={...this.state,connectionState:`connecting`,connectionMessage:this.t(`status.connecting`)},this.updateUI(),this.loading.begin(this.chart.getData().length>0);try{if(this.chart.disconnectStream(),await this.chart.connect({adapter:this.adapter,symbol:this.state.symbol,timeframe:this.state.timeframe,historyLimit:this.options.historyLimit??500,historyPageSize:this.options.historyPageSize}),e!==this.connectSeq||this.destroyed)return;this.chart.setWatermark(this.state.symbol.replace(`USDT`,` / USDT`),{fontSize:48,color:this.state.isDark?`rgba(255,255,255,0.03)`:`rgba(0,0,0,0.03)`}),this.applySymbolLayout(this.state.symbol),this.loading.hasFailed()?this.state={...this.state,connectionState:`error`}:(this.loading.end(),this.state={...this.state,connectionState:`connected`,connectionMessage:this.t(`status.live`)}),this.refetchCompares()}catch(t){if(e!==this.connectSeq||this.destroyed)return;this.loading.fail(this.t(`status.connectionFailed`)),this.state={...this.state,connectionState:`error`,connectionMessage:t instanceof Error?t.message:this.t(`status.connectionFailed`)}}this.updateUI()}scheduleLegend(){!this.indicatorLegend||this.legendFrame||(this.legendFrame=requestAnimationFrame(()=>{this.legendFrame=0,this.renderLegend()}))}renderLegend(){if(!this.indicatorLegend||this.destroyed)return;let t=this.chart.getData().length-1,n=this.chart.isTimeAligned()?this.legendHoverIndex:null,r=n===null?t:Math.min(Math.max(n,0),t),i=new Map;for(let e of this.chart.getIndicatorPanes())(e.instanceIds??[e.instanceId]).forEach((t,n)=>i.set(t,{...e.rect,row:n}));let a=this.settingsState.numberLocale||`en-US`,o=this.chart.getActiveIndicators().map(t=>{let n=i.get(t.instanceId)??null,o=r>=0?this.chart.getIndicatorOutput(t.instanceId)?.series?.[r]:null,s=this.chart.getIndicatorStyle(t.instanceId)?.colors??[],c=pr(t.descriptor,o,s);return{instanceId:t.instanceId,label:e.C(t.id,t.params,t.descriptor.defaultConfig,t.descriptor.shortName),visible:t.visible,values:c.map(e=>({text:n?gr(e.value,a):this.chart.formatPrice(e.value),color:e.color})),pane:n?{x:n.x+Wr,y:n.y+Math.min(Gr+n.row*Kr,Math.max(Gr,n.height-Kr)),width:n.width-2*Wr}:null}}),s=this.chart.getPlotRect(),c=this.chart.getMaximizedPane(),l=e=>o.find(t=>t.instanceId===e)?.label??``,u=this.chart.getIndicatorPanes().map(e=>({instanceId:e.instanceId,x:e.rect.x+e.rect.width-Wr,y:e.rect.y+qr,label:l(e.instanceId),collapsed:this.chart.isPaneCollapsed(e.instanceId),maximized:c===e.instanceId,canMoveUp:this.chart.canMovePane(e.instanceId,-1),canMoveDown:this.chart.canMovePane(e.instanceId,1)}));this.indicatorLegend.update(o,{left:s.x+Wr,top:this.chart.getLegendBottom()+1},u)}runPaneAction(e,t){t===`up`||t===`down`?this.chart.movePane(e,t===`up`?-1:1):t===`collapse`||t===`expand`?this.chart.setPaneCollapsed(e,t===`collapse`):this.chart.setMaximizedPane(t===`maximize`?e:null),this.scheduleLegend()}openLegendMenu(e,t){let n=this.legendMenu;if(!n)return;if(n.isOpen()){n.close();return}let r=[`price`,...this.chart.getIndicatorPanes().map(e=>e.instanceId)],i=1+this.chart.getIndicatorPanes().findIndex(t=>t.instanceIds.includes(e)),a=r[i-1],o=r[i+1],s=t=>t!==void 0&&this.chart.canMoveIndicatorToPane(e,t),c=[];s(a)&&c.push({id:`move:${a}`,label:this.t(a===`price`?`legend.movePrice`:`legend.moveUp`),icon:`arrowUp`}),s(o)&&c.push({id:`move:${o}`,label:this.t(`legend.moveDown`),icon:`arrowDown`}),s(`new`)&&c.push({id:`move:new`,label:this.t(`legend.moveNew`),icon:`plus`}),a!==`price`&&s(`price`)&&c.push({id:`move:price`,label:this.t(`legend.movePrice`),icon:`trendingUp`}),c.length>0&&c.push(`separator`),c.push({id:`settings`,label:this.t(`legend.settings`),icon:`settings`},{id:`remove`,label:this.t(`legend.remove`),icon:`trash`,danger:!0});let l=t.getBoundingClientRect(),u=this.root.getBoundingClientRect();n.open(c,l.left-u.left,l.bottom-u.top+2,t=>{t===`settings`?this.openIndicatorSettings(e):t===`remove`?this.handleRemoveIndicator(e):t.startsWith(`move:`)&&this.chart.moveIndicatorToPane(e,t.slice(5)),this.scheduleLegend()},t)}updateUI(){this.scheduleLegend(),this.toolbar?.update(this.state),this.sidebar?.update(this.state),this.statusBar?.update({connectionState:this.state.connectionState,message:this.state.connectionMessage,symbol:this.state.symbol,timeframe:this.state.timeframe})}resolveIsDark(e){return e===void 0||e===`dark`?!0:e===`light`?!1:typeof e==`object`&&e.background?this.isColorDark(e.background):!0}resolveTheme(e){return e===void 0||e===`dark`?n.DARK_THEME:e===`light`?n.LIGHT_THEME:typeof e==`object`?e:n.DARK_THEME}isColorDark(e){if(e.startsWith(`#`)&&e.length>=7){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return t+n+r<384}return!0}};function ei(t,i){let a=e=>{let t=(0,r.sourceParam)(e.descriptor);return t&&(0,n.parseIndicatorSource)(e.params[t])?.instanceId||null},o=new Set([t]);for(let e=!0;e;){e=!1;for(let t of i){let n=a(t);n&&o.has(n)&&!o.has(t.instanceId)&&(o.add(t.instanceId),e=!0)}}let s=[];for(let t of i){if(o.has(t.instanceId))continue;let r=e.C(t.id,t.params,t.descriptor.defaultConfig,t.descriptor.shortName);for(let e of t.descriptor.plots??[])s.push({value:(0,n.indicatorSource)(t.instanceId,e.key),label:`${r}: ${e.title}`})}return s}function ti(){try{return typeof localStorage<`u`?localStorage:null}catch{return null}}var ni=10,ri=5*6e4,ii=864e5;function ai(e,t){if(e.length===0)return null;let r=t&&(0,n.isValidTimeZone)(t)?t:null,i=e=>{let t=e<1e11?e*1e3:e;return Math.floor((t+(r?(0,n.zoneOffsetMinutes)(r,t)*6e4:0))/ii)},a=e[e.length-1],o=i(a.time),s=e.length-1;for(;s>0&&i(e[s-1].time)===o;)s--;let c=-1/0,l=1/0,u=0;for(let t=s;t<e.length;t++)c=Math.max(c,e[t].high),l=Math.min(l,e[t].low),u+=e[t].volume??0;return{open:e[s].open,high:c,low:l,close:a.close,volume:u,prevClose:s>0?e[s-1].close:void 0}}function oi(e,t){let n=e/6e4,[r,i]=Math.abs(n)<60?[Math.round(n)||Math.sign(n)||1,`minute`]:Math.abs(n)<1440?[Math.round(n/60),`hour`]:[Math.round(n/1440),`day`];try{return new Intl.RelativeTimeFormat(t,{numeric:`auto`}).format(r,i)}catch{return new Intl.RelativeTimeFormat(`en`,{numeric:`auto`}).format(r,i)}}function si(e,t){try{return new Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:2}).format(e)}catch{return String(e)}}function ci(e,t){let n=e?.sessions??[];if(n.length===0)return;let r;try{let e=new Intl.DateTimeFormat(t,{weekday:`short`,timeZone:`UTC`});r=Array.from({length:7},(t,n)=>e.format(Date.UTC(1970,0,4+n)))}catch{r=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]}let i=e=>{let t=[...new Set((e??[]).filter(e=>Number.isInteger(e)&&e>=0&&e<=6))].sort((e,t)=>e-t);return t.length===0||t.length===7?``:t.every((e,n)=>n===0||e===t[n-1]+1)&&t.length>2?`${r[t[0]]}–${r[t[t.length-1]]}`:t.map(e=>r[e]).join(`, `)};return n.map(e=>[`${e.start}–${e.end}`,i(e.days)].filter(Boolean).join(` `)).join(`, `)}function li(e){return!!e&&/^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e)}var ui={symbol:!1,interval:!1,crosshair:!0,time:!1,drawings:!1,replay:!1},di=[`symbol`,`interval`,`crosshair`,`time`,`drawings`,`replay`],$={"1x1":{cols:1,rows:1},"1x2":{cols:2,rows:1},"2x1":{cols:1,rows:2},"2x2":{cols:2,rows:2},"1x3":{cols:3,rows:1},"3x1":{cols:1,rows:3},"2x3":{cols:3,rows:2},"3x2":{cols:2,rows:3}};function fi(e){return typeof e==`string`&&Object.prototype.hasOwnProperty.call($,e)}function pi(e){return JSON.parse(JSON.stringify(e))}function mi(e,t,n=16){let r=(20-2*(e-1))/e,i=(20-2*(t-1))/t,a=``;for(let n=0;n<t;n++)for(let t=0;t<e;t++)a+=`<rect x="${2+t*(r+2)}" y="${2+n*(i+2)}" width="${r}" height="${i}" rx="1"/>`;return`<svg width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">${a}</svg>`}function hi(e){if(typeof e!=`object`||!e)return null;let t=e;if(t.v!==1||t.kind!==`grid`||!fi(t.layout)||!Array.isArray(t.cells))return null;let n=t.cells.map(Xn);if(n.some(e=>e===null))return null;let r=typeof t.sync==`object`&&t.sync!==null?t.sync:{},i={...ui};for(let e of di)typeof r[e]==`boolean`&&(i[e]=r[e]);let a=typeof t.active==`number`&&Number.isInteger(t.active)?t.active:0;return{v:1,kind:`grid`,layout:t.layout,sync:i,active:a,cells:n}}var gi=class{root;cellsEl;cells=[];layout;sync;active=0;hovered=null;relayDepth=0;uiTheme=null;parked=new Map;drawingFrame=0;drawingSource=null;layoutButtons=new Map;syncButtons=new Map;layoutsButton=null;session=null;layoutsUI=null;t;destroyed=!1;unregisterKeys=()=>{};onKeyDown=e=>{!(e.ctrlKey||e.metaKey)||e.altKey||e.shiftKey||e.key!==`s`&&e.key!==`S`||!this.layoutsUI||K()||!G(this.root,!0)||(e.preventDefault(),this.layoutsUI.save())};constructor(e,n={}){this.options=n,this.layout=fi(n.layout)?n.layout:`1x2`,this.sync={...ui,...n.sync},this.t=t.n(t.o(n.widget?.locale,n.widget?.messages)),g(),this.root=document.createElement(`div`),this.root.className=`tcw-root tcw-grid`,this.root.dataset.tcwTheme=n.widget?.theme===`light`?`light`:`dark`,P(this.root,N(n.widget?.ui),{variables:n.widget?.ui!==void 0}),n.bar!==!1&&this.root.appendChild(this.buildBar()),this.cellsEl=document.createElement(`div`),this.cellsEl.className=`tcw-grid-cells`,this.root.appendChild(this.cellsEl),e.appendChild(this.root),this.applyShape();for(let e=0;e<this.shapeCount();e++)this.cells.push(this.createCell(e));this.markActive();let r=this.cells[0]?.el.querySelector(`.tcw-root`)?.dataset.tcwTheme;r&&(this.root.dataset.tcwTheme=r),n.layouts!==!1&&this.setupLayouts(n.layouts===!0||n.layouts===void 0?{}:n.layouts),this.unregisterKeys=Kn(this.root),document.addEventListener(`keydown`,this.onKeyDown)}get relaying(){return this.relayDepth>0}quietly(e){this.relayDepth++;try{return e()}finally{this.relayDepth--}}getWidget(e){return this.cells[e]?.widget??null}getWidgets(){return this.cells.map(e=>e.widget)}getActiveIndex(){return this.active}getActiveWidget(){return this.cells[this.active].widget}setActive(e){e<0||e>=this.cells.length||e===this.active||(this.active=e,this.markActive(),this.options.onActiveChange?.(e,this.cells[e].widget),this.session?.changed())}getLayout(){return this.layout}setLayout(e){if(e===this.layout||!fi(e))return;this.layout=e;let t=this.shapeCount();for(;this.cells.length>t;){let e=this.cells.length-1,t=this.cells.pop();this.parked.set(e,t.widget.captureLayout()),this.destroyCell(t)}this.applyShape();for(let e=this.cells.length;e<t;e++){let t=this.createCell(e);this.cells.push(t),this.unpark(e,t)}this.active>=t&&(this.active=0,this.options.onActiveChange?.(0,this.cells[0].widget)),this.markActive(),this.renderBar(),this.session?.changed()}getSync(){return{...this.sync}}setUI(e){let t=N(e);P(this.root,t);for(let e of this.cells)e.widget.setUI(t);this.uiTheme=t}getUI(){return N(this.uiTheme??this.options.widget?.ui)}setSync(e){let t=this.sync;if(this.sync={...this.sync,...e},t.crosshair&&!this.sync.crosshair)for(let e of this.cells)e.widget.getChart().setCrosshairTime(null);let n=this.cells[this.active];if(n&&!this.relaying){let e=n.widget.getSymbol(),r=n.widget.getTimeframe();!t.symbol&&this.sync.symbol&&this.relay(n,t=>void t.setSymbol(e)),!t.interval&&this.sync.interval&&this.relay(n,e=>void e.setTimeframe(r)),!t.drawings&&this.sync.drawings&&this.mergeDrawings()}this.renderBar(),this.session?.changed()}setTheme(e){for(let t of this.cells)t.widget.setTheme(e);this.followTheme()}getLayoutSession(){return this.session}captureLayout(){let e=[...this.parked.entries()].sort(([e],[t])=>e-t).map(([,e])=>e);return{v:1,kind:`grid`,layout:this.layout,sync:{...this.sync},active:this.active,cells:[...this.cells.map(e=>e.widget.captureLayout()),...e]}}async restoreLayout(e){this.relayDepth++;let t;try{this.parked.clear(),this.setLayout(e.layout),this.sync={...e.sync},this.renderBar();let n=this.cells.length;e.cells.slice(n).forEach((e,t)=>this.parked.set(n+t,e)),t=await Promise.allSettled(this.cells.map((t,n)=>e.cells[n]?t.widget.restoreLayout(e.cells[n]):Promise.resolve()))}finally{this.relayDepth--}if(this.destroyed)return;this.setActive(Math.min(Math.max(0,e.active),this.cells.length-1));let n=t.find(e=>e.status===`rejected`);if(n)throw n.reason}getLayoutContent(){return JSON.stringify(this.captureLayout())}async applyLayoutContent(e){let t=hi(Zn(e));return t?(await this.restoreLayout(t),!0):!1}destroy(){if(!this.destroyed){this.destroyed=!0,document.removeEventListener(`keydown`,this.onKeyDown),this.unregisterKeys(),this.drawingFrame&&cancelAnimationFrame(this.drawingFrame),this.session?.destroy(),this.layoutsUI?.destroy();for(let e of this.cells)this.destroyCell(e);this.cells=[],this.root.remove(),_()}}shapeCount(){let{cols:e,rows:t}=$[this.layout];return e*t}applyShape(){let{cols:e,rows:t}=$[this.layout];this.cellsEl.style.gridTemplateColumns=`repeat(${e}, minmax(0, 1fr))`,this.cellsEl.style.gridTemplateRows=`repeat(${t}, minmax(0, 1fr))`}createCell(e){let n=document.createElement(`div`);n.className=`tcw-grid-cell`,n.setAttribute(`role`,`region`),n.setAttribute(`aria-label`,t.r(this.t(`grid.chart`),{n:e+1})),this.cellsEl.appendChild(n);let r=this.options.widget??{},i=this.options.cells?.[e]??{},a=this.cells[this.active]?.widget,o={},s=new $r(n,{...r,...i,...a&&this.sync.symbol?{symbol:a.getSymbol()}:{},...a&&this.sync.interval?{timeframe:a.getTimeframe()}:{},...this.options.adapter&&!i.adapter?{adapter:this.options.adapter(e)}:{},...this.uiTheme?{ui:this.uiTheme}:{},layouts:!1,onSymbolChange:e=>{i.onSymbolChange?.(e),r.onSymbolChange?.(e),this.sync.symbol&&this.relay(o,t=>void t.setSymbol(e)),this.session?.changed()},onTimeframeChange:e=>{i.onTimeframeChange?.(e),r.onTimeframeChange?.(e),this.sync.interval&&this.relay(o,t=>void t.setTimeframe(e)),this.session?.changed()}});return o.el=n,o.widget=s,this.wireCell(o),n.addEventListener(`pointerdown`,()=>this.setActive(this.cells.indexOf(o)),!0),n.addEventListener(`pointerenter`,()=>{this.hovered=o}),n.addEventListener(`pointerleave`,()=>{this.hovered===o&&(this.hovered=null)}),this.options.onChartAdd?.(s,e),o}wireCell(e){let t=e.widget.getChart(),n=()=>this.cells.filter(t=>t!==e);t.on(`crosshairMove`,e=>{let t=e.payload.bar?.time;if(!(!this.sync.crosshair||t===void 0))for(let e of n())e.widget.getChart().setCrosshairTime(t)}),t.on(`crosshairLeave`,()=>{if(this.sync.crosshair)for(let e of n())e.widget.getChart().setCrosshairTime(null)}),t.on(`visibleRangeChange`,n=>{if(!this.sync.time||this.relaying||(this.hovered??this.cells[this.active])!==e)return;let{from:r,to:i}=n.payload,a=t.getData(),o=a[r]?.time,s=a[i]?.time;o===void 0||s===void 0||this.relay(e,e=>e.getChart().setVisibleRange(o,s))});for(let n of[`drawingCreate`,`drawingUpdate`,`drawingRemove`])t.on(n,()=>{this.sync.drawings&&!this.relaying&&this.copyDrawingsSoon(e)});t.on(`replayStep`,t=>{if(!this.sync.replay||this.relaying)return;let{until:n}=t.payload;this.relay(e,e=>{let t=e.getChart();if(t.isReplayActive()){t.replaySeekToTime(n);return}let r=_i(t.getData(),n);r>=0&&t.replayStart({startIndex:r,paused:!0})})}),t.on(`replayState`,t=>{!this.sync.replay||this.relaying||t.payload.state!==`stopped`||this.relay(e,e=>{e.getChart().isReplayActive()&&e.getChart().replayStop()})}),t.on(`stateChange`,()=>this.session?.changed()),t.on(`themeChange`,()=>{this.relaying||this.followTheme(e)})}destroyCell(e){this.hovered===e&&(this.hovered=null),this.drawingSource===e&&(this.drawingSource=null),this.quietly(()=>e.widget.destroy()),e.el.remove()}relay(e,t){this.relaying||this.quietly(()=>{for(let n of this.cells)n!==e&&t(n.widget)})}unpark(e,t){let n=this.parked.get(e);if(!n)return;this.parked.delete(e);let r=this.cells[this.active]?.widget,i={...n,...r&&this.sync.symbol?{symbol:r.getSymbol()}:{},...r&&this.sync.interval?{timeframe:r.getTimeframe()}:{}};this.relayDepth++,t.widget.restoreLayout(i).catch(()=>t.widget.toast(this.t(`layouts.openFailed`),`error`)).finally(()=>{this.relayDepth--})}copyDrawingsSoon(e){this.drawingSource=e,!this.drawingFrame&&(this.drawingFrame=requestAnimationFrame(()=>{this.drawingFrame=0;let e=this.drawingSource;this.drawingSource=null,e&&!this.destroyed&&!this.relaying&&this.copyDrawings(e)}))}copyDrawings(e){let t=e.widget.getSymbol(),n=e.widget.getChart().getDrawings();this.quietly(()=>{for(let r of this.cells)r!==e&&r.widget.getSymbol()===t&&r.widget.getChart().setDrawings(pi(n))})}mergeDrawings(){let e=new Map;for(let t of this.cells)e.set(t.widget.getSymbol(),[...e.get(t.widget.getSymbol())??[],t]);this.quietly(()=>{for(let t of e.values()){if(t.length<2)continue;let e=new Map;for(let n of t)for(let t of n.widget.getChart().getDrawings())e.has(t.id)||e.set(t.id,t);let n=[...e.values()];for(let e of t)e.widget.getChart().setDrawings(pi(n))}})}followTheme(e=this.cells[this.active]){let t=e?.el.querySelector(`.tcw-root`)?.dataset.tcwTheme;t&&(this.root.dataset.tcwTheme=t,this.quietly(()=>{for(let n of this.cells)n!==e&&n.el.querySelector(`.tcw-root`)?.dataset.tcwTheme!==t&&n.widget.setTheme(t)}))}markActive(){this.cells.forEach((e,t)=>e.el.classList.toggle(`tcw-grid-cell-active`,t===this.active&&this.cells.length>1))}buildBar(){let e=document.createElement(`div`);e.className=`tcw-grid-bar`,e.setAttribute(`role`,`toolbar`),e.setAttribute(`aria-label`,this.t(`grid.bar`));let n=document.createElement(`div`);n.className=`tcw-grid-group`,n.setAttribute(`role`,`group`),n.setAttribute(`aria-label`,this.t(`grid.layout`));let r=this.options.layoutChoices?.filter(fi)??Object.keys($);for(let e of r){let{cols:r,rows:i}=$[e],a=r*i===1?this.t(`grid.single`):t.r(this.t(`grid.layoutOption`),{count:r*i,cols:r,rows:i}),o=document.createElement(`button`);o.type=`button`,o.className=`tcw-btn-icon`,o.title=a,o.setAttribute(`aria-label`,a),o.innerHTML=mi(r,i),o.addEventListener(`click`,()=>this.setLayout(e)),this.layoutButtons.set(e,o),n.appendChild(o)}let i=document.createElement(`div`);i.className=`tcw-grid-group`,i.setAttribute(`role`,`group`),i.setAttribute(`aria-label`,this.t(`grid.sync`));let a=document.createElement(`span`);a.className=`tcw-grid-label`,a.innerHTML=`${S(`link`,13)}<span>${w(this.t(`grid.sync`))}</span>`,i.appendChild(a);for(let e of di){let t=document.createElement(`button`);t.type=`button`,t.className=`tcw-btn tcw-grid-sync`,t.textContent=this.t(`grid.sync.${e}`),t.title=this.t(`grid.sync.${e}.hint`),t.addEventListener(`click`,()=>this.setSync({[e]:!this.sync[e]})),this.syncButtons.set(e,t),i.appendChild(t)}let o=document.createElement(`span`);return o.className=`tcw-toolbar-spacer`,e.append(n,this.sep(),i,o),this.options.layouts!==!1&&(this.layoutsButton=document.createElement(`button`),this.layoutsButton.type=`button`,this.layoutsButton.className=`tcw-dropdown-trigger tcw-layouts-btn`,this.layoutsButton.setAttribute(`aria-haspopup`,`menu`),this.layoutsButton.addEventListener(`click`,()=>{this.layoutsButton&&this.layoutsUI?.openMenu(this.layoutsButton)}),e.appendChild(this.layoutsButton)),this.renderBar(),e}sep(){let e=document.createElement(`span`);return e.className=`tcw-toolbar-sep`,e}renderBar(){for(let[e,t]of this.layoutButtons){let n=e===this.layout;t.classList.toggle(`tcw-active`,n),t.setAttribute(`aria-pressed`,String(n))}for(let[e,t]of this.syncButtons)t.classList.toggle(`tcw-active`,this.sync[e]),t.setAttribute(`aria-pressed`,String(this.sync[e]));this.renderLayoutsButton()}renderLayoutsButton(){let e=this.layoutsButton;if(!e)return;let t=this.session?.current()?.name??this.t(`layouts.unnamed`),n=this.session?.isDirty()??!1,r=`${this.t(`toolbar.layouts`)}: ${t}${n?` (${this.t(`layouts.unsavedChanges`)})`:``}`;e.innerHTML=`${S(`save`,14)}<span class="tcw-layouts-label">${w(t)}</span>`+(n?`<span class="tcw-layouts-dirty" aria-hidden="true"></span>`:``)+S(`chevronDown`,12),e.title=r,e.setAttribute(`aria-label`,r)}setupLayouts(t){let n=new e.t(t.storage??e.i(`tcw:grid-layouts:`),{capture:()=>{let e=this.cells[this.active].widget;return{content:this.getLayoutContent(),symbol:e.getSymbol(),timeframe:e.getTimeframe()}},apply:async e=>{if(!await this.applyLayoutContent(e.content))throw Error(`Not a grid layout`)}},{autoSave:t.autoSave,debounceMs:t.debounceMs,kind:`grid`,onChange:()=>this.renderLayoutsButton(),onError:()=>this.toast(this.t(`layouts.saveFailed`),`error`)});this.session=n,this.layoutsUI=new kn(n,{root:this.root,t:this.t,toast:(e,t)=>this.toast(e,t),formatTime:e=>{let{date:t,time:n}=q(e,null);return`${t} ${n}`}}),this.renderLayoutsButton(),t.openLast&&n.list().then(([e])=>e&&!this.destroyed?this.layoutsUI?.open(e.id):void 0,()=>void 0)}toast(e,t=`info`){this.cells[this.active]?.widget.toast(e,t)}};function _i(e,t){let n=-1;for(let r=0;r<e.length&&e[r].time<t;r++)n=r;return n}exports.CHART_TYPE_ICONS=b,exports.ChartWidget=$r,exports.ChartWidgetGrid=gi,exports.DEFAULT_GRID_SYNC=ui,exports.DRAWING_TOOL_ICONS=y,exports.EN_MESSAGES=t.c,exports.GRID_SHAPES=$,exports.LayoutSession=e.t,exports.MAX_LAYOUT_NAME=e.n,exports.UI_ICONS=v,exports.VI_MESSAGES=t.s,exports.WIDGET_UI_PRESETS=vt,exports.applyWidgetUI=P,exports.cleanLayoutName=e.r,exports.createChartTypeIcon=ce,exports.createIcon=S,exports.createToolIcon=C,exports.findWidgetLocale=t.i,exports.iconSvg=x,exports.localStorageLayouts=e.i,exports.memoryLayouts=e.a,exports.readGridLayout=hi,exports.readWatchlists=O,exports.readWidgetLayout=Xn,exports.registerWidgetLocale=t.a,exports.resolveWidgetUI=N,exports.widgetUIVariables=Tt;
|
|
2562
4302
|
//# sourceMappingURL=index.cjs.map
|