@dsh-ft/dsh-fft-paper-trading 0.7.1 → 0.7.2
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/lib/client.js +1 -1
- package/package.json +1 -4
- package/node_modules/@ftshare-lab/dsh-kline/CHANGELOG.md +0 -611
- package/node_modules/@ftshare-lab/dsh-kline/LICENSE +0 -21
- package/node_modules/@ftshare-lab/dsh-kline/PROVENANCE.md +0 -13
- package/node_modules/@ftshare-lab/dsh-kline/README.en.md +0 -171
- package/node_modules/@ftshare-lab/dsh-kline/README.md +0 -171
- package/node_modules/@ftshare-lab/dsh-kline/chart_service.py +0 -687
- package/node_modules/@ftshare-lab/dsh-kline/config/basic-symbols.json +0 -570
- package/node_modules/@ftshare-lab/dsh-kline/config/dsh-kline.patch.yml +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/config/dsh-tool-catalog.json +0 -3875
- package/node_modules/@ftshare-lab/dsh-kline/cordis.patch.yml +0 -33
- package/node_modules/@ftshare-lab/dsh-kline/core/__init__.py +0 -0
- package/node_modules/@ftshare-lab/dsh-kline/core/adjustment.py +0 -16
- package/node_modules/@ftshare-lab/dsh-kline/core/calc.py +0 -691
- package/node_modules/@ftshare-lab/dsh-kline/core/rows.py +0 -228
- package/node_modules/@ftshare-lab/dsh-kline/core/ta_engine.py +0 -99
- package/node_modules/@ftshare-lab/dsh-kline/lib/candle-sequence.js +0 -15
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-adjustment.js +0 -7
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-annotations.js +0 -33
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-applications.js +0 -171
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-context.js +0 -164
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-observation.js +0 -251
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-service-status.js +0 -82
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-source-status.js +0 -39
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-sources.js +0 -354
- package/node_modules/@ftshare-lab/dsh-kline/lib/client.js +0 -17581
- package/node_modules/@ftshare-lab/dsh-kline/lib/drawing-feedback.js +0 -284
- package/node_modules/@ftshare-lab/dsh-kline/lib/fibonacci.js +0 -18
- package/node_modules/@ftshare-lab/dsh-kline/lib/ftshare-settings-bridge.js +0 -159
- package/node_modules/@ftshare-lab/dsh-kline/lib/index.js +0 -279
- package/node_modules/@ftshare-lab/dsh-kline/lib/labeled-polyline.js +0 -17
- package/node_modules/@ftshare-lab/dsh-kline/lib/pattern-groups.js +0 -91
- package/node_modules/@ftshare-lab/dsh-kline/lib/price-bands.js +0 -55
- package/node_modules/@ftshare-lab/dsh-kline/lib/price-series.js +0 -47
- package/node_modules/@ftshare-lab/dsh-kline/lib/price-sticks.js +0 -32
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/candle-sequence.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-adjustment.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-annotations.d.ts +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-applications.d.ts +0 -26
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-context.d.ts +0 -14
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-observation.d.ts +0 -8
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-service-status.d.ts +0 -22
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-source-status.d.ts +0 -47
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-sources.d.ts +0 -25
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/BetterSidebarTab.d.ts +0 -12
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/ClassicShell.d.ts +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/KlineContent.d.ts +0 -37
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/PanelHost.d.ts +0 -25
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-apply.d.ts +0 -13
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-context.d.ts +0 -23
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-handoff.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-session-resolver.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/client-context.d.ts +0 -16
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/conversation.d.ts +0 -43
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/default-tab.d.ts +0 -3
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/embed.d.ts +0 -37
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/generated-view.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/horizontal-lines.d.ts +0 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/host-options.d.ts +0 -38
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/host-panels.d.ts +0 -55
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/index.d.ts +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/mode-preferences.d.ts +0 -25
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar-contract.d.ts +0 -52
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar-register.d.ts +0 -46
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar-services.d.ts +0 -45
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar.d.ts +0 -47
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/sidebar-integration.d.ts +0 -12
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/ui-onboarding.d.ts +0 -7
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/version.d.ts +0 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/drawing-feedback.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/fibonacci.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/ftshare-settings-bridge.d.ts +0 -50
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/index.d.ts +0 -26
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/labeled-polyline.d.ts +0 -11
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/pattern-groups.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/price-bands.d.ts +0 -3
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/price-series.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/price-sticks.d.ts +0 -3
- package/node_modules/@ftshare-lab/dsh-kline/package.json +0 -157
- package/node_modules/@ftshare-lab/dsh-kline/requirements.txt +0 -6
- package/node_modules/@ftshare-lab/dsh-kline/scripts/bootstrap.sh +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/scripts/dsh-bootstrap.mjs +0 -179
- package/node_modules/@ftshare-lab/dsh-kline/scripts/dsh-mcp-plugin.mjs +0 -27
- package/node_modules/@ftshare-lab/dsh-kline/scripts/run-dsh-kline.mjs +0 -658
- package/node_modules/@ftshare-lab/dsh-kline/scripts/run-dsh-kline.sh +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/server.py +0 -1755
- package/node_modules/@ftshare-lab/dsh-kline/tools/__init__.py +0 -0
- package/node_modules/@ftshare-lab/dsh-kline/tools/annotations.py +0 -119
- package/node_modules/@ftshare-lab/dsh-kline/tools/automatic_analysis.py +0 -158
- package/node_modules/@ftshare-lab/dsh-kline/tools/baostock_source.py +0 -176
- package/node_modules/@ftshare-lab/dsh-kline/tools/calc.py +0 -39
- package/node_modules/@ftshare-lab/dsh-kline/tools/channel_candidates.py +0 -260
- package/node_modules/@ftshare-lab/dsh-kline/tools/channel_preview.py +0 -82
- package/node_modules/@ftshare-lab/dsh-kline/tools/channels.py +0 -104
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_applications.py +0 -204
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_context.py +0 -186
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_edits.py +0 -363
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_functions.py +0 -451
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_indicators.py +0 -65
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_measurements.py +0 -84
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_source_status.py +0 -32
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_sources.py +0 -31
- package/node_modules/@ftshare-lab/dsh-kline/tools/closed_daily.py +0 -68
- package/node_modules/@ftshare-lab/dsh-kline/tools/draw.py +0 -410
- package/node_modules/@ftshare-lab/dsh-kline/tools/drawing_feedback.py +0 -45
- package/node_modules/@ftshare-lab/dsh-kline/tools/drawing_interaction.py +0 -117
- package/node_modules/@ftshare-lab/dsh-kline/tools/drawing_verification.py +0 -141
- package/node_modules/@ftshare-lab/dsh-kline/tools/fetch.py +0 -4680
- package/node_modules/@ftshare-lab/dsh-kline/tools/fibonacci.py +0 -83
- package/node_modules/@ftshare-lab/dsh-kline/tools/foreign_daily.py +0 -185
- package/node_modules/@ftshare-lab/dsh-kline/tools/free_sources.py +0 -483
- package/node_modules/@ftshare-lab/dsh-kline/tools/lines.py +0 -91
- package/node_modules/@ftshare-lab/dsh-kline/tools/nine_count.py +0 -66
- package/node_modules/@ftshare-lab/dsh-kline/tools/pattern_groups.py +0 -103
- package/node_modules/@ftshare-lab/dsh-kline/tools/pivots.py +0 -60
- package/node_modules/@ftshare-lab/dsh-kline/tools/polylines.py +0 -131
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_bands.py +0 -165
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_patterns.py +0 -311
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_series.py +0 -162
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_sticks.py +0 -114
- package/node_modules/@ftshare-lab/dsh-kline/tools/range_candidates.py +0 -170
- package/node_modules/@ftshare-lab/dsh-kline/tools/recent_drawing_candidates.py +0 -123
- package/node_modules/@ftshare-lab/dsh-kline/tools/rectangles.py +0 -76
- package/node_modules/@ftshare-lab/dsh-kline/tools/regression_channels.py +0 -87
- package/node_modules/@ftshare-lab/dsh-kline/tools/ta_functions.py +0 -228
- package/node_modules/@ftshare-lab/dsh-kline/tools/trend_lines.py +0 -106
- package/node_modules/@ftshare-lab/dsh-kline/tools/watchlist.py +0 -149
- package/node_modules/@ftshare-lab/dsh-kline/view/ft-logo.jpg +0 -0
- package/node_modules/@ftshare-lab/dsh-kline/view/vendor/klinecharts.min.js +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* KLineChart v9.6.0
|
|
4
|
-
* Copyright (c) 2019 lihu.
|
|
5
|
-
* Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*/
|
|
7
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).klinecharts={})}(this,(function(t){"use strict";var e,i,n,o,r,a,s,l,u;function c(t,e){if(v(t)||v(e))for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=t[i],o=e[i];v(o)&&v(n)?c(n,o):f(e[i])&&(t[i]=h(e[i]))}}function h(t){if(!v(t))return t;var e;for(var i in e=d(t)?[]:{},t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];e[i]=v(n)?h(n):n}return e}function d(t){return"[object Array]"===Object.prototype.toString.call(t)}function p(t){return"function"==typeof t}function v(t){return"object"==typeof t&&f(t)}function g(t){return"number"==typeof t&&!isNaN(t)}function f(t){return null!=t}function y(t){return"boolean"==typeof t}function m(t){return"string"==typeof t}t.LineType=void 0,(e=t.LineType||(t.LineType={})).Dashed="dashed",e.Solid="solid",t.PolygonType=void 0,(i=t.PolygonType||(t.PolygonType={})).Stroke="stroke",i.Fill="fill",i.StrokeFill="stroke_fill",t.TooltipShowRule=void 0,(n=t.TooltipShowRule||(t.TooltipShowRule={})).Always="always",n.FollowCross="follow_cross",n.None="none",t.TooltipShowType=void 0,(o=t.TooltipShowType||(t.TooltipShowType={})).Standard="standard",o.Rect="rect",t.TooltipIconPosition=void 0,(r=t.TooltipIconPosition||(t.TooltipIconPosition={})).Left="left",r.Middle="middle",r.Right="right",function(t){t.Fixed="fixed",t.Pointer="pointer"}(a||(a={})),t.CandleType=void 0,(s=t.CandleType||(t.CandleType={})).CandleSolid="candle_solid",s.CandleStroke="candle_stroke",s.CandleUpStroke="candle_up_stroke",s.CandleDownStroke="candle_down_stroke",s.Ohlc="ohlc",s.Area="area",t.YAxisPosition=void 0,(l=t.YAxisPosition||(t.YAxisPosition={})).Left="left",l.Right="right",t.YAxisType=void 0,(u=t.YAxisType||(t.YAxisType={})).Normal="normal",u.Percentage="percentage",u.Log="log";var _,x=/\\(\\)?/g,S=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g");function C(t,e,i){if(f(t)){var n=[];e.replace(S,(function(t){for(var e=[],i=1;arguments.length>i;i++)e[i-1]=arguments[i];var o=t;return f(e[1])?o=e[2].replace(x,"$1"):f(e[0])&&(o=e[0].trim()),n.push(o),""}));for(var o=t,r=0,a=n.length;f(o)&&a>r;)o=null==o?void 0:o[n[r++]];return f(o)?o:null!=i?i:"--"}return null!=i?i:"--"}function b(t,e,i){var n=t.format(new Date(e)).split(", "),o=n[0].split("/"),r=n[1].split(":"),a={YYYY:o[2],MM:o[0],DD:o[1],HH:"24"===r[0]?"00":r[0],mm:r[1],ss:r[2]};return i.replace(/YYYY|MM|DD|HH|mm|ss/g,(function(t){return a[t]}))}function w(t,e){var i=+t;return g(i)?i.toFixed(null!=e?e:2):"".concat(t)}function T(t){var e=+t;if(g(e)){if(e>1e9)return"".concat(+(e/1e9).toFixed(3),"B");if(e>1e6)return"".concat(+(e/1e6).toFixed(3),"M");if(e>1e3)return"".concat(+(e/1e3).toFixed(3),"K")}return"".concat(t)}function E(t,e){var i="".concat(t);if(0===e.length)return i;if(i.includes(".")){var n=i.split(".");return"".concat(n[0].replace(/(\d)(?=(\d{3})+$)/g,(function(t){return"".concat(t).concat(e)})),".").concat(n[1])}return i.replace(/(\d)(?=(\d{3})+$)/g,(function(t){return"".concat(t).concat(e)}))}t.FormatDateType=void 0,(_=t.FormatDateType||(t.FormatDateType={}))[_.Tooltip=0]="Tooltip",_[_.Crosshair=1]="Crosshair",_[_.XAxis=2]="XAxis";var I=function(t,e){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},I(t,e)};function P(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function i(){this.constructor=t}I(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var D,M=function(){return M=Object.assign||function(t){for(var e,i=1,n=arguments.length;n>i;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},M.apply(this,arguments)};function k(t,e,i,n){return new(i||(i=Promise))((function(o,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function s(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))}function A(t,e){var i,n,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(a=0)),a;)try{if(i=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&o[3]>s[1])){a.label=s[1];break}if(6===s[0]&&o[1]>a.label){a.label=o[1],o=s;break}if(o&&o[2]>a.label){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{i=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function F(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,o,r=i.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return a}function R(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;r>o;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError,t.ActionType=void 0,(D=t.ActionType||(t.ActionType={})).OnZoom="onZoom",D.OnScroll="onScroll",D.OnVisibleRangeChange="onVisibleRangeChange",D.OnTooltipIconClick="onTooltipIconClick",D.OnCrosshairChange="onCrosshairChange",D.OnCandleBarClick="onCandleBarClick",D.OnPaneDrag="onPaneDrag";var B,O=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){var e;0>(null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1)&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){var e;if(void 0!==t){var i=null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1;i>-1&&this._callbacks.splice(i,1)}else this._callbacks=[]},t.prototype.execute=function(t){this._callbacks.forEach((function(e){e(t)}))},t.prototype.isEmpty=function(){return 0===this._callbacks.length},t}(),V=1,W=(new Date).getTime();function N(t){var e=(new Date).getTime();return e===W?++V:V=1,W=e,"".concat(null!=t?t:"").concat(e,"_").concat(V)}function z(t,e){var i,n=document.createElement(t),o=null!=e?e:{};for(var r in o)n.style[r]=null!==(i=o[r])&&void 0!==i?i:"";return n}function Y(t){var e,i,n;return Math.ceil(null!==(n=null===(i=null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)||void 0===i?void 0:i.devicePixelRatio)&&void 0!==n?n:2)}function H(t,e,i){return"".concat(null!=e?e:"normal"," ").concat(null!=t?t:12,"px ").concat(null!=i?i:"Helvetica Neue")}function X(t,e,i,n){if(void 0===B){var o=document.createElement("canvas"),r=Y(o);(B=o.getContext("2d")).scale(r,r)}return B.font=H(e,i,n),Math.round(B.measureText(t).width)}function j(t,e,i){var n=0,o=0;for(o=t.length-1;n!==o;){var r=Math.floor((o+n)/2),a=o-n,s=t[r][e];if(i===t[n][e])return n;if(i===t[o][e])return o;if(i===s)return r;if(i>s?n=r:o=r,2>=a)break}return n}function Z(t,e){return null==e&&(e=10),+(+t).toFixed(e=Math.min(Math.max(0,e),20))}function G(t,e,i){var n=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER];return t.forEach((function(t){var o,r;n[0]=Math.max(null!==(o=t[e])&&void 0!==o?o:t,n[0]),n[1]=Math.min(null!==(r=t[i])&&void 0!==r?r:t,n[1])})),n}function K(t){return Math.log(t)/Math.log(10)}function U(t){return Math.pow(10,t)}var q,$=1,J=50,Q=function(){function e(t){this._dateTimeFormat=this._buildDateTimeFormat(),this._zoomEnabled=!0,this._scrollEnabled=!0,this._loading=!0,this._loadMoreCallback=null,this._more=!0,this._totalBarSpace=0,this._barSpace=6,this._offsetRightDistance=50,this._startScrollOffsetRightBarCount=0,this._minVisibleBarCount={left:2,right:2},this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._chartStore=t,this._gapBarSpace=this._calcGapBarSpace(),this._offsetRightBarCount=this._offsetRightDistance/this._barSpace}return e.prototype._calcGapBarSpace=function(){return Math.max(1,Math.min(Math.floor(.82*this._barSpace),Math.floor(this._barSpace)-1))},e.prototype.adjustVisibleRange=function(){var e,i=this._chartStore.getDataList(),n=i.length,o=this._totalBarSpace/this._barSpace,r=o-Math.min(this._minVisibleBarCount.left,n);this._offsetRightBarCount>r&&(this._offsetRightBarCount=r);var a=-n+Math.min(this._minVisibleBarCount.right,n);a>this._offsetRightBarCount&&(this._offsetRightBarCount=a);var s=Math.round(this._offsetRightBarCount+n+.5);s>n&&(s=n);var l=Math.round(s-o)-1;if(0>l&&(l=0),this._visibleRange={from:l,to:s,realFrom:this._offsetRightBarCount>0?Math.round(n+this._offsetRightBarCount-o)-1:l,realTo:s},this._chartStore.getActionStore().execute(t.ActionType.OnVisibleRangeChange,this._visibleRange),this._chartStore.adjustVisibleDataList(),0===l&&this._more&&!this._loading&&null!==this._loadMoreCallback){this._loading=!0;var u=i[0];this._loadMoreCallback(null!==(e=null==u?void 0:u.timestamp)&&void 0!==e?e:null)}},e.prototype.setMore=function(t){return this._more=t,this},e.prototype.setLoading=function(t){return this._loading=t,this},e.prototype.getDateTimeFormat=function(){return this._dateTimeFormat},e.prototype._buildDateTimeFormat=function(t){var e={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"};void 0!==t&&(e.timeZone=t);var i=null;try{i=new Intl.DateTimeFormat("en",e)}catch(t){}return i},e.prototype.setTimezone=function(t){var e=this._buildDateTimeFormat(t);null!==e&&(this._dateTimeFormat=e)},e.prototype.getTimezone=function(){return this._dateTimeFormat.resolvedOptions().timeZone},e.prototype.getBarSpace=function(){return{bar:this._barSpace,halfBar:this._barSpace/2,gapBar:this._gapBarSpace,halfGapBar:this._gapBarSpace/2}},e.prototype.setBarSpace=function(t,e){$>t||t>J||this._barSpace===t||(this._barSpace=t,this._gapBarSpace=this._calcGapBarSpace(),null==e||e(),this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0))},e.prototype.setTotalBarSpace=function(t){return this._totalBarSpace!==t&&(this._totalBarSpace=t,this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0)),this},e.prototype.setOffsetRightDistance=function(t,e){return this._offsetRightDistance=t,this._offsetRightBarCount=t/this._barSpace,null!=e&&e&&(this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0)),this},e.prototype.resetOffsetRightDistance=function(){this.setOffsetRightDistance(this._offsetRightDistance)},e.prototype.getInitialOffsetRightDistance=function(){return this._offsetRightDistance},e.prototype.getOffsetRightDistance=function(){return Math.max(0,this._offsetRightBarCount*this._barSpace)},e.prototype.getOffsetRightBarCount=function(){return this._offsetRightBarCount},e.prototype.setOffsetRightBarCount=function(t){return this._offsetRightBarCount=t,this},e.prototype.setLeftMinVisibleBarCount=function(t){return this._minVisibleBarCount.left=t,this},e.prototype.setRightMinVisibleBarCount=function(t){return this._minVisibleBarCount.right=t,this},e.prototype.getVisibleRange=function(){return this._visibleRange},e.prototype.startScroll=function(){this._startScrollOffsetRightBarCount=this._offsetRightBarCount},e.prototype.scroll=function(e){if(this._scrollEnabled){var i=e/this._barSpace;this._chartStore.getActionStore().execute(t.ActionType.OnScroll),this._offsetRightBarCount=this._startScrollOffsetRightBarCount-i,this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0)}},e.prototype.getDataByDataIndex=function(t){var e;return null!==(e=this._chartStore.getDataList()[t])&&void 0!==e?e:null},e.prototype.coordinateToFloatIndex=function(t){var e=this._chartStore.getDataList().length;return Math.round(1e6*(e+this._offsetRightBarCount-(this._totalBarSpace-t)/this._barSpace))/1e6},e.prototype.dataIndexToTimestamp=function(t){var e,i=this.getDataByDataIndex(t);return null!==(e=null==i?void 0:i.timestamp)&&void 0!==e?e:null},e.prototype.timestampToDataIndex=function(t){var e=this._chartStore.getDataList();return 0===e.length?0:j(e,"timestamp",t)},e.prototype.dataIndexToCoordinate=function(t){var e=this._chartStore.getDataList().length;return this._totalBarSpace-(e+this._offsetRightBarCount-t-.5)*this._barSpace},e.prototype.coordinateToDataIndex=function(t){return Math.ceil(this.coordinateToFloatIndex(t))-1},e.prototype.zoom=function(e,i){var n,o=this;if(this._zoomEnabled){if(void 0===(null==i?void 0:i.x)){var r=this._chartStore.getTooltipStore().getCrosshair();i={x:null!==(n=null==r?void 0:r.x)&&void 0!==n?n:this._totalBarSpace/2}}this._chartStore.getActionStore().execute(t.ActionType.OnZoom);var a=this.coordinateToFloatIndex(i.x);this.setBarSpace(this._barSpace+e*(this._barSpace/10),(function(){o._offsetRightBarCount+=a-o.coordinateToFloatIndex(null==i?void 0:i.x)}))}},e.prototype.setZoomEnabled=function(t){return this._zoomEnabled=t,this},e.prototype.getZoomEnabled=function(){return this._zoomEnabled},e.prototype.setScrollEnabled=function(t){return this._scrollEnabled=t,this},e.prototype.getScrollEnabled=function(){return this._scrollEnabled},e.prototype.setLoadMoreCallback=function(t){return this._loadMoreCallback=t,this},e.prototype.clear=function(){this._more=!0,this._loading=!0,this._visibleRange={from:0,to:0,realFrom:0,realTo:0}},e}();function tt(t,e,i,n,o){var r,a=e.result,s=e.figures,l=e.styles,u=C(l,"circles",n.circles),c=u.length,h=C(l,"bars",n.bars),d=h.length,p=C(l,"lines",n.lines),v=p.length,g=0,y=0,m=0;s.forEach((function(s){var l;switch(s.type){case"circle":var _=u[g%c];r=M(M({},_),{color:_.noChangeColor}),g++;break;case"bar":var x=h[y%d];r=M(M({},x),{color:x.noChangeColor}),y++;break;case"line":r=p[m%v],m++}if(f(r)){var S=null===(l=s.styles)||void 0===l?void 0:l.call(s,{prev:{kLineData:t[i-1],indicatorData:a[i-1]},current:{kLineData:t[i],indicatorData:a[i]},next:{kLineData:t[i+1],indicatorData:a[i+1]}},e,n);o(s,M(M({},r),S))}}))}t.IndicatorSeries=void 0,(q=t.IndicatorSeries||(t.IndicatorSeries={})).Normal="normal",q.Price="price",q.Volume="volume";var et=function(){function e(e){this.result=[],this._precisionFlag=!1;var i=e.name,n=e.shortName,o=e.series,r=e.calcParams,a=e.figures,s=e.precision,l=e.shouldOhlc,u=e.shouldFormatBigNumber,c=e.visible,d=e.minValue,p=e.maxValue,v=e.styles,g=e.extendData,f=e.regenerateFigures,y=e.createTooltipDataSource,m=e.draw;this.name=i,this.shortName=null!=n?n:i,this.series=null!=o?o:t.IndicatorSeries.Normal,this.precision=null!=s?s:4,this.calcParams=null!=r?r:[],this.figures=null!=a?a:[],this.shouldOhlc=null!=l&&l,this.shouldFormatBigNumber=null!=u&&u,this.visible=null==c||c,this.minValue=null!=d?d:null,this.maxValue=null!=p?p:null,this.styles=h(null!=v?v:{}),this.extendData=g,this.regenerateFigures=null!=f?f:null,this.createTooltipDataSource=null!=y?y:null,this.draw=null!=m?m:null}return e.prototype.setShortName=function(t){return this.shortName!==t&&(this.shortName=t,!0)},e.prototype.setSeries=function(t){return this.series!==t&&(this.series=t,!0)},e.prototype.setPrecision=function(t,e){var i=null!=e&&e,n=Math.floor(t);return!(n===this.precision||0>t||i&&(!i||this._precisionFlag))&&(this.precision=n,i||(this._precisionFlag=!0),!0)},e.prototype.setCalcParams=function(t){var e,i;return this.calcParams=t,this.figures=null!==(i=null===(e=this.regenerateFigures)||void 0===e?void 0:e.call(this,t))&&void 0!==i?i:this.figures,!0},e.prototype.setShouldOhlc=function(t){return this.shouldOhlc!==t&&(this.shouldOhlc=t,!0)},e.prototype.setShouldFormatBigNumber=function(t){return this.shouldFormatBigNumber!==t&&(this.shouldFormatBigNumber=t,!0)},e.prototype.setVisible=function(t){return this.visible!==t&&(this.visible=t,!0)},e.prototype.setStyles=function(t){return null!==t&&(c(this.styles,t),!0)},e.prototype.setExtendData=function(t){return this.extendData!==t&&(this.extendData=t,!0)},e.prototype.setFigures=function(t){return this.figures!==t&&(this.figures=t,!0)},e.prototype.setMinValue=function(t){return this.minValue!==t&&(this.minValue=t,!0)},e.prototype.setMaxValue=function(t){return this.maxValue!==t&&(this.maxValue=t,!0)},e.prototype.setRegenerateFigures=function(t){return this.regenerateFigures!==t&&(this.regenerateFigures=t,!0)},e.prototype.setCreateTooltipDataSource=function(t){return this.createTooltipDataSource!==t&&(this.createTooltipDataSource=t,!0)},e.prototype.setDraw=function(t){return this.draw!==t&&(this.draw=t,!0)},e.prototype.calcIndicator=function(t){return k(this,void 0,void 0,(function(){var e;return A(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.calc(t,this)];case 1:return e=i.sent(),this.result=e,[2,!0];case 2:return i.sent(),[2,!1];case 3:return[2]}}))}))},e.extend=function(t){return function(e){function i(){return e.call(this,t)||this}return P(i,e),i.prototype.calc=function(e,i){return t.calc(e,i)},i}(e)},e}(),it={name:"AVP",shortName:"AVP",series:t.IndicatorSeries.Price,precision:2,figures:[{key:"avp",title:"AVP: ",type:"line"}],calc:function(t){var e=0,i=0;return t.map((function(t){var n,o,r={},a=null!==(n=null==t?void 0:t.turnover)&&void 0!==n?n:0,s=null!==(o=null==t?void 0:t.volume)&&void 0!==o?o:0;return e+=a,0!==(i+=s)&&(r.avp=e/i),r}))}};var nt={name:"EMA",shortName:"EMA",series:t.IndicatorSeries.Price,calcParams:[6,12,20],precision:2,shouldOhlc:!0,figures:[{key:"ema1",title:"EMA6: ",type:"line"},{key:"ema2",title:"EMA12: ",type:"line"},{key:"ema3",title:"EMA20: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"ema".concat(e+1),title:"EMA".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=0,r=[];return t.map((function(t,e){var a={},s=t.close;return o+=s,i.forEach((function(t,i){t-1>e||(r[i]=e>t-1?(2*s+(t-1)*r[i])/(t+1):o/t,a[n[i].key]=r[i])})),a}))}},ot={name:"MA",shortName:"MA",series:t.IndicatorSeries.Price,calcParams:[5,10,30,60],precision:2,shouldOhlc:!0,figures:[{key:"ma5",title:"MA5: ",type:"line"},{key:"ma10",title:"MA10: ",type:"line"},{key:"ma30",title:"MA30: ",type:"line"},{key:"ma60",title:"MA60: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=[];return t.map((function(e,r){var a={},s=e.close;return i.forEach((function(e,i){var l;o[i]=(null!==(l=o[i])&&void 0!==l?l:0)+s,e-1>r||(a[n[i].key]=o[i]/e,o[i]-=t[r-(e-1)].close)})),a}))}},rt={name:"RSI",shortName:"RSI",calcParams:[6,12,24],figures:[{key:"rsi1",title:"RSI1: ",type:"line"},{key:"rsi2",title:"RSI2: ",type:"line"},{key:"rsi3",title:"RSI3: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){var i=e+1;return{key:"rsi".concat(i),title:"RSI".concat(i,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=[],r=[];return t.map((function(e,a){var s,l={},u=(null!==(s=t[a-1])&&void 0!==s?s:e).close,c=e.close-u;return i.forEach((function(e,i){var s,u,h;if(c>0?o[i]=(null!==(s=o[i])&&void 0!==s?s:0)+c:r[i]=(null!==(u=r[i])&&void 0!==u?u:0)+Math.abs(c),a>=e-1){l[n[i].key]=0!==r[i]?100-100/(1+o[i]/r[i]):0;var d=t[a-(e-1)],p=null!==(h=t[a-e])&&void 0!==h?h:d,v=d.close-p.close;v>0?o[i]-=v:r[i]-=Math.abs(v)}})),l}))}},at={name:"VOL",shortName:"VOL",series:t.IndicatorSeries.Volume,calcParams:[5,10,20],shouldFormatBigNumber:!0,precision:0,minValue:0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA20: ",type:"line"},{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t,e,i){var n=t.current.kLineData;return{color:n.close>n.open?C(e.styles,"bars[0].upColor",i.bars[0].upColor):n.open>n.close?C(e.styles,"bars[0].downColor",i.bars[0].downColor):C(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor)}}}],regenerateFigures:function(t){var e=t.map((function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}}));return e.push({key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t,e,i){var n=t.current.kLineData;return{color:n.close>n.open?C(e.styles,"bars[0].upColor",i.bars[0].upColor):n.open>n.close?C(e.styles,"bars[0].downColor",i.bars[0].downColor):C(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor)}}}),e},calc:function(t,e){var i=e.calcParams,n=e.figures,o=[];return t.map((function(e,r){var a,s=null!==(a=e.volume)&&void 0!==a?a:0,l={volume:s};return i.forEach((function(e,i){var a,u;o[i]=(null!==(a=o[i])&&void 0!==a?a:0)+s,e-1>r||(l[n[i].key]=o[i]/e,o[i]-=null!==(u=t[r-(e-1)].volume)&&void 0!==u?u:0)})),l}))}},st={name:"WR",shortName:"WR",calcParams:[6,10,14],figures:[{key:"wr1",title:"WR1: ",type:"line"},{key:"wr2",title:"WR2: ",type:"line"},{key:"wr3",title:"WR3: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"wr".concat(e+1),title:"WR".concat(e+1,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures;return t.map((function(e,o){var r={},a=e.close;return i.forEach((function(e,i){var s=e-1;if(o>=s){var l=G(t.slice(o-s,o+1),"high","low"),u=l[0],c=u-l[1];r[n[i].key]=0===c?0:(a-u)/c*100}})),r}))}},lt={},ut=[it,{name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(e,i,n){var o,r,a,s,l,u=null!==(r=null===(o=e.prev.indicatorData)||void 0===o?void 0:o.ao)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,c=null!==(s=null===(a=e.current.indicatorData)||void 0===a?void 0:a.ao)&&void 0!==s?s:Number.MIN_SAFE_INTEGER;return{color:l=c>u?C(i.styles,"bars[0].upColor",n.bars[0].upColor):C(i.styles,"bars[0].downColor",n.bars[0].downColor),style:c>u?t.PolygonType.Stroke:t.PolygonType.Fill,borderColor:l}}}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),o=0,r=0,a=0,s=0;return t.map((function(e,l){var u,c={},h=(e.low+e.high)/2;(o+=h,r+=h,l<i[0]-1)||(a=o/i[0],o-=((u=t[l-(i[0]-1)]).low+u.high)/2);l<i[1]-1||(s=r/i[1],r-=((u=t[l-(i[1]-1)]).low+u.high)/2);return n-1>l||(c.ao=a-s),c}))}},{name:"BIAS",shortName:"BIAS",calcParams:[6,12,24],figures:[{key:"bias1",title:"BIAS6: ",type:"line"},{key:"bias2",title:"BIAS12: ",type:"line"},{key:"bias3",title:"BIAS24: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"bias".concat(e+1),title:"BIAS".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=[];return t.map((function(e,r){var a={},s=e.close;return i.forEach((function(e,l){var u;if(o[l]=(null!==(u=o[l])&&void 0!==u?u:0)+s,r>=e-1){var c=o[l]/i[l];a[n[l].key]=(s-c)/c*100,o[l]-=t[r-(e-1)].close}})),a}))}},{name:"BOLL",shortName:"BOLL",series:t.IndicatorSeries.Price,calcParams:[20,2],precision:2,shouldOhlc:!0,figures:[{key:"up",title:"UP: ",type:"line"},{key:"mid",title:"MID: ",type:"line"},{key:"dn",title:"DN: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,o=0;return t.map((function(e,r){var a={};if(o+=e.close,r>=n){a.mid=o/i[0];var s=function(t,e){var i=t.length,n=0;return t.forEach((function(t){var i=t.close-e;n+=i*i})),Math.sqrt((n=Math.abs(n))/i)}(t.slice(r-n,r+1),a.mid);a.up=a.mid+i[1]*s,a.dn=a.mid-i[1]*s,o-=t[r-n].close}return a}))}},{name:"BRAR",shortName:"BRAR",calcParams:[26],figures:[{key:"br",title:"BR: ",type:"line"},{key:"ar",title:"AR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0;return t.map((function(e,s){var l,u,c={},h=e.high,d=e.low,p=e.open,v=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(r+=h-p,a+=p-d,n+=h-v,o+=v-d,s>=i[0]-1){c.ar=0!==a?r/a*100:0,c.br=0!==o?n/o*100:0;var g=t[s-(i[0]-1)],f=g.high,y=g.low,m=g.open,_=(null!==(u=t[s-i[0]])&&void 0!==u?u:t[s-(i[0]-1)]).close;n-=f-_,o-=_-y,r-=f-m,a-=m-y}return c}))}},{name:"BBI",shortName:"BBI",series:t.IndicatorSeries.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max.apply(Math,R([],L(i),!1)),o=[],r=[];return t.map((function(e,a){var s={},l=e.close;if(i.forEach((function(e,i){var n;o[i]=(null!==(n=o[i])&&void 0!==n?n:0)+l,e-1>a||(r[i]=o[i]/e,o[i]-=t[a-(e-1)].close)})),a>=n-1){var u=0;r.forEach((function(t){u+=t})),s.bbi=u/4}return s}))}},{name:"CCI",shortName:"CCI",calcParams:[20],figures:[{key:"cci",title:"CCI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,o=0,r=[];return t.map((function(e,a){var s={},l=(e.high+e.low+e.close)/3;if(o+=l,r.push(l),a>=n){var u=o/i[0],c=r.slice(a-n,a+1),h=0;c.forEach((function(t){h+=Math.abs(t-u)}));var d=h/i[0];s.cci=0!==d?(l-u)/d/.015:0,o-=(t[a-n].high+t[a-n].low+t[a-n].close)/3}return s}))}},{name:"CR",shortName:"CR",calcParams:[26,10,20,40,60],figures:[{key:"cr",title:"CR: ",type:"line"},{key:"ma1",title:"MA1: ",type:"line"},{key:"ma2",title:"MA2: ",type:"line"},{key:"ma3",title:"MA3: ",type:"line"},{key:"ma4",title:"MA4: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.ceil(i[1]/2.5+1),o=Math.ceil(i[2]/2.5+1),r=Math.ceil(i[3]/2.5+1),a=Math.ceil(i[4]/2.5+1),s=0,l=[],u=0,c=[],h=0,d=[],p=0,v=[],g=[];return t.forEach((function(e,f){var y,m,_,x,S,C={},b=null!==(y=t[f-1])&&void 0!==y?y:e,w=(b.high+b.close+b.low+b.open)/4,T=Math.max(0,e.high-w),E=Math.max(0,w-e.low);i[0]-1>f||(C.cr=0!==E?T/E*100:0,s+=C.cr,u+=C.cr,h+=C.cr,p+=C.cr,i[0]+i[1]-2>f||(l.push(s/i[1]),i[0]+i[1]+n-3>f||(C.ma1=l[l.length-1-n]),s-=null!==(m=g[f-(i[1]-1)].cr)&&void 0!==m?m:0),i[0]+i[2]-2>f||(c.push(u/i[2]),i[0]+i[2]+o-3>f||(C.ma2=c[c.length-1-o]),u-=null!==(_=g[f-(i[2]-1)].cr)&&void 0!==_?_:0),i[0]+i[3]-2>f||(d.push(h/i[3]),i[0]+i[3]+r-3>f||(C.ma3=d[d.length-1-r]),h-=null!==(x=g[f-(i[3]-1)].cr)&&void 0!==x?x:0),i[0]+i[4]-2>f||(v.push(p/i[4]),i[0]+i[4]+a-3>f||(C.ma4=v[v.length-1-a]),p-=null!==(S=g[f-(i[4]-1)].cr)&&void 0!==S?S:0)),g.push(C)})),g}},{name:"DMA",shortName:"DMA",calcParams:[10,50,10],figures:[{key:"dma",title:"DMA: ",type:"line"},{key:"ama",title:"AMA: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),o=0,r=0,a=0,s=[];return t.forEach((function(e,l){var u,c={},h=e.close;o+=h,r+=h;var d=0,p=0;if(i[0]-1>l||(d=o/i[0],o-=t[l-(i[0]-1)].close),i[1]-1>l||(p=r/i[1],r-=t[l-(i[1]-1)].close),l>=n-1){var v=d-p;c.dma=v,a+=v,n+i[2]-2>l||(c.ama=a/i[2],a-=null!==(u=s[l-(i[2]-1)].dma)&&void 0!==u?u:0)}s.push(c)})),s}},{name:"DMI",shortName:"DMI",calcParams:[14,6],figures:[{key:"pdi",title:"PDI: ",type:"line"},{key:"mdi",title:"MDI: ",type:"line"},{key:"adx",title:"ADX: ",type:"line"},{key:"adxr",title:"ADXR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=0,c=0,h=[];return t.forEach((function(e,d){var p,v,g={},f=null!==(p=t[d-1])&&void 0!==p?p:e,y=f.close,m=e.high,_=e.low,x=m-_,S=Math.abs(m-y),C=Math.abs(y-_),b=m-f.high,w=f.low-_,T=Math.max(Math.max(x,S),C),E=b>0&&b>w?b:0,I=w>0&&w>b?w:0;if(n+=T,o+=E,r+=I,d>=i[0]-1){d>i[0]-1?(a=a-a/i[0]+T,s=s-s/i[0]+E,l=l-l/i[0]+I):(a=n,s=o,l=r);var P=0,D=0;0!==a&&(P=100*s/a,D=100*l/a),g.pdi=P,g.mdi=D;var M=0;D+P!==0&&(M=Math.abs(D-P)/(D+P)*100),u+=M,2*i[0]-2>d||(g.adx=c=d>2*i[0]-2?(c*(i[0]-1)+M)/i[0]:u/i[0],2*i[0]+i[1]-3>d||(g.adxr=((null!==(v=h[d-(i[1]-1)].adx)&&void 0!==v?v:0)+c)/2))}h.push(g)})),h}},{name:"EMV",shortName:"EMV",calcParams:[14,9],figures:[{key:"emv",title:"EMV: ",type:"line"},{key:"maEmv",title:"MAEMV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=[];return t.map((function(e,r){var a,s={};if(r>0){var l=t[r-1],u=e.high,c=e.low,h=null!==(a=e.volume)&&void 0!==a?a:0,d=(u+c)/2-(l.high+l.low)/2;if(0===h||u-c==0)s.emv=0;else s.emv=d/(h/1e8/(u-c));n+=s.emv,o.push(s.emv),i[0]>r||(s.maEmv=n/i[0],n-=o[r-i[0]])}return s}))}},nt,{name:"MTM",shortName:"MTM",calcParams:[12,6],figures:[{key:"mtm",title:"MTM: ",type:"line"},{key:"maMtm",title:"MAMTM: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=[];return t.forEach((function(e,r){var a,s={};r<i[0]||(s.mtm=e.close-t[r-i[0]].close,n+=s.mtm,i[0]+i[1]-1>r||(s.maMtm=n/i[1],n-=null!==(a=o[r-(i[1]-1)].mtm)&&void 0!==a?a:0));o.push(s)})),o}},ot,{name:"MACD",shortName:"MACD",calcParams:[12,26,9],figures:[{key:"dif",title:"DIF: ",type:"line"},{key:"dea",title:"DEA: ",type:"line"},{key:"macd",title:"MACD: ",type:"bar",baseValue:0,styles:function(e,i,n){var o,r,a,s,l,u=null!==(r=null===(o=e.prev.indicatorData)||void 0===o?void 0:o.macd)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,c=null!==(s=null===(a=e.current.indicatorData)||void 0===a?void 0:a.macd)&&void 0!==s?s:Number.MIN_SAFE_INTEGER;return l=c>0?C(i.styles,"bars[0].upColor",n.bars[0].upColor):0>c?C(i.styles,"bars[0].downColor",n.bars[0].downColor):C(i.styles,"bars[0].noChangeColor",n.bars[0].noChangeColor),{style:c>u?t.PolygonType.Stroke:t.PolygonType.Fill,color:l,borderColor:l}}}],calc:function(t,e){var i,n,o=e.calcParams,r=0,a=0,s=0,l=0,u=Math.max(o[0],o[1]);return t.map((function(t,e){var c={},h=t.close;return r+=h,o[0]-1>e||(i=e>o[0]-1?(2*h+(o[0]-1)*i)/(o[0]+1):r/o[0]),o[1]-1>e||(n=e>o[1]-1?(2*h+(o[1]-1)*n)/(o[1]+1):r/o[1]),u-1>e||(c.dif=a=i-n,s+=a,u+o[2]-2>e||(c.macd=2*(a-(l=e>u+o[2]-2?(2*a+l*(o[2]-1))/(o[2]+1):s/o[2])),c.dea=l)),c}))}},{name:"OBV",shortName:"OBV",calcParams:[30],figures:[{key:"obv",title:"OBV: ",type:"line"},{key:"maObv",title:"MAOBV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=[];return t.forEach((function(e,a){var s,l,u,c,h=null!==(s=t[a-1])&&void 0!==s?s:e;h.close>e.close?o-=null!==(l=e.volume)&&void 0!==l?l:0:e.close>h.close&&(o+=null!==(u=e.volume)&&void 0!==u?u:0);var d={obv:o};n+=o,i[0]-1>a||(d.maObv=n/i[0],n-=null!==(c=r[a-(i[0]-1)].obv)&&void 0!==c?c:0),r.push(d)})),r}},{name:"PVT",shortName:"PVT",figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(t){var e=0;return t.map((function(i,n){var o,r,a={},s=null!==(o=i.volume)&&void 0!==o?o:1,l=(null!==(r=t[n-1])&&void 0!==r?r:i).close,u=0,c=l*s;return 0!==c&&(u=(i.close-l)/c),a.pvt=e+=u,a}))}},{name:"PSY",shortName:"PSY",calcParams:[12,6],figures:[{key:"psy",title:"PSY: ",type:"line"},{key:"maPsy",title:"MAPSY: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=[],a=[];return t.forEach((function(e,s){var l,u,c={},h=(null!==(l=t[s-1])&&void 0!==l?l:e).close,d=e.close-h>0?1:0;r.push(d),n+=d,i[0]-1>s||(c.psy=n/i[0]*100,o+=c.psy,i[0]+i[1]-2>s||(c.maPsy=o/i[1],o-=null!==(u=a[s-(i[1]-1)].psy)&&void 0!==u?u:0),n-=r[s-(i[0]-1)]),a.push(c)})),a}},{name:"ROC",shortName:"ROC",calcParams:[12,6],figures:[{key:"roc",title:"ROC: ",type:"line"},{key:"maRoc",title:"MAROC: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[],o=0;return t.forEach((function(e,r){var a,s,l={};if(r>=i[0]-1){var u=(null!==(a=t[r-i[0]])&&void 0!==a?a:t[r-(i[0]-1)]).close;l.roc=0!==u?(e.close-u)/u*100:0,o+=l.roc,i[0]-1+i[1]-1>r||(l.maRoc=o/i[1],o-=null!==(s=n[r-(i[1]-1)].roc)&&void 0!==s?s:0)}n.push(l)})),n}},rt,{name:"SMA",shortName:"SMA",series:t.IndicatorSeries.Price,calcParams:[12,2],precision:2,figures:[{key:"sma",title:"SMA: ",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams,n=0,o=0;return t.map((function(t,e){var r={},a=t.close;return n+=a,i[0]-1>e||(r.sma=o=e>i[0]-1?(a*i[1]+o*(i[0]-i[1]+1))/(i[0]+1):n/i[0]),r}))}},{name:"KDJ",shortName:"KDJ",calcParams:[9,3,3],figures:[{key:"k",title:"K: ",type:"line"},{key:"d",title:"D: ",type:"line"},{key:"j",title:"J: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[];return t.forEach((function(e,o){var r,a,s,l,u={},c=e.close;if(o>=i[0]-1){var h=G(t.slice(o-(i[0]-1),o+1),"high","low"),d=h[1],p=h[0]-d;u.k=((i[1]-1)*(null!==(a=null===(r=n[o-1])||void 0===r?void 0:r.k)&&void 0!==a?a:50)+(c-d)/(0===p?1:p)*100)/i[1],u.d=((i[2]-1)*(null!==(l=null===(s=n[o-1])||void 0===s?void 0:s.d)&&void 0!==l?l:50)+u.k)/i[2],u.j=3*u.k-2*u.d}n.push(u)})),n}},{name:"SAR",shortName:"SAR",series:t.IndicatorSeries.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(t,e,i){var n,o,r=t.current,a=null!==(o=null===(n=r.indicatorData)||void 0===n?void 0:n.sar)&&void 0!==o?o:Number.MIN_SAFE_INTEGER,s=r.kLineData;return{color:((null==s?void 0:s.high)+(null==s?void 0:s.low))/2>a?C(e.styles,"circles[0].upColor",i.circles[0].upColor):C(e.styles,"circles[0].downColor",i.circles[0].downColor)}}}],calc:function(t,e){var i=e.calcParams,n=i[0]/100,o=i[1]/100,r=i[2]/100,a=n,s=-100,l=!1,u=0;return t.map((function(e,i){var c=u,h=e.high,d=e.low;if(l){(-100===s||h>s)&&(s=h,a=Math.min(a+o,r)),u=c+a*(s-c);var p=Math.min(t[Math.max(1,i)-1].low,d);u>e.low?(u=s,a=n,s=-100,l=!l):u>p&&(u=p)}else{(-100===s||s>d)&&(s=d,a=Math.min(a+o,r)),u=c+a*(s-c);var v=Math.max(t[Math.max(1,i)-1].high,h);e.high>u?(u=s,a=0,s=-100,l=!l):v>u&&(u=v)}return{sar:u}}))}},{name:"TRIX",shortName:"TRIX",calcParams:[12,9],figures:[{key:"trix",title:"TRIX: ",type:"line"},{key:"maTrix",title:"MATRIX: ",type:"line"}],calc:function(t,e){var i,n,o,r=e.calcParams,a=0,s=0,l=0,u=0,c=[];return t.forEach((function(t,e){var h,d={},p=t.close;if(a+=p,e>=r[0]-1&&(s+=i=e>r[0]-1?(2*p+(r[0]-1)*i)/(r[0]+1):a/r[0],e>=2*r[0]-2&&(l+=n=e>2*r[0]-2?(2*i+(r[0]-1)*n)/(r[0]+1):s/r[0],e>=3*r[0]-3))){var v=void 0,g=0;e>3*r[0]-3?g=((v=(2*n+(r[0]-1)*o)/(r[0]+1))-o)/o*100:v=l/r[0],o=v,d.trix=g,u+=g,3*r[0]+r[1]-4>e||(d.maTrix=u/r[1],u-=null!==(h=c[e-(r[1]-1)].trix)&&void 0!==h?h:0)}c.push(d)})),c}},at,{name:"VR",shortName:"VR",calcParams:[26,6],figures:[{key:"vr",title:"VR: ",type:"line"},{key:"maVr",title:"MAVR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=[];return t.forEach((function(e,l){var u,c,h,d,p,v={},g=e.close,f=(null!==(u=t[l-1])&&void 0!==u?u:e).close,y=null!==(c=e.volume)&&void 0!==c?c:0;if(g>f?n+=y:f>g?o+=y:r+=y,l>=i[0]-1){var m=r/2;v.vr=o+m===0?0:(n+m)/(o+m)*100,a+=v.vr,i[0]+i[1]-2>l||(v.maVr=a/i[1],a-=null!==(h=s[l-(i[1]-1)].vr)&&void 0!==h?h:0);var _=t[l-(i[0]-1)],x=null!==(d=t[l-i[0]])&&void 0!==d?d:_,S=_.close,C=null!==(p=_.volume)&&void 0!==p?p:0;S>x.close?n-=C:x.close>S?o-=C:r-=C}s.push(v)})),s}},st];function ct(t){var e;return null!==(e=lt[t])&&void 0!==e?e:null}ut.forEach((function(t){lt[t.name]=et.extend(t)}));var ht,dt=function(){function e(t){this._instances=new Map,this._chartStore=t}return e.prototype._overrideInstance=function(t,e){var i=e.shortName,n=e.series,o=e.calcParams,r=e.precision,a=e.figures,s=e.minValue,l=e.maxValue,u=e.shouldOhlc,c=e.shouldFormatBigNumber,h=e.visible,d=e.styles,p=e.extendData,v=e.regenerateFigures,g=e.createTooltipDataSource,f=e.draw,y=e.calc,m=!1;void 0!==i&&t.setShortName(i)&&(m=!0),void 0!==n&&t.setSeries(n)&&(m=!0);var _=!1;return void 0!==o&&t.setCalcParams(o)&&(m=!0,_=!0),void 0!==a&&t.setFigures(a)&&(m=!0,_=!0),void 0!==s&&t.setMinValue(s)&&(m=!0),void 0!==l&&t.setMinValue(l)&&(m=!0),void 0!==r&&t.setPrecision(r)&&(m=!0),void 0!==u&&t.setShouldOhlc(u)&&(m=!0),void 0!==c&&t.setShouldFormatBigNumber(c)&&(m=!0),void 0!==h&&t.setVisible(h)&&(m=!0),void 0!==d&&t.setStyles(d)&&(m=!0),void 0!==p&&t.setExtendData(p)&&(m=!0,_=!0),void 0!==v&&t.setRegenerateFigures(v)&&(m=!0),void 0!==g&&t.setCreateTooltipDataSource(g)&&(m=!0),void 0!==f&&t.setDraw(f)&&(m=!0),void 0!==y&&(t.calc=y,_=!0),[m,_]},e.prototype.addInstance=function(t,e,i){var n;return k(this,void 0,void 0,(function(){var o,r,a,s;return A(this,(function(l){switch(l.label){case 0:return o=t.name,r=this._instances.get(e),null!==(n=null==r?void 0:r.has(o))&&void 0!==n&&n?[4,Promise.reject(Error("Duplicate indicators."))]:[3,2];case 1:case 3:return[2,l.sent()];case 2:return void 0===r&&(r=new Map,this._instances.set(e,r)),a=ct(o),s=new a,this._overrideInstance(s,t),i||r.clear(),r.set(o,s),[4,s.calcIndicator(this._chartStore.getDataList())]}}))}))},e.prototype.getInstances=function(t){var e;return null!==(e=this._instances.get(t))&&void 0!==e?e:new Map},e.prototype.removeInstance=function(t,e){var i=!1,n=this._instances.get(t);return void 0!==n&&(void 0!==e?n.has(e)&&(n.delete(e),i=!0):(n.clear(),i=!0),0===n.size&&this._instances.delete(t)),i},e.prototype.hasInstances=function(t){return this._instances.has(t)},e.prototype.calcInstance=function(t,e){var i;return k(this,void 0,void 0,(function(){var n,o,r,a=this;return A(this,(function(s){switch(s.label){case 0:return n=[],void 0!==t?void 0!==e?(o=this._instances.get(e),null!==(i=null==o?void 0:o.has(t))&&void 0!==i&&i&&(r=null==o?void 0:o.get(t),n.push(r.calcIndicator(this._chartStore.getDataList())))):this._instances.forEach((function(e){if(e.has(t)){var i=null==e?void 0:e.get(t);n.push(i.calcIndicator(a._chartStore.getDataList()))}})):this._instances.forEach((function(t){t.forEach((function(t){n.push(t.calcIndicator(a._chartStore.getDataList()))}))})),[4,Promise.all(n)];case 1:return[2,s.sent().includes(!0)]}}))}))},e.prototype.getInstanceByPaneId=function(t,e){var i;if(void 0!==t){var n=this._instances.get(t);return void 0!==e?null!==(i=null==n?void 0:n.get(e))&&void 0!==i?i:null:null!=n?n:null}return this._instances},e.prototype.setSeriesPrecision=function(e){this._instances.forEach((function(i){i.forEach((function(i){i.series===t.IndicatorSeries.Price&&i.setPrecision(e.price,!0),i.series===t.IndicatorSeries.Volume&&i.setPrecision(e.volume,!0)}))}))},e.prototype.override=function(t,e){return k(this,void 0,void 0,(function(){var i,n,o,r,a,s,l=this;return A(this,(function(u){switch(u.label){case 0:return i=t.name,n=new Map,null!==e?void 0!==(o=this._instances.get(e))&&n.set(e,o):n=this._instances,r=!1,a=[],n.forEach((function(e){var n=e.get(i);if(void 0!==n){var o=l._overrideInstance(n,t);o[1]?a.push(n.calcIndicator(l._chartStore.getDataList())):o[0]&&(r=!0)}})),[4,Promise.all(a)];case 1:return s=u.sent(),[2,[r,s.includes(!0)]]}}))}))},e}(),pt=function(){function t(t){this._crosshair={},this._activeIcon=null,this._chartStore=t}return t.prototype.setCrosshair=function(t,e){var i,n,o=this._chartStore.getDataList(),r=null!=t?t:{},a=o[n=void 0!==r.x?0>(i=this._chartStore.getTimeScaleStore().coordinateToDataIndex(r.x))?0:i>o.length-1?o.length-1:i:i=o.length-1],s=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(i),l=this._crosshair.x,u=this._crosshair.y,c=this._crosshair.paneId;this._crosshair=M(M({},r),{realX:s,kLineData:a,realDataIndex:i,dataIndex:n}),l===r.x&&u===r.y&&c===r.paneId||(null!==a&&this._chartStore.getChart().crosshairChange(this._crosshair),null!=e&&e||this._chartStore.getChart().updatePane(1))},t.prototype.recalculateCrosshair=function(t){this.setCrosshair(this._crosshair,t)},t.prototype.getCrosshair=function(){return this._crosshair},t.prototype.setActiveIcon=function(t){this._activeIcon=null!=t?t:null},t.prototype.getActiveIcon=function(){return this._activeIcon},t.prototype.clear=function(){this.setCrosshair({},!0),this.setActiveIcon()},t}();t.OverlayMode=void 0,(ht=t.OverlayMode||(t.OverlayMode={})).Normal="normal",ht.WeakMagnet="weak_magnet",ht.StrongMagnet="strong_magnet";var vt="overlay_figure_",gt=Number.MAX_SAFE_INTEGER,ft=function(){function e(e){this.currentStep=1,this.points=[],this._prevPressedPoint=null,this._prevPressedPoints=[];var i=e.mode,n=e.modeSensitivity,o=e.extendData,r=e.styles,a=e.totalStep,s=e.lock,l=e.visible,u=e.zLevel,c=e.needDefaultPointFigure,d=e.needDefaultXAxisFigure,p=e.needDefaultYAxisFigure,v=e.createPointFigures,f=e.createXAxisFigures,y=e.createYAxisFigures,m=e.performEventPressedMove,_=e.performEventMoveForDrawing,x=e.onDrawStart,S=e.onDrawing,C=e.onDrawEnd,b=e.onClick,w=e.onDoubleClick,T=e.onRightClick,E=e.onPressedMoveStart,I=e.onPressedMoving,P=e.onPressedMoveEnd,D=e.onMouseEnter,M=e.onMouseLeave,k=e.onRemoved,A=e.onSelected,F=e.onDeselected;this.name=e.name,this.totalStep=!g(a)||2>a?1:a,this.lock=null!=s&&s,this.visible=null==l||l,this.zLevel=null!=u?u:0,this.needDefaultPointFigure=null!=c&&c,this.needDefaultXAxisFigure=null!=d&&d,this.needDefaultYAxisFigure=null!=p&&p,this.mode=null!=i?i:t.OverlayMode.Normal,this.modeSensitivity=null!=n?n:8,this.extendData=o,this.styles=h(null!=r?r:{}),this.createPointFigures=null!=v?v:null,this.createXAxisFigures=null!=f?f:null,this.createYAxisFigures=null!=y?y:null,this.performEventPressedMove=null!=m?m:null,this.performEventMoveForDrawing=null!=_?_:null,this.onDrawStart=null!=x?x:null,this.onDrawing=null!=S?S:null,this.onDrawEnd=null!=C?C:null,this.onClick=null!=b?b:null,this.onDoubleClick=null!=w?w:null,this.onRightClick=null!=T?T:null,this.onPressedMoveStart=null!=E?E:null,this.onPressedMoving=null!=I?I:null,this.onPressedMoveEnd=null!=P?P:null,this.onMouseEnter=null!=D?D:null,this.onMouseLeave=null!=M?M:null,this.onRemoved=null!=k?k:null,this.onSelected=null!=A?A:null,this.onDeselected=null!=F?F:null}return e.prototype.setId=function(t){return void 0===this.id&&(this.id=t,!0)},e.prototype.setGroupId=function(t){return void 0===this.groupId&&(this.groupId=t,!0)},e.prototype.setDefaultZLevel=function(t){return void 0===this.defaultZLevel&&(this.defaultZLevel=t,!0)},e.prototype.setPaneId=function(t){this.paneId=t},e.prototype.setExtendData=function(t){return t!==this.extendData&&(this.extendData=t,!0)},e.prototype.setStyles=function(t){return null!==t&&(c(this.styles,t),!0)},e.prototype.setPoints=function(t){if(t.length>0){var e=void 0;if(this.points=R([],L(t),!1),this.totalStep-1>t.length?(this.currentStep=t.length+1,e=t.length):(this.currentStep=-1,e=this.totalStep-1),null!==this.performEventMoveForDrawing)for(var i=0;e>i;i++)this.performEventMoveForDrawing({currentStep:i+2,mode:this.mode,points:this.points,performPointIndex:i,performPoint:this.points[i]});return-1===this.currentStep&&null!==this.performEventPressedMove&&this.performEventPressedMove({currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:this.points.length-1,performPoint:this.points[this.points.length-1]}),!0}return!1},e.prototype.setLock=function(t){return this.lock!==t&&(this.lock=t,!0)},e.prototype.setVisible=function(t){return this.visible!==t&&(this.visible=t,!0)},e.prototype.resetZLevel=function(){this.zLevel=this.defaultZLevel},e.prototype.setZLevel=function(t){return this.zLevel!==t&&(this.zLevel=t,!0)},e.prototype.setMode=function(t){return this.mode!==t&&(this.mode=t,!0)},e.prototype.setModeSensitivity=function(t){return this.modeSensitivity!==t&&(this.modeSensitivity=t,!0)},e.prototype.setOnDrawStartCallback=function(t){return this.onDrawStart!==t&&(this.onDrawStart=t,!0)},e.prototype.setOnDrawingCallback=function(t){return this.onDrawing!==t&&(this.onDrawing=t,!0)},e.prototype.setOnDrawEndCallback=function(t){return this.onDrawEnd!==t&&(this.onDrawEnd=t,!0)},e.prototype.setOnClickCallback=function(t){return this.onClick!==t&&(this.onClick=t,!0)},e.prototype.setOnDoubleClickCallback=function(t){return this.onDoubleClick!==t&&(this.onDoubleClick=t,!0)},e.prototype.setOnRightClickCallback=function(t){return this.onRightClick!==t&&(this.onRightClick=t,!0)},e.prototype.setOnPressedMoveStartCallback=function(t){return this.onPressedMoveStart!==t&&(this.onPressedMoveStart=t,!0)},e.prototype.setOnPressedMovingCallback=function(t){return this.onPressedMoving!==t&&(this.onPressedMoving=t,!0)},e.prototype.setOnPressedMoveEndCallback=function(t){return this.onPressedMoveEnd!==t&&(this.onPressedMoveEnd=t,!0)},e.prototype.setOnMouseEnterCallback=function(t){return this.onMouseEnter!==t&&(this.onMouseEnter=t,!0)},e.prototype.setOnMouseLeaveCallback=function(t){return this.onMouseLeave!==t&&(this.onMouseLeave=t,!0)},e.prototype.setOnRemovedCallback=function(t){return this.onRemoved!==t&&(this.onRemoved=t,!0)},e.prototype.setOnSelectedCallback=function(t){return this.onSelected!==t&&(this.onSelected=t,!0)},e.prototype.setOnDeselectedCallback=function(t){return this.onDeselected!==t&&(this.onDeselected=t,!0)},e.prototype.nextStep=function(){this.currentStep===this.totalStep-1?this.currentStep=-1:this.currentStep++},e.prototype.forceComplete=function(){this.currentStep=-1},e.prototype.isDrawing=function(){return-1!==this.currentStep},e.prototype.isStart=function(){return 1===this.currentStep},e.prototype.eventMoveForDrawing=function(t){var e,i=this.currentStep-1,n={};void 0!==t.timestamp&&(n.timestamp=t.timestamp),void 0!==t.dataIndex&&(n.dataIndex=t.dataIndex),void 0!==t.value&&(n.value=t.value),this.points[i]=n,null===(e=this.performEventMoveForDrawing)||void 0===e||e.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:i,performPoint:n})},e.prototype.eventPressedPointMove=function(t,e){var i;void 0!==t.dataIndex&&(this.points[e].dataIndex=t.dataIndex,this.points[e].timestamp=t.timestamp),void 0!==t.value&&(this.points[e].value=t.value),null===(i=this.performEventPressedMove)||void 0===i||i.call(this,{currentStep:this.currentStep,points:this.points,mode:this.mode,performPointIndex:e,performPoint:this.points[e]})},e.prototype.startPressedMove=function(t){this._prevPressedPoint=M({},t),this._prevPressedPoints=h(this.points)},e.prototype.eventPressedOtherMove=function(t,e){var i,n;null!==this._prevPressedPoint&&(void 0!==t.dataIndex&&void 0!==this._prevPressedPoint.dataIndex&&(i=t.dataIndex-this._prevPressedPoint.dataIndex),void 0!==t.value&&void 0!==this._prevPressedPoint.value&&(n=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map((function(t){var o;void 0===t.dataIndex&&void 0!==t.timestamp&&(t.dataIndex=e.timestampToDataIndex(t.timestamp));var r=M({},t);return void 0!==i&&void 0!==t.dataIndex&&(r.dataIndex=t.dataIndex+i,r.timestamp=null!==(o=e.dataIndexToTimestamp(r.dataIndex))&&void 0!==o?o:void 0),void 0!==n&&void 0!==t.value&&(r.value=t.value+n),r})))},e.extend=function(t){return function(e){function i(){return e.call(this,t)||this}return P(i,e),i}(e)},e}(),yt={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.precision,n=t.thousandsSeparator,o=t.overlay.points;if(e.length>0){var r=[],a=[],s=t.bounding.width;if(e.length>1&&void 0!==o[0].value&&void 0!==o[1].value){var l=e[0].y-e[1].y,u=o[0].value-o[1].value;[1,.786,.618,.5,.382,.236,0].forEach((function(t){var c,h=e[1].y+l*t,d=E(((null!==(c=o[1].value)&&void 0!==c?c:0)+u*t).toFixed(i.price),n);r.push({coordinates:[{x:0,y:h},{x:s,y:h}]}),a.push({x:0,y:h,text:"".concat(d," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})}))}return[{type:"line",attrs:r},{type:"text",isCheckEvent:!1,attrs:a}]}return[]}},mt={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i={x:0,y:e[0].y};return void 0!==e[1]&&e[1].x>e[0].x&&(i.x=t.bounding.width),[{type:"line",attrs:{coordinates:[e[0],i]}}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){2===t.currentStep&&(t.points[0].value=t.performPoint.value)}},_t=function(){function t(){this._children=[],this._callbacks=new Map}return t.prototype.registerEvent=function(t,e){return this._callbacks.set(t,e),this},t.prototype.onEvent=function(t,e,i){var n=this._callbacks.get(t);return!(void 0===n||!this.checkEventOn(e))&&n(e,i)},t.prototype.checkEventOn=function(t){var e,i;try{for(var n=F(this._children),o=n.next();!o.done;o=n.next()){if(o.value.checkEventOn(t))return!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return!1},t.prototype.dispatchEvent=function(t,e,i){var n=this._children.length-1;if(n>-1)for(var o=n;o>-1;o--)if(this._children[o].dispatchEvent(t,e,i))return!0;return this.onEvent(t,e,i)},t.prototype.addChild=function(t){return this._children.push(t),this},t.prototype.clear=function(){this._children=[]},t}(),xt=function(t){function e(e){var i=t.call(this)||this;return i.attrs=e.attrs,i.styles=e.styles,i}return P(e,t),e.prototype.checkEventOn=function(t){return this.checkEventOnImp(t,this.attrs,this.styles)},e.prototype.draw=function(t){this.drawImp(t,this.attrs,this.styles)},e.extend=function(t){var i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.checkEventOnImp=function(e,i,n){return t.checkEventOn(e,i,n)},i.prototype.drawImp=function(e,i,n){t.draw(e,i,n)},i}(e);return i},e}(_t);function St(t,e){return Math.sqrt(Math.pow(t.x+e.x,2)+Math.pow(t.y+e.y,2))}function Ct(t){var e=St(t[0],t[1]),i=e+St(t[1],t[2]),n=[t[2].x-t[0].x,t[2].y-t[0].y];return[{x:t[1].x-.5*n[0]*e/i,y:t[1].y-.5*n[1]*e/i},{x:t[1].x+.5*n[0]*e/i,y:t[1].y+.5*n[1]*e/i}]}function bt(t,e){var i=e.coordinates;if(i.length>1)for(var n=1;i.length>n;n++){var o=i[n-1],r=i[n];if(o.x===r.x){if(4>Math.abs(o.y-t.y)+Math.abs(r.y-t.y)-Math.abs(o.y-r.y)&&2>Math.abs(t.x-o.x))return!0}else{var a=Et(o,r),s=wt(a,t),l=Math.abs(s-t.y);if(4>Math.abs(o.x-t.x)+Math.abs(r.x-t.x)-Math.abs(o.x-r.x)&&4>l*l/(a[0]*a[0]+1))return!0}}return!1}function wt(t,e){return null!=t?e.x*t[0]+t[1]:e.y}function Tt(t,e,i){return wt(Et(t,e),i)}function Et(t,e){var i=t.x-e.x;if(0!==i){var n=(t.y-e.y)/i;return[n,t.y-n*t.x]}return null}function It(e,i,n){var o=i.coordinates,r=o.length;if(r>1){var a=n.style,s=void 0===a?t.LineType.Solid:a,l=n.smooth,u=n.size,c=n.color,h=void 0===c?"currentColor":c,d=n.dashedValue,p=void 0===d?[2,2]:d;if(e.lineWidth=void 0===u?1:u,e.strokeStyle=h,e.setLineDash(s===t.LineType.Dashed?p:[]),e.beginPath(),e.moveTo(o[0].x,o[0].y),null!=l&&l){for(var v=[],g=1;r-1>g;g++)v=v.concat(Ct([o[g-1],o[g],o[g+1]]));e.quadraticCurveTo(v[0].x,v[0].y,o[1].x,o[1].y);for(var f=2;r-1>f;f++)e.bezierCurveTo(v[2*(f-2)+1].x,v[2*(f-2)+1].y,v[2*(f-1)].x,v[2*(f-1)].y,o[f].x,o[f].y);e.quadraticCurveTo(v[2*(f-2)+1].x,v[2*(f-2)+1].y,o[f].x,o[f].y)}else for(f=1;o.length>f;f++)e.lineTo(o[f].x,o[f].y);e.stroke(),e.closePath()}}var Pt={name:"line",checkEventOn:bt,draw:function(t,e,i){It(t,e,i)}};function Dt(t,e,i){var n=null!=i?i:0,o=[];if(t.length>1)if(t[0].x===t[1].x){var r=e.height;if(o.push({coordinates:[{x:t[0].x,y:0},{x:t[0].x,y:r}]}),t.length>2){o.push({coordinates:[{x:t[2].x,y:0},{x:t[2].x,y:r}]});for(var a=t[0].x-t[2].x,s=0;n>s;s++){var l=a*(s+1);o.push({coordinates:[{x:t[0].x+l,y:0},{x:t[0].x+l,y:r}]})}}}else{var u=e.width,c=Et(t[0],t[1]),h=c[0],d=c[1];if(o.push({coordinates:[{x:0,y:0*h+d},{x:u,y:u*h+d}]}),t.length>2){var p=t[2].y-h*t[2].x;o.push({coordinates:[{x:0,y:0*h+p},{x:u,y:u*h+p}]});for(a=d-p,s=0;n>s;s++){var v=d+a*(s+1);o.push({coordinates:[{x:0,y:0*h+v},{x:u,y:u*h+v}]})}}}return o}function Mt(t,e){if(t.length>1){var i=void 0;return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[1].y>t[0].y?{x:t[0].x,y:e.height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:Tt(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:Tt(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],i]}}return[]}var kt={name:"simpleAnnotation",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e,i,n=t.overlay,o=t.coordinates;f(n.extendData)&&(i=p(n.extendData)?n.extendData(n):null!==(e=n.extendData)&&void 0!==e?e:"");var r=o[0].x,a=o[0].y-6,s=a-50,l=s-5;return[{type:"line",attrs:{coordinates:[{x:r,y:a},{x:r,y:s}]},ignoreEvent:!0},{type:"polygon",attrs:{coordinates:[{x:r,y:s},{x:r-4,y:l},{x:r+4,y:l}]},ignoreEvent:!0},{type:"text",attrs:{x:r,y:l,text:null!=i?i:"",align:"center",baseline:"bottom"},ignoreEvent:!0}]}},At={name:"simpleTag",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e=t.coordinates;return{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:t.bounding.width,y:e[0].y}]},ignoreEvent:!0}},createYAxisFigures:function(t){var e,i,n,o,r,a=t.overlay,s=t.coordinates,l=t.bounding,u=t.yAxis,c=t.precision;return null!==(e=null==u?void 0:u.isFromZero())&&void 0!==e&&e?(n="left",o=0):(n="right",o=l.width),f(a.extendData)&&(r=p(a.extendData)?a.extendData(a):null!==(i=a.extendData)&&void 0!==i?i:""),f(r)||void 0===a.points[0].value||(r=w(a.points[0].value,c.price)),{type:"text",attrs:{x:o,y:s[0].y,text:null!=r?r:"",align:n,baseline:"middle"}}}},Ft={};function Lt(t){var e;return null!==(e=Ft[t])&&void 0!==e?e:null}[yt,mt,{name:"horizontalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=[];return 2===e.length&&i.push({coordinates:e}),[{type:"line",attrs:i}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){2===t.currentStep&&(t.points[0].value=t.performPoint.value)}},{name:"horizontalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return[{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:t.bounding.width,y:e[0].y}]}}]}},{name:"parallelStraightLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:Dt(t.coordinates,t.bounding)}]}},{name:"priceChannelLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:Dt(t.coordinates,t.bounding,1)}]}},{name:"priceLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.thousandsSeparator,n=t.overlay.points[0].value;return[{type:"line",attrs:{coordinates:[e[0],{x:t.bounding.width,y:e[0].y}]}},{type:"text",ignoreEvent:!0,attrs:{x:e[0].x,y:e[0].y,text:E((void 0===n?0:n).toFixed(t.precision.price),i),baseline:"bottom"}}]}},{name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:Mt(t.coordinates,t.bounding)}]}},{name:"segment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]}},{name:"straightLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return 2===e.length?e[0].x===e[1].x?[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]:[{type:"line",attrs:{coordinates:[{x:0,y:Tt(e[0],e[1],{x:0,y:e[0].y})},{x:i.width,y:Tt(e[0],e[1],{x:i.width,y:e[0].y})}]}}]:[]}},{name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;if(2===e.length){var i={x:e[0].x,y:0};return e[1].y>e[0].y&&(i.y=t.bounding.height),[{type:"line",attrs:{coordinates:[e[0],i]}}]}return[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.points,i=t.performPoint;2===t.currentStep&&(e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex)}},{name:"verticalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.points,i=t.performPoint;2===t.currentStep&&(e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex)}},{name:"verticalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:t.bounding.height}]}}]}},kt,At].forEach((function(t){Ft[t.name]=ft.extend(t)}));var Rt="candle_pane",Bt="indicator_pane_",Ot="x_axis_pane",Vt=function(){function t(t){this._instances=new Map,this._counter=new Map,this._progressInstanceInfo=null,this._pressedInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._hoverInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._clickInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._chartStore=t}return t.prototype._overrideInstance=function(t,e){var i=e.id,n=e.groupId,o=e.points,r=e.styles,a=e.lock,s=e.visible,l=e.zLevel,u=e.mode,c=e.modeSensitivity,h=e.extendData,d=e.onDrawStart,p=e.onDrawing,v=e.onDrawEnd,g=e.onClick,f=e.onDoubleClick,y=e.onRightClick,m=e.onPressedMoveStart,_=e.onPressedMoving,x=e.onPressedMoveEnd,S=e.onMouseEnter,C=e.onMouseLeave,b=e.onRemoved,w=e.onSelected,T=e.onDeselected,E=!1,I=!1;return void 0!==i&&t.setId(i),void 0!==n&&t.setGroupId(n),void 0!==o&&t.setPoints(o)&&(E=!0),void 0!==r&&t.setStyles(r)&&(E=!0),void 0!==a&&t.setLock(a),void 0!==s&&t.setVisible(s)&&(E=!0),void 0!==l&&t.setZLevel(l)&&(E=!0,I=!0),void 0!==u&&t.setMode(u),void 0!==c&&t.setModeSensitivity(c),void 0!==h&&t.setExtendData(h)&&(E=!0),void 0!==d&&t.setOnDrawStartCallback(d),void 0!==p&&t.setOnDrawingCallback(p),void 0!==v&&t.setOnDrawEndCallback(v),void 0!==g&&t.setOnClickCallback(g),void 0!==f&&t.setOnDoubleClickCallback(f),void 0!==y&&t.setOnRightClickCallback(y),void 0!==m&&t.setOnPressedMoveStartCallback(m),void 0!==_&&t.setOnPressedMovingCallback(_),void 0!==x&&t.setOnPressedMoveEndCallback(x),void 0!==S&&t.setOnMouseEnterCallback(S),void 0!==C&&t.setOnMouseLeaveCallback(C),void 0!==b&&t.setOnRemovedCallback(b),void 0!==w&&t.setOnSelectedCallback(w),void 0!==T&&t.setOnDeselectedCallback(T),[E,I]},t.prototype.getInstanceById=function(t){var e,i;try{for(var n=F(this._instances),o=n.next();!o.done;o=n.next()){var r=o.value[1].find((function(e){return e.id===t}));if(void 0!==r)return r}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return null!==this._progressInstanceInfo&&this._progressInstanceInfo.instance.id===t?this._progressInstanceInfo.instance:null},t.prototype._sort=function(t){var e;void 0!==t?null===(e=this._instances.get(t))||void 0===e||e.sort((function(t,e){return t.defaultZLevel-e.defaultZLevel})).sort((function(t,e){return t.zLevel-e.zLevel})):this._instances.forEach((function(t){t.sort((function(t,e){return t.defaultZLevel-e.defaultZLevel})).sort((function(t,e){return t.zLevel-e.zLevel}))}))},t.prototype.addInstances=function(t,e,i){var n=this,o=t.map((function(t){var o,r,a,s,l,u=null!==(o=t.id)&&void 0!==o?o:N("overlay_");if(null===n.getInstanceById(u)){var c=Lt(t.name);if(null!==c){var h=new c,d=(null!==(r=n._counter.get(e))&&void 0!==r?r:0)+1;n._counter.set(e,d),h.setDefaultZLevel(d),h.setPaneId(e);var p=null!==(a=t.groupId)&&void 0!==a?a:u;return t.id=u,t.groupId=p,n._overrideInstance(h,t),h.isDrawing()?n._progressInstanceInfo={paneId:e,instance:h,appointPaneFlag:i}:(n._instances.has(e)||n._instances.set(e,[]),null===(s=n._instances.get(e))||void 0===s||s.push(h)),h.isStart()&&(null===(l=h.onDrawStart)||void 0===l||l.call(h,{overlay:h})),u}}return null}));return o.some((function(t){return null!==t}))&&(this._sort(),this._chartStore.getChart().updatePane(1,e)),o},t.prototype.getProgressInstanceInfo=function(){return this._progressInstanceInfo},t.prototype.progressInstanceComplete=function(){var t;if(null!==this._progressInstanceInfo){var e=this._progressInstanceInfo,i=e.instance,n=e.paneId;i.isDrawing()||(this._instances.has(n)||this._instances.set(n,[]),null===(t=this._instances.get(n))||void 0===t||t.push(i),this._sort(n),this._progressInstanceInfo=null)}},t.prototype.updateProgressInstanceInfo=function(t,e){null!==this._progressInstanceInfo&&(void 0!==e&&e&&(this._progressInstanceInfo.appointPaneFlag=e),this._progressInstanceInfo.paneId=t,this._progressInstanceInfo.instance.setPaneId(t))},t.prototype.getInstances=function(t){var e;if(void 0===t){var i=[];return this._instances.forEach((function(t){i=i.concat(t)})),i}return null!==(e=this._instances.get(t))&&void 0!==e?e:[]},t.prototype.override=function(t){var e=this,i=t.id,n=t.groupId,o=t.name,r=!1,a=!1,s=function(i){var n=e._overrideInstance(i,t);n[0]&&(r=!0),n[1]&&(a=!0)};if(void 0!==i){var l=this.getInstanceById(i);null!==l&&s(l)}else if(this._instances.forEach((function(t){t.forEach((function(t){(void 0!==o&&t.name===o||void 0!==n&&t.groupId===n||void 0===o&&void 0===n)&&s(t)}))})),null!==this._progressInstanceInfo){var u=this._progressInstanceInfo.instance;(void 0!==o&&u.name===o||void 0!==n&&u.groupId===n||void 0===o&&void 0===n)&&s(u)}a&&this._sort(),r&&this._chartStore.getChart().updatePane(1)},t.prototype.removeInstance=function(t){var e,i,n,o=function(t,e){if(void 0!==t.id){if(e.id!==t.id)return!1}else if(void 0!==t.groupId){if(e.groupId!==t.groupId)return!1}else if(void 0!==t.name&&e.name!==t.name)return!1;return!0},r=[];if(null!==this._progressInstanceInfo){var a=this._progressInstanceInfo.instance;(void 0===t||void 0!==t&&o(t,a))&&(r.push(this._progressInstanceInfo.paneId),null===(n=a.onRemoved)||void 0===n||n.call(a,{overlay:a}),this._progressInstanceInfo=null)}if(void 0!==t){var s=new Map,l=function(e){var i=e[1].filter((function(i){var n;return!o(t,i)||(r.includes(e[0])||r.push(e[0]),null===(n=i.onRemoved)||void 0===n||n.call(i,{overlay:i}),!1)}));i.length>0&&s.set(e[0],i)};try{for(var u=F(this._instances),c=u.next();!c.done;c=u.next()){l(c.value)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}this._instances=s}else this._instances.forEach((function(t,e){r.push(e),t.forEach((function(t){var e;null===(e=t.onRemoved)||void 0===e||e.call(t,{overlay:t})}))})),this._instances.clear();if(r.length>0){var h=this._chartStore.getChart();r.forEach((function(t){h.updatePane(1,t)})),h.updatePane(1,Ot)}},t.prototype.setPressedInstanceInfo=function(t){this._pressedInstanceInfo=t},t.prototype.getPressedInstanceInfo=function(){return this._pressedInstanceInfo},t.prototype.setHoverInstanceInfo=function(t,e){var i,n,o=this._hoverInstanceInfo,r=o.instance,a=o.figureKey,s=o.figureIndex;if(((null==r?void 0:r.id)!==(null===(i=t.instance)||void 0===i?void 0:i.id)||o.figureType!==t.figureType||s!==t.figureIndex)&&(this._hoverInstanceInfo=t,(null==r?void 0:r.id)!==(null===(n=t.instance)||void 0===n?void 0:n.id))){var l=!1,u=!1;null!==r&&(u=!0,r.resetZLevel(),p(r.onMouseLeave)&&(r.onMouseLeave(M({overlay:r,figureKey:a,figureIndex:s},e)),l=!0)),null!==t.instance&&(u=!0,t.instance.setZLevel(gt),p(t.instance.onMouseEnter)&&(t.instance.onMouseEnter(M({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),l=!0)),u&&this._sort(),l||this._chartStore.getChart().updatePane(1)}},t.prototype.getHoverInstanceInfo=function(){return this._hoverInstanceInfo},t.prototype.setClickInstanceInfo=function(t,e){var i,n,o,r,a,s,l,u,c,h=this._clickInstanceInfo,d=h.paneId,p=h.instance,v=h.figureType,g=h.figureKey,f=h.figureIndex;if(null!==(n=null===(i=t.instance)||void 0===i?void 0:i.isDrawing())&&void 0!==n&&n||null===(r=null===(o=t.instance)||void 0===o?void 0:o.onClick)||void 0===r||r.call(o,M({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),((null==p?void 0:p.id)!==(null===(a=t.instance)||void 0===a?void 0:a.id)||v!==t.figureType||f!==t.figureIndex)&&(this._clickInstanceInfo=t,(null==p?void 0:p.id)!==(null===(s=t.instance)||void 0===s?void 0:s.id))){null===(l=null==p?void 0:p.onDeselected)||void 0===l||l.call(p,M({overlay:p,figureKey:g,figureIndex:f},e)),null===(c=null===(u=t.instance)||void 0===u?void 0:u.onSelected)||void 0===c||c.call(u,M({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e));var y=this._chartStore.getChart();y.updatePane(1,t.paneId),d!==t.paneId&&y.updatePane(1,d),y.updatePane(1,Ot)}},t.prototype.getClickInstanceInfo=function(){return this._clickInstanceInfo},t.prototype.isEmpty=function(){return 0===this._instances.size&&null===this._progressInstanceInfo},t.prototype.isDrawing=function(){var t,e;return null!==this._progressInstanceInfo&&null!==(e=null===(t=this._progressInstanceInfo)||void 0===t?void 0:t.instance.isDrawing())&&void 0!==e&&e},t}(),Wt=function(){function t(){this._actions=new Map}return t.prototype.execute=function(t,e){var i;null===(i=this._actions.get(t))||void 0===i||i.execute(e)},t.prototype.subscribe=function(t,e){var i;this._actions.has(t)||this._actions.set(t,new O),null===(i=this._actions.get(t))||void 0===i||i.subscribe(e)},t.prototype.unsubscribe=function(t,e){var i=this._actions.get(t);void 0!==i&&(i.unsubscribe(e),i.isEmpty()&&this._actions.delete(t))},t.prototype.has=function(t){var e=this._actions.get(t);return void 0!==e&&!e.isEmpty()},t}(),Nt={light:{grid:{horizontal:{color:"#EDEDED"},vertical:{color:"#EDEDED"}},candle:{priceMark:{high:{color:"#76808F"},low:{color:"#76808F"}},tooltip:{rect:{color:"#FEFEFE",borderColor:"#F2F3F5"},text:{color:"#76808F"}}},indicator:{tooltip:{text:{color:"#76808F"}}},xAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},yAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},separator:{color:"#DDDDDD"},crosshair:{horizontal:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}},vertical:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}}}},dark:{grid:{horizontal:{color:"#292929"},vertical:{color:"#292929"}},candle:{priceMark:{high:{color:"#929AA5"},low:{color:"#929AA5"}},tooltip:{rect:{color:"rgba(10, 10, 10, .6)",borderColor:"rgba(10, 10, 10, .6)"},text:{color:"#929AA5"}}},indicator:{tooltip:{text:{color:"#929AA5"}}},xAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},yAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},separator:{color:"#333333"},crosshair:{horizontal:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}},vertical:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}}}}};function zt(t){var e;return null!==(e=Nt[t])&&void 0!==e?e:null}var Yt=function(){function e(e,i){this._styles={grid:{show:!0,horizontal:{show:!0,size:1,color:"#EDEDED",style:t.LineType.Dashed,dashedValue:[2,2]},vertical:{show:!0,size:1,color:"#EDEDED",style:t.LineType.Dashed,dashedValue:[2,2]}},candle:{type:t.CandleType.CandleSolid,bar:{upColor:"#2DC08E",downColor:"#F92855",noChangeColor:"#888888",upBorderColor:"#2DC08E",downBorderColor:"#F92855",noChangeBorderColor:"#888888",upWickColor:"#2DC08E",downWickColor:"#F92855",noChangeWickColor:"#888888"},area:{lineSize:2,lineColor:"#1677FF",value:"close",backgroundColor:[{offset:0,color:"rgba(22, 119, 255, 0.01)"},{offset:1,color:"rgba(22, 119, 255, 0.2)"}]},priceMark:{show:!0,high:{show:!0,color:"#76808F",textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"},low:{show:!0,color:"#76808F",textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"},last:{show:!0,upColor:"#2DC08E",downColor:"#F92855",noChangeColor:"#888888",line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,4],size:1},text:{show:!0,style:t.PolygonType.Fill,size:12,paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderColor:"transparent",borderStyle:t.LineType.Solid,borderSize:0,borderDashedValue:[2,2],color:"#FFFFFF",family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,custom:null,defaultValue:"n/a",rect:{position:a.Fixed,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:8,offsetLeft:10,offsetTop:8,offsetRight:10,offsetBottom:8,borderRadius:4,borderSize:1,borderColor:"#F2F3F5",color:"#FEFEFE"},text:{size:12,family:"Helvetica Neue",weight:"normal",color:"#76808F",marginLeft:10,marginTop:8,marginRight:6,marginBottom:0},icons:[]}},indicator:{ohlc:{upColor:"rgba(45, 192, 142, .7)",downColor:"rgba(249, 40, 85, .7)",noChangeColor:"#888888"},bars:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:"rgba(45, 192, 142, .7)",downColor:"rgba(249, 40, 85, .7)",noChangeColor:"#888888"}],lines:[{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:"#FF9600"},{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:"#935EBD"},{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:"#1677FF"},{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:"#E11D74"},{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:"#01C5C4"}],circles:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:"rgba(45, 192, 142, .7)",downColor:"rgba(249, 40, 85, .7)",noChangeColor:"#888888"}],lastValueMark:{show:!1,text:{show:!1,style:t.PolygonType.Fill,color:"#FFFFFF",size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderColor:"transparent",borderSize:1,borderDashedValue:[2,2],paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderRadius:2}},tooltip:{showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:"#76808F",marginLeft:10,marginTop:8,marginRight:6,marginBottom:0},icons:[]}},xAxis:{show:!0,size:"auto",axisLine:{show:!0,color:"#DDDDDD",size:1},tickText:{show:!0,color:"#76808F",size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:4},tickLine:{show:!0,size:1,length:3,color:"#DDDDDD"}},yAxis:{show:!0,size:"auto",type:t.YAxisType.Normal,position:t.YAxisPosition.Right,inside:!1,reverse:!1,axisLine:{show:!0,color:"#DDDDDD",size:1},tickText:{show:!0,color:"#76808F",size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:4},tickLine:{show:!0,size:1,length:3,color:"#DDDDDD"}},separator:{size:1,color:"#DDDDDD",fill:!0,activeBackgroundColor:"rgba(33, 150, 243, 0.08)"},crosshair:{show:!0,horizontal:{show:!0,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,2],size:1,color:"#76808F"},text:{show:!0,style:t.PolygonType.Fill,color:"#FFFFFF",size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:"#686D76",borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:"#686D76"}},vertical:{show:!0,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,2],size:1,color:"#76808F"},text:{show:!0,style:t.PolygonType.Fill,color:"#FFFFFF",size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:"#686D76",paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:"#686D76"}}},overlay:{point:{color:"#1677FF",borderColor:"rgba(22, 119, 255, 0.35)",borderSize:1,radius:5,activeColor:"#1677FF",activeBorderColor:"rgba(22, 119, 255, 0.35)",activeBorderSize:3,activeRadius:5},line:{style:t.LineType.Solid,smooth:!1,color:"#1677FF",size:1,dashedValue:[2,2]},rect:{style:t.PolygonType.Fill,color:"rgba(22, 119, 255, 0.25)",borderColor:"#1677FF",borderSize:1,borderRadius:0,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},polygon:{style:t.PolygonType.Fill,color:"#1677FF",borderColor:"#1677FF",borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},circle:{style:t.PolygonType.Fill,color:"rgba(22, 119, 255, 0.25)",borderColor:"#1677FF",borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},arc:{style:t.LineType.Solid,color:"#1677FF",size:1,dashedValue:[2,2]},text:{style:t.PolygonType.Fill,color:"#FFFFFF",size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:"#1677FF",paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:"#1677FF"},rectText:{style:t.PolygonType.Fill,color:"#FFFFFF",size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:"#1677FF",paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:"#1677FF"}}},this._customApi={formatDate:b,formatBigNumber:T},this._locale="en-US",this._precision={price:2,volume:0},this._thousandsSeparator=",",this._dataList=[],this._timeScaleStore=new Q(this),this._indicatorStore=new dt(this),this._overlayStore=new Vt(this),this._tooltipStore=new pt(this),this._actionStore=new Wt,this._visibleDataList=[],this._chart=e,this.setOptions(i)}return e.prototype.adjustVisibleDataList=function(){this._visibleDataList=[];for(var t=this._timeScaleStore.getVisibleRange(),e=t.to,i=t.from;e>i;i++){var n=this._dataList[i],o=this._timeScaleStore.dataIndexToCoordinate(i);this._visibleDataList.push({dataIndex:i,x:o,data:n})}},e.prototype.setOptions=function(t){if(void 0!==t){var e=t.locale,i=t.timezone,n=t.styles,o=t.customApi;void 0!==e&&(this._locale=e),void 0!==i&&this._timeScaleStore.setTimezone(i),void 0!==n&&(m(n)?c(this._styles,zt(n)):c(this._styles,n)),void 0!==o&&c(this._customApi,o),void 0!==t.thousandsSeparator&&(this._thousandsSeparator=t.thousandsSeparator)}return this},e.prototype.getStyles=function(){return this._styles},e.prototype.getLocale=function(){return this._locale},e.prototype.getCustomApi=function(){return this._customApi},e.prototype.getThousandsSeparator=function(){return this._thousandsSeparator},e.prototype.getPrecision=function(){return this._precision},e.prototype.setPrecision=function(t){return this._precision=t,this._indicatorStore.setSeriesPrecision(t),this},e.prototype.getDataList=function(){return this._dataList},e.prototype.getVisibleDataList=function(){return this._visibleDataList},e.prototype.addData=function(t,e,i){if(d(t)){this._timeScaleStore.setLoading(!1),this._timeScaleStore.setMore(null==i||i);var n=0===this._dataList.length;this._dataList=t.concat(this._dataList),n&&this._timeScaleStore.resetOffsetRightDistance(),this._timeScaleStore.adjustVisibleRange()}else{if(e<this._dataList.length)this._dataList[e]=t,this.adjustVisibleDataList();else{this._dataList.push(t);var o=this._timeScaleStore.getOffsetRightBarCount();0>o&&this._timeScaleStore.setOffsetRightBarCount(--o),this._timeScaleStore.adjustVisibleRange()}}this._tooltipStore.recalculateCrosshair(!0)},e.prototype.clear=function(){this._dataList=[],this._visibleDataList=[],this._timeScaleStore.clear(),this._tooltipStore.clear()},e.prototype.getTimeScaleStore=function(){return this._timeScaleStore},e.prototype.getIndicatorStore=function(){return this._indicatorStore},e.prototype.getOverlayStore=function(){return this._overlayStore},e.prototype.getTooltipStore=function(){return this._tooltipStore},e.prototype.getActionStore=function(){return this._actionStore},e.prototype.getChart=function(){return this._chart},e}(),Ht="main",Xt="xAxis",jt="yAxis",Zt="separator";function Gt(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return void 0!==t&&c(e,t),e}var Kt=function(t){function e(e,i){var n=t.call(this)||this;return n._bounding=Gt(),n._pane=i,n.init(e),n}return P(e,t),e.prototype.init=function(t){this._rootContainer=t,this._container=this.createContainer(),t.appendChild(this._container)},e.prototype.setBounding=function(t){return c(this._bounding,t),this},e.prototype.getContainer=function(){return this._container},e.prototype.getBounding=function(){return this._bounding},e.prototype.getPane=function(){return this._pane},e.prototype.update=function(t){this.updateImp(this._container,this._bounding,null!=t?t:3)},e.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},e}(_t);function Ut(t){return null==window.requestAnimationFrame?window.setTimeout(t,20):window.requestAnimationFrame(t)}function qt(t){null==window.cancelAnimationFrame&&window.clearTimeout(t),window.cancelAnimationFrame(t)}var $t=-1,Jt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._mainRequestAnimationId=$t,e._overlayRequestAnimationId=$t,e}return P(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this._mainCanvas=z("canvas",{position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"}),this._mainCtx=this._mainCanvas.getContext("2d"),this._overlayCanvas=z("canvas",{position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"}),this._overlayCtx=this._overlayCanvas.getContext("2d");var i=this.getContainer();i.appendChild(this._mainCanvas),i.appendChild(this._overlayCanvas)},e.prototype.createContainer=function(){return z("div",{margin:"0",padding:"0",position:"absolute",top:"0",overflow:"hidden",boxSizing:"border-box",zIndex:"1"})},e.prototype._optimalUpdateMain=function(t,e){var i=this;this._mainRequestAnimationId!==$t&&(qt(this._mainRequestAnimationId),this._mainRequestAnimationId=$t),this._mainRequestAnimationId=Ut((function(){if(t!==i._mainCanvas.offsetWidth||e!==i._mainCanvas.offsetHeight){i._mainCtx.clearRect(0,0,i._mainCanvas.offsetWidth,i._mainCanvas.offsetHeight);var n=Y(i._mainCanvas),o=Math.floor(t*n),r=Math.floor(e*n);i._mainCanvas.style.width="".concat(t,"px"),i._mainCanvas.style.height="".concat(e,"px"),i._mainCanvas.width=o,i._mainCanvas.height=r,i._mainCtx.scale(n,n)}else i._mainCtx.clearRect(0,0,i._mainCanvas.offsetWidth,i._mainCanvas.offsetHeight);i.updateMain(i._mainCtx)}))},e.prototype._optimalUpdateOverlay=function(t,e){var i=this;this._overlayRequestAnimationId!==$t&&(qt(this._overlayRequestAnimationId),this._overlayRequestAnimationId=$t),this._overlayRequestAnimationId=Ut((function(){if(t!==i._overlayCanvas.offsetWidth||e!==i._overlayCanvas.offsetHeight){i._overlayCtx.clearRect(0,0,i._overlayCanvas.offsetWidth,i._overlayCanvas.offsetHeight);var n=Y(i._overlayCanvas),o=Math.floor(t*n),r=Math.floor(e*n);i._overlayCanvas.style.width="".concat(t,"px"),i._overlayCanvas.style.height="".concat(e,"px"),i._overlayCanvas.width=o,i._overlayCanvas.height=r,i._overlayCtx.scale(n,n)}else i._overlayCtx.clearRect(0,0,i._overlayCanvas.offsetWidth,i._overlayCanvas.offsetHeight);i.updateOverlay(i._overlayCtx)}))},e.prototype.updateImp=function(t,e,i){var n=e.width,o=e.height;t.style.left="".concat(e.left,"px");var r=i;switch(n===t.offsetWidth&&o===t.offsetHeight||(t.style.width="".concat(n,"px"),t.style.height="".concat(o,"px"),r=3),r){case 0:this._optimalUpdateMain(n,o);break;case 1:this._optimalUpdateOverlay(n,o);break;case 3:case 4:this._optimalUpdateMain(n,o),this._optimalUpdateOverlay(n,o)}},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=z("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=Y(o);return o.width=i*a,o.height=n*a,r.scale(a,a),r.drawImage(this._mainCanvas,0,0,i,n),t&&r.drawImage(this._overlayCanvas,0,0,i,n),o},e}(Kt);function Qt(t,e){var i=t.x-e.x,n=t.y-e.y,o=e.r;return!(i*i+n*n>o*o)}function te(e,i,n){var o=i.x,r=i.y,a=i.r,s=n.style,l=void 0===s?t.PolygonType.Fill:s,u=n.color,c=n.borderSize,h=void 0===c?1:c,d=n.borderColor,p=void 0===d?"currentColor":d,v=n.borderStyle,g=void 0===v?t.LineType.Solid:v,f=n.borderDashedValue,y=void 0===f?[2,2]:f;l!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||(e.fillStyle=void 0===u?"currentColor":u,e.beginPath(),e.arc(o,r,a,0,2*Math.PI),e.closePath(),e.fill()),l!==t.PolygonType.Stroke&&n.style!==t.PolygonType.StrokeFill||(e.strokeStyle=p,e.lineWidth=h,e.setLineDash(g===t.LineType.Dashed?y:[]),e.beginPath(),e.arc(o,r,a,0,2*Math.PI),e.closePath(),e.stroke())}var ee={name:"circle",checkEventOn:Qt,draw:function(t,e,i){te(t,e,i)}};function ie(t,e){for(var i=!1,n=e.coordinates,o=0,r=n.length-1;n.length>o;r=o++)n[o].y>t.y!=n[r].y>t.y&&(n[r].x-n[o].x)*(t.y-n[o].y)/(n[r].y-n[o].y)+n[o].x>t.x&&(i=!i);return i}function ne(e,i,n){var o=i.coordinates,r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=n.borderSize,u=void 0===l?1:l,c=n.borderColor,h=void 0===c?"currentColor":c,d=n.borderStyle,p=void 0===d?t.LineType.Solid:d,v=n.borderDashedValue,g=void 0===v?[2,2]:v;if(a===t.PolygonType.Fill||n.style===t.PolygonType.StrokeFill){e.fillStyle=void 0===s?"currentColor":s,e.beginPath(),e.moveTo(o[0].x,o[0].y);for(var f=1;o.length>f;f++)e.lineTo(o[f].x,o[f].y);e.closePath(),e.fill()}if(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill){e.strokeStyle=h,e.lineWidth=u,e.setLineDash(p===t.LineType.Dashed?g:[]),e.beginPath(),e.moveTo(o[0].x,o[0].y);for(f=1;o.length>f;f++)e.lineTo(o[f].x,o[f].y);e.closePath(),e.stroke()}}var oe={name:"polygon",checkEventOn:ie,draw:function(t,e,i){ne(t,e,i)}};function re(t){return"transparent"===t}function ae(t,e){var i=e.x,n=e.width;4>n&&(i-=2,n=4);var o=e.y,r=e.height;return 4>r&&(o-=2,r=4),!(i>t.x||t.x>i+n||o>t.y||t.y>o+r)}function se(e,i,n){var o=i.x,r=i.y,a=i.width,s=i.height,l=n.style,u=void 0===l?t.PolygonType.Fill:l,c=n.color,h=void 0===c?"transparent":c,d=n.borderSize,p=void 0===d?1:d,v=n.borderColor,g=void 0===v?"transparent":v,f=n.borderStyle,y=void 0===f?t.LineType.Solid:f,_=n.borderRadius,x=void 0===_?0:_,S=n.borderDashedValue,C=void 0===S?[2,2]:S;if(u===t.PolygonType.Fill||n.style===t.PolygonType.StrokeFill){var b=!0;m(h)&&(b=!re(h)),b&&(e.fillStyle=h,e.beginPath(),e.moveTo(o+x,r),e.arcTo(o+a,r,o+a,r+s,x),e.arcTo(o+a,r+s,o,r+s,x),e.arcTo(o,r+s,o,r,x),e.arcTo(o,r,o+a,r,x),e.closePath(),e.fill())}u!==t.PolygonType.Stroke&&n.style!==t.PolygonType.StrokeFill||re(g)||0>p||(e.strokeStyle=g,e.lineWidth=p,e.setLineDash(y===t.LineType.Dashed?C:[]),e.beginPath(),e.moveTo(o+x,r),e.arcTo(o+a,r,o+a,r+s,x),e.arcTo(o+a,r+s,o,r+s,x),e.arcTo(o,r+s,o,r,x),e.arcTo(o,r,o+a,r,x),e.closePath(),e.stroke())}var le={name:"rect",checkEventOn:ae,draw:function(t,e,i){se(t,e,i)}};function ue(t,e){var i,n,o=e.size,r=void 0===o?12:o,a=e.paddingLeft,s=e.paddingTop,l=void 0===s?0:s,u=e.paddingRight,c=void 0===u?0:u,h=e.paddingBottom,d=void 0===h?0:h,p=e.weight,v=t.x,g=t.y,f=t.align,y=void 0===f?"left":f,m=t.baseline,_=void 0===m?"top":m,x=t.width,S=t.height,C=null!=x?x:(void 0===a?0:a)+X(t.text,r,void 0===p?"normal":p,e.family)+c,b=null!=S?S:l+r+d;switch(y){case"left":case"start":i=v;break;case"right":case"end":i=v-C;break;default:i=v-C/2}switch(_){case"top":case"hanging":n=g;break;case"bottom":case"ideographic":case"alphabetic":n=g-b;break;default:n=g-b/2}return{x:i,y:n,width:C,height:b}}function ce(t,e,i){var n=ue(e,i),o=n.x,r=n.y;return!(o>t.x||t.x>o+n.width||r>t.y||t.y>r+n.height)}function he(t,e,i){var n=e.text,o=i.color,r=void 0===o?"currentColor":o,a=i.size,s=void 0===a?12:a,l=i.family,u=i.weight,c=i.paddingLeft,h=void 0===c?0:c,d=i.paddingTop,p=void 0===d?0:d,v=i.paddingRight,g=void 0===v?0:v,f=ue(e,i);se(t,f,M(M({},i),{color:i.backgroundColor})),t.textAlign="left",t.textBaseline="top",t.font=H(s,u,l),t.fillStyle=r,t.fillText(n,f.x+h,f.y+p,f.width-h-g)}var de={name:"text",checkEventOn:function(t,e,i){return ce(t,e,i)},draw:function(t,e,i){he(t,e,i)}},pe=he;function ve(t,e){if(2>Math.abs(Math.sqrt((h=(u=t).x-(c=e).x)*h+(d=u.y-c.y)*d)-e.r)){var i=e.r,n=e.startAngle,o=e.endAngle,r=i*Math.cos(n)+e.x,a=i*Math.sin(n)+e.y,s=i*Math.cos(o)+e.x,l=i*Math.sin(o)+e.y;return!(t.x>Math.max(r,s)+2||Math.min(r,s)-2>t.x||t.y>Math.max(a,l)+2||Math.min(a,l)-2>t.y)}var u,c,h,d;return!1}function ge(e,i,n){var o=i.x,r=i.y,a=i.r,s=i.startAngle,l=i.endAngle,u=n.style,c=void 0===u?t.LineType.Solid:u,h=n.size,d=n.color,p=void 0===d?"currentColor":d,v=n.dashedValue,g=void 0===v?[2,2]:v;e.lineWidth=void 0===h?1:h,e.strokeStyle=p,e.setLineDash(c===t.LineType.Dashed?g:[]),e.beginPath(),e.arc(o,r,a,s,l),e.stroke(),e.closePath()}var fe={name:"arc",checkEventOn:ve,draw:function(t,e,i){ge(t,e,i)}},ye={};[ee,Pt,oe,le,de,de,fe].forEach((function(t){ye[t.name]=xt.extend(t)}));var me=function(t){function e(e){var i=t.call(this)||this;return i._widget=e,i}return P(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e,i,n){var o=function(t){var e;return null!==(e=ye[t])&&void 0!==e?e:null}(t);if(null!==o){var r=new o({name:t,attrs:e,styles:i});if(void 0!==n){for(var a in n)n.hasOwnProperty(a)&&r.registerEvent(a,n[a]);this.addChild(r)}return r}return null},e.prototype.draw=function(t){this.clear(),this.drawImp(t)},e}(_t),_e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=this.getWidget().getPane(),o=n.getChart(),r=i.getBounding(),a=o.getStyles().grid;if(a.show){t.save(),t.globalCompositeOperation="destination-over";var s=a.horizontal;if(s.show)n.getAxisComponent().getTicks().forEach((function(i){var n;null===(n=e.createFigure("line",{coordinates:[{x:0,y:i.coord},{x:r.width,y:i.coord}]},s))||void 0===n||n.draw(t)}));var l=a.vertical;if(l.show)o.getXAxisPane().getAxisComponent().getTicks().forEach((function(i){var n;null===(n=e.createFigure("line",{coordinates:[{x:i.coord,y:0},{x:i.coord,y:r.height}]},l))||void 0===n||n.draw(t)}));t.restore()}},e}(me),xe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.eachChildren=function(t){var e=this.getWidget().getPane().getChart().getChartStore(),i=e.getVisibleDataList(),n=e.getTimeScaleStore().getBarSpace();i.forEach((function(e,i){t(e,n,i)}))},e}(me),Se=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._boundCandleBarClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().getActionStore().execute(t.ActionType.OnCandleBarClick,e),!1}},i}return P(i,e),i.prototype.drawImp=function(t){var e=this,i=this.getWidget().getPane(),n=i.getId()===Rt,o=i.getChart().getChartStore(),r=this.getCandleBarOptions(o);if(null!==r){var a=i.getAxisComponent();this.eachChildren((function(i,o){e._drawCandleBar(t,a,i,o,r,n)}))}},i.prototype.getCandleBarOptions=function(t){var e=t.getStyles().candle;return{type:e.type,styles:e.bar}},i.prototype._drawCandleBar=function(e,i,n,o,r,a){var s,l,u,c=this,h=n.data,d=n.x,p=h.open,v=h.high,g=h.low,f=h.close,y=o.halfGapBar,m=o.gapBar,_=r.type,x=r.styles;f>p?(s=x.upColor,l=x.upBorderColor,u=x.upWickColor):p>f?(s=x.downColor,l=x.downBorderColor,u=x.downWickColor):(s=x.noChangeColor,l=x.noChangeBorderColor,u=x.noChangeWickColor);var S=i.convertToPixel(p),C=i.convertToPixel(f),b=[S,C,i.convertToPixel(v),i.convertToPixel(g)];b.sort((function(t,e){return t-e}));var w=Math.max(1,b[2]-b[1]),T=[];_!==t.CandleType.Ohlc?(T.push({name:"rect",attrs:{x:d-.5,y:b[0],width:1,height:b[1]-b[0]},styles:{color:u}}),T.push(_===t.CandleType.CandleStroke||_===t.CandleType.CandleUpStroke&&f>p||_===t.CandleType.CandleDownStroke&&p>f?{name:"rect",attrs:{x:d-y+.5,y:b[1],width:m-1,height:w},styles:{style:t.PolygonType.Stroke,borderColor:l}}:{name:"rect",attrs:{x:d-y+.5,y:b[1],width:m-1,height:w},styles:{style:t.PolygonType.StrokeFill,color:s,borderColor:l}}),T.push({name:"rect",attrs:{x:d-.5,y:b[2],width:1,height:b[3]-b[2]},styles:{color:u}})):T=[{name:"rect",attrs:{x:d-.5,y:b[0],width:1,height:b[3]-b[0]},styles:{color:s}},{name:"rect",attrs:{x:d-y,y:S,width:y,height:1},styles:{color:s}},{name:"rect",attrs:{x:d,y:C,width:y,height:1},styles:{color:s}}],T.forEach((function(t){var i,o,r=t.attrs,s=t.styles;a&&(o={mouseClickEvent:c._boundCandleBarClickEvent(n)}),null===(i=c.createFigure("rect",r,s,o))||void 0===i||i.draw(e)}))},i}(xe),Ce=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.getCandleBarOptions=function(e){var i,n,o=this.getWidget().getPane();if(!o.getAxisComponent().isInCandle()){var r=e.getIndicatorStore().getInstances(o.getId());try{for(var a=F(r),s=a.next();!s.done;s=a.next()){var l=s.value[1];if(l.shouldOhlc&&l.visible){var u=l.styles,c=e.getStyles().indicator,h=C(u,"ohlc.upColor",c.ohlc.upColor),d=C(u,"ohlc.downColor",c.ohlc.downColor),p=C(u,"ohlc.noChangeColor",c.ohlc.noChangeColor);return{type:t.CandleType.Ohlc,styles:{upColor:h,downColor:d,noChangeColor:p,upBorderColor:h,downBorderColor:d,noChangeBorderColor:p,upWickColor:h,downWickColor:d,noChangeWickColor:p}}}}}catch(t){i={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}}return null},i.prototype.drawImp=function(t){var i=this;e.prototype.drawImp.call(this,t);var n=this.getWidget(),o=n.getPane(),r=o.getChart(),a=n.getBounding(),s=r.getXAxisPane().getAxisComponent(),l=o.getAxisComponent(),u=r.getChartStore(),c=u.getDataList(),h=u.getTimeScaleStore(),d=h.getVisibleRange(),p=u.getIndicatorStore().getInstances(o.getId()),v=u.getStyles().indicator;p.forEach((function(e){var n;if(e.visible){var o=!1;if(null!==e.draw&&(t.save(),o=null!==(n=e.draw({ctx:t,kLineDataList:c,indicator:e,visibleRange:d,bounding:a,barSpace:h.getBarSpace(),defaultStyles:v,xAxis:s,yAxis:l}))&&void 0!==n&&n,t.restore()),!o){var r=e.result;i.eachChildren((function(n,o){var u,h,d,p=o.halfGapBar,y=o.gapBar,m=n.dataIndex,_=n.x,x=s.convertToPixel(m-1),S=s.convertToPixel(m+1),C=null!==(u=r[m-1])&&void 0!==u?u:{},b=null!==(h=r[m])&&void 0!==h?h:{},w=null!==(d=r[m+1])&&void 0!==d?d:{},T={x:x},E={x:_},I={x:S};e.figures.forEach((function(t){var e=t.key;T[e]=l.convertToPixel(C[e]),E[e]=l.convertToPixel(b[e]),I[e]=l.convertToPixel(w[e])})),tt(c,e,m,v,(function(e,n){var r,u,c;if(f(b[e.key])){var h=E[e.key],d=null===(r=e.attrs)||void 0===r?void 0:r.call(e,{coordinate:{prev:T,current:E,next:I},bounding:a,barSpace:o,xAxis:s,yAxis:l});if(!f(d))switch(e.type){case"circle":d={x:_,y:h,r:p};break;case"rect":case"bar":var v=null!==(u=e.baseValue)&&void 0!==u?u:l.getExtremum().min,m=l.convertToPixel(v),x=Math.abs(m-h);v!==b[e.key]&&(x=Math.max(1,x));d={x:_-p,y:h>m?m:h,width:y,height:x};break;case"line":g(E[e.key])&&g(I[e.key])&&(d={coordinates:[{x:E.x,y:E[e.key]},{x:I.x,y:I[e.key]}]})}if(f(d)){var S=e.type;null===(c=i.createFigure("bar"===S?"rect":S,d,n))||void 0===c||c.draw(t)}}}))}))}}}))},i}(Se),be=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=e.getBounding(),o=e.getPane().getChart().getChartStore(),r=o.getTooltipStore().getCrosshair(),a=o.getStyles().crosshair;if(void 0!==r.paneId&&a.show){if(r.paneId===i.getId()){var s=r.y;this._drawLine(t,[{x:0,y:s},{x:n.width,y:s}],a.horizontal)}var l=r.realX;this._drawLine(t,[{x:l,y:0},{x:l,y:n.height}],a.vertical)}},e.prototype._drawLine=function(t,e,i){var n;if(i.show){var o=i.line;o.show&&(null===(n=this.createFigure("line",{coordinates:e},o))||void 0===n||n.draw(t))}},e}(me),we=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._boundIconClickEvent=function(e,n){return function(){return i.getWidget().getPane().getChart().getChartStore().getActionStore().execute(t.ActionType.OnTooltipIconClick,M(M({},e),{iconId:n})),!0}},i._boundIconMouseMoveEvent=function(t,e){return function(){return i.getWidget().getPane().getChart().getChartStore().getTooltipStore().setActiveIcon(M(M({},t),{iconId:e})),!0}},i}return P(i,e),i.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=i.getChart().getChartStore(),o=n.getTooltipStore().getCrosshair();if(void 0!==o.kLineData){var r=e.getBounding(),a=n.getCustomApi(),s=n.getThousandsSeparator(),l=n.getIndicatorStore().getInstances(i.getId()),u=n.getTooltipStore().getActiveIcon(),c=n.getStyles().indicator;this.drawIndicatorTooltip(t,i.getId(),n.getDataList(),o,u,l,a,s,r,c)}},i.prototype.drawIndicatorTooltip=function(t,e,i,n,o,r,a,s,l,u,c){var h=this,d=u.tooltip,p=0;if(this.isDrawTooltip(n,d)){var v=d.text,g=0,f=null!=c?c:0,y=0;r.forEach((function(r){var c=h.getIndicatorTooltipData(i,n,r,a,s,u),d=c.name,m=c.calcParamsText,_=c.values,x=d.length>0,S=_.length>0;if(x||S){var C=L(h.classifyTooltipIcons(c.icons),3),b=C[1],w=C[2],T=L(h.drawStandardTooltipIcons(t,l,{paneId:e,indicatorName:r.name,iconId:""},o,C[0],g,f,y),4);if(g=T[0],f=T[1],p+=T[3],y=T[2],x){var E=d;m.length>0&&(E="".concat(E).concat(m));var I=L(h.drawStandardTooltipLabels(t,l,[{title:{text:"",color:v.color},value:{text:E,color:v.color}}],g,f,y,v),4);g=I[0],f=I[1],p+=I[3],y=I[2]}var P=L(h.drawStandardTooltipIcons(t,l,{paneId:e,indicatorName:r.name,iconId:""},o,b,g,f,y),4);if(g=P[0],f=P[1],p+=P[3],y=P[2],S){var D=L(h.drawStandardTooltipLabels(t,l,_,g,f,y,v),4);g=D[0],f=D[1],p+=D[3],y=D[2]}var M=L(h.drawStandardTooltipIcons(t,l,{paneId:e,indicatorName:r.name,iconId:""},o,w,g,f,y),4);g=0,p+=M[3],f=M[1]+M[2],y=0}}))}return p},i.prototype.drawStandardTooltipIcons=function(t,e,i,n,o,r,a,s){var l=this,u=r,c=a,h=0,d=0,p=0;return o.length>0&&(o.forEach((function(e){var i=e.marginLeft,n=e.marginTop,o=e.marginRight,r=e.marginBottom,a=e.paddingLeft,s=e.paddingTop,l=e.paddingRight,u=e.paddingBottom,c=e.size,p=e.icon;t.font=H(c,"normal",e.fontFamily),h+=i+a+t.measureText(p).width+l+o,d=Math.max(d,n+s+c+u+r)})),u+h>e.width?(u=o[0].marginLeft,c+=s,p=d):p=Math.max(0,d-s),o.forEach((function(e){var o,r=e.marginRight,a=e.paddingLeft,s=e.paddingRight,h=e.icon,d=(null==n?void 0:n.paneId)===i.paneId&&(null==n?void 0:n.indicatorName)===i.indicatorName&&(null==n?void 0:n.iconId)===e.id;null===(o=l.createFigure("text",{text:h,x:u+=e.marginLeft,y:c+e.marginTop},{paddingLeft:a,paddingTop:e.paddingTop,paddingRight:s,paddingBottom:e.paddingBottom,color:d?e.activeColor:e.color,size:e.size,family:e.fontFamily,backgroundColor:d?e.activeBackgroundColor:e.backgroundColor},{mouseClickEvent:l._boundIconClickEvent(i,e.id),mouseMoveEvent:l._boundIconMouseMoveEvent(i,e.id)}))||void 0===o||o.draw(t),u+=a+t.measureText(h).width+s+r}))),[u,c,Math.max(s,d),p]},i.prototype.drawStandardTooltipLabels=function(t,e,i,n,o,r,a){var s=this,l=n,u=o,c=0,h=0,d=r;if(i.length>0){var p=a.marginLeft,v=a.marginTop,g=a.marginRight,f=a.marginBottom,y=a.size,m=a.family,_=a.weight;t.font=H(y,_,m),i.forEach((function(i){var n,o,r=i.title,a=i.value,x=t.measureText(r.text).width,S=t.measureText(a.text).width,C=y+v+f;l+p+(x+S)+g>e.width?(l=p,u+=C,h+=C):(l+=p,h+=Math.max(0,C-d)),d=c=Math.max(d,C),r.text.length>0&&(null===(n=s.createFigure("text",{x:l,y:u+v,text:r.text},{color:r.color,size:y,family:m,weight:_}))||void 0===n||n.draw(t),l+=x),null===(o=s.createFigure("text",{x:l,y:u+v,text:a.text},{color:a.color,size:y,family:m,weight:_}))||void 0===o||o.draw(t),l+=S+g}))}return[l,u,c,h]},i.prototype.isDrawTooltip=function(e,i){var n=i.showRule;return n===t.TooltipShowRule.Always||n===t.TooltipShowRule.FollowCross&&void 0!==e.paneId},i.prototype.getIndicatorTooltipData=function(t,e,i,n,o,r){var a,s,l=r.tooltip,u=l.showName?i.shortName:"",c="",h=i.calcParams;h.length>0&&l.showParams&&(c="(".concat(h.join(","),")"));var d={name:u,calcParamsText:c,values:[],icons:l.icons},p=e.dataIndex,g=null!==(a=i.result)&&void 0!==a?a:[],y=[];if(i.visible){var m=null!==(s=g[p])&&void 0!==s?s:{};tt(t,i,p,r,(function(t,e){if(void 0!==t.title){var r=e.color,a=m[t.key];f(a)&&(a=w(a,i.precision),i.shouldFormatBigNumber&&(a=n.formatBigNumber(a))),y.push({title:{text:t.title,color:r},value:{text:E(null!=a?a:l.defaultValue,o),color:r}})}})),d.values=y}if(null!==i.createTooltipDataSource){var _=this.getWidget(),x=_.getPane(),S=x.getChart().getChartStore(),C=i.createTooltipDataSource({kLineDataList:t,indicator:i,visibleRange:S.getTimeScaleStore().getVisibleRange(),bounding:_.getBounding(),crosshair:e,defaultStyles:r,xAxis:x.getChart().getXAxisPane().getAxisComponent(),yAxis:x.getAxisComponent()}),b=C.name,T=C.calcParamsText,I=C.values,P=C.icons;if(void 0!==b&&l.showName&&(d.name=b),void 0!==T&&l.showParams&&(d.calcParamsText=T),void 0!==P&&(d.icons=P),void 0!==I&&i.visible){var D=[],M=r.tooltip.text.color;I.forEach((function(t){var e={text:"",color:M};v(t.title)?e=t.title:e.text=t.title;var i={text:"",color:M};v(t.value)?i=t.value:i.text=t.value,i.text=E(i.text,o),D.push({title:e,value:i})})),d.values=D}}return d},i.prototype.classifyTooltipIcons=function(e){var i=[],n=[],o=[];return e.forEach((function(e){switch(e.position){case t.TooltipIconPosition.Left:i.push(e);break;case t.TooltipIconPosition.Middle:n.push(e);break;case t.TooltipIconPosition.Right:o.push(e)}})),[i,n,o]},i}(me),Te=function(e){function i(t){var i=e.call(this,t)||this;return i._initEvent(),i}return P(i,e),i.prototype._initEvent=function(){var t=this,e=this.getWidget().getPane(),i=e.getId(),n=e.getChart().getChartStore().getOverlayStore();this.registerEvent("mouseMoveEvent",(function(e){var o,r=n.getProgressInstanceInfo();if(null!==r){var a=r.instance,s=r.paneId;a.isStart()&&(n.updateProgressInstanceInfo(i),s=i);var l=a.points.length-1,u="".concat(vt,"point_").concat(l);return a.isDrawing()&&s===i&&(a.eventMoveForDrawing(t._coordinateToPoint(r.instance,e)),null===(o=a.onDrawing)||void 0===o||o.call(a,M({overlay:a,figureKey:u,figureIndex:l},e))),t._figureMouseMoveEvent(a,1,u,l,0)(e)}return n.setHoverInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseClickEvent",(function(e){var o,r,a=n.getProgressInstanceInfo();if(null!==a){var s=a.instance,l=a.paneId;s.isStart()&&(n.updateProgressInstanceInfo(i,!0),l=i);var u=s.points.length-1,c="".concat(vt,"point_").concat(u);return s.isDrawing()&&l===i&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(o=s.onDrawing)||void 0===o||o.call(s,M({overlay:s,figureKey:c,figureIndex:u},e)),s.nextStep(),s.isDrawing()||(n.progressInstanceComplete(),null===(r=s.onDrawEnd)||void 0===r||r.call(s,M({overlay:s,figureKey:c,figureIndex:u},e)))),t._figureMouseClickEvent(s,1,c,u,0)(e)}return n.setClickInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseDoubleClickEvent",(function(e){var o,r=n.getProgressInstanceInfo();if(null!==r){var a=r.instance,s=r.paneId;if(a.isDrawing()&&s===i&&(a.forceComplete(),!a.isDrawing())){n.progressInstanceComplete();var l=a.points.length-1,u="".concat(vt,"point_").concat(l);null===(o=a.onDrawEnd)||void 0===o||o.call(a,M({overlay:a,figureKey:u,figureIndex:l},e))}var c=a.points.length-1;return t._figureMouseClickEvent(a,1,"".concat(vt,"point_").concat(c),c,0)(e)}return!1})).registerEvent("mouseRightClickEvent",(function(e){var i=n.getProgressInstanceInfo();if(null!==i){var o=i.instance;if(o.isDrawing()){var r=o.points.length-1;return t._figureMouseRightClickEvent(o,1,"".concat(vt,"point_").concat(r),r,0)(e)}}return!1})).registerEvent("mouseUpEvent",(function(t){var e,o=n.getPressedInstanceInfo(),r=o.instance;return null!==r&&(null===(e=r.onPressedMoveEnd)||void 0===e||e.call(r,M({overlay:r,figureKey:o.figureKey,figureIndex:o.figureIndex},t))),n.setPressedInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1}),!1})).registerEvent("pressedMouseMoveEvent",(function(e){var i,o,r=n.getPressedInstanceInfo(),a=r.instance,s=r.figureType,l=r.figureIndex;if(null!==a){if(!(a.lock||null!==(o=null===(i=a.onPressedMoving)||void 0===i?void 0:i.call(a,M({overlay:a,figureIndex:l,figureKey:r.figureKey},e)))&&void 0!==o&&o)){var u=t._coordinateToPoint(a,e);1===s?a.eventPressedPointMove(u,l):a.eventPressedOtherMove(u,t.getWidget().getPane().getChart().getChartStore().getTimeScaleStore())}return!0}return!1}))},i.prototype._createFigureEvents=function(t,e,i,n,o,r){var a;if(!t.isDrawing()){var s=[];if(void 0!==r&&(y(r)?r&&(s=["mouseClickEvent","mouseDoubleClickEvent","mouseRightClickEvent","tapEvent","doubleTapEvent","mouseDownEvent","touchStartEvent","mouseMoveEvent","touchMoveEvent"]):s=r),0===s.length)return{mouseMoveEvent:this._figureMouseMoveEvent(t,e,i,n,o),mouseDownEvent:this._figureMouseDownEvent(t,e,i,n,o),mouseClickEvent:this._figureMouseClickEvent(t,e,i,n,o),mouseRightClickEvent:this._figureMouseRightClickEvent(t,e,i,n,o),mouseDoubleClickEvent:this._figureMouseDoubleClickEvent(t,e,i,n,o)};a={},s.includes("mouseMoveEvent")||s.includes("touchMoveEvent")||(a.mouseMoveEvent=this._figureMouseMoveEvent(t,e,i,n,o)),s.includes("mouseDownEvent")||s.includes("touchStartEvent")||(a.mouseDownEvent=this._figureMouseDownEvent(t,e,i,n,o)),s.includes("mouseClickEvent")||s.includes("tapEvent")||(a.mouseClickEvent=this._figureMouseClickEvent(t,e,i,n,o)),s.includes("mouseDoubleClickEvent")||s.includes("doubleTapEvent")||(a.mouseDoubleClickEvent=this._figureMouseDoubleClickEvent(t,e,i,n,o)),s.includes("mouseRightClickEvent")||(a.mouseRightClickEvent=this._figureMouseRightClickEvent(t,e,i,n,o))}return a},i.prototype._figureMouseMoveEvent=function(t,e,i,n,o){var r=this;return function(a){var s=r.getWidget().getPane();return s.getChart().getChartStore().getOverlayStore().setHoverInstanceInfo({paneId:s.getId(),instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},i.prototype._figureMouseDownEvent=function(t,e,i,n,o){var r=this;return function(a){var s,l=r.getWidget().getPane(),u=l.getId(),c=l.getChart().getChartStore().getOverlayStore();return t.startPressedMove(r._coordinateToPoint(t,a)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,M({overlay:t,figureIndex:n,figureKey:i},a)),c.setPressedInstanceInfo({paneId:u,instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o}),!0}},i.prototype._figureMouseClickEvent=function(t,e,i,n,o){var r=this;return function(a){var s=r.getWidget().getPane(),l=s.getId();return s.getChart().getChartStore().getOverlayStore().setClickInstanceInfo({paneId:l,instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},i.prototype._figureMouseDoubleClickEvent=function(t,e,i,n,o){return function(e){var o;return null===(o=t.onDoubleClick)||void 0===o||o.call(t,M(M({},e),{figureIndex:n,figureKey:i,overlay:t})),!0}},i.prototype._figureMouseRightClickEvent=function(t,e,i,n,o){var r=this;return function(e){var o,a;null!==(a=null===(o=t.onRightClick)||void 0===o?void 0:o.call(t,M({overlay:t,figureIndex:n,figureKey:i},e)))&&void 0!==a&&a||r.getWidget().getPane().getChart().getChartStore().getOverlayStore().removeInstance(t);return!0}},i.prototype._coordinateToPoint=function(e,i){var n,o={},r=this.getWidget().getPane(),a=r.getChart(),s=r.getId(),l=a.getChartStore().getTimeScaleStore();if(this.coordinateToPointTimestampDataIndexFlag()){var u=a.getXAxisPane().getAxisComponent().convertFromPixel(i.x),c=null!==(n=l.dataIndexToTimestamp(u))&&void 0!==n?n:void 0;o.dataIndex=u,o.timestamp=c}if(this.coordinateToPointValueFlag()){var h=r.getAxisComponent(),d=h.convertFromPixel(i.y);if(e.mode!==t.OverlayMode.Normal&&s===Rt&&void 0!==o.dataIndex){var p=l.getDataByDataIndex(o.dataIndex);if(null!==p){var v=e.modeSensitivity;if(d>p.high)if(e.mode===t.OverlayMode.WeakMagnet){var g=h.convertToPixel(p.high);h.convertFromPixel(g-v)>d&&(d=p.high)}else d=p.high;else if(p.low>d)if(e.mode===t.OverlayMode.WeakMagnet){var f=h.convertToPixel(p.low);d>h.convertFromPixel(f-v)&&(d=p.low)}else d=p.low;else{var y=Math.max(p.open,p.close),m=Math.min(p.open,p.close);d=d>y?p.high-d>d-y?y:p.high:m>d?m-d>d-p.low?p.low:m:d-m>y-d?y:m}}}o.value=d}return o},i.prototype.coordinateToPointValueFlag=function(){return!0},i.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},i.prototype.dispatchEvent=function(t,i,n){return this.getWidget().getPane().getChart().getChartStore().getOverlayStore().isDrawing()?this.onEvent(t,i,n):e.prototype.dispatchEvent.call(this,t,i,n)},i.prototype.checkEventOn=function(){return!0},i.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=i.getPane(),o=n.getId(),r=n.getChart(),a=n.getAxisComponent(),s=r.getXAxisPane().getAxisComponent(),l=i.getBounding(),u=r.getChartStore(),c=u.getCustomApi(),h=u.getThousandsSeparator(),d=u.getTimeScaleStore(),p=d.getDateTimeFormat(),v=d.getBarSpace(),g=u.getPrecision(),f=u.getStyles().overlay,y=u.getOverlayStore(),m=y.getHoverInstanceInfo(),_=y.getClickInstanceInfo();this.getCompleteOverlays(y,o).forEach((function(i){i.visible&&e._drawOverlay(t,i,l,v,g,p,c,h,f,s,a,m,_,d)}));var x=y.getProgressInstanceInfo();if(null!==x){var S=this.getProgressOverlay(x,o);null!==S&&S.visible&&this._drawOverlay(t,S,l,v,g,p,c,h,f,s,a,m,_,d)}},i.prototype._drawOverlay=function(t,e,i,n,o,r,a,s,l,u,c,h,d,p){var v=e.points.map((function(t){var e,i,n=t.dataIndex;void 0!==t.timestamp&&(n=p.timestampToDataIndex(t.timestamp));var o={x:0,y:0};return void 0!==n&&(o.x=null!==(e=null==u?void 0:u.convertToPixel(n))&&void 0!==e?e:0),void 0!==t.value&&(o.y=null!==(i=null==c?void 0:c.convertToPixel(t.value))&&void 0!==i?i:0),o}));if(v.length>0){var g=[].concat(this.getFigures(e,v,i,n,o,s,r,l,u,c));this.drawFigures(t,e,g,l)}this.drawDefaultFigures(t,e,v,i,o,r,a,s,l,u,c,h,d)},i.prototype.drawFigures=function(t,e,i,n){var o=this;i.forEach((function(i,r){var a=i.type,s=i.styles,l=i.ignoreEvent;[].concat(i.attrs).forEach((function(u,c){var h,d,p,v=o._createFigureEvents(e,2,null!==(h=i.key)&&void 0!==h?h:"",r,c,l),g=M(M(M({},n[a]),null===(d=e.styles)||void 0===d?void 0:d[a]),s);null===(p=o.createFigure(a,u,g,v))||void 0===p||p.draw(t)}))}))},i.prototype.getCompleteOverlays=function(t,e){return t.getInstances(e)},i.prototype.getProgressOverlay=function(t,e){return t.paneId===e?t.instance:null},i.prototype.getFigures=function(t,e,i,n,o,r,a,s,l,u){var c,h;return null!==(h=null===(c=t.createPointFigures)||void 0===c?void 0:c.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:o,thousandsSeparator:r,dateTimeFormat:a,defaultStyles:s,xAxis:l,yAxis:u}))&&void 0!==h?h:[]},i.prototype.drawDefaultFigures=function(t,e,i,n,o,r,a,s,l,u,c,h,d){var p,v,g=this;if(e.needDefaultPointFigure&&((null===(p=h.instance)||void 0===p?void 0:p.id)===e.id&&0!==h.figureType||(null===(v=d.instance)||void 0===v?void 0:v.id)===e.id&&0!==d.figureType)){var f=e.styles,y=M(M({},l.point),null==f?void 0:f.point);i.forEach((function(i,n){var o,r,a,s=i.x,l=i.y,u=y.radius,c=y.color,d=y.borderColor,p=y.borderSize;(null===(o=h.instance)||void 0===o?void 0:o.id)===e.id&&1===h.figureType&&h.figureIndex===n&&(u=y.activeRadius,c=y.activeColor,d=y.activeBorderColor,p=y.activeBorderSize),null===(r=g.createFigure("circle",{x:s,y:l,r:u+p},{color:d},g._createFigureEvents(e,1,"".concat(vt,"point_").concat(n),n,0)))||void 0===r||r.draw(t),null===(a=g.createFigure("circle",{x:s,y:l,r:u},{color:c}))||void 0===a||a.draw(t)}))}},i}(me),Ee=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._gridView=new _e(n),n._indicatorView=new Ce(n),n._crosshairLineView=new be(n),n._tooltipView=n.createTooltipView(),n._overlayView=new Te(n),n.addChild(n._tooltipView),n.addChild(n._overlayView),n.getContainer().style.cursor="crosshair",n.registerEvent("mouseMoveEvent",(function(){return i.getChart().getChartStore().getTooltipStore().setActiveIcon(),!1})),n}return P(e,t),e.prototype.getName=function(){return Ht},e.prototype.updateMain=function(t){this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t)},e.prototype.createTooltipView=function(){return new we(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){this._overlayView.draw(t),this._crosshairLineView.draw(t),this._tooltipView.draw(t)},e}(Jt),Ie=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.drawImp=function(t){var e,i,n=this.getWidget(),o=n.getPane(),r=o.getChart(),a=n.getBounding(),s=o.getAxisComponent(),l=r.getStyles().candle.area,u=[],c=[],h=Number.MAX_SAFE_INTEGER;this.eachChildren((function(t,e,i){var n=t.x,o=e.halfGapBar,r=t.data[l.value];if(g(r)){var d=s.convertToPixel(r);if(0===i){var p=n-o;c.push({x:p,y:a.height}),c.push({x:p,y:d}),u.push({x:p,y:d})}u.push({x:n,y:d}),c.push({x:n,y:d}),h=Math.min(h,d)}}));var p=c.length;if(p>0){var v=c[p-1],f=v.x;u.push({x:f,y:v.y}),c.push({x:f,y:v.y}),c.push({x:f,y:a.height})}if(u.length>0&&(null===(e=this.createFigure("line",{coordinates:u},{color:l.lineColor,size:l.lineSize}))||void 0===e||e.draw(t)),c.length>0){var y=l.backgroundColor,m=void 0;if(d(y)){var _=t.createLinearGradient(0,a.height,0,h);try{y.forEach((function(t){_.addColorStop(t.offset,t.color)}))}catch(t){}m=_}else m=y;null===(i=this.createFigure("polygon",{coordinates:c},{color:m}))||void 0===i||i.draw(t)}},e}(xe),Pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.drawImp=function(t){var e=this.getWidget().getPane(),i=e.getChart().getChartStore(),n=i.getStyles().candle.priceMark,o=n.high,r=n.low;if(n.show&&(o.show||r.show)){var a=i.getThousandsSeparator(),s=i.getPrecision(),l=e.getAxisComponent(),u=Number.MIN_SAFE_INTEGER,c=0,h=Number.MAX_SAFE_INTEGER,d=0;this.eachChildren((function(t){var e=t.data,i=t.x;e.high>u&&(u=e.high,c=i),h>e.low&&(h=e.low,d=i)}));var p=l.convertToPixel(u),v=l.convertToPixel(h);o.show&&u!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,E(w(u,s.price),a),{x:c,y:p},v>p?[-2,-5]:[2,5],o),r.show&&h!==Number.MAX_SAFE_INTEGER&&this._drawMark(t,E(w(h,s.price),a),{x:d,y:v},v>p?[2,5]:[-2,-5],r)}},e.prototype._drawMark=function(t,e,i,n,o){var r,a,s,l,u,c,h=i.x,d=i.y+n[0];null===(r=this.createFigure("line",{coordinates:[{x:h-2,y:d+n[0]},{x:h,y:d},{x:h+2,y:d+n[0]}]},{color:o.color}))||void 0===r||r.draw(t),h>this.getWidget().getBounding().width/2?(u=(l=h-5)-o.textOffset,c="right"):(c="left",u=(l=h+5)+o.textOffset);var p=d+n[1];null===(a=this.createFigure("line",{coordinates:[{x:h,y:d},{x:h,y:p},{x:l,y:p}]},{color:o.color}))||void 0===a||a.draw(t),null===(s=this.createFigure("text",{x:u,y:p,text:e,align:c,baseline:"middle"},{color:o.color,size:o.textSize,family:o.textFamily,weight:o.textWeight}))||void 0===s||s.draw(t)},e}(xe),De=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getStyles().candle.priceMark,s=a.last,l=s.line;if(a.show&&s.show&&l.show){var u=n.getAxisComponent(),c=r.getDataList(),h=c[c.length-1];if(null!=h){var d=h.close,p=h.open,v=u.convertToNicePixel(d);null===(e=this.createFigure("line",{coordinates:[{x:0,y:v},{x:o.width,y:v}]},{style:l.style,color:d>p?s.upColor:p>d?s.downColor:s.noChangeColor,size:l.size,dashedValue:l.dashedValue}))||void 0===e||e.draw(t)}}},e}(me),Me={"zh-CN":{time:"时间:",open:"开:",high:"高:",low:"低:",close:"收:",volume:"成交量:",turnover:"成交额:",change:"涨幅:"},"en-US":{time:"Time: ",open:"Open: ",high:"High: ",low:"Low: ",close:"Close: ",volume:"Volume: ",turnover:"Turnover: ",change:"Change: "}};var ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.drawImp=function(e){var i,n=this.getWidget(),o=n.getPane(),r=o.getId(),a=o.getChart().getChartStore(),s=a.getTooltipStore().getCrosshair();if(void 0!==s.kLineData){var l=n.getBounding(),u=null===(i=o.getYAxisWidget())||void 0===i?void 0:i.getBounding(),c=a.getDataList(),h=a.getPrecision(),d=a.getLocale(),p=a.getCustomApi(),v=a.getThousandsSeparator(),g=a.getTooltipStore().getActiveIcon(),f=a.getIndicatorStore().getInstances(o.getId()),y=a.getTimeScaleStore().getDateTimeFormat(),m=a.getStyles(),_=m.candle,x=m.indicator;if(_.tooltip.showType===t.TooltipShowType.Rect&&x.tooltip.showType===t.TooltipShowType.Rect){var S=this.isDrawTooltip(s,_.tooltip),C=this.isDrawTooltip(s,x.tooltip);this._drawRectTooltip(e,c,f,l,u,s,h,y,d,p,v,S,C,m,0)}else if(_.tooltip.showType===t.TooltipShowType.Standard&&x.tooltip.showType===t.TooltipShowType.Standard){var b=this._drawCandleStandardTooltip(e,c,r,l,s,g,h,y,d,p,v,_);this.drawIndicatorTooltip(e,r,c,s,g,f,p,v,l,x,b)}else if(_.tooltip.showType===t.TooltipShowType.Rect&&x.tooltip.showType===t.TooltipShowType.Standard){var w=this.drawIndicatorTooltip(e,r,c,s,g,f,p,v,l,x,0);S=this.isDrawTooltip(s,_.tooltip);this._drawRectTooltip(e,c,f,l,u,s,h,y,d,p,v,S,!1,m,w)}else{var T=this._drawCandleStandardTooltip(e,c,r,l,s,g,h,y,d,p,v,_);C=this.isDrawTooltip(s,x.tooltip);this._drawRectTooltip(e,c,f,l,u,s,h,y,d,p,v,!1,C,m,T)}}},i.prototype._drawCandleStandardTooltip=function(t,e,i,n,o,r,a,s,l,u,c,h){var d,p,v,g=h.tooltip,f=g.text,y=0;if(this.isDrawTooltip(o,g)){var m=null!==(d=o.dataIndex)&&void 0!==d?d:0,_=this._getCandleTooltipData({prev:null!==(p=e[m-1])&&void 0!==p?p:null,current:o.kLineData,next:null!==(v=e[m+1])&&void 0!==v?v:null},a,s,l,u,c,h),x=0,S=0,C=0,b=L(this.classifyTooltipIcons(g.icons),3),w=b[1],T=b[2],E=L(this.drawStandardTooltipIcons(t,n,{paneId:i,indicatorName:"",iconId:""},r,b[0],x,S,0),4);y+=E[3];var I=L(this.drawStandardTooltipIcons(t,n,{paneId:i,indicatorName:"",iconId:""},r,w,x=E[0],S=E[1],C=E[2]),4);if(x=I[0],S=I[1],y+=I[3],C=I[2],_.length>0){var P=L(this.drawStandardTooltipLabels(t,n,_,x,S,C,f),4);x=P[0],S=P[1],y+=P[3],C=P[2]}var D=L(this.drawStandardTooltipIcons(t,n,{paneId:i,indicatorName:"",iconId:""},r,T,x,S,C),4);x=D[0],S=D[1],y+=D[3],C=D[2]}return y},i.prototype._drawRectTooltip=function(e,i,n,o,r,s,l,u,c,h,d,p,v,g,f){var y,m,_,x,S,C=this,b=g.candle,w=g.indicator,T=b.tooltip,E=w.tooltip;if(p||v){var I=null!==(y=s.dataIndex)&&void 0!==y?y:0,P=this._getCandleTooltipData({prev:null!==(m=i[I-1])&&void 0!==m?m:null,current:s.kLineData,next:null!==(_=i[I+1])&&void 0!==_?_:null},l,u,c,h,d,b),D=T.text,M=D.marginLeft,k=D.marginRight,A=D.marginTop,F=D.marginBottom,L=D.size,R=D.weight,B=D.family,O=T.rect,V=O.position,W=O.paddingLeft,N=O.paddingRight,z=O.paddingTop,Y=O.paddingBottom,X=O.offsetLeft,j=O.offsetRight,Z=O.offsetTop,G=O.offsetBottom,K=O.borderSize,U=O.borderRadius,q=O.borderColor,$=O.color,J=0,Q=0,tt=0;p&&(e.font=H(L,R,B),P.forEach((function(t){var i=t.value,n="".concat(t.title.text).concat(i.text),o=e.measureText(n).width+M+k;J=Math.max(J,o)})),tt+=(F+A+L)*P.length);var et=E.text,it=et.marginLeft,nt=et.marginRight,ot=et.marginTop,rt=et.marginBottom,at=et.size,st=et.weight,lt=et.family,ut=[];if(v&&(e.font=H(at,st,lt),n.forEach((function(t){var n,o=null!==(n=C.getIndicatorTooltipData(i,s,t,h,d,w).values)&&void 0!==n?n:[];ut.push(o),o.forEach((function(t){var i=t.value,n="".concat(t.title.text).concat(i.text),o=e.measureText(n).width+it+nt;J=Math.max(J,o),tt+=ot+rt+at}))}))),0!==(Q+=J)&&0!==tt){Q+=2*K+W+N,tt+=2*K+z+Y;var ct=V===a.Pointer&&s.paneId===Rt,ht=(null!==(x=s.realX)&&void 0!==x?x:0)>o.width/2,dt=0;if(ct){var pt=s.realX;dt=ht?pt-j-Q:pt+X}else ht?(dt=X,g.yAxis.inside&&g.yAxis.position===t.YAxisPosition.Left&&(dt+=r.width)):(dt=o.width-j-Q,g.yAxis.inside&&g.yAxis.position===t.YAxisPosition.Right&&(dt-=r.width));var vt=f+Z;if(ct)(vt=s.y-tt/2)+tt>o.height-G&&(vt=o.height-G-tt),f+Z>vt&&(vt=f+Z);null===(S=this.createFigure("rect",{x:dt,y:vt,width:Q,height:tt},{style:t.PolygonType.StrokeFill,color:$,borderColor:q,borderSize:K,borderRadius:U}))||void 0===S||S.draw(e);var gt=dt+K+W+M,ft=vt+K+z;if(p&&P.forEach((function(t){var i,n,o=t.title;null===(i=C.createFigure("text",{x:gt,y:ft+=A,text:o.text},{color:o.color,size:L,family:B,weight:R}))||void 0===i||i.draw(e);var r=t.value;null===(n=C.createFigure("text",{x:dt+Q-K-k-N,y:ft,text:r.text,align:"right"},{color:r.color,size:L,family:B,weight:R}))||void 0===n||n.draw(e),ft+=L+F})),v){var yt=dt+K+W+it;ut.forEach((function(t){t.forEach((function(t){var i,n,o=t.title,r=t.value;null===(i=C.createFigure("text",{x:yt,y:ft+=ot,text:o.text},{color:o.color,size:at,family:lt,weight:st}))||void 0===i||i.draw(e),null===(n=C.createFigure("text",{x:dt+Q-K-nt-N,y:ft,text:r.text,align:"right"},{color:r.color,size:at,family:lt,weight:st}))||void 0===n||n.draw(e),ft+=at+rt}))}))}}}},i.prototype._getCandleTooltipData=function(e,i,n,o,r,a,s){var l,u,c,h,d,g,f=s.tooltip,y=f.text.color,m=e.current,_=null!==(u=null===(l=e.prev)||void 0===l?void 0:l.close)&&void 0!==u?u:m.close,x=m.close-_,S=i.price,C=i.volume,b={"{time}":r.formatDate(n,m.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Tooltip),"{open}":E(w(m.open,S),a),"{high}":E(w(m.high,S),a),"{low}":E(w(m.low,S),a),"{close}":E(w(m.close,S),a),"{volume}":E(r.formatBigNumber(w(null!==(c=m.volume)&&void 0!==c?c:f.defaultValue,C)),a),"{turnover}":E(w(null!==(h=m.turnover)&&void 0!==h?h:f.defaultValue,S),a),"{change}":0===_?f.defaultValue:"".concat(w(x/_*100),"%")};return(null!==(g=p(f.custom)?null===(d=f.custom)||void 0===d?void 0:d.call(f,e,s):f.custom)&&void 0!==g?g:[{title:"time",value:"{time}"},{title:"open",value:"{open}"},{title:"high",value:"{high}"},{title:"low",value:"{low}"},{title:"close",value:"{close}"},{title:"volume",value:"{volume}"}]).map((function(t){var e,i=t.title,n=t.value,r={text:"",color:""};v(i)?r=M({},i):(r.text=i,r.color=y),r.text=function(t,e){var i,n;return null!==(n=null===(i=Me[e])||void 0===i?void 0:i[t])&&void 0!==n?n:t}(r.text,o);var a={text:f.defaultValue,color:""};v(n)?a=M({},n):(a.text=n,a.color=y);var l=a.text.match(/{(\S*)}/);if(null!==l&&l.length>1){var u="{".concat(l[1],"}");a.text=a.text.replace(u,null!==(e=b[u])&&void 0!==e?e:f.defaultValue),"{change}"===u&&(a.color=0===x?s.priceMark.last.noChangeColor:x>0?s.priceMark.last.upColor:s.priceMark.last.downColor)}return{title:r,value:a}}))},i}(we),Ae=function(e){function i(t,i){var n=e.call(this,t,i)||this;return n._candleBarView=new Se(n),n._candleAreaView=new Ie(n),n._candleHighLowPriceView=new Pe(n),n._candleLastPriceLineView=new De(n),n.addChild(n._candleBarView),n}return P(i,e),i.prototype.updateMainContent=function(e){this.getPane().getChart().getStyles().candle.type!==t.CandleType.Area?(this._candleBarView.draw(e),this._candleHighLowPriceView.draw(e)):this._candleAreaView.draw(e),this._candleLastPriceLineView.draw(e)},i.prototype.createTooltipView=function(){return new ke(this)},i}(Ee),Fe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.drawImp=function(t){var e,i=this,n=this.getWidget(),o=n.getPane(),r=n.getBounding(),a=o.getAxisComponent(),s=this.getAxisStyles(o.getChart().getStyles());if(s.show){s.axisLine.show&&(null===(e=this.createFigure("line",this.createAxisLine(r,s),s.axisLine))||void 0===e||e.draw(t));var l=a.getTicks();if(s.tickLine.show)this.createTickLines(l,r,s).forEach((function(e){var n;null===(n=i.createFigure("line",e,s.tickLine))||void 0===n||n.draw(t)}));if(s.tickText.show)this.createTickTexts(l,r,s).forEach((function(e){var n;null===(n=i.createFigure("text",e,s.tickText))||void 0===n||n.draw(t)}))}},e}(me),Le=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.getAxisStyles=function(t){return t.yAxis},e.prototype.createAxisLine=function(t,e){var i,n=this.getWidget().getPane().getAxisComponent(),o=e.axisLine.size;return{coordinates:[{x:i=n.isFromZero()?o/2:t.width-o,y:0},{x:i,y:t.height}]}},e.prototype.createTickLines=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),o=i.axisLine,r=i.tickLine,a=0,s=0;return n.isFromZero()?(a=0,o.show&&(a+=o.size),s=a+r.length):(a=e.width,o.show&&(a-=o.size),s=a-r.length),t.map((function(t){return{coordinates:[{x:a,y:t.coord},{x:s,y:t.coord}]}}))},e.prototype.createTickTexts=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),o=i.axisLine,r=i.tickLine,a=i.tickText,s=0;n.isFromZero()?(s=a.marginStart,o.show&&(s+=o.size),r.show&&(s+=r.length)):(s=e.width-a.marginEnd,o.show&&(s-=o.size),r.show&&(s-=r.length));var l=this.getWidget().getPane().getAxisComponent().isFromZero()?"left":"right";return t.map((function(t){return{x:s,y:t.coord,text:t.text,align:l,baseline:"middle"}}))},e}(Fe),Re=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.drawImp=function(e){var i,n=this.getWidget(),o=n.getPane(),r=n.getBounding(),a=o.getChart().getChartStore(),s=a.getStyles().candle.priceMark,l=s.last,u=l.text;if(s.show&&l.show&&u.show){var c=a.getPrecision(),h=o.getAxisComponent(),d=a.getDataList(),p=a.getVisibleDataList(),v=d[d.length-1];if(void 0!==v){var g=v.close,f=v.open,y=h.convertToNicePixel(g),m=void 0;m=g>f?l.upColor:f>g?l.downColor:l.noChangeColor;var _=void 0;if(h.getType()===t.YAxisType.Percentage){var x=p[0].data.close;_="".concat(((g-x)/x*100).toFixed(2),"%")}else _=w(g,c.price);_=E(_,a.getThousandsSeparator());var S=void 0,C=void 0;h.isFromZero()?(S=0,C="left"):(S=r.width,C="right"),null===(i=this.createFigure("text",{x:S,y:y,text:_,align:C,baseline:"middle"},M(M({},u),{backgroundColor:m})))||void 0===i||i.draw(e)}}},i}(me),Be=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getCustomApi(),s=r.getStyles().indicator,l=s.lastValueMark,u=l.text;if(l.show){var c=n.getAxisComponent(),h=r.getDataList(),d=h.length-1,p=r.getIndicatorStore().getInstances(n.getId()),v=r.getThousandsSeparator();p.forEach((function(i){var n=i.result[d];if(void 0!==n&&i.visible){var r=i.precision;tt(h,i,d,s,(function(s,l){var h,d=n[s.key];if(f(d)){var p=c.convertToNicePixel(d),g=w(d,r);i.shouldFormatBigNumber&&(g=a.formatBigNumber(g)),g=E(g,v);var y=void 0,m=void 0;c.isFromZero()?(y=0,m="left"):(y=o.width,m="right"),null===(h=e.createFigure("text",{x:y,y:p,text:g,align:m,baseline:"middle"},M(M({},u),{backgroundColor:l.color})))||void 0===h||h.draw(t)}}))}}))}},e}(me),Oe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!1},e.prototype.drawDefaultFigures=function(t,e,i,n,o,r,a,s,l,u,c,h,d){this.drawFigures(t,e,this.getDefaultFigures(e,i,n,o,r,a,s,u,c,d),l)},e.prototype.getDefaultFigures=function(t,e,i,n,o,r,a,s,l,u){var c,h,d=[];if(t.needDefaultYAxisFigure&&t.id===(null===(c=u.instance)||void 0===c?void 0:c.id)&&u.paneId===this.getWidget().getPane().getId()){var p,v,g=Number.MAX_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER;null!==(h=null==l?void 0:l.isFromZero())&&void 0!==h&&h?(p="left",v=0):(p="right",v=i.width),e.forEach((function(e,i){var o=t.points[i];if(void 0!==o.value){g=Math.min(g,e.y),f=Math.max(f,e.y);var r=E(w(o.value,n.price),a);d.push({type:"text",attrs:{x:v,y:e.y,text:r,align:p,baseline:"middle"},ignoreEvent:!0})}})),e.length>1&&d.unshift({type:"rect",attrs:{x:0,y:g,width:i.width,height:f-g},ignoreEvent:!0})}return d},e.prototype.getFigures=function(t,e,i,n,o,r,a,s,l,u){var c,h;return null!==(h=null===(c=t.createYAxisFigures)||void 0===c?void 0:c.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:o,thousandsSeparator:r,dateTimeFormat:a,defaultStyles:s,xAxis:l,yAxis:u}))&&void 0!==h?h:[]},e}(Te),Ve=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=i.getPane().getChart().getChartStore(),a=r.getTooltipStore().getCrosshair(),s=r.getStyles().crosshair;if(void 0!==a.paneId&&this.compare(a,n.getId())&&s.show){var l=this.getDirectionStyles(s),u=l.text;if(l.show&&u.show){var c=n.getAxisComponent(),h=this.getText(a,r,c);t.font=H(u.size,u.weight,u.family),null===(e=this.createFigure("text",this.getTextAttrs(h,t.measureText(h).width,a,o,c,u),u))||void 0===e||e.draw(t)}}},i.prototype.compare=function(t,e){return t.paneId===e},i.prototype.getDirectionStyles=function(t){return t.horizontal},i.prototype.getText=function(e,i,n){var o,r,a,s=n,l=n.convertFromPixel(e.y);if(s.getType()===t.YAxisType.Percentage){var u=null!==(r=null===(o=i.getVisibleDataList()[0])||void 0===o?void 0:o.data)&&void 0!==r?r:{};a="".concat(((l-u.close)/u.close*100).toFixed(2),"%")}else{var c=i.getIndicatorStore().getInstances(e.paneId),h=0,d=!1;s.isInCandle()?h=i.getPrecision().price:c.forEach((function(t){h=Math.max(t.precision,h),d||(d=t.shouldFormatBigNumber)})),a=w(l,h),d&&(a=i.getCustomApi().formatBigNumber(a))}return E(a,i.getThousandsSeparator())},i.prototype.getTextAttrs=function(t,e,i,n,o,r){var a,s;return o.isFromZero()?(a=0,s="left"):(a=n.width,s="right"),{x:a,y:i.y,text:t,align:s,baseline:"middle"}},i}(me),We=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._yAxisView=new Le(n),n._candleLastPriceLabelView=new Re(n),n._indicatorLastValueView=new Be(n),n._overlayYAxisView=new Oe(n),n._crosshairHorizontalLabelView=new Ve(n),n.getContainer().style.cursor="ns-resize",n.addChild(n._overlayYAxisView),n}return P(e,t),e.prototype.getName=function(){return jt},e.prototype.updateMain=function(t){this._yAxisView.draw(t),this.getPane().getAxisComponent().isInCandle()&&this._candleLastPriceLabelView.draw(t),this._indicatorLastValueView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayYAxisView.draw(t),this._crosshairHorizontalLabelView.draw(t)},e}(Jt),Ne=function(){function t(t){this._extremum={min:0,max:0,range:0,realMin:0,realMax:0,realRange:0},this._prevExtremum={min:0,max:0,range:0,realMin:0,realMax:0,realRange:0},this._ticks=[],this._autoCalcTickFlag=!0,this._parent=t}return t.prototype.getParent=function(){return this._parent},t.prototype.buildTicks=function(t){return this._autoCalcTickFlag&&(this._extremum=this.calcExtremum()),!(this._prevExtremum.min===this._extremum.min&&this._prevExtremum.max===this._extremum.max&&!t)&&(this._prevExtremum=this._extremum,this._ticks=this.optimalTicks(this._calcTicks()),!0)},t.prototype.getTicks=function(){return this._ticks},t.prototype.getScrollZoomEnabled=function(){var t;return null===(t=this.getParent().getOptions().axisOptions.scrollZoomEnabled)||void 0===t||t},t.prototype.setExtremum=function(t){this._autoCalcTickFlag=!1,this._extremum=t},t.prototype.getExtremum=function(){return this._extremum},t.prototype.setAutoCalcTickFlag=function(t){this._autoCalcTickFlag=t},t.prototype.getAutoCalcTickFlag=function(){return this._autoCalcTickFlag},t.prototype._calcTicks=function(){var t=this._extremum,e=t.realMin,i=t.realMax,n=t.realRange,o=[];if(n>=0){var r=L(this._calcTickInterval(n),2),a=r[0],s=r[1],l=Z(Math.ceil(e/a)*a,s),u=Z(Math.floor(i/a)*a,s),c=0,h=l;if(0!==a)for(;u>=h;){var d=h.toFixed(s);o[c]={text:d,coord:0,value:d},++c,h+=a}}return o},t.prototype._calcTickInterval=function(t){var e,i,n,o,r=(i=Math.floor(K(e=t/8)),n=U(i),e=(1.5>(o=e/n)?1:2.5>o?2:3.5>o?3:4.5>o?4:5.5>o?5:6.5>o?6:8)*n,-20>i?e:+e.toFixed(0>i?-i:0)),a=function(t){var e=""+t,i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return 0>n?-n:0}var o=e.indexOf(".");return 0>o?0:e.length-1-o}(r);return[r,a]},t}(),ze=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.calcExtremum=function(){var e,i,n,o,r,a=this.getParent(),s=a.getChart(),l=s.getChartStore(),u=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER,h=[],d=!1,p=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER;l.getIndicatorStore().getInstances(a.getId()).forEach((function(t){var e,i,n;d||(d=null!==(e=t.shouldOhlc)&&void 0!==e&&e),g=Math.min(g,t.precision),null!==t.minValue&&(p=Math.min(p,t.minValue)),null!==t.maxValue&&(v=Math.max(v,t.maxValue)),h.push({figures:null!==(i=t.figures)&&void 0!==i?i:[],result:null!==(n=t.result)&&void 0!==n?n:[]})}));var y=4,m=this.isInCandle();if(m){var _=l.getPrecision().price;y=g!==Number.MAX_SAFE_INTEGER?Math.min(g,_):_}else g!==Number.MAX_SAFE_INTEGER&&(y=g);var x=l.getVisibleDataList(),S=s.getStyles().candle,C=S.type===t.CandleType.Area,b=S.area.value,w=m&&!C||!m&&d;x.forEach((function(t){var e=t.dataIndex,i=t.data;if(w&&(u=Math.min(u,i.low),c=Math.max(c,i.high)),m&&C){var n=i[b];u=Math.min(u,n),c=Math.max(c,n)}h.forEach((function(t){var i,n=null!==(i=t.result[e])&&void 0!==i?i:{};t.figures.forEach((function(t){var e=n[t.key];f(e)&&(u=Math.min(u,e),c=Math.max(c,e))}))}))})),u!==Number.MAX_SAFE_INTEGER&&c!==Number.MIN_SAFE_INTEGER?(u=Math.min(p,u),c=Math.max(v,c)):(u=0,c=10);var T,E=this.getType();switch(E){case t.YAxisType.Percentage:var I=null===(e=x[0])||void 0===e?void 0:e.data;void 0!==(null==I?void 0:I.close)&&(u=(u-I.close)/I.close*100,c=(c-I.close)/I.close*100),T=.01;break;case t.YAxisType.Log:u=K(u),c=K(c),T=.05*U(-y);break;default:T=U(-y)}if(u===c||T>Math.abs(u-c)){var P=p===u,D=v===c;u=P?u:D?u-8*T:u-4*T,c=D?c:P?c+8*T:c+4*T}var M=null!==(n=null===(i=this.getParent().getYAxisWidget())||void 0===i?void 0:i.getBounding().height)&&void 0!==n?n:0,k=a.getOptions().gap,A=null!==(o=null==k?void 0:k.top)&&void 0!==o?o:.2;1>A||(A/=M);var F=null!==(r=null==k?void 0:k.bottom)&&void 0!==r?r:.1;1>F||(F/=M);var L,R,B,O=Math.abs(c-u);return O=Math.abs((c+=O*A)-(u-=O*F)),E===t.YAxisType.Log?(L=U(u),R=U(c),B=Math.abs(R-L)):(L=u,R=c,B=O),{min:u,max:c,range:O,realMin:L,realMax:R,realRange:B}},i.prototype._innerConvertToPixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,o=this.getExtremum(),r=(t-o.min)/o.range;return this.isReverse()?Math.round(r*n):Math.round((1-r)*n)},i.prototype.isInCandle=function(){return this.getParent().getId()===Rt},i.prototype.getType=function(){return this.isInCandle()?this.getParent().getChart().getStyles().yAxis.type:t.YAxisType.Normal},i.prototype.getPosition=function(){return this.getParent().getChart().getStyles().yAxis.position},i.prototype.isReverse=function(){return!!this.isInCandle()&&this.getParent().getChart().getStyles().yAxis.reverse},i.prototype.isFromZero=function(){var e=this.getParent().getChart().getStyles().yAxis,i=e.inside;return e.position===t.YAxisPosition.Left&&i||e.position===t.YAxisPosition.Right&&!i},i.prototype.optimalTicks=function(e){var i,n,o=this,r=this.getParent(),a=null!==(n=null===(i=r.getYAxisWidget())||void 0===i?void 0:i.getBounding().height)&&void 0!==n?n:0,s=r.getChart().getChartStore(),l=s.getCustomApi(),u=[],c=this.getType(),h=s.getIndicatorStore().getInstances(r.getId()),d=s.getThousandsSeparator(),p=0,v=!1;this.isInCandle()?p=s.getPrecision().price:h.forEach((function(t){p=Math.max(p,t.precision),v||(v=t.shouldFormatBigNumber)}));var g,f=s.getStyles().xAxis.tickText.size;return e.forEach((function(e){var i,n=e.value,r=o._innerConvertToPixel(+n);switch(c){case t.YAxisType.Percentage:i="".concat(w(n,2),"%");break;case t.YAxisType.Log:r=o._innerConvertToPixel(K(+n)),i=w(n,p);break;default:i=w(n,p),v&&(i=l.formatBigNumber(n))}i=E(i,d),r>f&&a-f>r&&(void 0!==g&&Math.abs(g-r)>2*f||void 0===g)&&(u.push({text:i,coord:r,value:n}),g=r)})),u},i.prototype.getAutoSize=function(){var e=this.getParent(),i=e.getChart(),n=i.getStyles(),o=n.yAxis,r=o.size;if("auto"!==r)return r;var a=i.getChartStore(),s=a.getCustomApi(),l=0;if(o.show&&(o.axisLine.show&&(l+=o.axisLine.size),o.tickLine.show&&(l+=o.tickLine.length),o.tickText.show)){var u=0;this.getTicks().forEach((function(t){u=Math.max(u,X(t.text,o.tickText.size,o.tickText.weight,o.tickText.family))})),l+=o.tickText.marginStart+o.tickText.marginEnd+u}var c=n.crosshair,h=0;if(c.show&&c.horizontal.show&&c.horizontal.text.show){var d=a.getIndicatorStore().getInstances(e.getId()),p=0,v=!1;d.forEach((function(t){p=Math.max(t.precision,p),v||(v=t.shouldFormatBigNumber)}));var g=2;if(this.getType()!==t.YAxisType.Percentage)if(this.isInCandle()){var f=a.getPrecision().price,y=n.indicator.lastValueMark;g=y.show&&y.text.show?Math.max(p,f):f}else g=p;var m=w(this.getExtremum().max,g);v&&(m=s.formatBigNumber(m)),h+=c.horizontal.text.paddingLeft+c.horizontal.text.paddingRight+2*c.horizontal.text.borderSize+X(m,c.horizontal.text.size,c.horizontal.text.weight,c.horizontal.text.family)}return Math.max(l,h)},i.prototype.convertFromPixel=function(e){var i,n,o,r=null!==(n=null===(i=this.getParent().getYAxisWidget())||void 0===i?void 0:i.getBounding().height)&&void 0!==n?n:0,a=this.getExtremum(),s=a.min,l=a.range,u=(this.isReverse()?e/r:1-e/r)*l+s;switch(this.getType()){case t.YAxisType.Percentage:var c=null===(o=this.getParent().getChart().getChartStore().getVisibleDataList()[0])||void 0===o?void 0:o.data;return void 0!==(null==c?void 0:c.close)?c.close*u/100+c.close:0;case t.YAxisType.Log:return U(u);default:return u}},i.prototype.convertToRealValue=function(e){var i=e;return this.getType()===t.YAxisType.Log&&(i=U(e)),i},i.prototype.convertToPixel=function(e){var i,n=e;switch(this.getType()){case t.YAxisType.Percentage:var o=null===(i=this.getParent().getChart().getChartStore().getVisibleDataList()[0])||void 0===i?void 0:i.data;void 0!==(null==o?void 0:o.close)&&(n=(e-o.close)/o.close*100);break;case t.YAxisType.Log:n=K(e);break;default:n=e}return this._innerConvertToPixel(n)},i.prototype.convertToNicePixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,o=this.convertToPixel(t);return Math.round(Math.max(.05*n,Math.min(o,.98*n)))},i}(Ne),Ye=function(){function t(t,e,i,n){this._bounding=Gt(),this._chart=i,this._id=n,this._init(t,e)}return t.prototype._init=function(t,e){this._rootContainer=t,this._container=z("div",{width:"100%",margin:"0",padding:"0",position:"relative",overflow:"hidden",boxSizing:"border-box"}),null!==e?t.insertBefore(this._container,e):t.appendChild(this._container)},t.prototype.getContainer=function(){return this._container},t.prototype.getId=function(){return this._id},t.prototype.getChart=function(){return this._chart},t.prototype.getBounding=function(){return this._bounding},t.prototype.update=function(t){this._bounding.height!==this._container.offsetHeight&&(this._container.style.height="".concat(this._bounding.height,"px")),this.updateImp(null!=t?t:3,this._container,this._bounding)},t.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},t}(),He=function(t){function e(e,i,n,o){var r=t.call(this,e,i,n,o)||this;r._yAxisWidget=null,r._axis=r.createAxisComponent(),r._options={minHeight:30,dragEnabled:!0,gap:{top:.2,bottom:.1},axisOptions:{scrollZoomEnabled:!0}};var a=r.getContainer();return r._mainWidget=r.createMainWidget(a),r._yAxisWidget=r.createYAxisWidget(a),r}return P(e,t),e.prototype.setOptions=function(t){var e,i,n,o,r;return c(this._options,t),this.getId()===Ot?(o=this.getMainWidget().getContainer(),r="ew-resize"):(o=null===(e=this.getYAxisWidget())||void 0===e?void 0:e.getContainer(),r="ns-resize"),o.style.cursor=null===(n=null===(i=t.axisOptions)||void 0===i?void 0:i.scrollZoomEnabled)||void 0===n||n?r:"default",this},e.prototype.getOptions=function(){return this._options},e.prototype.getAxisComponent=function(){return this._axis},e.prototype.setBounding=function(t,e,i){var n,o;c(this.getBounding(),t);var r={};return f(t.height)&&(r.height=t.height),f(t.top)&&(r.top=t.top),this._mainWidget.setBounding(r),null===(n=this._yAxisWidget)||void 0===n||n.setBounding(r),f(e)&&this._mainWidget.setBounding(e),f(i)&&(null===(o=this._yAxisWidget)||void 0===o||o.setBounding(i)),this},e.prototype.getMainWidget=function(){return this._mainWidget},e.prototype.getYAxisWidget=function(){return this._yAxisWidget},e.prototype.updateImp=function(t){var e;this._mainWidget.update(t),null===(e=this._yAxisWidget)||void 0===e||e.update(t)},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=z("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=Y(o);o.width=i*a,o.height=n*a,r.scale(a,a);var s=this._mainWidget.getBounding();if(r.drawImage(this._mainWidget.getImage(t),s.left,0,s.width,s.height),null!==this._yAxisWidget){var l=this._yAxisWidget.getBounding();r.drawImage(this._yAxisWidget.getImage(t),l.left,0,l.width,l.height)}return o},e.prototype.createYAxisWidget=function(t){return null},e}(Ye),Xe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.createAxisComponent=function(){return new ze(this)},e.prototype.createMainWidget=function(t){return new Ee(t,this)},e.prototype.createYAxisWidget=function(t){return new We(t,this)},e}(He),je=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.createMainWidget=function(t){return new Ae(t,this)},e}(Xe),Ze=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.getAxisStyles=function(t){return t.xAxis},e.prototype.createAxisLine=function(t,e){var i=e.axisLine.size/2;return{coordinates:[{x:0,y:i},{x:t.width,y:i}]}},e.prototype.createTickLines=function(t,e,i){var n=i.tickLine,o=i.axisLine.size;return t.map((function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:o+n.length}]}}))},e.prototype.createTickTexts=function(t,e,i){var n=i.tickText,o=i.axisLine.size,r=i.tickLine.length;return t.map((function(t){return{x:t.coord,y:o+r+n.marginStart,text:t.text,align:"center",baseline:"top"}}))},e}(Fe),Ge=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},i.prototype.coordinateToPointValueFlag=function(){return!1},i.prototype.getCompleteOverlays=function(t){return t.getInstances()},i.prototype.getProgressOverlay=function(t){return t.instance},i.prototype.getDefaultFigures=function(e,i,n,o,r,a,s,l,u,c){var h,d=[];if(e.needDefaultXAxisFigure&&e.id===(null===(h=c.instance)||void 0===h?void 0:h.id)){var p=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER;i.forEach((function(i,n){p=Math.min(p,i.x),v=Math.max(v,i.x);var o=e.points[n];if(void 0!==o.timestamp){var s=a.formatDate(r,o.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair);d.push({type:"text",attrs:{x:i.x,y:0,text:s,align:"center"},ignoreEvent:!0})}})),i.length>1&&d.unshift({type:"rect",attrs:{x:p,y:0,width:v-p,height:n.height},ignoreEvent:!0})}return d},i.prototype.getFigures=function(t,e,i,n,o,r,a,s,l,u){var c,h;return null!==(h=null===(c=t.createXAxisFigures)||void 0===c?void 0:c.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:o,thousandsSeparator:r,dateTimeFormat:a,defaultStyles:s,xAxis:l,yAxis:u}))&&void 0!==h?h:[]},i}(Oe),Ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.compare=function(t){return void 0!==t.kLineData&&t.dataIndex===t.realDataIndex},i.prototype.getDirectionStyles=function(t){return t.vertical},i.prototype.getText=function(e,i){var n,o=null===(n=e.kLineData)||void 0===n?void 0:n.timestamp;return i.getCustomApi().formatDate(i.getTimeScaleStore().getDateTimeFormat(),o,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair)},i.prototype.getTextAttrs=function(t,e,i,n,o,r){var a,s=i.realX,l="center";return 0>s-e/2-r.paddingLeft?(a=0,l="left"):s+e/2+r.paddingRight>n.width?(a=n.width,l="right"):a=s,{x:a,y:0,text:t,align:l,baseline:"top"}},i}(Ve),Ue=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._xAxisView=new Ze(n),n._overlayXAxisView=new Ge(n),n._crosshairVerticalLabelView=new Ke(n),n.getContainer().style.cursor="ew-resize",n.addChild(n._overlayXAxisView),n}return P(e,t),e.prototype.getName=function(){return Xt},e.prototype.updateMain=function(t){this._xAxisView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayXAxisView.draw(t),this._crosshairVerticalLabelView.draw(t)},e}(Jt),qe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),i.prototype.calcExtremum=function(){var t=this.getParent().getChart().getChartStore().getTimeScaleStore().getVisibleRange(),e=t.from,i=t.to,n=i-1,o=i-e;return{min:e,max:n,range:o,realMin:e,realMax:n,realRange:o}},i.prototype.optimalTicks=function(e){var i,n,o=this.getParent().getChart(),r=o.getChartStore(),a=r.getCustomApi().formatDate,s=[],l=e.length,u=r.getDataList();if(l>0){var c=r.getTimeScaleStore().getDateTimeFormat(),h=o.getStyles().xAxis.tickText,d=X("00-00 00:00",h.size,h.weight,h.family),p=this.convertToPixel(parseInt(e[0].value,10)),v=1;if(l>1){var g=this.convertToPixel(parseInt(e[1].value,10)),f=Math.abs(g-p);d>f&&(v=Math.ceil(d/f))}for(var y=0;l>y;y+=v){var m=parseInt(e[y].value,10),_=u[m].timestamp,x=a(c,_,"HH:mm",t.FormatDateType.XAxis);if(0!==y)x=null!==(i=this._optimalTickLabel(a,c,_,u[parseInt(e[y-v].value,10)].timestamp))&&void 0!==i?i:x;var S=this.convertToPixel(m);s.push({text:x,coord:S,value:_})}if(1===s.length)s[0].text=a(c,s[0].value,"YYYY-MM-DD HH:mm",t.FormatDateType.XAxis);else{var C=s[0].value,b=s[1].value;if(void 0!==s[2]){var w=s[2].text;/^[0-9]{2}-[0-9]{2}$/.test(w)?s[0].text=a(c,C,"MM-DD",t.FormatDateType.XAxis):/^[0-9]{4}-[0-9]{2}$/.test(w)?s[0].text=a(c,C,"YYYY-MM",t.FormatDateType.XAxis):/^[0-9]{4}$/.test(w)&&(s[0].text=a(c,C,"YYYY",t.FormatDateType.XAxis))}else s[0].text=null!==(n=this._optimalTickLabel(a,c,C,b))&&void 0!==n?n:s[0].text}}return s},i.prototype._optimalTickLabel=function(e,i,n,o){var r=e(i,n,"YYYY",t.FormatDateType.XAxis),a=e(i,n,"YYYY-MM",t.FormatDateType.XAxis),s=e(i,n,"MM-DD",t.FormatDateType.XAxis);return r!==e(i,o,"YYYY",t.FormatDateType.XAxis)?r:a!==e(i,o,"YYYY-MM",t.FormatDateType.XAxis)?a:s!==e(i,o,"MM-DD",t.FormatDateType.XAxis)?s:null},i.prototype.getAutoSize=function(){var t=this.getParent().getChart().getStyles(),e=t.xAxis,i=e.size;if("auto"!==i)return i;var n=t.crosshair,o=0;e.show&&(e.axisLine.show&&(o+=e.axisLine.size),e.tickLine.show&&(o+=e.tickLine.length),e.tickText.show&&(o+=e.tickText.marginStart+e.tickText.marginEnd+e.tickText.size));var r=0;return n.show&&n.vertical.show&&n.vertical.text.show&&(r+=n.vertical.text.paddingTop+n.vertical.text.paddingBottom+2*n.vertical.text.borderSize+n.vertical.text.size),Math.max(o,r)},i.prototype.convertTimestampFromPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),i=e.coordinateToDataIndex(t);return e.dataIndexToTimestamp(i)},i.prototype.convertTimestampToPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),i=e.timestampToDataIndex(t);return e.dataIndexToCoordinate(i)},i.prototype.convertFromPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().coordinateToDataIndex(t)},i.prototype.convertToPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().dataIndexToCoordinate(t)},i}(Ne),$e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.createAxisComponent=function(){return new qe(this)},e.prototype.createMainWidget=function(t){return new Ue(t,this)},e}(He);function Je(){var t;return"undefined"!=typeof window&&(null!==(t=window.navigator.userAgent.toLowerCase().indexOf("firefox"))&&void 0!==t?t:-1)>-1}function Qe(){return"undefined"!=typeof window&&/iPhone|iPad|iPod/.test(window.navigator.platform)}var ti=function(){function t(t,e,i){var n=this;this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:-1/0,y:1/0},this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:-1/0,y:1/0},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartCoordinate=null,this._touchMoveStartCoordinate=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeMouseWheel=null,this._unsubscribeContextMenu=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._startPinchMiddleCoordinate=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!Qe(),this._onFirefoxOutsideMouseUp=function(t){n._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){n._firesTouchEvents(t)?(++n._tapCount,null!==n._tapTimeoutId&&n._tapCount>1&&(30>n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._tapCoordinate).manhattanDistance&&!n._cancelTap&&n._processEvent(n._makeCompatEvent(t),n._handler.doubleTapEvent),n._resetTapTimeout())):(++n._clickCount,null!==n._clickTimeoutId&&n._clickCount>1&&(5>n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._clickCoordinate).manhattanDistance&&!n._cancelClick&&n._processEvent(n._makeCompatEvent(t),n._handler.mouseDoubleClickEvent),n._resetClickTimeout()))},this._target=t,this._handler=e,this._options=i,this._init()}return t.prototype.destroy=function(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeMouseWheel&&(this._unsubscribeMouseWheel(),this._unsubscribeMouseWheel=null),null!==this._unsubscribeContextMenu&&(this._unsubscribeContextMenu(),this._unsubscribeContextMenu=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()},t.prototype._mouseEnterHandler=function(t){var e,i,n,o=this;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this);var r=this._mouseMoveHandler.bind(this);this._unsubscribeMousemove=function(){o._target.removeEventListener("mousemove",r)},this._target.addEventListener("mousemove",r);var a=this._mouseWheelHandler.bind(this);this._unsubscribeMouseWheel=function(){o._target.removeEventListener("wheel",a)},this._target.addEventListener("wheel",a,{passive:!1});var s=this._contextMenuHandler.bind(this);this._unsubscribeContextMenu=function(){o._target.removeEventListener("contextmenu",s)},this._target.addEventListener("contextmenu",s,{passive:!1}),this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseEnterEvent),this._acceptMouseLeave=!0)},t.prototype._resetClickTimeout=function(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:-1/0,y:1/0}},t.prototype._resetTapTimeout=function(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:-1/0,y:1/0}},t.prototype._mouseMoveHandler=function(t){this._mousePressed||null!==this._touchMoveStartCoordinate||this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseMoveEvent),this._acceptMouseLeave=!0)},t.prototype._mouseWheelHandler=function(t){if(Math.abs(t.deltaX)>Math.abs(t.deltaY)){if(void 0===this._handler.mouseWheelHortEvent)return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(void 0===this._handler.mouseWheelVertEvent)return;var e=-t.deltaY/100;if(0===e)return;switch(this._preventDefault(t),t.deltaMode){case t.DOM_DELTA_PAGE:e*=120;break;case t.DOM_DELTA_LINE:e*=32}if(0!==e){var i=Math.sign(e)*Math.min(1,Math.abs(e));this._handler.mouseWheelVertEvent(this._makeCompatEvent(t),i)}}},t.prototype._contextMenuHandler=function(t){this._preventDefault(t)},t.prototype._touchMoveHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null!==e&&(this._lastTouchEventTimeStamp=this._eventTimeStamp(t),null===this._startPinchMiddleCoordinate&&!this._preventTouchDragProcess)){this._pinchPrevented=!0;var i=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._touchMoveStartCoordinate),n=i.yOffset;if(this._touchMoveExceededManhattanDistance||i.manhattanDistance>=5){if(!this._touchMoveExceededManhattanDistance){var o=.5*i.xOffset,r=n>=o&&!this._options.treatVertDragAsPageScroll(),a=o>n&&!this._options.treatHorzDragAsPageScroll();r||a||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}this._preventTouchDragProcess||this._processEvent(this._makeCompatEvent(t,e),this._handler.touchMoveEvent)}}},t.prototype._mouseMoveWithDownHandler=function(t){0===t.button&&(5>this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._mouseMoveStartCoordinate).manhattanDistance||(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick&&this._processEvent(this._makeCompatEvent(t),this._handler.pressedMouseMoveEvent))},t.prototype._mouseTouchMoveWithDownInfo=function(t,e){var i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return{xOffset:i,yOffset:n,manhattanDistance:i+n}},t.prototype._touchEndHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null!==e){this._activeTouchId=null,this._lastTouchEventTimeStamp=this._eventTimeStamp(t),this._clearLongTapTimeout(),this._touchMoveStartCoordinate=null,null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var i=this._makeCompatEvent(t,e);if(this._processEvent(i,this._handler.touchEndEvent),++this._tapCount,null!==this._tapTimeoutId&&this._tapCount>1)30>this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance&&!this._cancelTap&&this._processEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout();else this._cancelTap||(this._processEvent(i,this._handler.tapEvent),void 0!==this._handler.tapEvent&&this._preventDefault(t));0===this._tapCount&&this._preventDefault(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,this._preventDefault(t))}},t.prototype._mouseUpHandler=function(t){if(0===t.button){var e=this._makeCompatEvent(t);if(this._mouseMoveStartCoordinate=null,this._mousePressed=!1,null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),Je())this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp);if(!this._firesTouchEvents(t))if(this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,null!==this._clickTimeoutId&&this._clickCount>1)5>this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance&&!this._cancelClick&&this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout();else this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent)}},t.prototype._clearLongTapTimeout=function(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)},t.prototype._touchStartHandler=function(t){if(null===this._activeTouchId){var e=t.changedTouches[0];this._activeTouchId=e.identifier,this._lastTouchEventTimeStamp=this._eventTimeStamp(t);var i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartCoordinate=this._getCoordinate(e),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var n=this._touchMoveHandler.bind(this),o=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=function(){i.removeEventListener("touchmove",n),i.removeEventListener("touchend",o)},i.addEventListener("touchmove",n,{passive:!1}),i.addEventListener("touchend",o,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),500),this._processEvent(this._makeCompatEvent(t,e),this._handler.touchStartEvent),null===this._tapTimeoutId&&(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapCoordinate=this._getCoordinate(e))}},t.prototype._mouseDownHandler=function(t){if(2===t.button)return this._preventDefault(t),void this._processEvent(this._makeCompatEvent(t),this._handler.mouseRightClickEvent);if(0===t.button){var e=this._target.ownerDocument.documentElement;Je()&&e.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartCoordinate=this._getCoordinate(t),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);var i=this._mouseMoveWithDownHandler.bind(this),n=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=function(){e.removeEventListener("mousemove",i),e.removeEventListener("mouseup",n)},e.addEventListener("mousemove",i),e.addEventListener("mouseup",n),this._mousePressed=!0,this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseDownEvent),null===this._clickTimeoutId&&(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickCoordinate=this._getCoordinate(t)))}},t.prototype._init=function(){var t=this;this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));var e=this._target.ownerDocument,i=function(e){null!=t._handler.mouseDownOutsideEvent&&(e.composed&&t._target.contains(e.composedPath()[0])||null!==e.target&&t._target.contains(e.target)||t._handler.mouseDownOutsideEvent({x:0,y:0,pageX:0,pageY:0}))};this._unsubscribeOutsideTouchEvents=function(){e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=function(){e.removeEventListener("mousedown",i)},e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!0}),Qe()&&(this._unsubscribeMobileSafariEvents=function(){t._target.removeEventListener("dblclick",t._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),this._target.addEventListener("mousedown",(function(t){if(1===t.button)return t.preventDefault(),!1})),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(function(){}),{passive:!1})},t.prototype._initPinch=function(){var t=this;void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",(function(e){return t._checkPinchState(e.touches)}),{passive:!0}),this._target.addEventListener("touchmove",(function(e){if(2===e.touches.length&&null!==t._startPinchMiddleCoordinate&&void 0!==t._handler.pinchEvent){var i=t._getTouchDistance(e.touches[0],e.touches[1])/t._startPinchDistance;t._handler.pinchEvent(M(M({},t._startPinchMiddleCoordinate),{pageX:0,pageY:0}),i),t._preventDefault(e)}}),{passive:!1}),this._target.addEventListener("touchend",(function(e){t._checkPinchState(e.touches)})))},t.prototype._checkPinchState=function(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)},t.prototype._startPinch=function(t){var e,i=null!==(e=this._target.getBoundingClientRect())&&void 0!==e?e:{left:0,top:0};this._startPinchMiddleCoordinate={x:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,y:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this._startPinchDistance=this._getTouchDistance(t[0],t[1]),void 0!==this._handler.pinchStartEvent&&this._handler.pinchStartEvent({x:0,y:0,pageX:0,pageY:0}),this._clearLongTapTimeout()},t.prototype._stopPinch=function(){null!==this._startPinchMiddleCoordinate&&(this._startPinchMiddleCoordinate=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent({x:0,y:0,pageX:0,pageY:0}))},t.prototype._mouseLeaveHandler=function(t){var e,i,n;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this),this._firesTouchEvents(t)||this._acceptMouseLeave&&(this._processEvent(this._makeCompatEvent(t),this._handler.mouseLeaveEvent),this._acceptMouseLeave=!Qe())},t.prototype._longTapHandler=function(t){var e=this._touchWithId(t.touches,this._activeTouchId);null!==e&&(this._processEvent(this._makeCompatEvent(t,e),this._handler.longTapEvent),this._cancelTap=!0,this._longTapActive=!0)},t.prototype._firesTouchEvents=function(t){var e;return void 0!==(null===(e=t.sourceCapabilities)||void 0===e?void 0:e.firesTouchEvents)?t.sourceCapabilities.firesTouchEvents:this._eventTimeStamp(t)<this._lastTouchEventTimeStamp+500},t.prototype._processEvent=function(t,e){null==e||e.call(this._handler,t)},t.prototype._makeCompatEvent=function(t,e){var i,n=this,o=null!=e?e:t,r=null!==(i=this._target.getBoundingClientRect())&&void 0!==i?i:{left:0,top:0};return{x:o.clientX-r.left,y:o.clientY-r.top,pageX:o.pageX,pageY:o.pageY,isTouch:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,preventDefault:function(){"touchstart"!==t.type&&n._preventDefault(t)}}},t.prototype._getTouchDistance=function(t,e){var i=t.clientX-e.clientX,n=t.clientY-e.clientY;return Math.sqrt(i*i+n*n)},t.prototype._preventDefault=function(t){t.cancelable&&t.preventDefault()},t.prototype._getCoordinate=function(t){return{x:t.pageX,y:t.pageY}},t.prototype._eventTimeStamp=function(t){var e;return null!==(e=t.timeStamp)&&void 0!==e?e:performance.now()},t.prototype._touchWithId=function(t,e){for(var i=0;t.length>i;++i)if(t[i].identifier===e)return t[i];return null},t}(),ei=function(){function t(t,e){var i=this;this._flingStartTime=(new Date).getTime(),this._flingScrollRequestId=null,this._startScrollCoordinate=null,this._touchCoordinate=null,this._touchCancelCrosshair=!1,this._touchZoomed=!1,this._pinchScale=1,this._mouseDownWidget=null,this._prevYAxisExtremum=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,this._mouseMoveTriggerWidgetInfo={pane:null,widget:null},this._boundKeyBoardDownEvent=function(t){if(t.shiftKey)switch(t.code){case"Equal":i._chart.getChartStore().getTimeScaleStore().zoom(.5);break;case"Minus":i._chart.getChartStore().getTimeScaleStore().zoom(-.5);break;case"ArrowLeft":(e=i._chart.getChartStore().getTimeScaleStore()).startScroll(),e.scroll(-3*e.getBarSpace().bar);break;case"ArrowRight":var e;(e=i._chart.getChartStore().getTimeScaleStore()).startScroll(),e.scroll(3*e.getBarSpace().bar)}},this._container=t,this._chart=e,this._event=new ti(t,this,{treatVertDragAsPageScroll:function(){return!1},treatHorzDragAsPageScroll:function(){return!1}}),t.addEventListener("keydown",this._boundKeyBoardDownEvent)}return t.prototype.pinchStartEvent=function(){return this._touchZoomed=!0,this._pinchScale=1,!0},t.prototype.pinchEvent=function(t,e){var i=this._findWidgetByEvent(t),n=i.pane,o=i.widget;if((null==n?void 0:n.getId())!==Ot&&(null==o?void 0:o.getName())===Ht){var r=this._makeWidgetEvent(t,o),a=5*(e-this._pinchScale);return this._pinchScale=e,this._chart.getChartStore().getTimeScaleStore().zoom(a,{x:r.x,y:r.y}),!0}return!1},t.prototype.mouseWheelHortEvent=function(t,e){var i=this._chart.getChartStore().getTimeScaleStore();return i.startScroll(),i.scroll(e),!0},t.prototype.mouseWheelVertEvent=function(t,e){var i,n=this._findWidgetByEvent(t).widget,o=null!==(i=t.isTouch)&&void 0!==i&&i,r=this._makeWidgetEvent(t,n),a=null,s=null==n?void 0:n.getName();if(o)if(s===Ht||s===Xt)a={x:r.x,y:r.y};else{var l=this._chart.getCandlePane().getBounding();a={x:l.width/2,y:l.height/2}}else s===Ht&&(a={x:r.x,y:r.y});return null!==a&&(this._chart.getChartStore().getTimeScaleStore().zoom(e,{x:r.x,y:r.y}),!0)},t.prototype.mouseDownEvent=function(t){var e,i,n=this._findWidgetByEvent(t),o=n.pane,r=n.widget;if(this._mouseDownWidget=r,null!==r){var a=this._makeWidgetEvent(t,r);switch(r.getName()){case Zt:return r.dispatchEvent("mouseDownEvent",a);case Ht:var s=null!==(e=o.getAxisComponent().getExtremum())&&void 0!==e?e:null;return this._prevYAxisExtremum=null===s?s:M({},s),this._startScrollCoordinate={x:a.x,y:a.y},this._chart.getChartStore().getTimeScaleStore().startScroll(),r.dispatchEvent("mouseDownEvent",a);case Xt:return(l=r.dispatchEvent("mouseDownEvent",a))&&this._chart.updatePane(1),this._xAxisStartScaleCoordinate={x:a.x,y:a.y},this._xAxisStartScaleDistance=a.pageX,l;case jt:var l;(l=r.dispatchEvent("mouseDownEvent",a))&&this._chart.updatePane(1);s=null!==(i=o.getAxisComponent().getExtremum())&&void 0!==i?i:null;return this._prevYAxisExtremum=null===s?s:M({},s),this._yAxisStartScaleDistance=a.pageY,l}}return!1},t.prototype.mouseMoveEvent=function(t){var e,i,n,o=this._findWidgetByEvent(t),r=o.pane,a=o.widget,s=this._makeWidgetEvent(t,a);if((null===(e=this._mouseMoveTriggerWidgetInfo.pane)||void 0===e?void 0:e.getId())===(null==r?void 0:r.getId())&&(null===(i=this._mouseMoveTriggerWidgetInfo.widget)||void 0===i?void 0:i.getName())===(null==a?void 0:a.getName())||(null==a||a.dispatchEvent("mouseEnterEvent",s),null===(n=this._mouseMoveTriggerWidgetInfo.widget)||void 0===n||n.dispatchEvent("mouseLeaveEvent",s),this._mouseMoveTriggerWidgetInfo={pane:r,widget:a}),null!==a)switch(a.getName()){case Ht:var l=a.dispatchEvent("mouseMoveEvent",s),u=this._chart.getChartStore(),c={x:s.x,y:s.y,paneId:null==r?void 0:r.getId()};return l&&null!==u.getTooltipStore().getActiveIcon()&&(c=void 0,null!==a&&(a.getContainer().style.cursor="pointer")),this._chart.getChartStore().getTooltipStore().setCrosshair(c),l;case Zt:case Xt:case jt:l=a.dispatchEvent("mouseMoveEvent",s);return this._chart.getChartStore().getTooltipStore().setCrosshair(),l}return!1},t.prototype.pressedMouseMoveEvent=function(t){var e,i,n,o,r;if(null!==this._mouseDownWidget&&this._mouseDownWidget.getName()===Zt)return this._mouseDownWidget.dispatchEvent("pressedMouseMoveEvent",t);var a=this._findWidgetByEvent(t),s=a.pane,l=a.widget;if(null!==l&&(null===(e=this._mouseDownWidget)||void 0===e?void 0:e.getPane().getId())===(null==s?void 0:s.getId())&&(null===(i=this._mouseDownWidget)||void 0===i?void 0:i.getName())===l.getName()){var u=this._makeWidgetEvent(t,l);switch(l.getName()){case Ht:var c=l.getBounding();if(!(x=l.dispatchEvent("pressedMouseMoveEvent",u))&&null!==this._startScrollCoordinate){var h=s.getAxisComponent();if(null!==this._prevYAxisExtremum&&!h.getAutoCalcTickFlag()&&h.getScrollZoomEnabled()){var d=this._prevYAxisExtremum,p=d.min,v=d.max+(b=(S=d.range)*(C=(null!==(n=null==h?void 0:h.isReverse())&&void 0!==n&&n?this._startScrollCoordinate.y-u.y:u.y-this._startScrollCoordinate.y)/c.height)),g=h.convertToRealValue(w=p+b),f=h.convertToRealValue(v);h.setExtremum({min:w,max:v,range:v-w,realMin:g,realMax:f,realRange:f-g})}var y=u.x-this._startScrollCoordinate.x;this._chart.getChartStore().getTimeScaleStore().scroll(y)}return this._chart.getChartStore().getTooltipStore().setCrosshair({x:u.x,y:u.y,paneId:null==s?void 0:s.getId()}),x;case Xt:if(x=l.dispatchEvent("pressedMouseMoveEvent",u))this._chart.updatePane(1);else{var m=s.getAxisComponent();if(null===(o=null==m?void 0:m.getScrollZoomEnabled())||void 0===o||o){var _=10*((C=this._xAxisStartScaleDistance/u.pageX)-this._xAxisScale);this._xAxisScale=C,this._chart.getChartStore().getTimeScaleStore().zoom(_,null!==(r=this._xAxisStartScaleCoordinate)&&void 0!==r?r:void 0)}}return x;case jt:var x;if(x=l.dispatchEvent("pressedMouseMoveEvent",u))this._chart.updatePane(1);else{h=s.getAxisComponent();if(null!==this._prevYAxisExtremum&&h.getScrollZoomEnabled()){var S,C,b,w,T=this._prevYAxisExtremum,E=(S=T.range)*(C=u.pageY/this._yAxisStartScaleDistance);v=T.max+(b=(E-S)/2),g=h.convertToRealValue(w=(p=T.min)-b),f=h.convertToRealValue(v);h.setExtremum({min:w,max:v,range:E,realMin:g,realMax:f,realRange:f-g}),this._chart.adjustPaneViewport(!1,!0,!0,!0)}}return x}}return!1},t.prototype.mouseUpEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e);switch(e.getName()){case Ht:case Zt:case Xt:case jt:i=e.dispatchEvent("mouseUpEvent",n)}i&&this._chart.updatePane(1)}return this._mouseDownWidget=null,this._startScrollCoordinate=null,this._prevYAxisExtremum=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,i},t.prototype.mouseClickEvent=function(t){var e=this._findWidgetByEvent(t).widget;if(null!==e){var i=this._makeWidgetEvent(t,e);return e.dispatchEvent("mouseClickEvent",i)}return!1},t.prototype.mouseRightClickEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e);switch(e.getName()){case Ht:case Xt:case jt:i=e.dispatchEvent("mouseRightClickEvent",n)}i&&this._chart.updatePane(1)}return!1},t.prototype.mouseDoubleClickEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n)switch(n.getName()){case Ht:var o=this._makeWidgetEvent(t,n);return n.dispatchEvent("mouseDoubleClickEvent",o);case jt:var r=i.getAxisComponent();if(!r.getAutoCalcTickFlag())return r.setAutoCalcTickFlag(!0),this._chart.adjustPaneViewport(!1,!0,!0,!0),!0}return!1},t.prototype.mouseLeaveEvent=function(){return this._chart.getChartStore().getTooltipStore().setCrosshair(),!0},t.prototype.touchStartEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n){var o=this._makeWidgetEvent(t,n);switch(n.getName()){case Ht:var r=this._chart.getChartStore(),a=r.getTooltipStore();if(n.dispatchEvent("mouseDownEvent",o))return this._touchCancelCrosshair=!0,this._touchCoordinate=null,a.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._flingScrollRequestId&&(qt(this._flingScrollRequestId),this._flingScrollRequestId=null),this._flingStartTime=(new Date).getTime(),this._startScrollCoordinate={x:o.x,y:o.y},r.getTimeScaleStore().startScroll(),this._touchZoomed=!1,null!==this._touchCoordinate){var s=o.x-this._touchCoordinate.x,l=o.y-this._touchCoordinate.y;10>Math.sqrt(s*s+l*l)?(this._touchCoordinate={x:o.x,y:o.y},a.setCrosshair({x:o.x,y:o.y,paneId:null==i?void 0:i.getId()})):(this._touchCoordinate=null,this._touchCancelCrosshair=!0,a.setCrosshair())}return!0;case Xt:case jt:var u=n.dispatchEvent("mouseDownEvent",o);return u&&this._chart.updatePane(1),u}}return!1},t.prototype.touchMoveEvent=function(t){var e,i,n,o=this._findWidgetByEvent(t),r=o.pane,a=o.widget;if(null!==a){var s=this._makeWidgetEvent(t,a),l=a.getName(),u=this._chart.getChartStore(),c=u.getTooltipStore();switch(l){case Ht:if(a.dispatchEvent("pressedMouseMoveEvent",s))return null===(e=s.preventDefault)||void 0===e||e.call(s),c.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._touchCoordinate)null===(i=s.preventDefault)||void 0===i||i.call(s),c.setCrosshair({x:s.x,y:s.y,paneId:null==r?void 0:r.getId()});else if(null!==this._startScrollCoordinate&&Math.abs(this._startScrollCoordinate.x-s.x)>this._startScrollCoordinate.y-s.y){var h=s.x-this._startScrollCoordinate.x;u.getTimeScaleStore().scroll(h)}return!0;case Xt:case jt:var d=a.dispatchEvent("pressedMouseMoveEvent",s);return d&&(null===(n=s.preventDefault)||void 0===n||n.call(s),this._chart.updatePane(1)),d}}return!1},t.prototype.touchEndEvent=function(t){var e=this,i=this._findWidgetByEvent(t).widget;if(null!==i){var n=this._makeWidgetEvent(t,i);switch(i.getName()){case Ht:if(i.dispatchEvent("mouseUpEvent",n),null!==this._startScrollCoordinate){var o=(new Date).getTime()-this._flingStartTime,r=(n.x-this._startScrollCoordinate.x)/(o>0?o:1)*20;if(200>o&&Math.abs(r)>0){var a=this._chart.getChartStore().getTimeScaleStore(),s=function(){e._flingScrollRequestId=Ut((function(){a.startScroll(),a.scroll(r),1>Math.abs(r*=.975)?null!==e._flingScrollRequestId&&(qt(e._flingScrollRequestId),e._flingScrollRequestId=null):s()}))};s()}}return!0;case Xt:case jt:i.dispatchEvent("mouseUpEvent",n)&&this._chart.updatePane(1)}}return!1},t.prototype.tapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget,o=!1;if(null!==n){var r=this._makeWidgetEvent(t,n),a=n.dispatchEvent("mouseClickEvent",r);if(n.getName()===Ht){var s=this._makeWidgetEvent(t,n),l=this._chart.getChartStore().getTooltipStore();a?(this._touchCancelCrosshair=!0,this._touchCoordinate=null,l.setCrosshair(void 0,!0),o=!0):(this._touchCancelCrosshair||this._touchZoomed||(this._touchCoordinate={x:s.x,y:s.y},l.setCrosshair({x:s.x,y:s.y,paneId:null==i?void 0:i.getId()},!0),o=!0),this._touchCancelCrosshair=!1)}(o||a)&&this._chart.updatePane(1)}return o},t.prototype.doubleTapEvent=function(t){return this.mouseDoubleClickEvent(t)},t.prototype.longTapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n&&n.getName()===Ht){var o=this._makeWidgetEvent(t,n);return this._touchCoordinate={x:o.x,y:o.y},this._chart.getChartStore().getTooltipStore().setCrosshair({x:o.x,y:o.y,paneId:null==i?void 0:i.getId()}),!0}return!1},t.prototype._findWidgetByEvent=function(t){var e,i,n,o,r=t.x,a=t.y,s=this._chart.getAllSeparatorPanes(),l=this._chart.getChartStore().getStyles().separator.size;try{for(var u=F(s),c=u.next();!c.done;c=u.next()){var h=L(c.value,2)[1],d=(y=h.getBounding()).top-Math.round((7-l)/2);if(!(y.left>r||r>y.left+y.width||d>a||a>d+7))return{pane:h,widget:h.getWidget()}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}var p=this._chart.getAllDrawPanes(),v=null;try{for(var g=F(p),f=g.next();!f.done;f=g.next()){var y,m=f.value;if(!((y=m.getBounding()).left>r||r>y.left+y.width||y.top>a||a>y.top+y.height)){v=m;break}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}var _=null;if(null!==v){if(null===_){var x=v.getMainWidget(),S=x.getBounding();S.left>r||r>S.left+S.width||S.top>a||a>S.top+S.height||(_=x)}if(null===_){var C=v.getYAxisWidget();if(null!==C){var b=C.getBounding();b.left>r||r>b.left+b.width||b.top>a||a>b.top+b.height||(_=C)}}}return{pane:v,widget:_}},t.prototype._makeWidgetEvent=function(t,e){var i,n,o,r=null!==(i=null==e?void 0:e.getBounding())&&void 0!==i?i:null;return M(M({},t),{x:t.x-(null!==(n=null==r?void 0:r.left)&&void 0!==n?n:0),y:t.y-(null!==(o=null==r?void 0:r.top)&&void 0!==o?o:0)})},t.prototype.destroy=function(){this._container.removeEventListener("keydown",this._boundKeyBoardDownEvent),this._event.destroy()},t}();var ii,ni=function(e){function i(t,i){var n,o,r,a=e.call(this,t,i)||this;return a._dragFlag=!1,a._dragStartY=0,a._topPaneHeight=0,a._bottomPaneHeight=0,a._pressedMouseMoveEvent=(n=a._pressedTouchMouseMoveEvent,o=20,r=0,function(){var t=Date.now();t-r>(null!=o?o:20)&&(n.apply(this,arguments),r=t)}),a.registerEvent("touchStartEvent",a._mouseDownEvent.bind(a)).registerEvent("touchMoveEvent",a._pressedMouseMoveEvent.bind(a)).registerEvent("touchEndEvent",a._mouseUpEvent.bind(a)).registerEvent("mouseDownEvent",a._mouseDownEvent.bind(a)).registerEvent("mouseUpEvent",a._mouseUpEvent.bind(a)).registerEvent("pressedMouseMoveEvent",a._pressedMouseMoveEvent.bind(a)).registerEvent("mouseEnterEvent",a._mouseEnterEvent.bind(a)).registerEvent("mouseLeaveEvent",a._mouseLeaveEvent.bind(a)),a}return P(i,e),i.prototype.getName=function(){return Zt},i.prototype.checkEventOn=function(){return!0},i.prototype._mouseDownEvent=function(t){this._dragFlag=!0,this._dragStartY=t.pageY;var e=this.getPane();return this._topPaneHeight=e.getTopPane().getBounding().height,this._bottomPaneHeight=e.getBottomPane().getBounding().height,!0},i.prototype._mouseUpEvent=function(){return this._dragFlag=!1,this._mouseLeaveEvent()},i.prototype._pressedTouchMouseMoveEvent=function(e){var i=e.pageY-this._dragStartY,n=this.getPane(),o=n.getTopPane(),r=n.getBottomPane(),a=0>i;if(null!==o&&null!==r&&r.getOptions().dragEnabled){var s=void 0,l=void 0,u=void 0,c=void 0;a?(s=o,l=r,u=this._topPaneHeight,c=this._bottomPaneHeight):(s=r,l=o,u=this._bottomPaneHeight,c=this._topPaneHeight);var h=s.getOptions().minHeight;if(u>h){var d=Math.max(u-Math.abs(i),h),p=u-d;s.setBounding({height:d}),l.setBounding({height:c+p});var v=n.getChart();v.getChartStore().getActionStore().execute(t.ActionType.OnPaneDrag,{paneId:n.getId}),v.adjustPaneViewport(!0,!0,!0,!0,!0)}}return!0},i.prototype._mouseEnterEvent=function(){var t,e=this.getPane(),i=e.getBottomPane();if(null!==(t=null==i?void 0:i.getOptions().dragEnabled)&&void 0!==t&&t){var n=e.getChart().getStyles().separator;return this.getContainer().style.background=n.activeBackgroundColor,!0}return!1},i.prototype._mouseLeaveEvent=function(){return!this._dragFlag&&(this.getContainer().style.background="",!0)},i.prototype.createContainer=function(){return z("div",{width:"100%",height:"".concat(7,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},i.prototype.updateImp=function(t,e,i){if(4===i||2===i){var n=this.getPane().getChart().getStyles().separator;t.style.top="".concat(-Math.floor((7-n.size)/2),"px"),t.style.height="".concat(7,"px")}},i}(Kt),oi=function(t){function e(e,i,n,o,r,a){var s=t.call(this,e,i,n,o)||this;return s.getContainer().style.overflow="",s._topPane=r,s._bottomPane=a,s._separatorWidget=new ni(s.getContainer(),s),s}return P(e,t),e.prototype.setBounding=function(t){return c(this.getBounding(),t),this},e.prototype.getTopPane=function(){return this._topPane},e.prototype.setTopPane=function(t){return this._topPane=t,this},e.prototype.getBottomPane=function(){return this._bottomPane},e.prototype.setBottomPane=function(t){return this._bottomPane=t,this},e.prototype.getWidget=function(){return this._separatorWidget},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=this.getChart().getStyles().separator,r=z("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),s=Y(r);return r.width=i*s,r.height=n*s,a.scale(s,s),a.fillStyle=o.color,a.fillRect(0,0,i,n),r},e.prototype.updateImp=function(t,e,i){if(4===t||2===t){var n=this.getChart().getStyles().separator;e.style.backgroundColor=n.color,e.style.height="".concat(i.height,"px"),e.style.marginLeft="".concat(i.left,"px"),e.style.width="".concat(i.width,"px"),this._separatorWidget.update(t)}},e}(Ye);t.DomPosition=void 0,(ii=t.DomPosition||(t.DomPosition={})).Root="root",ii.Main="main",ii.YAxis="yAxis";var ri=function(){function e(t,e){this._drawPanes=[],this._separatorPanes=new Map,this._initContainer(t),this._chartEvent=new ei(this._chartContainer,this),this._chartStore=new Yt(this,e),this._initPanes(e),this.adjustPaneViewport(!0,!0,!0)}return e.prototype._initContainer=function(t){this._container=t,this._chartContainer=z("div",{position:"relative",width:"100%",outline:"none",borderStyle:"none",cursor:"crosshair",boxSizing:"border-box",userSelect:"none",webkitUserSelect:"none",msUserSelect:"none",MozUserSelect:"none",webkitTapHighlightColor:"transparent"}),this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer)},e.prototype._initPanes=function(t){var e,i=this,n=null!==(e=null==t?void 0:t.layout)&&void 0!==e?e:[{type:"candle"}],o=!1,r=!1,a=function(t){if(!r){var e=i._createPane($e,Ot,null!=t?t:{});i._xAxisPane=e,r=!0}};n.forEach((function(t){var e,n,r;switch(t.type){case"candle":if(!o){var s=null!==(e=t.options)&&void 0!==e?e:{};c(s,{id:Rt});var l=i._createPane(je,Rt,s);i._candlePane=l,(u=null!==(n=t.content)&&void 0!==n?n:[]).forEach((function(t){i.createIndicator(t,!0,s)})),o=!0}break;case"indicator":var u,h;if((u=null!==(r=t.content)&&void 0!==r?r:[]).length>0)u.forEach((function(e){f(h)?i.createIndicator(e,!0,{id:h}):h=i.createIndicator(e,!0,t.options)}));break;case"xAxis":a(t.options)}})),a({position:"bottom"})},e.prototype._createPane=function(t,e,i){var n,o,r;switch(null==i?void 0:i.position){case"top":var a=this._drawPanes[0];f(a)&&(o=new t(this._chartContainer,a.getContainer(),this,e),n=0);break;case"bottom":break;default:for(var s=this._drawPanes.length-1;s>-1;s--){var l=this._drawPanes[s],u=this._drawPanes[s-1];"bottom"===(null==l?void 0:l.getOptions().position)&&"bottom"!==(null==u?void 0:u.getOptions().position)&&(o=new t(this._chartContainer,l.getContainer(),this,e),n=s)}}if(f(o)||(o=new t(this._chartContainer,null,this,e)),o.setOptions(null!=i?i:{}),f(n)?(this._drawPanes.splice(n,0,o),r=n):(this._drawPanes.push(o),r=this._drawPanes.length-1),o.getId()!==Ot){var c=this._drawPanes[r+1];if(f(c)&&c.getId()===Ot&&(c=this._drawPanes[r+2]),f(c))f(d=this._separatorPanes.get(c))?d.setTopPane(o):(d=new oi(this._chartContainer,c.getContainer(),this,"",o,c),this._separatorPanes.set(c,d));var h=this._drawPanes[r-1];if(f(h)&&h.getId()===Ot&&(h=this._drawPanes[r-2]),f(h)){var d=new oi(this._chartContainer,o.getContainer(),this,"",h,o);this._separatorPanes.set(o,d)}}return o},e.prototype._measurePaneHeight=function(){var t,e=this,i=this._container.offsetHeight,n=this._chartStore.getStyles().separator.size,o=this._xAxisPane.getAxisComponent().getAutoSize(),r=i-o-this._separatorPanes.size*n;0>r&&(r=0);var a=0;this._drawPanes.forEach((function(t){if(t.getId()!==Rt&&t.getId()!==Ot){var e=t.getBounding().height,i=t.getOptions().minHeight;i>e&&(e=i),a+e>r?e=Math.max(r-(a=r),0):a+=e,t.setBounding({height:e})}})),null===(t=this._candlePane)||void 0===t||t.setBounding({height:r-a}),this._xAxisPane.setBounding({height:o});var s=0;this._drawPanes.forEach((function(t){var i=e._separatorPanes.get(t);f(i)&&(i.setBounding({height:n,top:s}),s+=n),t.setBounding({top:s}),s+=t.getBounding().height}))},e.prototype._measurePaneWidth=function(){var e=this,i=this._chartStore.getStyles(),n=i.yAxis,o=n.position===t.YAxisPosition.Left,r=!n.inside,a=this._container.offsetWidth,s=0,l=Number.MIN_SAFE_INTEGER,u=0,c=0;this._drawPanes.forEach((function(t){t.getId()!==Ot&&(l=Math.max(l,t.getAxisComponent().getAutoSize()))})),l>a&&(l=a),r?(s=a-l,o?(u=0,c=l):(u=a-l,c=0)):(s=a,c=0,u=o?0:a-l),this._chartStore.getTimeScaleStore().setTotalBarSpace(s);var h,d={width:a},p={width:s,left:c},v={width:l,left:u};h=r&&!i.separator.fill?p:d,this._drawPanes.forEach((function(t){var i;null===(i=e._separatorPanes.get(t))||void 0===i||i.setBounding(h),t.setBounding(d,p,v)}))},e.prototype._setPaneOptions=function(t,e){var i;if(m(t.id)){var n=this.getDrawPaneById(t.id),o=!1;if(null!==n){var r=e;if(t.id!==Rt&&void 0!==t.height&&t.height>0){var a=Math.max(null!==(i=t.minHeight)&&void 0!==i?i:n.getOptions().minHeight,0);n.setBounding({height:Math.max(a,t.height)}),r=!0,o=!0}n.setOptions(t),r&&this.adjustPaneViewport(o,!0,!0,!0,!0)}}},e.prototype.getDrawPaneById=function(t){if(t===Rt)return this._candlePane;if(t===Ot)return this._xAxisPane;var e=this._drawPanes.find((function(e){return e.getId()===t}));return null!=e?e:null},e.prototype.getContainer=function(){return this._container},e.prototype.getChartStore=function(){return this._chartStore},e.prototype.getCandlePane=function(){return this._candlePane},e.prototype.getXAxisPane=function(){return this._xAxisPane},e.prototype.getAllDrawPanes=function(){return this._drawPanes},e.prototype.getAllSeparatorPanes=function(){return this._separatorPanes},e.prototype.adjustPaneViewport=function(t,e,i,n,o){t&&this._measurePaneHeight();var r=e,a=null!=o&&o;(null!=n&&n||a)&&this._drawPanes.forEach((function(t){var e=t.getAxisComponent().buildTicks(a);r||(r=e)})),r&&this._measurePaneWidth(),null!=i&&i&&(this._xAxisPane.getAxisComponent().buildTicks(!0),this.updatePane(4))},e.prototype.updatePane=function(t,e){if(f(e)){var i=this.getDrawPaneById(e);null==i||i.update(t)}else this._separatorPanes.forEach((function(e){e.update(t)})),this._drawPanes.forEach((function(e){e.update(t)}))},e.prototype.crosshairChange=function(e){var i=this,n=this._chartStore.getActionStore();if(n.has(t.ActionType.OnCrosshairChange)){var o={};this._drawPanes.forEach((function(t){var n=t.getId(),r={};i._chartStore.getIndicatorStore().getInstances(n).forEach((function(t){var i,n=t.result;r[t.name]=n[null!==(i=e.dataIndex)&&void 0!==i?i:n.length-1]})),o[n]=r})),void 0!==e.paneId&&n.execute(t.ActionType.OnCrosshairChange,M(M({},e),{indicatorData:o}))}},e.prototype.getDom=function(e,i){var n,o;if(!f(e))return this._chartContainer;var r=this.getDrawPaneById(e);if(null!==r)switch(null!=i?i:t.DomPosition.Root){case t.DomPosition.Root:return r.getContainer();case t.DomPosition.Main:return r.getMainWidget().getContainer();case t.DomPosition.YAxis:return null!==(o=null===(n=r.getYAxisWidget())||void 0===n?void 0:n.getContainer())&&void 0!==o?o:null}return null},e.prototype.getSize=function(e,i){var n,o;if(!f(e))return{width:this._chartContainer.offsetWidth,height:this._chartContainer.offsetHeight,left:0,top:0,right:0,bottom:0};var r=this.getDrawPaneById(e);if(null!==r)switch(null!=i?i:t.DomPosition.Root){case t.DomPosition.Root:return r.getBounding();case t.DomPosition.Main:return r.getMainWidget().getBounding();case t.DomPosition.YAxis:return null!==(o=null===(n=r.getYAxisWidget())||void 0===n?void 0:n.getBounding())&&void 0!==o?o:null}return null},e.prototype.setStyles=function(t){var e,i,n;this._chartStore.setOptions({styles:t}),f(null===(e=null==(n=m(t)?zt(t):t)?void 0:n.yAxis)||void 0===e?void 0:e.type)&&(null===(i=this._candlePane)||void 0===i||i.getAxisComponent().setAutoCalcTickFlag(!0)),this.adjustPaneViewport(!0,!0,!0,!0,!0)},e.prototype.getStyles=function(){return this._chartStore.getStyles()},e.prototype.setLocale=function(t){this._chartStore.setOptions({locale:t}),this.adjustPaneViewport(!0,!0,!0,!0,!0)},e.prototype.getLocale=function(){return this._chartStore.getLocale()},e.prototype.setCustomApi=function(t){this._chartStore.setOptions({customApi:t}),this.adjustPaneViewport(!0,!0,!0,!0,!0)},e.prototype.setPriceVolumePrecision=function(t,e){this._chartStore.setPrecision({price:t,volume:e})},e.prototype.getPriceVolumePrecision=function(){return this._chartStore.getPrecision()},e.prototype.setTimezone=function(t){this._chartStore.setOptions({timezone:t}),this._xAxisPane.getAxisComponent().buildTicks(!0),this._xAxisPane.update(3)},e.prototype.getTimezone=function(){return this._chartStore.getTimeScaleStore().getTimezone()},e.prototype.setOffsetRightDistance=function(t){this._chartStore.getTimeScaleStore().setOffsetRightDistance(t,!0)},e.prototype.getOffsetRightDistance=function(){return this._chartStore.getTimeScaleStore().getOffsetRightDistance()},e.prototype.setLeftMinVisibleBarCount=function(t){t>0&&this._chartStore.getTimeScaleStore().setLeftMinVisibleBarCount(Math.ceil(t))},e.prototype.setRightMinVisibleBarCount=function(t){t>0&&this._chartStore.getTimeScaleStore().setRightMinVisibleBarCount(Math.ceil(t))},e.prototype.setBarSpace=function(t){this._chartStore.getTimeScaleStore().setBarSpace(t)},e.prototype.getBarSpace=function(){return this._chartStore.getTimeScaleStore().getBarSpace().bar},e.prototype.getVisibleRange=function(){return this._chartStore.getTimeScaleStore().getVisibleRange()},e.prototype.clearData=function(){this._chartStore.clear()},e.prototype.getDataList=function(){return this._chartStore.getDataList()},e.prototype.applyNewData=function(t,e,i){this._chartStore.clear(),0===t.length?this.adjustPaneViewport(!1,!0,!0,!0):this.applyMoreData(t,e,i)},e.prototype.applyMoreData=function(t,e,i){var n=this;this._chartStore.addData(t,0,e),t.length>0&&this._chartStore.getIndicatorStore().calcInstance().then((function(t){n.adjustPaneViewport(!1,!0,!0,!0),null==i||i()})).catch((function(t){}))},e.prototype.updateData=function(t,e){var i=this,n=this._chartStore.getDataList(),o=n.length,r=t.timestamp,a=C(n[o-1],"timestamp",0);if(r>=a){var s=o;r===a&&(s=o-1),this._chartStore.addData(t,s),this._chartStore.getIndicatorStore().calcInstance().then((function(t){i.adjustPaneViewport(!1,!0,!0,!0),null==e||e()})).catch((function(t){}))}},e.prototype.loadMore=function(t){this._chartStore.getTimeScaleStore().setLoadMoreCallback(t)},e.prototype.createIndicator=function(t,e,i,n){var o,r=this,a=m(t)?{name:t}:t;if(null===ct(a.name))return null;var s=null==i?void 0:i.id,l=this.getDrawPaneById(null!=s?s:"");if(null!==l)this._chartStore.getIndicatorStore().addInstance(a,null!=s?s:"",null!=e&&e).then((function(t){var e;r._setPaneOptions(null!=i?i:{},null!==(e=l.getAxisComponent().buildTicks(!0))&&void 0!==e&&e)})).catch((function(t){}));else{null!=s||(s=N(Bt));var u=this._createPane(Xe,s,null!=i?i:{}),c=null!==(o=null==i?void 0:i.height)&&void 0!==o?o:100;u.setBounding({height:c}),this._chartStore.getIndicatorStore().addInstance(a,s,null!=e&&e).finally((function(){r.adjustPaneViewport(!0,!0,!0,!0,!0),null==n||n()}))}return null!=s?s:null},e.prototype.overrideIndicator=function(t,e,i){var n=this;this._chartStore.getIndicatorStore().override(t,null!=e?e:null).then((function(t){var e=L(t,2),o=e[1];(e[0]||o)&&(n.adjustPaneViewport(!1,o,!0,o),null==i||i())})).catch((function(){}))},e.prototype.getIndicatorByPaneId=function(t,e){return this._chartStore.getIndicatorStore().getInstanceByPaneId(t,e)},e.prototype.removeIndicator=function(t,e){var i,n,o,r=this._chartStore.getIndicatorStore();if(r.removeInstance(t,e)){var a=!1;if(t!==Rt&&!r.hasInstances(t)){var s=this.getDrawPaneById(t),l=this._drawPanes.findIndex((function(e){return e.getId()===t}));if(null!==s){a=!0;var u=this._separatorPanes.get(s);if(f(u)){var c=null==u?void 0:u.getTopPane();try{for(var h=F(this._separatorPanes),d=h.next();!d.done;d=h.next()){var p=d.value;if(p[1].getTopPane().getId()===s.getId()){p[1].setTopPane(c);break}}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}u.destroy(),this._separatorPanes.delete(s)}this._drawPanes.splice(l,1),s.destroy();var v=this._drawPanes[0];f(v)&&v.getId()===Ot&&(v=this._drawPanes[1]),null===(o=this._separatorPanes.get(v))||void 0===o||o.destroy(),this._separatorPanes.delete(v)}}this.adjustPaneViewport(a,!0,!0,!0,!0)}},e.prototype.createOverlay=function(t,e){var i=[];if(m(t))i=[{name:t}];else if(d(t))i=t.map((function(t){return m(t)?{name:t}:t}));else{i=[t]}var n=!0;f(e)&&null!==this.getDrawPaneById(e)||(e=Rt,n=!1);var o=this._chartStore.getOverlayStore().addInstances(i,e,n);return d(t)?o:o[0]},e.prototype.getOverlayById=function(t){return this._chartStore.getOverlayStore().getInstanceById(t)},e.prototype.overrideOverlay=function(t){this._chartStore.getOverlayStore().override(t)},e.prototype.removeOverlay=function(t){var e;void 0!==t&&(e=m(t)?{id:t}:t),this._chartStore.getOverlayStore().removeInstance(e)},e.prototype.setPaneOptions=function(t){this._setPaneOptions(t,!1)},e.prototype.setZoomEnabled=function(t){this._chartStore.getTimeScaleStore().setZoomEnabled(t)},e.prototype.isZoomEnabled=function(){return this._chartStore.getTimeScaleStore().getZoomEnabled()},e.prototype.setScrollEnabled=function(t){this._chartStore.getTimeScaleStore().setScrollEnabled(t)},e.prototype.isScrollEnabled=function(){return this._chartStore.getTimeScaleStore().getScrollEnabled()},e.prototype.scrollByDistance=function(t,e){var i=void 0===e||0>e?0:e,n=this._chartStore.getTimeScaleStore();if(i>0){n.startScroll();var o=(new Date).getTime(),r=function(){var e=((new Date).getTime()-o)/i,a=e>=1;n.scroll(a?t:t*e),a||requestAnimationFrame(r)};r()}else n.startScroll(),n.scroll(t)},e.prototype.scrollToRealTime=function(t){var e=this._chartStore.getTimeScaleStore(),i=e.getBarSpace().bar,n=e.getOffsetRightBarCount()-e.getInitialOffsetRightDistance()/i;this.scrollByDistance(n*i,t)},e.prototype.scrollToDataIndex=function(t,e){var i=this._chartStore.getTimeScaleStore(),n=(i.getOffsetRightBarCount()+(this.getDataList().length-1-t))*i.getBarSpace().bar;this.scrollByDistance(n,e)},e.prototype.scrollToTimestamp=function(t,e){var i=j(this.getDataList(),"timestamp",t);this.scrollToDataIndex(i,e)},e.prototype.zoomAtCoordinate=function(t,e,i){var n=void 0===i||0>i?0:i,o=this._chartStore.getTimeScaleStore();if(n>0){var r=o.getBarSpace().bar,a=r*t-r,s=(new Date).getTime(),l=function(){var t=((new Date).getTime()-s)/n,i=t>=1;o.zoom((i?a:a*t)/r,e),i||requestAnimationFrame(l)};l()}else o.zoom(t,e)},e.prototype.zoomAtDataIndex=function(t,e,i){var n=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(e);this.zoomAtCoordinate(t,{x:n,y:0},i)},e.prototype.zoomAtTimestamp=function(t,e,i){var n=j(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,n,i)},e.prototype.convertToPixel=function(t,e){var i,n=e.paneId,o=void 0===n?Rt:n,r=e.absolute,a=void 0!==r&&r,s=[];if(o!==Ot){var l=this.getDrawPaneById(o);if(null!==l){var u=this._chartStore.getTimeScaleStore(),c=l.getBounding(),h=[].concat(t),p=this._xAxisPane.getAxisComponent(),v=l.getAxisComponent();s=h.map((function(t){var e={},i=t.dataIndex;if(void 0!==t.timestamp&&(i=u.timestampToDataIndex(t.timestamp)),void 0!==i&&(e.x=null==p?void 0:p.convertToPixel(i)),void 0!==t.value){var n=null==v?void 0:v.convertToPixel(t.value);e.y=a?c.top+n:n}return e}))}}return d(t)?s:null!==(i=s[0])&&void 0!==i?i:{}},e.prototype.convertFromPixel=function(t,e){var i,n=e.paneId,o=void 0===n?Rt:n,r=e.absolute,a=void 0!==r&&r,s=[];if(o!==Ot){var l=this.getDrawPaneById(o);if(null!==l){var u=this._chartStore.getTimeScaleStore(),c=l.getBounding(),h=[].concat(t),p=this._xAxisPane.getAxisComponent(),v=l.getAxisComponent();s=h.map((function(t){var e,i,n={};if(void 0!==t.x){var o=null!==(e=null==p?void 0:p.convertFromPixel(t.x))&&void 0!==e?e:-1;n.dataIndex=o,n.timestamp=null!==(i=u.dataIndexToTimestamp(o))&&void 0!==i?i:void 0}void 0!==t.y&&(n.value=v.convertFromPixel(a?t.y-c.top:t.y));return n}))}}return d(t)?s:null!==(i=s[0])&&void 0!==i?i:{}},e.prototype.executeAction=function(e,i){var n;if(e===t.ActionType.OnCrosshairChange){var o=M({},i);o.paneId=null!==(n=o.paneId)&&void 0!==n?n:Rt,this._chartStore.getTooltipStore().setCrosshair(o)}},e.prototype.subscribeAction=function(t,e){this._chartStore.getActionStore().subscribe(t,e)},e.prototype.unsubscribeAction=function(t,e){this._chartStore.getActionStore().unsubscribe(t,e)},e.prototype.getConvertPictureUrl=function(t,e,i){var n=this,o=this._chartContainer.offsetWidth,r=this._chartContainer.offsetHeight,a=z("canvas",{width:"".concat(o,"px"),height:"".concat(r,"px"),boxSizing:"border-box"}),s=a.getContext("2d"),l=Y(a);a.width=o*l,a.height=r*l,s.scale(l,l),s.fillStyle=null!=i?i:"#FFFFFF",s.fillRect(0,0,o,r);var u=null!=t&&t;return this._drawPanes.forEach((function(t){var e=n._separatorPanes.get(t);if(f(e)){var i=e.getBounding();s.drawImage(e.getImage(u),i.left,i.top,i.width,i.height)}var r=t.getBounding();s.drawImage(t.getImage(u),0,r.top,o,r.height)})),a.toDataURL("image/".concat(null!=e?e:"jpeg"))},e.prototype.resize=function(){this.adjustPaneViewport(!0,!0,!0,!0,!0)},e.prototype.destroy=function(){this._chartEvent.destroy(),this._drawPanes.forEach((function(t){t.destroy()})),this._drawPanes=[],this._container.removeChild(this._chartContainer)},e}(),ai=new Map,si=1;var li={clone:h,merge:c,isString:m,isNumber:g,isValid:f,isObject:v,isArray:d,isFunction:p,isBoolean:y,formatValue:C,formatPrecision:w,formatBigNumber:T,formatDate:b,formatThousands:E,calcTextWidth:X,getLinearSlopeIntercept:Et,getLinearYFromSlopeIntercept:wt,getLinearYFromCoordinates:Tt,checkCoordinateOnArc:ve,checkCoordinateOnCircle:Qt,checkCoordinateOnLine:bt,checkCoordinateOnPolygon:ie,checkCoordinateOnRect:ae,checkCoordinateOnText:ce,drawArc:ge,drawCircle:te,drawLine:It,drawPolygon:ne,drawRect:se,drawText:he,drawRectText:pe};t.dispose=function(t){var e,i,n;if(t instanceof ri)n=t.id;else{var o=void 0;n=null!==(e=null==(o=m(t)?document.getElementById(t):t)?void 0:o.getAttribute("k-line-chart-id"))&&void 0!==e?e:null}null!==n&&(null===(i=ai.get(n))||void 0===i||i.destroy(),ai.delete(n))},t.getFigureClass=function(t){var e;return null!==(e=ye[t])&&void 0!==e?e:null},t.getOverlayClass=function(t){var e;return null!==(e=Ft[t])&&void 0!==e?e:null},t.getSupportedFigures=function(){return Object.keys(ye)},t.getSupportedIndicators=function(){return Object.keys(lt)},t.getSupportedLocales=function(){return Object.keys(Me)},t.getSupportedOverlays=function(){return Object.keys(Ft)},t.init=function(t,e){var i;if(null===(i=m(t)?document.getElementById(t):t))return null;var n=ai.get(i.id);if(void 0!==n)return n;var o="k_line_chart_".concat(si++);return(n=new ri(i,e)).id=o,i.setAttribute("k-line-chart-id",o),ai.set(o,n),n},t.registerFigure=function(t){ye[t.name]=xt.extend(t)},t.registerIndicator=function(t){lt[t.name]=et.extend(t)},t.registerLocale=function(t,e){Me[t]=M(M({},Me[t]),e)},t.registerOverlay=function(t){Ft[t.name]=ft.extend(t)},t.registerStyles=function(t,e){Nt[t]=e},t.utils=li,t.version=function(){return"9.6.0"}}));
|