@chartspire/chartspire-chart 1.1.0 → 10.0.0-alpha3
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/{LICENSE_APACHE_2.0 → LICENSE} +201 -201
- package/NOTICE +5 -17
- package/README.md +14 -109
- package/README.zh-CN.md +114 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +247 -258
- package/dist/index.esm.js +4557 -5675
- package/dist/umd/klinecharts.js +4560 -5678
- package/dist/umd/klinecharts.js.map +1 -1
- package/dist/umd/klinecharts.min.js +2 -2
- package/licenses/LICENSE-lightweight-charts +202 -0
- package/{LICENSE_AGPL3 → licenses/LICENSE_AGPL3} +662 -662
- package/package.json +98 -98
- package/CHANGELOG.md +0 -26
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* KLineChart
|
|
3
|
+
* KLineChart v10.0.0-alpha2
|
|
4
4
|
* Copyright (c) 2019 lihu.
|
|
5
5
|
* Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
|
|
6
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=function(t,i){return e=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])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n,o,r,a,s,l,c,u,h,d=function(){return d=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},d.apply(this,arguments)};function p(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 g(t,e){var i,n,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)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 r.label++,{value:s[1],done:!1};case 5:r.label++,n=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}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 v(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 f(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 y(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;o<r;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.LineType=void 0,(n=t.LineType||(t.LineType={})).Dashed="dashed",n.Solid="solid",t.PolygonType=void 0,(o=t.PolygonType||(t.PolygonType={})).Stroke="stroke",o.Fill="fill",o.StrokeFill="stroke_fill",t.TooltipShowRule=void 0,(r=t.TooltipShowRule||(t.TooltipShowRule={})).Always="always",r.FollowCross="follow_cross",r.None="none",t.TooltipShowType=void 0,(a=t.TooltipShowType||(t.TooltipShowType={})).Standard="standard",a.Rect="rect",t.TooltipIconPosition=void 0,(s=t.TooltipIconPosition||(t.TooltipIconPosition={})).Left="left",s.Middle="middle",s.Right="right",function(t){t.Fixed="fixed",t.Pointer="pointer"}(l||(l={})),t.CandleType=void 0,(c=t.CandleType||(t.CandleType={})).CandleSolid="candle_solid",c.CandleStroke="candle_stroke",c.CandleUpStroke="candle_up_stroke",c.CandleDownStroke="candle_down_stroke",c.Ohlc="ohlc",c.Area="area",t.YAxisPosition=void 0,(u=t.YAxisPosition||(t.YAxisPosition={})).Left="left",u.Right="right",t.YAxisType=void 0,(h=t.YAxisType||(t.YAxisType={})).Normal="normal",h.Percentage="percentage",h.Log="log";var m="#F92855",_="rgba(249, 40, 85, .7)",x="#2DC08E",S="rgba(45, 192, 142, .7)",C="#888888",b="#FFFFFF",T="#1677FF",w="#76808F",E="#DDDDDD";function I(t){return"rgba(22, 119, 255, ".concat(t,")")}function P(){function e(){return{show:!0,size:1,color:"#EDEDED",style:t.LineType.Dashed,dashedValue:[2,2]}}return{show:!0,horizontal:e(),vertical:e()}}function D(){return{show:!0,size:"auto",axisLine:{show:!0,color:E,size:1},tickText:{show:!0,color:w,size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:4},tickLine:{show:!0,size:1,length:3,color:E}}}function M(){function e(){return{show:!0,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,2],size:1,color:w},text:{show:!0,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:w,borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:w}}}return{show:!0,horizontal:e(),vertical:e()}}function k(){var e=I(.35),i=I(.25);function n(){return{style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:T,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:T}}return{point:{color:T,borderColor:e,borderSize:1,radius:5,activeColor:T,activeBorderColor:e,activeBorderSize:3,activeRadius:5},line:{style:t.LineType.Solid,smooth:!1,color:T,size:1,dashedValue:[2,2]},rect:{style:t.PolygonType.Fill,color:i,borderColor:T,borderSize:1,borderRadius:0,borderStyle:t.LineType.Solid,borderDashedValue:[2,2],positionX:0,positionY:0},polygon:{style:t.PolygonType.Fill,color:T,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},circle:{style:t.PolygonType.Fill,color:i,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},arc:{style:t.LineType.Solid,color:T,size:1,dashedValue:[2,2]},text:n(),rectText:n()}}function A(t,e){if(R(t)||R(e))for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=t[i],o=e[i];R(o)&&R(n)?A(n,o):O(e[i])&&(t[i]=L(e[i]))}}function L(t){if(!R(t))return t;var e;for(var i in e=F(t)?[]:{},t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];R(n)?e[i]=L(n):e[i]=n}return e}function F(t){return"[object Array]"===Object.prototype.toString.call(t)}function N(t){return"function"==typeof t}function R(t){return"object"==typeof t&&O(t)}function B(t){return"number"==typeof t&&!isNaN(t)}function O(t){return null!=t}function V(t){return"boolean"==typeof t}function W(t){return"string"==typeof t}var z,H,Y=/\\(\\)?/g,X=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g");function U(t,e,i){if(O(t)){var n=[];e.replace(X,(function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var o=t;return O(e[1])?o=e[2].replace(Y,"$1"):O(e[0])&&(o=e[0].trim()),n.push(o),""}));for(var o=t,r=0,a=n.length;O(o)&&r<a;)o=null==o?void 0:o[n[r++]];return O(o)?o:null!=i?i:"--"}return null!=i?i:"--"}function G(t,e,i){var n={};return t.formatToParts(new Date(e)).forEach((function(t){var e=t.type,i=t.value;switch(e){case"year":n.YYYY=i;break;case"month":n.MM=i;break;case"day":n.DD=i;break;case"hour":n.HH="24"===i?"00":i;break;case"minute":n.mm=i;break;case"second":n.ss=i}})),i.replace(/YYYY|MM|DD|HH|mm|ss/g,(function(t){return n[t]}))}function j(t,e){var i=+t;return B(i)?i.toFixed(null!=e?e:2):"".concat(t)}function K(t){var e=+t;if(B(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 Z(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)}))}function q(t,e){var i="".concat(t);if(new RegExp("\\.0{"+e+",}[1-9][0-9]*$").test(i)){var n=i.split("."),o=n[n.length-1],r=o.match(/0*/);if(O(r)){var a=r[0].length;return n[n.length-1]=o.replace(/0*/,"0{".concat(a,"}")),n.join(".")}}return i}function $(t){var e,i,n;return 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:1}function Q(t,e,i){return"".concat(null!=e?e:"normal"," ").concat(null!=t?t:12,"px ").concat(null!=i?i:"Helvetica Neue")}function J(t,e,i,n){if(!O(z)){var o=document.createElement("canvas"),r=$(o);(z=o.getContext("2d")).scale(r,r)}return z.font=Q(e,i,n),Math.round(z.measureText(t).width)}t.ActionType=void 0,(H=t.ActionType||(t.ActionType={})).OnDataReady="onDataReady",H.OnZoom="onZoom",H.OnScroll="onScroll",H.OnVisibleRangeChange="onVisibleRangeChange",H.OnTooltipIconClick="onTooltipIconClick",H.OnCrosshairChange="onCrosshairChange",H.OnCandleBarClick="onCandleBarClick",H.OnPaneDrag="onPaneDrag";var tt,et=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){var e;(null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1)<0&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){var e;if(N(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}();function it(t,e,i,n,o){var r,a=e.result,s=e.figures,l=e.styles,c=U(l,"circles",n.circles),u=c.length,h=U(l,"bars",n.bars),p=h.length,g=U(l,"lines",n.lines),v=g.length,f=U(l,"text"),y=f.length,m=0,_=0,x=0,S=0,C=0;s.forEach((function(s){var l;switch(s.type){case"circle":C=m;var b=c[m%u];r=d(d({},b),{color:b.noChangeColor}),m++;break;case"bar":C=_;var T=h[_%p];r=d(d({},T),{color:T.noChangeColor}),_++;break;case"line":C=x,r=g[x%v],x++;break;case"text":C=S,r=f[S%y],S++}if(O(r)){var w={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=null===(l=s.styles)||void 0===l?void 0:l.call(s,w,e,n);o(s,d(d({},r),E),C)}}))}t.IndicatorSeries=void 0,(tt=t.IndicatorSeries||(t.IndicatorSeries={})).Normal="normal",tt.Price="price",tt.Volume="volume";var nt,ot=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,c=e.shouldFormatBigNumber,u=e.visible,h=e.zLevel,d=e.minValue,p=e.maxValue,g=e.styles,v=e.extendData,f=e.regenerateFigures,y=e.createTooltipDataSource,m=e.draw,_=e.patternData;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!=c&&c,this.visible=null==u||u,this.zLevel=null!=h?h:0,this.minValue=null!=d?d:null,this.maxValue=null!=p?p:null,this.styles=L(null!=g?g:{}),this.extendData=v,this.regenerateFigures=null!=f?f:null,this.createTooltipDataSource=null!=y?y:null,this.draw=null!=m?m:null,this.patternData=null!=_?_: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&&t>=0)||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.setZLevel=function(t){return this.zLevel!==t&&(this.zLevel=t,!0)},e.prototype.setStyles=function(t){return A(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.setPatternData=function(t){return this.patternData!==t&&(this.patternData=t,!0)},e.prototype.calcIndicator=function(t){return p(this,void 0,void 0,(function(){var e;return g(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 n(){return e.call(this,t)||this}return i(n,e),n.prototype.calc=function(e,i){return t.calc(e,i)},n}(e)},e}();t.OverlayMode=void 0,(nt=t.OverlayMode||(t.OverlayMode={})).Normal="normal",nt.WeakMagnet="weak_magnet",nt.StrongMagnet="strong_magnet";var rt,at="overlay_figure_",st=Number.MAX_SAFE_INTEGER,lt=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.name,s=e.totalStep,l=e.lock,c=e.visible,u=e.zLevel,h=e.needDefaultPointFigure,d=e.needDefaultXAxisFigure,p=e.needDefaultYAxisFigure,g=e.createPointFigures,v=e.createXAxisFigures,f=e.createYAxisFigures,y=e.performEventPressedMove,m=e.performEventMoveForDrawing,_=e.onDrawStart,x=e.onDrawing,S=e.onDrawEnd,C=e.onClick,b=e.onDoubleClick,T=e.onRightClick,w=e.onPressedMoveStart,E=e.onPressedMoving,I=e.onPressedMoveEnd,P=e.onMouseEnter,D=e.onMouseLeave,M=e.onRemoved,k=e.onSelected,A=e.onDeselected;this.name=a,this.totalStep=!B(s)||s<2?1:s,this.lock=null!=l&&l,this.visible=null==c||c,this.zLevel=null!=u?u:0,this.needDefaultPointFigure=null!=h&&h,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=L(null!=r?r:{}),this.createPointFigures=null!=g?g:null,this.createXAxisFigures=null!=v?v:null,this.createYAxisFigures=null!=f?f:null,this.performEventPressedMove=null!=y?y:null,this.performEventMoveForDrawing=null!=m?m:null,this.onDrawStart=null!=_?_:null,this.onDrawing=null!=x?x:null,this.onDrawEnd=null!=S?S:null,this.onClick=null!=C?C:null,this.onDoubleClick=null!=b?b:null,this.onRightClick=null!=T?T:null,this.onPressedMoveStart=null!=w?w:null,this.onPressedMoving=null!=E?E:null,this.onPressedMoveEnd=null!=I?I:null,this.onMouseEnter=null!=P?P:null,this.onMouseLeave=null!=D?D:null,this.onRemoved=null!=M?M:null,this.onSelected=null!=k?k:null,this.onDeselected=null!=A?A:null}return e.prototype.setId=function(t){return!W(this.id)&&(this.id=t,!0)},e.prototype.setGroupId=function(t){return!W(this.groupId)&&(this.groupId=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 A(this.styles,t),!0},e.prototype.setPoints=function(t){if(t.length>0){var e=void 0;if(this.points=y([],f(t),!1),t.length>=this.totalStep-1?(this.currentStep=-1,e=this.totalStep-1):(this.currentStep=t.length+1,e=t.length),null!==this.performEventMoveForDrawing)for(var i=0;i<e;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.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={};B(t.timestamp)&&(n.timestamp=t.timestamp),B(t.dataIndex)&&(n.dataIndex=t.dataIndex),B(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;B(t.dataIndex)&&(this.points[e].dataIndex=t.dataIndex,this.points[e].timestamp=t.timestamp),B(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=d({},t),this._prevPressedPoints=L(this.points)},e.prototype.eventPressedOtherMove=function(t,e){var i,n;null!==this._prevPressedPoint&&(B(t.dataIndex)&&B(this._prevPressedPoint.dataIndex)&&(i=t.dataIndex-this._prevPressedPoint.dataIndex),B(t.value)&&B(this._prevPressedPoint.value)&&(n=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map((function(t){var o;B(t.timestamp)&&(t.dataIndex=e.timestampToDataIndex(t.timestamp));var r=d({},t);return B(i)&&B(t.dataIndex)&&(r.dataIndex=t.dataIndex+i,r.timestamp=null!==(o=e.dataIndexToTimestamp(r.dataIndex))&&void 0!==o?o:void 0),B(n)&&B(t.value)&&(r.value=t.value+n),r})))},e.extend=function(t){return function(e){function n(){return e.call(this,t)||this}return i(n,e),n}(e)},e}();t.FormatDateType=void 0,(rt=t.FormatDateType||(t.FormatDateType={}))[rt.Tooltip=0]="Tooltip",rt[rt.Crosshair=1]="Crosshair",rt[rt.XAxis=2]="XAxis";var ct,ut=1,ht=(new Date).getTime();function dt(t){var e=(new Date).getTime();return e===ht?++ut:ut=1,ht=e,"".concat(null!=t?t:"").concat(e,"_").concat(ut)}function pt(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 gt(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,a<=2)break}return n}function vt(t,e){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),+(+t).toFixed(e)}function ft(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 yt(t){return Math.log(t)/Math.log(10)}function mt(t){return Math.pow(10,t)}!function(t){t.Init="init",t.Forward="forward",t.Backward="backward"}(ct||(ct={}));var _t=1,xt=50,St=function(){function e(t){this._dateTimeFormat=this._buildDateTimeFormat(),this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=8,this._offsetRightDistance=80,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._chartStore=t,this._gapBarSpace=this._calcGapBarSpace(),this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace}return e.prototype._calcGapBarSpace=function(){var t=Math.floor(.82*this._barSpace),e=Math.floor(this._barSpace),i=Math.min(t,e-1);return Math.max(1,i)},e.prototype.adjustVisibleRange=function(){var e,i,n,o,r=this._chartStore.getDataList(),a=r.length,s=this._totalBarSpace/this._barSpace;1===this._scrollLimitRole?(n=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,o=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(n=this._minVisibleBarCount.left,o=this._minVisibleBarCount.right),n=Math.max(0,n),o=Math.max(0,o);var l=s-Math.min(n,a);this._lastBarRightSideDiffBarCount>l&&(this._lastBarRightSideDiffBarCount=l);var c=-a+Math.min(o,a);this._lastBarRightSideDiffBarCount<c&&(this._lastBarRightSideDiffBarCount=c);var u=Math.round(this._lastBarRightSideDiffBarCount+a+.5),h=u;u>a&&(u=a);var d=Math.round(u-s)-1;d<0&&(d=0);var p=this._lastBarRightSideDiffBarCount>0?Math.round(a+this._lastBarRightSideDiffBarCount-s)-1:d;if(this._visibleRange={from:d,to:u,realFrom:p,realTo:h},this._chartStore.getActionStore().execute(t.ActionType.OnVisibleRangeChange,this._visibleRange),this._chartStore.adjustVisibleDataList(),0===d){var g=r[0];this._chartStore.executeLoadMoreCallback(null!==(e=null==g?void 0:g.timestamp)&&void 0!==e?e:null),this._chartStore.executeLoadDataCallback({type:ct.Forward,data:null!=g?g:null})}u===a&&this._chartStore.executeLoadDataCallback({type:ct.Backward,data:null!==(i=r[a-1])&&void 0!==i?i:null})},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"};W(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||t>xt||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=1===this._scrollLimitRole?Math.min(this._maxOffsetDistance.right,t):t,this._lastBarRightSideDiffBarCount=this._offsetRightDistance/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._lastBarRightSideDiffBarCount*this._barSpace)},e.prototype.getLastBarRightSideDiffBarCount=function(){return this._lastBarRightSideDiffBarCount},e.prototype.setLastBarRightSideDiffBarCount=function(t){return this._lastBarRightSideDiffBarCount=t,this},e.prototype.setMaxOffsetLeftDistance=function(t){return this._scrollLimitRole=1,this._maxOffsetDistance.left=t,this},e.prototype.setMaxOffsetRightDistance=function(t){return this._scrollLimitRole=1,this._maxOffsetDistance.right=t,this},e.prototype.setLeftMinVisibleBarCount=function(t){return this._scrollLimitRole=0,this._minVisibleBarCount.left=t,this},e.prototype.setRightMinVisibleBarCount=function(t){return this._scrollLimitRole=0,this._minVisibleBarCount.right=t,this},e.prototype.getVisibleRange=function(){return this._visibleRange},e.prototype.startScroll=function(){this._startLastBarRightSideDiffBarCount=this._lastBarRightSideDiffBarCount},e.prototype.scroll=function(e){if(this._scrollEnabled){var i=e/this._barSpace;this._chartStore.getActionStore().execute(t.ActionType.OnScroll),this._lastBarRightSideDiffBarCount=this._startLastBarRightSideDiffBarCount-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,i=(this._totalBarSpace-t)/this._barSpace,n=e+this._lastBarRightSideDiffBarCount-i;return Math.round(1e6*n)/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:gt(e,"timestamp",t)},e.prototype.dataIndexToCoordinate=function(t){var e=this._chartStore.getDataList().length+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(e-.5)*this._barSpace)-.5},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){var r=null!=i?i:null;if(!B(null==r?void 0:r.x)){var a=this._chartStore.getTooltipStore().getCrosshair();r={x:null!==(n=null==a?void 0:a.x)&&void 0!==n?n:this._totalBarSpace/2}}this._chartStore.getActionStore().execute(t.ActionType.OnZoom);var s=r.x,l=this.coordinateToFloatIndex(s),c=this._barSpace+e*(this._barSpace/10);this.setBarSpace(c,(function(){o._lastBarRightSideDiffBarCount+=l-o.coordinateToFloatIndex(s)}))}},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.clear=function(){this._visibleRange={from:0,to:0,realFrom:0,realTo:0}},e}(),Ct={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}))}},bt={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,c=e.prev,u=e.current,h=null!==(r=null===(o=c.indicatorData)||void 0===o?void 0:o.ao)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,d=null!==(s=null===(a=u.indicatorData)||void 0===a?void 0:a.ao)&&void 0!==s?s:Number.MIN_SAFE_INTEGER;return{color:l=d>h?U(i.styles,"bars[0].upColor",n.bars[0].upColor):U(i.styles,"bars[0].downColor",n.bars[0].downColor),style:d>h?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 c={},u=(e.low+e.high)/2;if(o+=u,r+=u,l>=i[0]-1){a=o/i[0];var h=t[l-(i[0]-1)];o-=(h.low+h.high)/2}if(l>=i[1]-1){s=r/i[1];h=t[l-(i[1]-1)];r-=(h.low+h.high)/2}return l>=n-1&&(c.ao=a-s),c}))}};var Tt={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=e.close,s={};if(o+=a,r>=n){s.mid=o/i[0];var l=function(t,e){var i=t.length,n=0;return t.forEach((function(t){var i=t.close-e;n+=i*i})),n=Math.abs(n),Math.sqrt(n/i)}(t.slice(r-n,r+1),s.mid);s.up=s.mid+i[1]*l,s.dn=s.mid-i[1]*l,o-=t[r-n].close}return s}))}},wt={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,y([],f(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,a>=e-1&&(r[i]=o[i]/e,o[i]-=t[a-(e-1)].close)})),a>=n-1){var c=0;r.forEach((function(t){c+=t})),s.bbi=c/4}return s}))}},Et={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 c=o/i[0],u=r.slice(a-n,a+1),h=0;u.forEach((function(t){h+=Math.abs(t-c)}));var d=h/i[0];s.cci=0!==d?(l-c)/d/.015:0;var p=(t[a-n].high+t[a-n].low+t[a-n].close)/3;o-=p}return s}))}},It={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=[],c=0,u=[],h=0,d=[],p=0,g=[],v=[];return t.forEach((function(e,f){var y,m,_,x,S,C={},b=null!==(y=t[f-1])&&void 0!==y?y:e,T=(b.high+b.close+b.low+b.open)/4,w=Math.max(0,e.high-T),E=Math.max(0,T-e.low);f>=i[0]-1&&(C.cr=0!==E?w/E*100:0,s+=C.cr,c+=C.cr,h+=C.cr,p+=C.cr,f>=i[0]+i[1]-2&&(l.push(s/i[1]),f>=i[0]+i[1]+n-3&&(C.ma1=l[l.length-1-n]),s-=null!==(m=v[f-(i[1]-1)].cr)&&void 0!==m?m:0),f>=i[0]+i[2]-2&&(u.push(c/i[2]),f>=i[0]+i[2]+o-3&&(C.ma2=u[u.length-1-o]),c-=null!==(_=v[f-(i[2]-1)].cr)&&void 0!==_?_:0),f>=i[0]+i[3]-2&&(d.push(h/i[3]),f>=i[0]+i[3]+r-3&&(C.ma3=d[d.length-1-r]),h-=null!==(x=v[f-(i[3]-1)].cr)&&void 0!==x?x:0),f>=i[0]+i[4]-2&&(g.push(p/i[4]),f>=i[0]+i[4]+a-3&&(C.ma4=g[g.length-1-a]),p-=null!==(S=v[f-(i[4]-1)].cr)&&void 0!==S?S:0)),v.push(C)})),v}},Pt={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 c,u={},h=e.close;o+=h,r+=h;var d=0,p=0;if(l>=i[0]-1&&(d=o/i[0],o-=t[l-(i[0]-1)].close),l>=i[1]-1&&(p=r/i[1],r-=t[l-(i[1]-1)].close),l>=n-1){var g=d-p;u.dma=g,a+=g,l>=n+i[2]-2&&(u.ama=a/i[2],a-=null!==(c=s[l-(i[2]-1)].dma)&&void 0!==c?c:0)}s.push(u)})),s}},Dt={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,c=0,u=0,h=[];return t.forEach((function(e,d){var p,g,v={},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,T=f.low-_,w=Math.max(Math.max(x,S),C),E=b>0&&b>T?b:0,I=T>0&&T>b?T:0;if(n+=w,o+=E,r+=I,d>=i[0]-1){d>i[0]-1?(a=a-a/i[0]+w,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),v.pdi=P,v.mdi=D;var M=0;D+P!==0&&(M=Math.abs(D-P)/(D+P)*100),c+=M,d>=2*i[0]-2&&(u=d>2*i[0]-2?(u*(i[0]-1)+M)/i[0]:c/i[0],v.adx=u,d>=2*i[0]+i[1]-3&&(v.adxr=((null!==(g=h[d-(i[1]-1)].adx)&&void 0!==g?g:0)+u)/2))}h.push(v)})),h}},Mt={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;console.log("dataList: ",t);var o=0,r=[];return t.map((function(t,e){var a={},s=t.close;return o+=s,i.forEach((function(t,i){e>=t-1&&(r[i]=e>t-1?(2*s+(t-1)*r[i])/(t+1):o/t,a[n[i].key]=r[i])})),a}))}},kt={name:"MA",shortName:"MA",series:t.IndicatorSeries.Price,calcParams:[5,10,20,50,100],precision:2,shouldOhlc:!0,figures:[{key:"ma5",title:"MA5: ",type:"line"},{key:"ma10",title:"MA10: ",type:"line"},{key:"ma20",title:"MA20: ",type:"line"},{key:"ma50",title:"MA50: ",type:"line"},{key:"ma100",title:"MA100: ",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,r>=e-1&&(a[n[i].key]=o[i]/e,o[i]-=t[r-(e-1)].close)})),a}))}},At={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,c=e.prev,u=e.current,h=null!==(r=null===(o=c.indicatorData)||void 0===o?void 0:o.macd)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,d=null!==(s=null===(a=u.indicatorData)||void 0===a?void 0:a.macd)&&void 0!==s?s:Number.MIN_SAFE_INTEGER;return l=d>0?U(i.styles,"bars[0].upColor",n.bars[0].upColor):d<0?U(i.styles,"bars[0].downColor",n.bars[0].downColor):U(i.styles,"bars[0].noChangeColor",n.bars[0].noChangeColor),{style:h<d?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,c=Math.max(o[0],o[1]);return t.map((function(t,e){var u={},h=t.close;return r+=h,e>=o[0]-1&&(i=e>o[0]-1?(2*h+(o[0]-1)*i)/(o[0]+1):r/o[0]),e>=o[1]-1&&(n=e>o[1]-1?(2*h+(o[1]-1)*n)/(o[1]+1):r/o[1]),e>=c-1&&(a=i-n,u.dif=a,s+=a,e>=c+o[2]-2&&(l=e>c+o[2]-2?(2*a+l*(o[2]-1))/(o[2]+1):s/o[2],u.macd=2*(a-l),u.dea=l)),u}))}},Lt={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={},c=(null!==(s=t[a-1])&&void 0!==s?s:e).close,u=e.close-c;return i.forEach((function(e,i){var s,c,h;if(u>0?o[i]=(null!==(s=o[i])&&void 0!==s?s:0)+u:r[i]=(null!==(c=r[i])&&void 0!==c?c:0)+Math.abs(u),a>=e-1){0!==r[i]?l[n[i].key]=100-100/(1+o[i]/r[i]):l[n[i].key]=0;var d=t[a-(e-1)],p=null!==(h=t[a-e])&&void 0!==h?h:d,g=d.close-p.close;g>0?o[i]-=g:r[i]-=Math.abs(g)}})),l}))}},Ft={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,e>=i[0]-1&&(o=e>i[0]-1?(a*i[1]+o*(i[0]-i[1]+1))/(i[0]+1):n/i[0],r.sma=o),r}))}},Nt={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,c={},u=e.close;if(o>=i[0]-1){var h=ft(t.slice(o-(i[0]-1),o+1),"high","low"),d=h[0],p=h[1],g=d-p,v=(u-p)/(0===g?1:g)*100;c.k=((i[1]-1)*(null!==(a=null===(r=n[o-1])||void 0===r?void 0:r.k)&&void 0!==a?a:50)+v)/i[1],c.d=((i[2]-1)*(null!==(l=null===(s=n[o-1])||void 0===s?void 0:s.d)&&void 0!==l?l:50)+c.k)/i[2],c.j=3*c.k-2*c.d}n.push(c)})),n}},Rt={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:a<((null==s?void 0:s.high)+(null==s?void 0:s.low))/2?U(e.styles,"circles[0].upColor",i.circles[0].upColor):U(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,c=0;return t.map((function(e,i){var u=c,h=e.high,d=e.low;if(l){(-100===s||s<h)&&(s=h,a=Math.min(a+o,r)),c=u+a*(s-u);var p=Math.min(t[Math.max(1,i)-1].low,d);c>e.low?(c=s,a=n,s=-100,l=!l):c>p&&(c=p)}else{(-100===s||s>d)&&(s=d,a=Math.min(a+o,r)),c=u+a*(s-u);var g=Math.max(t[Math.max(1,i)-1].high,h);c<e.high?(c=s,a=0,s=-100,l=!l):c<g&&(c=g)}return{sar:c}}))}};function Bt(){return{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t,e,i){var n=t.current.kLineData,o=U(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor);return O(n)&&(n.close>n.open?o=U(e.styles,"bars[0].upColor",i.bars[0].upColor):n.close<n.open&&(o=U(e.styles,"bars[0].downColor",i.bars[0].downColor))),{color:o}}}}var Ot={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"},Bt()],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(Bt()),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,c;o[i]=(null!==(a=o[i])&&void 0!==a?a:0)+s,r>=e-1&&(l[n[i].key]=o[i]/e,o[i]-=null!==(c=t[r-(e-1)].volume)&&void 0!==c?c:0)})),l}))}},Vt={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=ft(t.slice(o-s,o+1),"high","low"),c=l[0],u=c-l[1];r[n[i].key]=0===u?0:(a-c)/u*100}})),r}))}},Wt={name:"HIGH",shortName:"HIGH",series:t.IndicatorSeries.Price,precision:2,figures:[{key:"hh",title:"Higher High: ",type:"text",textMessage:"HH",styles:function(t,e,i){var n,o=null===(n=t.current.kLineData)||void 0===n?void 0:n.hh,r=U(e.styles,"circles[0].noChangeColor",i.circles[0].noChangeColor);return!0===o?{color:r=U(e.styles,"circles[0].upColor",i.circles[0].upColor)}:{color:r}}},{key:"lh",title:"Lower High: ",type:"text",textMessage:"LH",styles:function(t,e,i){var n,o=null===(n=t.current.kLineData)||void 0===n?void 0:n.lh,r=U(e.styles,"circles[0].noChangeColor",i.circles[0].noChangeColor);return!0===o?{color:r=U(e.styles,"circles[0].downColor",i.circles[0].downColor)}:{color:r}}}],shouldOhlc:!0,calc:function(t){var e=function(t){var e=[],i=[],n=0,o=0;t.map((function(t){e.push(t.high-n),i.push(t.low-o),n=t.high,o=t.low})),console.log("High diff",e),console.log("Low diff",i);var r=(a=e,a.map((function(t,e,i){return t>0&&e+1<i.length&&i[e+1]<0})));var a;return console.log("HH:",r),r}(t),i=0,n=0,o=0,r=0;return t.map((function(t){return e[i++]?t.high>r?(t.hh=!0,n=t.high,r=t.high,{hh:n}):(t.lh=!0,o=t.high,r=t.high,{lh:o}):{NaN:NaN}}))}};function zt(t,e,i){if(e<2*i||e>=t.length)return{timestamp:NaN,high:NaN};var n=t.slice(e-2*i,e+1),o=Math.max.apply(Math,y([],f(n.slice(-i).map((function(t){return t.high}))),!1));return Math.max.apply(Math,y([],f(n.map((function(t){return t.high}))),!1))===n[i].high&&n[i].high>o?{timestamp:n[i].timestamp,high:n[i].high}:{timestamp:NaN,high:NaN}}function Ht(t,e,i){if(e<2*i||e>=t.length)return{timestamp:NaN,low:NaN};var n=t.slice(e-2*i,e+1),o=Math.min.apply(Math,y([],f(n.slice(-i).map((function(t){return t.low}))),!1));return Math.min.apply(Math,y([],f(n.map((function(t){return t.low}))),!1))===n[i].low&&n[i].low<o?{timestamp:n[i].timestamp,low:n[i].low}:{timestamp:NaN,low:NaN}}function Yt(t,e){return void 0===e&&(e=0),isNaN(t)||void 0===t?e:t}function Xt(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}var Ut,Gt={name:"HS",shortName:"Head and Shoulders",series:t.IndicatorSeries.Price,calcParams:[8],precision:2,figures:[{key:"hs",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams[0],n={timestamp:NaN,high:NaN},o=[NaN,NaN,NaN],r=[NaN,NaN,NaN],a=[NaN,NaN,NaN],s={timestamp:NaN,low:NaN},l=[NaN,NaN,NaN],c=[NaN,NaN,NaN],u=[NaN,NaN,NaN],h=!1,d=[];return t.map((function(e,p){var g;if(p<=i)return{NaN:NaN};try{n=zt(t,p,i),s=Ht(t,p,i),isNaN(n.high)||(o.push(n.high),r.push(p),a.push(n.timestamp),o.length>3&&(o.shift(),r.shift(),a.shift())),isNaN(s.low)||(l.push(s.low),c.push(p),u.push(s.timestamp),l.length>3&&(l.shift(),c.shift(),u.shift()));var v=o[2],f=l[2],y=a[2],m=u[2],_=r[2],x=c[2],S=o[1],C=l[1],b=a[1],T=u[1],w=r[1],E=c[1],I=o[0],P=l[0],D=a[0],M=u[0],k=r[0],A=c[0],L=I>P&&I>C&&(S>I&&S>v)&&(v>f&&v<S)&&v<S&&v>f&&S>I&&I>P&&f>P&&_>x&&w>E&&k>A&&k<E&&x>w,F=[],N=[],R=[],B=[];if(L&&!h){F.push(P,I,C,S,f,v),N.push(A,k,E,w,x,_),B.push(M,D,T,b,m,y),R.push(F,N,B);var O=R[0].map((function(t,e){return{prices:t,index:R[1][e],ts:R[2][e]}}));return h=L,{hs:O}}if(p>=t.length-2*i){console.log("Last Index, checking if there is a head and shoulder pattern forming");var V=o[1],W=r[1],z=a[1],H=o[2],Y=r[2],X=a[2],U=V>P&&V>C,G=H>V;if(m>t[t.length-2*i].timestamp&&U&&G&&(A<W&&A<E&&W<E&&W<Y&&E<Y)){F.push(P,V,C,H,f),N.push(A,W,E,Y,x),B.push(M,z,T,X,m,y);for(var j=!1,K=0;K<d.length;K++)Xt(F,d[K])&&(j=!0);j||(d.push(F),R.push(F,N,B));var Z=(null!==(g=R[0])&&void 0!==g?g:[]).map((function(t,e){return{prices:t,index:R[1][e],ts:R[2][e]}}));return{potentialHs:Z}}}return h=L,n={timestamp:NaN,high:NaN},s={timestamp:NaN,low:NaN},{hs:R}}catch(t){console.log("Error ",t)}return{NaN:NaN}}))}},jt={name:"INVHS",shortName:"Inverse Head and Shoulders",series:t.IndicatorSeries.Price,calcParams:[8],precision:2,figures:[{key:"invHs",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams[0],n={timestamp:NaN,high:NaN},o=[NaN,NaN,NaN],r=[NaN,NaN,NaN],a=[NaN,NaN,NaN],s={timestamp:NaN,low:NaN},l=[NaN,NaN,NaN],c=[NaN,NaN,NaN],u=[NaN,NaN,NaN],h=!1,d=[];return t.map((function(e,p){var g;if(p<=i)return{NaN:NaN};try{n=zt(t,p,i),s=Ht(t,p,i),isNaN(n.high)||(o.push(n.high),r.push(p),a.push(n.timestamp),o.length>3&&(o.shift(),r.shift(),a.shift())),isNaN(s.low)||(l.push(s.low),c.push(p),u.push(s.timestamp),l.length>3&&(l.shift(),c.shift(),u.shift()));var v=o[2],f=l[2],y=a[2],m=u[2],_=r[2],x=c[2],S=o[1],C=l[1],b=a[1],T=u[1],w=r[1],E=c[1],I=o[0],P=l[0],D=a[0],M=u[0],k=r[0],A=c[0],L=P<S&&P<I&&(P>C&&C<f)&&(f>C&&f<v)&&v>P&&v>S&&v<I&&k<A&&A<w&&w<E&&x>_&&_>E&&f<S,F=[],N=[],R=[],B=[];if(L&&!h){F.push(P,I,C,S,f,v),N.push(A,k,E,w,x,_),B.push(M,D,T,b,m,y),R.push(F,N,B);var O=R[0].map((function(t,e){return{prices:t,index:R[1][e],ts:R[2][e]}}));return h=L,{invHs:O}}if(p>=t.length-2*i){console.log("Last Index, checking if there is a head and shoulder pattern forming");var V=l[1],W=c[1],z=u[1],H=l[2],Y=c[2],X=u[2],U=V<I&&V<S,G=H<V;if(y>t[t.length-2*i].timestamp&&U&&G&&(k<W&&k<w&&W<w&&W<Y&&w<Y)){F.push(I,V,S,H,v),N.push(k,W,w,Y,_),B.push(D,z,b,X,m,y);for(var j=!1,K=0;K<d.length;K++)Xt(F,d[K])&&(j=!0);j||(d.push(F),R.push(F,N,B));var Z=(null!==(g=R[0])&&void 0!==g?g:[]).map((function(t,e){return{prices:t,index:R[1][e],ts:R[2][e]}}));return console.log("Potential Head and Shoulder ",Z),{potentialInvHs:Z}}}return h=L,n={timestamp:NaN,high:NaN},s={timestamp:NaN,low:NaN},{invHs:R}}catch(t){console.log("Error ",t)}return{NaN:NaN}}))}};!function(t){t.HEAD_SHOULDER="hs",t.POTENTIAL_HEAD_SHOULDER="potentialHs",t.INV_HEAD_SHOULDER="invHs",t.POTENTIAL_INV_HEAD_SHOULDER="potentialInvHs",t.SUPER_TREND="SuperTrend",t.WEDGES="wedges",t.DESC_BROADENING_WEDGES="descBroadeningWedges"}(Ut||(Ut={}));var Kt={name:Ut.SUPER_TREND,shortName:"SuperTrend",series:t.IndicatorSeries.Price,calcParams:[11,3],precision:2,figures:[{key:"buy",title:"BUY: ",type:"line",styles:function(){return{size:3,color:"#2DC08E"}}},{key:"sell",title:"SELL: ",type:"line",styles:function(){return{size:3,color:"#F92855"}}},{key:"candleStick",title:"candleStick: ",type:"line",styles:function(){return{size:3,color:"rgba(0, 0, 0, 0)"}}}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams[0],n=[],o=[],r=[],a=e.calcParams[1],s=1,l=0,c=0;return t.map((function(t,e){var u={};n.push(t.high),o.push(t.low),r.push(t.close);var h=(t.high+t.low)/2,d=function(t,e,i,n){if(t.length<n||e.length<n||i.length<n)return 0;for(var o=[],r=1;r<t.length;r++){var a=t[r],s=e[r],l=i[r-1],c=Math.max(a-s,Math.abs(a-l),Math.abs(s-l));o.push(c)}var u=0;for(r=0;r<n;r++)u+=o[r];for(u/=n,r=n;r<o.length;r++)u=(u*(n-1)+o[r])/n;return u}(n,o,r,i);return l=r[e-1]>Yt(l,h-a*d)?Math.max(h-a*d,Yt(l,h-a*d)):h-a*d,c=r[e-1]<Yt(c,h+a*d)?Math.min(h+a*d,Yt(c,h+a*d)):h+a*d,-1===(s=Yt(s,1))&&t.close>Yt(c,h+a*d)?s=1:1===s&&t.close<Yt(l,h-a*d)&&(s=-1),1===s?u.buy=l:u.sell=c,u.candleStick=(t.open+t.close)/2,u}))}},Zt={name:Ut.WEDGES,shortName:Ut.WEDGES,series:t.IndicatorSeries.Price,calcParams:[20,20,2,1,3,1],precision:2,figures:[{key:"topLine",type:"line"},{key:"bottomLine",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams[0],n=e.calcParams[1],o=e.calcParams[2],r=e.calcParams[3],a=e.calcParams[4],s=e.calcParams[5],l=[],c=[],u=[],h=[];return t.forEach((function(e,o){var r=zt(t,o,i),a=Ht(t,o,n);isNaN(r.high)||(u.push(r),l.push(o)),isNaN(a.low)||(h.push(a),c.push(o))})),t.slice(i).map((function(e,d){d===t.length-1&&console.log("last");var p=l[l.length-o],g=l[l.length-r],v=u[u.length-o].high,f=u[u.length-r].high,y=c[c.length-a],m=c[c.length-s],_=h[h.length-a].low,x=h[h.length-s].low;return{topLine:{x1:p-i,y1:v,x2:g+i,y2:f},bottomLine:{x1:y+n,y1:_,x2:m,y2:x}}}))}},qt={name:Ut.DESC_BROADENING_WEDGES,shortName:Ut.DESC_BROADENING_WEDGES,series:t.IndicatorSeries.Price,calcParams:[9],precision:2,figures:[{key:"WedgeLine",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams[0],n=[],o=[],r=0,a=0,s=0,l=0,c=[],u=[],h=0,d=0,p=0,g=0;return t.map((function(e,v){var f,y,m,_,x,S,C,b,T={topLine:{x1:0,y1:0,x2:100,y2:100},bottomLine:{x1:50,y1:50,x2:150,y2:150}},w=zt(t,v,i),E=Ht(t,v,i);null!=w&&(n.push(w),o.push(v-i)),null!=E&&(c.push(E),u.push(v-i));var I={x1:0,x2:0,y1:0,y2:0};n.length>2?(n.shift(),o.shift()):n.length>=2&&(r=o[0],s=null!==(y=null===(f=n[0])||void 0===f?void 0:f.high)&&void 0!==y?y:0,a=o[1],(l=null!==(_=null===(m=n[1])||void 0===m?void 0:m.high)&&void 0!==_?_:0)<s&&(I.x1=r,I.y1=s,I.x2=a,I.y2=l,T.topLine=I)),c.length>2?(c.shift(),u.shift()):u.length>=2&&(h=u[0],p=null!==(S=null===(x=c[0])||void 0===x?void 0:x.low)&&void 0!==S?S:0,d=u[1],g=null!==(b=null===(C=c[1])||void 0===C?void 0:C.low)&&void 0!==b?b:0);var P={x1:0,x2:0,y1:0,y2:0};return g<p&&(P.x1=h,P.y1=p,P.x2=d,P.y2=g,T.bottomLine=P),void 0===T.topLine||void 0===T.bottomLine?(T.empty=!0,{WedgeLine:T}):{WedgeLine:T}}))}},$t={name:"candleVolume",shortName:"Volume",calc:function(t){return t.map((function(t){return t.volume}))},createTooltipDataSource:function(t){var e,i=t.kLineDataList,n=t.crosshair,o=t.indicator,r=t.defaultStyles,a=n.dataIndex,s=o.result,l=o.styles||r,c=i[a];return e=c.close>c.open?l.bars[0].upColor:c.close<c.open?l.bars[0].downColor:l.bars[0].noChangeColor,{name:"Volume",values:[{title:"",value:{text:s[a]||"n/a",color:e}}]}},draw:function(t){for(var e=t.ctx,i=t.kLineDataList,n=t.bounding,o=t.visibleRange,r=t.barSpace,a=t.defaultStyles,s=t.xAxis,l=o.from,c=o.to,u=i.map((function(t){return t.volume})),h=Number.MIN_SAFE_INTEGER,d=l;d<c;d++){var p=u[d];h=Math.max(p,h)}var g=n.height,v=g/4;e.globalCompositeOperation="destination-over";var f=a;for(d=l;d<c;d++){var y=i[d],m=(p=u[d],void 0);m=y.close>y.open?Qt(f.bars[0].upColor,.3):y.close<y.open?Qt(f.bars[0].downColor,.3):Qt(f.bars[0].noChangeColor,.3);var _=s.convertToPixel(d);e.fillStyle=m;var x=g-p/h*v;e.fillRect(_-r.halfGapBar,x,r.gapBar,g-x)}return!1}};function Qt(t,e){return t.replace(/rgba\((\d+), (\d+), (\d+), (.+)\)/,"rgba($1, $2, $3, ".concat(e,")"))}var Jt={},te=[Ct,bt,{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 c;if(o[l]=(null!==(c=o[l])&&void 0!==c?c:0)+s,r>=e-1){var u=o[l]/i[l];a[n[l].key]=(s-u)/u*100,o[l]-=t[r-(e-1)].close}})),a}))}},Tt,{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,c,u={},h=e.high,d=e.low,p=e.open,g=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(r+=h-p,a+=p-d,n+=h-g,o+=g-d,s>=i[0]-1){u.ar=0!==a?r/a*100:0,u.br=0!==o?n/o*100:0;var v=t[s-(i[0]-1)],f=v.high,y=v.low,m=v.open,_=(null!==(c=t[s-i[0]])&&void 0!==c?c:t[s-(i[0]-1)]).close;n-=f-_,o-=_-y,r-=f-m,a-=m-y}return u}))}},wt,Et,It,Pt,Dt,{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],c=e.high,u=e.low,h=null!==(a=e.volume)&&void 0!==a?a:0,d=(c+u)/2-(l.high+l.low)/2;if(0===h||c-u==0)s.emv=0;else{var p=h/1e8/(c-u);s.emv=d/p}n+=s.emv,o.push(s.emv),r>=i[0]&&(s.maEmv=n/i[0],n-=o[r-i[0]])}return s}))}},Mt,{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={};if(r>=i[0]){var l=e.close,c=t[r-i[0]].close;s.mtm=l-c,n+=s.mtm,r>=i[0]+i[1]-1&&(s.maMtm=n/i[1],n-=null!==(a=o[r-(i[1]-1)].mtm)&&void 0!==a?a:0)}o.push(s)})),o}},kt,At,{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,c,u,h=null!==(s=t[a-1])&&void 0!==s?s:e;e.close<h.close?o-=null!==(l=e.volume)&&void 0!==l?l:0:e.close>h.close&&(o+=null!==(c=e.volume)&&void 0!==c?c:0);var d={obv:o};n+=o,a>=i[0]-1&&(d.maObv=n/i[0],n-=null!==(u=r[a-(i[0]-1)].obv)&&void 0!==u?u: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=i.close,l=null!==(o=i.volume)&&void 0!==o?o:1,c=(null!==(r=t[n-1])&&void 0!==r?r:i).close,u=0,h=c*l;return 0!==h&&(u=(s-c)/h),e+=u,a.pvt=e,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,c,u={},h=(null!==(l=t[s-1])&&void 0!==l?l:e).close,d=e.close-h>0?1:0;r.push(d),n+=d,s>=i[0]-1&&(u.psy=n/i[0]*100,o+=u.psy,s>=i[0]+i[1]-2&&(u.maPsy=o/i[1],o-=null!==(c=a[s-(i[1]-1)].psy)&&void 0!==c?c:0),n-=r[s-(i[0]-1)]),a.push(u)})),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 c=e.close,u=(null!==(a=t[r-i[0]])&&void 0!==a?a:t[r-(i[0]-1)]).close;l.roc=0!==u?(c-u)/u*100:0,o+=l.roc,r>=i[0]-1+i[1]-1&&(l.maRoc=o/i[1],o-=null!==(s=n[r-(i[1]-1)].roc)&&void 0!==s?s:0)}n.push(l)})),n}},Lt,Ft,Nt,Rt,{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,c=0,u=[];return t.forEach((function(t,e){var h,d={},p=t.close;if(a+=p,e>=r[0]-1&&(i=e>r[0]-1?(2*p+(r[0]-1)*i)/(r[0]+1):a/r[0],s+=i,e>=2*r[0]-2&&(n=e>2*r[0]-2?(2*i+(r[0]-1)*n)/(r[0]+1):s/r[0],l+=n,e>=3*r[0]-3))){var g=void 0,v=0;e>3*r[0]-3?v=((g=(2*n+(r[0]-1)*o)/(r[0]+1))-o)/o*100:g=l/r[0],o=g,d.trix=v,c+=v,e>=3*r[0]+r[1]-4&&(d.maTrix=c/r[1],c-=null!==(h=u[e-(r[1]-1)].trix)&&void 0!==h?h:0)}u.push(d)})),u}},Ot,{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 c,u,h,d,p,g={},v=e.close,f=(null!==(c=t[l-1])&&void 0!==c?c:e).close,y=null!==(u=e.volume)&&void 0!==u?u:0;if(v>f?n+=y:v<f?o+=y:r+=y,l>=i[0]-1){var m=r/2;g.vr=o+m===0?0:(n+m)/(o+m)*100,a+=g.vr,l>=i[0]+i[1]-2&&(g.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:S<x.close?o-=C:r-=C}s.push(g)})),s}},Vt,Wt,Gt,jt,Kt,Zt,qt,$t];function ee(t){var e;return null!==(e=Jt[t])&&void 0!==e?e:null}te.forEach((function(t){Jt[t.name]=ot.extend(t)}));var ie=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,c=e.shouldOhlc,u=e.shouldFormatBigNumber,h=e.visible,d=e.zLevel,p=e.styles,g=e.extendData,v=e.regenerateFigures,f=e.createTooltipDataSource,y=e.draw,m=e.patternData,_=e.calc,x=!1;W(i)&&t.setShortName(i)&&(x=!0),O(n)&&t.setSeries(n)&&(x=!0);var S=!1;F(o)&&t.setCalcParams(o)&&(x=!0,S=!0),F(a)&&t.setFigures(a)&&(x=!0,S=!0),void 0!==s&&t.setMinValue(s)&&(x=!0),void 0!==l&&t.setMinValue(l)&&(x=!0),B(r)&&t.setPrecision(r)&&(x=!0),V(c)&&t.setShouldOhlc(c)&&(x=!0),V(u)&&t.setShouldFormatBigNumber(u)&&(x=!0),V(h)&&t.setVisible(h)&&(x=!0);var C=!1;return B(d)&&t.setZLevel(d)&&(x=!0,C=!0),O(p)&&t.setStyles(p)&&(x=!0),void 0!==g&&t.setExtendData(g)&&(x=!0,S=!0),void 0!==v&&t.setRegenerateFigures(v)&&(x=!0),void 0!==f&&t.setCreateTooltipDataSource(f)&&(x=!0),void 0!==y&&t.setDraw(y)&&(x=!0),void 0!==m&&t.setPatternData(m)&&(x=!0),N(_)&&(t.calc=_,S=!0),[x,S,C]},e.prototype._sort=function(t){var e;W(t)?null===(e=this._instances.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._instances.forEach((function(t){t.sort((function(t,e){return t.zLevel-e.zLevel}))}))},e.prototype.addInstance=function(t,e,i){return p(this,void 0,void 0,(function(){var n,o,r,a;return g(this,(function(s){switch(s.label){case 0:return n=t.name,O(o=this._instances.get(e))?O(o.find((function(t){return t.name===n})))?[4,Promise.reject(new Error("Duplicate indicators."))]:[3,2]:[3,2];case 1:case 3:return[2,s.sent()];case 2:return O(o)||(o=[]),r=ee(n),a=new r,this.synchronizeSeriesPrecision(a),this._overrideInstance(a,t),i||(o=[]),o.push(a),this._instances.set(e,o),this._sort(e),[4,a.calcIndicator(this._chartStore.getDataList())]}}))}))},e.prototype.getInstances=function(t){var e;return null!==(e=this._instances.get(t))&&void 0!==e?e:[]},e.prototype.removeInstance=function(t,e){var i,n=!1,o=this._instances.get(t);if(O(o)){if(W(e)){var r=o.findIndex((function(t){return t.name===e}));r>-1&&(o.splice(r,1),n=!0)}else this._instances.set(t,[]),n=!0;0===(null===(i=this._instances.get(t))||void 0===i?void 0:i.length)&&this._instances.delete(t)}return n},e.prototype.hasInstances=function(t){return this._instances.has(t)},e.prototype.calcInstance=function(t,e){return p(this,void 0,void 0,(function(){var i,n,o,r=this;return g(this,(function(a){switch(a.label){case 0:return i=[],W(t)?W(e)?O(n=this._instances.get(e))&&O(o=n.find((function(e){return e.name===t})))&&i.push(o.calcIndicator(this._chartStore.getDataList())):this._instances.forEach((function(e){var n=e.find((function(e){return e.name===t}));O(n)&&i.push(n.calcIndicator(r._chartStore.getDataList()))})):this._instances.forEach((function(t){t.forEach((function(t){i.push(t.calcIndicator(r._chartStore.getDataList()))}))})),[4,Promise.all(i)];case 1:return[2,a.sent().includes(!0)]}}))}))},e.prototype.getInstanceByPaneId=function(t,e){var i,n,o=function(t){var e=new Map;return t.forEach((function(t){e.set(t.name,t)})),e};if(W(t)){var r=null!==(i=this._instances.get(t))&&void 0!==i?i:[];return W(e)?null!==(n=null==r?void 0:r.find((function(t){return t.name===e})))&&void 0!==n?n:null:o(r)}var a=new Map;return this._instances.forEach((function(t,e){a.set(e,o(t))})),a},e.prototype.synchronizeSeriesPrecision=function(e){var i=this._chartStore.getPrecision(),n=i.price,o=i.volume,r=function(e){switch(e.series){case t.IndicatorSeries.Price:e.setPrecision(n,!0);break;case t.IndicatorSeries.Volume:e.setPrecision(o,!0)}};O(e)?r(e):this._instances.forEach((function(t){t.forEach((function(t){r(t)}))}))},e.prototype.override=function(t,e){return p(this,void 0,void 0,(function(){var i,n,o,r,a,s,l,c=this;return g(this,(function(u){switch(u.label){case 0:return i=t.name,n=new Map,null!==e?O(o=this._instances.get(e))&&n.set(e,o):n=this._instances,r=!1,a=[],s=!1,n.forEach((function(e){var n=e.find((function(t){return t.name===i}));if(O(n)){var o=c._overrideInstance(n,t);o[2]&&(s=!0),o[1]?a.push(n.calcIndicator(c._chartStore.getDataList())):o[0]&&(r=!0)}})),s&&this._sort(),[4,Promise.all(a)];case 1:return l=u.sent(),[2,[r,l.includes(!0)]]}}))}))},e}(),ne=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=B(r.x)?(i=this._chartStore.getTimeScaleStore().coordinateToDataIndex(r.x))<0?0:i>o.length-1?o.length-1:i:i=o.length-1],s=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(i),l=this._crosshair.x,c=this._crosshair.y,u=this._crosshair.paneId;this._crosshair=d(d({},r),{realX:s,kLineData:a,realDataIndex:i,dataIndex:n}),l===r.x&&c===r.y&&u===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}(),oe={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n=t.overlay,o=t.precision,r=t.thousandsSeparator,a=t.decimalFoldThreshold,s=n.points;if(e.length>0){var l=[],c=[],u=i.width;if(e.length>1&&B(s[0].value)&&B(s[1].value)){var h=e[0].y-e[1].y,d=s[0].value-s[1].value;[1,.786,.618,.5,.382,.236,0].forEach((function(t){var i,n=e[1].y+h*t,p=q(Z(((null!==(i=s[1].value)&&void 0!==i?i:0)+d*t).toFixed(o.price),r),a);l.push({coordinates:[{x:0,y:n},{x:u,y:n}]}),c.push({x:0,y:n,text:"".concat(p," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})}))}return[{type:"line",attrs:l},{type:"text",isCheckEvent:!1,attrs:c}]}return[]}},re={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n={x:0,y:e[0].y};return O(e[1])&&e[0].x<e[1].x&&(n.x=i.width),[{type:"line",attrs:{coordinates:[e[0],n]}}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},ae=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!(!O(n)||!this.checkEventOn(e))&&n(e,i)},t.prototype.checkEventOn=function(t){var e,i;try{for(var n=v(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}(),se=function(t){function e(e){var i=t.call(this)||this;return i.attrs=e.attrs,i.styles=e.styles,i}return i(e,t),e.prototype.checkEventOn=function(t){return this.checkEventOnImp(t,this.attrs,this.styles)},e.prototype.setAttrs=function(t){return this.attrs=t,this},e.prototype.setStyles=function(t){return this.styles=t,this},e.prototype.draw=function(t){this.drawImp(t,this.attrs,this.styles)},e.extend=function(t){var n=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.checkEventOnImp=function(e,i,n){return t.checkEventOn(e,i,n)},n.prototype.drawImp=function(e,i,n){t.draw(e,i,n)},n}(e);return n},e}(ae);function le(t,e){var i=[];i=i.concat(e);for(var n=0;n<i.length;n++){var o=i[n].coordinates;if(o.length>1)for(var r=1;r<o.length;r++){var a=o[r-1],s=o[r];if(a.x===s.x){if(Math.abs(a.y-t.y)+Math.abs(s.y-t.y)-Math.abs(a.y-s.y)<4&&Math.abs(t.x-a.x)<2)return!0}else{var l=he(a,s),c=ce(l,t),u=Math.abs(c-t.y);if(Math.abs(a.x-t.x)+Math.abs(s.x-t.x)-Math.abs(a.x-s.x)<4&&u*u/(l[0]*l[0]+1)<4)return!0}}}return!1}function ce(t,e){return null!==t?e.x*t[0]+t[1]:e.y}function ue(t,e,i){return ce(he(t,e),i)}function he(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 de(t,e,i){var n=e.length,o=B(i)?i>0&&i<1?i:0:i?.5:0;if(o>0&&n>2){for(var r=e[0].x,a=e[0].y,s=1;s<n-1;s++){var l=e[s-1],c=e[s],u=e[s+1],h=c.x-l.x,d=c.y-l.y,p=u.x-c.x,g=u.y-c.y,v=u.x-l.x,f=u.y-l.y,y=Math.sqrt(h*h+d*d),m=Math.sqrt(p*p+g*g),_=m/(m+y),x=c.x+v*o*_,S=c.y+f*o*_;x=Math.min(x,Math.max(u.x,c.x)),S=Math.min(S,Math.max(u.y,c.y)),x=Math.max(x,Math.min(u.x,c.x)),S=Math.max(S,Math.min(u.y,c.y)),v=x-c.x,f=S-c.y;var C=c.x-v*y/m,b=c.y-f*y/m;C=Math.min(C,Math.max(l.x,c.x)),b=Math.min(b,Math.max(l.y,c.y)),C=Math.max(C,Math.min(l.x,c.x)),b=Math.max(b,Math.min(l.y,c.y)),v=c.x-C,f=c.y-b,x=c.x+v*m/y,S=c.y+f*m/y,t.bezierCurveTo(r,a,C,b,c.x,c.y),r=x,a=S}var T=e[n-1];t.bezierCurveTo(r,a,T.x,T.y,T.x,T.y)}else for(s=1;s<n;s++)t.lineTo(e[s].x,e[s].y)}function pe(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.smooth,l=void 0!==s&&s,c=n.size,u=void 0===c?1:c,h=n.color,d=void 0===h?"currentColor":h,p=n.dashedValue,g=void 0===p?[2,2]:p;e.lineWidth=u,e.strokeStyle=d,a===t.LineType.Dashed?e.setLineDash(g):e.setLineDash([]),o.forEach((function(t){var i=t.coordinates;i.length>1&&(e.beginPath(),e.moveTo(i[0].x,i[0].y),de(e,i,l),e.stroke(),e.closePath())}))}function ge(e,i,n,o){var r=o.style,a=void 0===r?t.LineType.Solid:r,s=o.size,l=void 0===s?1:s,c=o.dashedValue,u=void 0===c?[2,2]:c,h=o.color,d=void 0===h?"red":h;e.lineWidth=l,e.strokeStyle=d,a===t.LineType.Dashed?e.setLineDash(u):e.setLineDash([]),e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(n.x,n.y),e.stroke()}var ve={name:"line",checkEventOn:le,draw:function(t,e,i){pe(t,e,i)}};function fe(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;s<n;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 c=e.width,u=he(t[0],t[1]),h=u[0],d=u[1];if(o.push({coordinates:[{x:0,y:0*h+d},{x:c,y:c*h+d}]}),t.length>2){var p=t[2].y-h*t[2].x;o.push({coordinates:[{x:0,y:0*h+p},{x:c,y:c*h+p}]});for(a=d-p,s=0;s<n;s++){var g=d+a*(s+1);o.push({coordinates:[{x:0,y:0*h+g},{x:c,y:c*h+g}]})}}}return o}var ye={name:"parallelStraightLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:fe(t.coordinates,t.bounding)}]}},me={name:"priceChannelLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:fe(t.coordinates,t.bounding,1)}]}},_e={name:"priceLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n=t.precision,o=t.overlay,r=t.thousandsSeparator,a=t.decimalFoldThreshold,s=o.points[0].value,l=void 0===s?0:s;return[{type:"line",attrs:{coordinates:[e[0],{x:i.width,y:e[0].y}]}},{type:"text",ignoreEvent:!0,attrs:{x:e[0].x,y:e[0].y,text:q(Z(l.toFixed(n.price),r),a),baseline:"bottom"}}]}};function xe(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[0].y<t[1].y?{x:t[0].x,y:e.height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:ue(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:ue(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],i]}}return[]}var Se={name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:xe(t.coordinates,t.bounding)}]}},Ce={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:ue(e[0],e[1],{x:0,y:e[0].y})},{x:i.width,y:ue(e[0],e[1],{x:i.width,y:e[0].y})}]}}]:[]}},be={name:"simpleAnnotation",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e,i,n=t.overlay,o=t.coordinates;O(n.extendData)&&(i=N(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}]}},Te={name:"simpleTag",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e=t.bounding,i=t.coordinates;return{type:"line",attrs:{coordinates:[{x:0,y:i[0].y},{x:e.width,y:i[0].y}]},ignoreEvent:!0}},createYAxisFigures:function(t){var e,i,n,o,r,a=t.overlay,s=t.coordinates,l=t.bounding,c=t.yAxis,u=t.precision;return null!==(e=null==c?void 0:c.isFromZero())&&void 0!==e&&e?(n="left",o=0):(n="right",o=l.width),O(a.extendData)&&(r=N(a.extendData)?a.extendData(a):null!==(i=a.extendData)&&void 0!==i?i:""),!O(r)&&B(a.points[0].value)&&(r=j(a.points[0].value,u.price)),{type:"text",attrs:{x:o,y:s[0].y,text:null!=r?r:"",align:n,baseline:"middle"}}}},we={};function Ee(t){var e;return null!==(e=we[t])&&void 0!==e?e:null}[oe,re,{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){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},{name:"horizontalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:i.width,y:e[0].y}]}}]}},ye,me,_e,Se,{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}}]:[]}},Ce,{name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;if(2===e.length){var n={x:e[0].x,y:0};return e[0].y<e[1].y&&(n.y=i.height),[{type:"line",attrs:{coordinates:[e[0],n]}}]}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.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.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.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},{name:"verticalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]}},be,Te].forEach((function(t){we[t.name]=lt.extend(t)}));var Ie="candle_pane",Pe="indicator_pane_",De="x_axis_pane",Me=function(){function t(t){this._instances=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,c=e.mode,u=e.modeSensitivity,h=e.extendData,d=e.onDrawStart,p=e.onDrawing,g=e.onDrawEnd,v=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,T=e.onSelected,w=e.onDeselected,E=!1,I=!1;return W(i)&&t.setId(i),W(n)&&t.setGroupId(n),F(o)&&t.setPoints(o)&&(E=!0),O(r)&&t.setStyles(r)&&(E=!0),V(a)&&t.setLock(a),V(s)&&t.setVisible(s)&&(E=!0),B(l)&&t.setZLevel(l)&&(E=!0,I=!0),O(c)&&t.setMode(c),B(u)&&t.setModeSensitivity(u),void 0!==h&&t.setExtendData(h)&&(E=!0),void 0!==d&&t.setOnDrawStartCallback(d),void 0!==p&&t.setOnDrawingCallback(p),void 0!==g&&t.setOnDrawEndCallback(g),void 0!==v&&t.setOnClickCallback(v),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!==T&&t.setOnSelectedCallback(T),void 0!==w&&t.setOnDeselectedCallback(w),[E,I]},t.prototype.getInstanceById=function(t){var e,i;try{for(var n=v(this._instances),o=n.next();!o.done;o=n.next()){var r=o.value[1].find((function(e){return e.id===t}));if(O(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;W(t)?null===(e=this._instances.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._instances.forEach((function(t){t.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=null!==(o=t.id)&&void 0!==o?o:dt("overlay_");if(null===n.getInstanceById(l)){var c=Ee(t.name);if(null!==c){var u=new c;u.setPaneId(e);var h=null!==(r=t.groupId)&&void 0!==r?r:l;return t.id=l,t.groupId=h,n._overrideInstance(u,t),u.isDrawing()?n._progressInstanceInfo={paneId:e,instance:u,appointPaneFlag:i}:(n._instances.has(e)||n._instances.set(e,[]),null===(a=n._instances.get(e))||void 0===a||a.push(u)),u.isStart()&&(null===(s=u.onDrawStart)||void 0===s||s.call(u,{overlay:u})),l}}return null}));if(o.some((function(t){return null!==t}))){this._sort();var r=this._chartStore.getChart();r.updatePane(1,e),r.updatePane(1,De)}return 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&&(V(e)&&e&&(this._progressInstanceInfo.appointPaneFlag=e),this._progressInstanceInfo.paneId=t,this._progressInstanceInfo.instance.setPaneId(t))},t.prototype.getInstances=function(t){var e;if(!W(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(W(i)){var l=this.getInstanceById(i);null!==l&&s(l)}else{var c=W(o),u=W(n);if(this._instances.forEach((function(t){t.forEach((function(t){(c&&t.name===o||u&&t.groupId===n||!c&&!u)&&s(t)}))})),null!==this._progressInstanceInfo){var h=this._progressInstanceInfo.instance;(c&&h.name===o||u&&h.groupId===n||!c&&!u)&&s(h)}}a&&this._sort(),r&&this._chartStore.getChart().updatePane(1)},t.prototype.removeInstance=function(t){var e,i,n,o=function(t,e){if(W(t.id)){if(e.id!==t.id)return!1}else if(W(t.groupId)){if(e.groupId!==t.groupId)return!1}else if(W(t.name)&&e.name!==t.name)return!1;return!0},r=[],a=O(t);if(null!==this._progressInstanceInfo){var s=this._progressInstanceInfo.instance;(!a||a&&o(t,s))&&(r.push(this._progressInstanceInfo.paneId),null===(n=s.onRemoved)||void 0===n||n.call(s,{overlay:s}),this._progressInstanceInfo=null)}if(a){var l=new Map,c=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&&l.set(e[0],i)};try{for(var u=v(this._instances),h=u.next();!h.done;h=u.next()){c(h.value)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}this._instances=l}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 d=this._chartStore.getChart();r.forEach((function(t){d.updatePane(1,t)})),d.updatePane(1,De)}},t.prototype.setPressedInstanceInfo=function(t){this._pressedInstanceInfo=t},t.prototype.getPressedInstanceInfo=function(){return this._pressedInstanceInfo},t.prototype.updatePointPosition=function(t,e){if(t>0){var i=this._chartStore.getDataList();this._instances.forEach((function(n){n.forEach((function(n){n.points.forEach((function(n){if(!O(n.timestamp)&&O(n.dataIndex)){e===ct.Forward&&(n.dataIndex=n.dataIndex+t);var o=i[n.dataIndex];n.timestamp=null==o?void 0:o.timestamp}}))}))}))}},t.prototype.setHoverInstanceInfo=function(t,e){var i,n,o=this._hoverInstanceInfo,r=o.instance,a=o.figureType,s=o.figureKey,l=o.figureIndex;if(((null==r?void 0:r.id)!==(null===(i=t.instance)||void 0===i?void 0:i.id)||a!==t.figureType||l!==t.figureIndex)&&(this._hoverInstanceInfo=t,(null==r?void 0:r.id)!==(null===(n=t.instance)||void 0===n?void 0:n.id))){var c=!1,u=!1;null!==r&&(u=!0,N(r.onMouseLeave)&&(r.onMouseLeave(d({overlay:r,figureKey:s,figureIndex:l},e)),c=!0)),null!==t.instance&&(u=!0,t.instance.setZLevel(st),N(t.instance.onMouseEnter)&&(t.instance.onMouseEnter(d({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),c=!0)),u&&this._sort(),c||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,c,u,h=this._clickInstanceInfo,p=h.paneId,g=h.instance,v=h.figureType,f=h.figureKey,y=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,d({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),((null==g?void 0:g.id)!==(null===(a=t.instance)||void 0===a?void 0:a.id)||v!==t.figureType||y!==t.figureIndex)&&(this._clickInstanceInfo=t,(null==g?void 0:g.id)!==(null===(s=t.instance)||void 0===s?void 0:s.id))){null===(l=null==g?void 0:g.onDeselected)||void 0===l||l.call(g,d({overlay:g,figureKey:f,figureIndex:y},e)),null===(u=null===(c=t.instance)||void 0===c?void 0:c.onSelected)||void 0===u||u.call(c,d({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e));var m=this._chartStore.getChart();m.updatePane(1,t.paneId),p!==t.paneId&&m.updatePane(1,p),m.updatePane(1,De)}},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}(),ke=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 et),null===(i=this._actions.get(t))||void 0===i||i.subscribe(e)},t.prototype.unsubscribe=function(t,e){var i=this._actions.get(t);O(i)&&(i.unsubscribe(e),i.isEmpty()&&this._actions.delete(t))},t.prototype.has=function(t){var e=this._actions.get(t);return O(e)&&!e.isEmpty()},t}(),Ae={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 Le(t){var e;return null!==(e=Ae[t])&&void 0!==e?e:null}var Fe=function(){function e(e,i){var n,o,r;this._styles={grid:P(),candle:(r={show:!0,color:w,textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"},{type:t.CandleType.CandleSolid,bar:{upColor:x,downColor:m,noChangeColor:C,upBorderColor:x,downBorderColor:m,noChangeBorderColor:C,upWickColor:x,downWickColor:m,noChangeWickColor:C},area:{lineSize:2,lineColor:T,smooth:!1,value:"close",backgroundColor:[{offset:0,color:I(.01)},{offset:1,color:I(.2)}],point:{show:!0,color:T,radius:4,rippleColor:I(.3),rippleRadius:8,animation:!0,animationDuration:1e3}},priceMark:{show:!0,high:d({},r),low:d({},r),last:{show:!0,upColor:x,downColor:m,noChangeColor:C,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:b,family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,custom:[{title:"time",value:"{time}"},{title:"open",value:"{open}"},{title:"high",value:"{high}"},{title:"low",value:"{low}"},{title:"close",value:"{close}"},{title:"volume",value:"{volume}"}],defaultValue:"n/a",rect:{position:l.Fixed,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,offsetLeft:4,offsetTop:4,offsetRight:4,offsetBottom:4,borderRadius:4,borderSize:1,borderColor:"#F2F3F5",color:"#FEFEFE",positionX:0,positionY:0},text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4,borderSize:1,borderRadius:0,backgroundColor:"transparent"},icons:[]}}),indicator:(o=["#FF9600","#935EBD","#1677FF","#E11D74","#01C5C4"].map((function(e){return{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:e}})),{ohlc:{upColor:S,downColor:_,noChangeColor:C},bars:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:S,downColor:_,noChangeColor:C}],lines:o,circles:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:S,downColor:_,noChangeColor:C}],lastValueMark:{show:!1,text:{show:!1,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderColor:"transparent",borderSize:0,borderDashedValue:[2,2],paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderRadius:2}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4,borderSize:1,borderRadius:0,backgroundColor:"transparent"},icons:[]}}),xAxis:D(),yAxis:(n=D(),n.type=t.YAxisType.Normal,n.position=t.YAxisPosition.Right,n.inside=!1,n.reverse=!1,n),separator:{size:1,color:E,fill:!0,activeBackgroundColor:I(.08)},crosshair:M(),overlay:k()},this._customApi={formatDate:G,formatBigNumber:K},this._locale="en-US",this._precision={price:2,volume:0},this._thousandsSeparator=",",this._decimalFoldThreshold=3,this._dataList=[],this._loadMoreCallback=null,this._loadDataCallback=null,this._loading=!0,this._forwardMore=!0,this._backwardMore=!0,this._timeScaleStore=new St(this),this._indicatorStore=new ie(this),this._overlayStore=new Me(this),this._tooltipStore=new ne(this),this._actionStore=new ke,this._visibleDataList=[],this._chart=e,this.setOptions(i)}return e.prototype.adjustVisibleDataList=function(){this._visibleDataList=[];for(var t=this._timeScaleStore.getVisibleRange(),e=t.realFrom,i=t.realTo,n=e;n<i;n++){var o=this._dataList[n],r=this._timeScaleStore.dataIndexToCoordinate(n);this._visibleDataList.push({dataIndex:n,x:r,data:o})}},e.prototype.setOptions=function(t){var e,i,n,o;if(O(t)){var r=t.locale,a=t.timezone,s=t.styles,l=t.customApi,c=t.thousandsSeparator,u=t.decimalFoldThreshold;if(W(r)&&(this._locale=r),W(a)&&this._timeScaleStore.setTimezone(a),O(s)){var h=null;h=W(s)?Le(s):s,A(this._styles,h),F(null===(i=null===(e=null==h?void 0:h.candle)||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.custom)&&(this._styles.candle.tooltip.custom=null===(o=null===(n=null==h?void 0:h.candle)||void 0===n?void 0:n.tooltip)||void 0===o?void 0:o.custom)}O(l)&&A(this._customApi,l),W(c)&&(this._thousandsSeparator=c),B(u)&&u>0&&(this._decimalFoldThreshold=u)}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.getDecimalFoldThreshold=function(){return this._decimalFoldThreshold},e.prototype.getPrecision=function(){return this._precision},e.prototype.setPrecision=function(t){return this._precision=t,this._indicatorStore.synchronizeSeriesPrecision(),this},e.prototype.getDataList=function(){return this._dataList},e.prototype.getVisibleDataList=function(){return this._visibleDataList},e.prototype.addData=function(e,i,n){return p(this,void 0,void 0,(function(){var o,r,a,s,l,c,u;return g(this,(function(h){switch(h.label){case 0:if(o=!1,r=!1,a=0,F(e)){switch(a=e.length,i){case ct.Init:this.clear(),this._dataList=e,this._forwardMore=null==n||n,this._timeScaleStore.resetOffsetRightDistance(),r=!0;break;case ct.Backward:this._dataList=this._dataList.concat(e),this._backwardMore=null!=n&&n,r=a>0;break;case ct.Forward:this._dataList=e.concat(this._dataList),this._forwardMore=null!=n&&n,r=a>0}this._loading=!1,o=!0}else s=this._dataList.length,l=e.timestamp,c=U(this._dataList[s-1],"timestamp",0),l>c?(this._dataList.push(e),(u=this._timeScaleStore.getLastBarRightSideDiffBarCount())<0&&this._timeScaleStore.setLastBarRightSideDiffBarCount(--u),a=1,o=!0,r=!0):l===c&&(this._dataList[s-1]=e,o=!0,r=!0);if(!o)return[3,5];h.label=1;case 1:return h.trys.push([1,4,,5]),this._overlayStore.updatePointPosition(a,i),r?(this._timeScaleStore.adjustVisibleRange(),this._tooltipStore.recalculateCrosshair(!0),[4,this._indicatorStore.calcInstance()]):[3,3];case 2:h.sent(),this._chart.adjustPaneViewport(!1,!0,!0,!0),h.label=3;case 3:return this._actionStore.execute(t.ActionType.OnDataReady),[3,5];case 4:return h.sent(),[3,5];case 5:return[2]}}))}))},e.prototype.setLoadMoreCallback=function(t){this._loadMoreCallback=t},e.prototype.executeLoadMoreCallback=function(t){this._forwardMore&&!this._loading&&O(this._loadMoreCallback)&&(this._loading=!0,this._loadMoreCallback(t))},e.prototype.setLoadDataCallback=function(t){this._loadDataCallback=t},e.prototype.executeLoadDataCallback=function(t){var e=this;if(!this._loading&&O(this._loadDataCallback)&&(this._forwardMore&&t.type===ct.Forward||this._backwardMore&&t.type===ct.Backward)){this._loading=!0,this._loadDataCallback(d(d({},t),{callback:function(i,n){e.addData(i,t.type,n).then((function(){})).catch((function(){}))}}))}},e.prototype.clear=function(){this._forwardMore=!0,this._backwardMore=!0,this._loading=!0,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}(),Ne="main",Re="xAxis",Be="yAxis",Oe="separator";function Ve(t){return N(window.requestAnimationFrame)?window.requestAnimationFrame(t):window.setTimeout(t,20)}function We(t){N(window.cancelAnimationFrame)?window.cancelAnimationFrame(t):window.clearTimeout(t)}var ze=function(){function t(t,e){var i=this;this._supportedDevicePixelContentBox=!1,this._width=0,this._height=0,this._pixelWidth=0,this._pixelHeight=0,this._nextPixelWidth=0,this._nextPixelHeight=0,this._requestAnimationId=-1,this._mediaQueryListener=function(){var t=$(i._element);i._nextPixelWidth=Math.round(i._element.clientWidth*t),i._nextPixelHeight=Math.round(i._element.clientHeight*t),i._resetPixelRatio()},this._listener=e,this._element=pt("canvas",t),this._ctx=this._element.getContext("2d",{willReadFrequently:!0}),function(){return p(this,void 0,void 0,(function(){return g(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var e=new ResizeObserver((function(i){t(i.every((function(t){return"devicePixelContentBoxSize"in t}))),e.disconnect()}));e.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1}))];case 1:return[2,t.sent()]}}))}))}().then((function(t){i._supportedDevicePixelContentBox=t,t?(i._resizeObserver=new ResizeObserver((function(t){var e,n=t.find((function(t){return t.target===i._element})),o=null===(e=null==n?void 0:n.devicePixelContentBoxSize)||void 0===e?void 0:e[0];O(o)&&(i._nextPixelWidth=o.inlineSize,i._nextPixelHeight=o.blockSize,i._pixelWidth===i._nextPixelWidth&&i._pixelHeight===i._nextPixelHeight||i._resetPixelRatio())})),i._resizeObserver.observe(i._element,{box:"device-pixel-content-box"})):(i._mediaQueryList=window.matchMedia("(resolution: ".concat($(i._element),"dppx)")),i._mediaQueryList.addListener(i._mediaQueryListener))})).catch((function(t){return!1}))}return t.prototype._resetPixelRatio=function(){var t=this;this._executeListener((function(){var e=t._element.clientWidth,i=t._element.clientHeight,n=t._nextPixelWidth/e,o=t._nextPixelHeight/i;t._width=e,t._height=i,t._pixelWidth=t._nextPixelWidth,t._pixelHeight=t._nextPixelHeight,t._element.width=t._nextPixelWidth,t._element.height=t._nextPixelHeight,t._ctx.scale(n,o)}))},t.prototype._executeListener=function(t){var e=this;-1===this._requestAnimationId&&(this._requestAnimationId=Ve((function(){e._ctx.clearRect(0,0,e._width,e._height),null==t||t(),e._listener(),e._requestAnimationId=-1})))},t.prototype.update=function(t,e){if(this._width!==t||this._height!==e){if(this._element.style.width="".concat(t,"px"),this._element.style.height="".concat(e,"px"),!this._supportedDevicePixelContentBox){var i=$(this._element);this._nextPixelWidth=Math.round(t*i),this._nextPixelHeight=Math.round(e*i),this._resetPixelRatio()}}else this._executeListener()},t.prototype.getElement=function(){return this._element},t.prototype.getContext=function(){return this._ctx},t.prototype.destroy=function(){var t,e;null===(t=this._resizeObserver)||void 0===t||t.unobserve(this._element),null===(e=this._mediaQueryList)||void 0===e||e.removeListener(this._mediaQueryListener)},t}();function He(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return O(t)&&A(e,t),e}var Ye=function(t){function e(e,i){var n=t.call(this)||this;return n._bounding=He(),n._pane=i,n.init(e),n}return i(e,t),e.prototype.init=function(t){this._rootContainer=t,this._container=this.createContainer(),t.appendChild(this._container)},e.prototype.setBounding=function(t){return A(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}(ae),Xe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.init=function(e){var i=this;t.prototype.init.call(this,e),this._mainCanvas=new ze({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){i.updateMain(i._mainCanvas.getContext())})),this._overlayCanvas=new ze({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){i.updateOverlay(i._overlayCanvas.getContext())}));var n=this.getContainer();n.appendChild(this._mainCanvas.getElement()),n.appendChild(this._overlayCanvas.getElement())},e.prototype.createContainer=function(){return pt("div",{margin:"0",padding:"0",position:"absolute",top:"0",overflow:"hidden",boxSizing:"border-box",zIndex:"1"})},e.prototype.updateImp=function(t,e,i){var n=e.width,o=e.height,r=e.left;t.style.left="".concat(r,"px");var a=i,s=t.clientWidth,l=t.clientHeight;switch(n===s&&o===l||(t.style.width="".concat(n,"px"),t.style.height="".concat(o,"px"),a=3),a){case 0:this._mainCanvas.update(n,o);break;case 1:this._overlayCanvas.update(n,o);break;case 3:case 4:this._mainCanvas.update(n,o),this._overlayCanvas.update(n,o)}},e.prototype.destroy=function(){this._mainCanvas.destroy(),this._overlayCanvas.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=pt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=$(o);return o.width=i*a,o.height=n*a,r.scale(a,a),r.drawImage(this._mainCanvas.getElement(),0,0,i,n),t&&r.drawImage(this._overlayCanvas.getElement(),0,0,i,n),o},e}(Ye);function Ue(t){return"transparent"===t||"none"===t||/^[rR][gG][Bb][Aa]\(([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\s]*,){3}[\s]*0[\s]*\)$/.test(t)||/^[hH][Ss][Ll][Aa]\(([\s]*(360|3[0-5][0-9]|[012]?[0-9][0-9]?)[\s]*,)([\s]*((100|[0-9][0-9]?)%|0)[\s]*,){2}([\s]*0[\s]*)\)$/.test(t)}function Ge(t,e){var i=[];i=i.concat(e);for(var n=0;n<i.length;n++){var o=i[n],r=o.x,a=o.y,s=o.r,l=t.x-r,c=t.y-a;if(!(l*l+c*c>s*s))return!0}return!1}function je(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,c=n.borderSize,u=void 0===c?1:c,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v;a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&Ue(l)||(e.fillStyle=l,o.forEach((function(t){var i=t.x,n=t.y,o=t.r;e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&u>0&&!Ue(d)&&(e.strokeStyle=d,e.lineWidth=u,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r;e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.stroke()})))}var Ke={name:"circle",checkEventOn:Ge,draw:function(t,e,i){je(t,e,i)}};function Ze(t,e){var i=[];i=i.concat(e);for(var n=0;n<i.length;n++){for(var o=!1,r=i[n].coordinates,a=0,s=r.length-1;a<r.length;s=a++)r[a].y>t.y!=r[s].y>t.y&&t.x<(r[s].x-r[a].x)*(t.y-r[a].y)/(r[s].y-r[a].y)+r[a].x&&(o=!o);if(o)return!0}return!1}function qe(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,c=n.borderSize,u=void 0===c?1:c,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v;a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&Ue(l)||(e.fillStyle=l,o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&u>0&&!Ue(d)&&(e.strokeStyle=d,e.lineWidth=u,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.stroke()})))}var $e={name:"polygon",checkEventOn:Ze,draw:function(t,e,i){qe(t,e,i)}};function Qe(t,e){var i=[];i=i.concat(e);for(var n=0;n<i.length;n++){var o=i[n],r=o.x,a=o.width;a<4&&(r-=2,a=4);var s=o.y,l=o.height;if(l<4&&(s-=2,l=4),t.x>=r&&t.x<=r+a&&t.y>=s&&t.y<=s+l)return!0}return!1}function Je(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"transparent":s,c=n.borderSize,u=void 0===c?1:c,h=n.borderColor,d=void 0===h?"transparent":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderRadius,f=void 0===v?0:v,y=n.borderDashedValue,m=void 0===y?[2,2]:y,_=n.positionX,x=void 0===_?0:_,S=n.positionY,C=void 0===S?0:S;a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&Ue(l)||(e.fillStyle=l,o.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;e.beginPath(),e.moveTo(i+f+x,n+C),e.arcTo(i+o+x,n+C,i+o+x,n+r+C,f),e.arcTo(i+o+x,n+r+C,i+x,n+r+C,f),e.arcTo(i+x,n+r+C,i+x,n+C,f),e.arcTo(i+x,n+C,i+o+x,n+C,f),e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&u>0&&!Ue(d)&&(e.strokeStyle=d,e.lineWidth=u,g===t.LineType.Dashed?e.setLineDash(m):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;e.beginPath(),e.moveTo(i+f+x,n+C),e.arcTo(i+o,n+C,i+o+x,n+r+C,f),e.arcTo(i+o+x,n+r+C,i+x,n+r+C,f),e.arcTo(i+x,n+r+C,i+x,n+C,f),e.arcTo(i+x,n+C,i+o+x,n+C,f),e.closePath(),e.stroke()})))}var ti={name:"rect",checkEventOn:Qe,draw:function(t,e,i){Je(t,e,i)}};function ei(t,e){var i,n,o=e.size,r=void 0===o?12:o,a=e.paddingLeft,s=void 0===a?0:a,l=e.paddingTop,c=void 0===l?0:l,u=e.paddingRight,h=void 0===u?0:u,d=e.paddingBottom,p=void 0===d?0:d,g=e.weight,v=void 0===g?"normal":g,f=e.family,y=t.x,m=t.y,_=t.text,x=t.align,S=void 0===x?"left":x,C=t.baseline,b=void 0===C?"top":C,T=t.width,w=t.height,E=null!=T?T:s+J(_,r,v,f)+h,I=null!=w?w:c+r+p;switch(S){case"left":case"start":i=y;break;case"right":case"end":i=y-E;break;default:i=y-E/2}switch(b){case"top":case"hanging":n=m;break;case"bottom":case"ideographic":case"alphabetic":n=m-I;break;default:n=m-I/2}return{x:i,y:n,width:E,height:I}}function ii(t,e,i){var n=[];n=n.concat(e);for(var o=0;o<n.length;o++){var r=ei(n[o],i),a=r.x,s=r.y,l=r.width,c=r.height;if(t.x>=a&&t.x<=a+l&&t.y>=s&&t.y<=s+c)return!0}return!1}function ni(t,e,i,n){var o=[];o=o.concat(e);var r=i.color,a=void 0===r?"currentColor":r,s=i.size,l=void 0===s?12:s,c=i.family,u=i.weight,h=i.paddingLeft,p=void 0===h?0:h,g=i.paddingTop,v=void 0===g?0:g,f=i.paddingRight,y=void 0===f?0:f,m=o.map((function(t){return ei(t,i)}));Je(t,m,d(d({},i),{color:i.backgroundColor})),n===Ut.HEAD_SHOULDER?(t.textAlign="center",t.textBaseline="bottom"):n===Ut.INV_HEAD_SHOULDER?(t.textAlign="center",t.textBaseline="top"):(t.textAlign="left",t.textBaseline="top"),t.font=Q(l,u,c),t.fillStyle=a,o.forEach((function(e,i){var n=m[i];t.fillText(e.text,n.x+p,n.y+v,n.width-p-y)}))}var oi={name:"text",checkEventOn:ii,draw:function(t,e,i){ni(t,e,i,"")}},ri=ni;function ai(t,e){var i,n,o,r,a=[];a=a.concat(e);for(var s=0;s<a.length;s++){var l=a[s];if(Math.abs((n=l,o=void 0,r=void 0,o=(i=t).x-n.x,r=i.y-n.y,Math.sqrt(o*o+r*r)-l.r))<2){var c=l.r,u=l.startAngle,h=l.endAngle,d=c*Math.cos(u)+l.x,p=c*Math.sin(u)+l.y,g=c*Math.cos(h)+l.x,v=c*Math.sin(h)+l.y;if(t.x<=Math.max(d,g)+2&&t.x>=Math.min(d,g)-2&&t.y<=Math.max(p,v)+2&&t.y>=Math.min(p,v)-2)return!0}}return!1}function si(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.size,l=void 0===s?1:s,c=n.color,u=void 0===c?"currentColor":c,h=n.dashedValue,d=void 0===h?[2,2]:h;e.lineWidth=l,e.strokeStyle=u,a===t.LineType.Dashed?e.setLineDash(d):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r,r=t.startAngle,a=t.endAngle;e.beginPath(),e.arc(i,n,o,r,a),e.stroke(),e.closePath()}))}var li={name:"arc",checkEventOn:ai,draw:function(t,e,i){si(t,e,i)}},ci={};[Ke,ve,$e,ti,oi,oi,li].forEach((function(t){ci[t.name]=se.extend(t)}));var ui=function(t){function e(e){var i=t.call(this)||this;return i._widget=e,i}return i(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e){var i,n,o=(i=t.name,null!==(n=ci[i])&&void 0!==n?n:null);if(null!==o){var r=new o(t);if(O(e)){for(var a in e)e.hasOwnProperty(a)&&r.registerEvent(a,e[a]);this.addChild(r)}return r}return null},e.prototype.draw=function(t){this.clear(),this.drawImp(t)},e}(ae),hi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i,n=this.getWidget(),o=this.getWidget().getPane(),r=o.getChart(),a=n.getBounding(),s=r.getStyles().grid;if(s.show){t.save(),t.globalCompositeOperation="destination-over";var l=s.horizontal;if(l.show){var c=o.getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:0,y:t.coord},{x:a.width,y:t.coord}]}}));null===(e=this.createFigure({name:"line",attrs:c,styles:l}))||void 0===e||e.draw(t)}var u=s.vertical;if(u.show){c=r.getXAxisPane().getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:a.height}]}}));null===(i=this.createFigure({name:"line",attrs:c,styles:u}))||void 0===i||i.draw(t)}t.restore()}},e}(ui),di=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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}(ui),pi=function(e){function n(){var i=e.apply(this,y([],f(arguments),!1))||this;return i._boundCandleBarClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().getActionStore().execute(t.ActionType.OnCandleBarClick,e),!1}},i}return i(n,e),n.prototype.drawImp=function(e){var i=this,n=this.getWidget().getPane(),o=n.getId()===Ie,r=n.getChart().getChartStore(),a=this.getCandleBarOptions(r);if(null!==a){var s=n.getAxisComponent();this.eachChildren((function(n,r){var l=n.data,c=n.x;if(O(l)){var u=l.open,h=l.high,d=l.low,p=l.close,g=a.type,v=a.styles,f=[];p>u?(f[0]=v.upColor,f[1]=v.upBorderColor,f[2]=v.upWickColor):p<u?(f[0]=v.downColor,f[1]=v.downBorderColor,f[2]=v.downWickColor):(f[0]=v.noChangeColor,f[1]=v.noChangeBorderColor,f[2]=v.noChangeWickColor);var y=s.convertToPixel(u),m=s.convertToPixel(p),_=[y,m,s.convertToPixel(h),s.convertToPixel(d)];_.sort((function(t,e){return t-e}));var x=[];switch(g){case t.CandleType.CandleSolid:x=i._createSolidBar(c,_,r,f);break;case t.CandleType.CandleStroke:x=i._createStrokeBar(c,_,r,f);break;case t.CandleType.CandleUpStroke:x=p>u?i._createStrokeBar(c,_,r,f):i._createSolidBar(c,_,r,f);break;case t.CandleType.CandleDownStroke:x=u>p?i._createStrokeBar(c,_,r,f):i._createSolidBar(c,_,r,f);break;case t.CandleType.Ohlc:var S=Math.min(Math.max(Math.round(.2*r.gapBar),1),7);x=[{name:"rect",attrs:[{x:c-S/2,y:_[0],width:S,height:_[3]-_[0]},{x:c-r.halfGapBar,y:y+S>_[3]?_[3]-S:y,width:r.halfGapBar-S/2,height:S},{x:c+S/2,y:m+S>_[3]?_[3]-S:m,width:r.halfGapBar-S/2,height:S}],styles:{color:f[0]}}]}x.forEach((function(t){var r,a;o&&(a={mouseClickEvent:i._boundCandleBarClickEvent(n)}),null===(r=i.createFigure(t,a))||void 0===r||r.draw(e)}))}}))}},n.prototype.getCandleBarOptions=function(t){var e=t.getStyles().candle;return{type:e.type,styles:e.bar}},n.prototype._createSolidBar=function(e,i,n,o){return[{name:"rect",attrs:{x:e-.5,y:i[0],width:1,height:i[3]-i[0]},styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar+.5,y:i[1],width:n.gapBar-1,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.StrokeFill,color:o[0],borderColor:o[1]}}]},n.prototype._createStrokeBar=function(e,i,n,o){return[{name:"rect",attrs:[{x:e-.5,y:i[0],width:1,height:i[1]-i[0]},{x:e-.5,y:i[2],width:1,height:i[3]-i[2]}],styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar+.5,y:i[1],width:n.gapBar-1,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.Stroke,borderColor:o[1]}}]},n}(di);function gi(t,e,i,n,o){var r=[],a=[];return t.forEach((function(t,s){var l;if(void 0!==(null===(l=n.data)||void 0===l?void 0:l.timestamp)&&t===n.data.timestamp){var c=void 0;s%2==0?(c={x:e.x,y:i.convertToPixel(o?n.data.high:n.data.low)},a.push(o?n.data.high:n.data.low)):(c={x:e.x,y:i.convertToPixel(o?n.data.low:n.data.high)},a.push(o?n.data.low:n.data.high)),r.push(c)}})),{coordinateArr:r,dataPointsArr:a}}function vi(e,i,n,o,r){if(!(n.length>0)||function(t){var e=t[1]>t[0],i=t[3]>t[2],n=t[5]>t[4],o=t[3]>t[1]&&t[3]>t[5];return e&&i&&n&&o}(n)){var a=d({},o),s="#961EEA",l="Left Shoulder",c="Head";a.style=t.LineType.Solid,5===i.length&&(a.style=t.LineType.Dashed,l="Potential Left Shoulder",c="Potential Head"),a.size=3,a.color=s,a.dashedValue=[2],ge(e,i[0],i[1],a),ge(e,i[1],i[2],a),ge(e,i[2],i[3],a),ge(e,i[3],i[4],a),6===i.length&&ge(e,i[4],i[5],a);var u=d({},r.tooltip.text);u.backgroundColor=s,u.weight="bold",u.color="#FFFFFF",u.borderRadius=4,5===i.length?u.paddingLeft=32:u.paddingLeft=7,5===i.length?u.paddingRight=-15:u.paddingRight=7,u.paddingTop=5,u.paddingBottom=5,u.positionX=-35,u.positionY=-14,ni(e,{x:i[1].x,y:i[1].y,text:l},u,Ut.HEAD_SHOULDER),u.positionX=-14,u.positionY=-14,ni(e,{x:i[3].x,y:i[3].y,text:c},u,Ut.HEAD_SHOULDER),6===i.length&&(u.positionX=-39,u.positionY=-14,ni(e,{x:i[5].x,y:i[5].y,text:"Right Shoulder"},u,Ut.HEAD_SHOULDER))}}function fi(e,i,n,o,r){if(!(n.length>0)||function(t){var e=t[1]<t[0],i=t[3]<t[2],n=t[5]<t[4],o=t[3]<t[1]&&t[3]<t[5];return e&&i&&n&&o}(n)){var a=d({},o),s="#03fc0f",l="Left Shoulder",c="Head";a.style=t.LineType.Solid,5===i.length&&(a.style=t.LineType.Dashed,l="Potential Left Shoulder",c="Potential Head"),a.size=3,a.color=s,a.dashedValue=[2],ge(e,i[0],i[1],a),ge(e,i[1],i[2],a),ge(e,i[2],i[3],a),ge(e,i[3],i[4],a),6===i.length&&ge(e,i[4],i[5],a);var u=d({},r.tooltip.text);u.backgroundColor=s,u.weight="bold",u.color="#000000",u.borderRadius=4,5===i.length?u.paddingLeft=32:u.paddingLeft=7,5===i.length?u.paddingRight=-15:u.paddingRight=7,u.paddingTop=5,u.paddingBottom=5,u.positionX=-35,ni(e,{x:i[1].x,y:i[1].y,text:l},u,Ut.INV_HEAD_SHOULDER),u.positionX=-14,ni(e,{x:i[3].x,y:i[3].y,text:c},u,Ut.INV_HEAD_SHOULDER),6===i.length&&(u.positionX=-39,ni(e,{x:i[5].x,y:i[5].y,text:"Right Shoulder"},u,Ut.INV_HEAD_SHOULDER))}}function yi(t){var e=t.values().next().value;if(null!=e){e.sort((function(t,e){return t-e}));var i=t.keys().next().value;t.set(i,e)}}function mi(t,e,i){var n=new Path2D;if(t.length>1){n.moveTo(t[0],i);for(var o=0,r=t.length;o<r;++o)n.lineTo(t[o],e[o]);n.lineTo(t[t.length-1],i)}return n}function _i(t,e,i,n,o){if(0!==e.length){var r=t.canvas;t.save(),t.globalAlpha=.01,t.fillStyle=o,t.clip(mi(e,i,r.height)),t.fill(mi(e,n,0)),t.restore()}}function xi(t){var e=t.x2-t.x1,i=(t.y2-t.y1)/e,n=t.x2+e,o=t.y2+i*e;return{x1:t.x2,y1:t.y2,x2:n,y2:o}}var Si=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.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=v(r),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.shouldOhlc&&l.visible){var c=l.styles,u=e.getStyles().indicator,h=U(c,"ohlc.upColor",u.ohlc.upColor),d=U(c,"ohlc.downColor",u.ohlc.downColor),p=U(c,"ohlc.noChangeColor",u.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},n.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(),c=r.getChartStore(),u=c.getDataList(),h=c.getTimeScaleStore(),p=h.getVisibleRange(),g=c.getIndicatorStore().getInstances(o.getId()),v=c.getStyles().indicator;t.save(),g.forEach((function(e){var n,o,r,c,g;if(e.visible){e.zLevel<0?t.globalCompositeOperation="destination-over":t.globalCompositeOperation="source-over";var m=!1,_=[],x=[],S=[],C=[],b=[],T=[];if(null!==e.draw&&(t.save(),m=null!==(n=e.draw({ctx:t,kLineDataList:u,indicator:e,visibleRange:p,bounding:a,barSpace:h.getBarSpace(),defaultStyles:v,xAxis:s,yAxis:l}))&&void 0!==n&&n,t.restore()),!m){var w=e.result,E=!1,I=!1,P=[],D=[],M=!1,k=!1,A=[],L=[],F=!1,N=!1,R=!1,V=0;if(e.name.toLowerCase()===Ut.HEAD_SHOULDER)(W=function(t){var e=[],i=[];t.forEach((function(t){Ut.HEAD_SHOULDER in t?t[Ut.HEAD_SHOULDER].forEach((function(t){e.push(t.ts)})):Ut.POTENTIAL_HEAD_SHOULDER in t&&t[Ut.POTENTIAL_HEAD_SHOULDER].forEach((function(t){i.push(t.ts)}))}));var n=new Map;return e.length>0&&n.set(Ut.HEAD_SHOULDER,e),i.length>0&&n.set(Ut.POTENTIAL_HEAD_SHOULDER,i),yi(n),n}(w)).size>0&&(W.has(Ut.HEAD_SHOULDER)&&(E=!0,P=null!==(o=W.get(Ut.HEAD_SHOULDER))&&void 0!==o?o:[]),W.has(Ut.POTENTIAL_HEAD_SHOULDER)&&(I=!0,D=null!==(r=W.get(Ut.POTENTIAL_HEAD_SHOULDER))&&void 0!==r?r:[]));else if(e.name.toLowerCase()===Ut.INV_HEAD_SHOULDER.toLowerCase()){var W;(W=function(t){var e=[],i=[];t.forEach((function(t){Ut.INV_HEAD_SHOULDER in t?t[Ut.INV_HEAD_SHOULDER].forEach((function(t){e.push(t.ts)})):Ut.POTENTIAL_INV_HEAD_SHOULDER in t&&t[Ut.POTENTIAL_INV_HEAD_SHOULDER].forEach((function(t){i.push(t.ts)}))}));var n=new Map;return e.length>0&&n.set(Ut.INV_HEAD_SHOULDER,e),i.length>0&&n.set(Ut.POTENTIAL_INV_HEAD_SHOULDER,i),yi(n),n}(w)).size>0&&(W.has(Ut.INV_HEAD_SHOULDER)&&(M=!0,A=null!==(c=W.get(Ut.INV_HEAD_SHOULDER))&&void 0!==c?c:[]),W.has(Ut.POTENTIAL_INV_HEAD_SHOULDER)&&(k=!0,L=null!==(g=W.get(Ut.POTENTIAL_INV_HEAD_SHOULDER))&&void 0!==g?g:[]))}else e.name.toLowerCase()===Ut.SUPER_TREND.toLowerCase()?F=!0:e.name.toLowerCase()===Ut.WEDGES.toLowerCase()?N=!0:e.name.toLocaleLowerCase()===Ut.DESC_BROADENING_WEDGES.toLocaleLowerCase()&&(R=!0);var z=[],H=new Map,Y=0;i.eachChildren((function(n,o){var r,c,h,p=o.halfGapBar,g=o.gapBar,m=n.dataIndex,F=n.x,W=s.convertToPixel(m-1),X=s.convertToPixel(m+1),U=null!==(r=w[m-1])&&void 0!==r?r:{},G=null!==(c=w[m])&&void 0!==c?c:{},j=null!==(h=w[m+1])&&void 0!==h?h:{},K={x:W},Z={x:F},q={x:X};E&&(_.push.apply(_,y([],f(gi(P,Z,l,n,!1).coordinateArr),!1)),x.push.apply(x,y([],f(gi(P,Z,l,n,!1).dataPointsArr),!1))),I&&S.push.apply(S,y([],f(gi(D,Z,l,n,!1).coordinateArr),!1)),M&&(C.push.apply(C,y([],f(gi(A,Z,l,n,!0).coordinateArr),!1)),b.push.apply(b,y([],f(gi(A,Z,l,n,!0).dataPointsArr),!1))),k&&T.push.apply(T,y([],f(gi(L,Z,l,n,!0).coordinateArr),!1)),(N||R)&&V++,e.figures.forEach((function(t){var e=t.key,i=U[e];B(i)&&(K[e]=l.convertToPixel(i));var n=G[e];B(n)&&(Z[e]=l.convertToPixel(n));var o=j[e];B(o)&&(q[e]=l.convertToPixel(o))})),it(u,e,m,v,(function(e,n,r){var c,u,h;if(O(G[e.key])){var f=Z[e.key];if(H.set(Y++,[F,f]),(N||R)&&w.length===V){var y=JSON.parse(JSON.stringify(w));!function(t,e,i){var n=t[t.length-1];null!=n.topLine&&null!=n.bottomLine&&(n.topLine.x1=e.convertToPixel(n.topLine.x1),n.topLine.x2=e.convertToPixel(n.topLine.x2),n.topLine.y1=i.convertToPixel(n.topLine.y1),n.topLine.y2=i.convertToPixel(n.topLine.y2),n.bottomLine.x1=e.convertToPixel(n.bottomLine.x1),n.bottomLine.x2=e.convertToPixel(n.bottomLine.x2),n.bottomLine.y1=i.convertToPixel(n.bottomLine.y1),n.bottomLine.y2=i.convertToPixel(n.bottomLine.y2))}(y,s,l),function(t,e,i,n){var o=d({},i);o.color=n?"#00FF00":"#FF0000";var r=e[e.length-1];if(null!=r.topLine){t.save(),ge(t,{x:r.topLine.x1,y:r.topLine.y1},{x:r.topLine.x2,y:r.topLine.y2},o);var a=xi(r.topLine);ge(t,{x:a.x1,y:a.y1},{x:a.x2,y:a.y2},o),ge(t,{x:r.bottomLine.x1,y:r.bottomLine.y1},{x:r.bottomLine.x2,y:r.bottomLine.y2},o);var s=xi(r.bottomLine);ge(t,{x:s.x1,y:s.y1},{x:s.x2,y:s.y2},o),t.beginPath(),t.moveTo(r.topLine.x1,r.topLine.y1),t.lineTo(a.x2,a.y2),t.lineTo(s.x2,s.y2),t.lineTo(r.bottomLine.x1,r.bottomLine.y1),t.closePath(),t.globalAlpha=.1,t.fillStyle="green",t.fill(),t.restore()}}(t,y,n,N)}E&&6===_.length?(vi(t,_,x,n,v),_.length=0):I&&5===S.length?(vi(t,S,[],n,v),S.length=0):M&&6===C.length?(fi(t,C,b,n,v),C.length=0):k&&5===T.length&&(fi(t,T,[],n,v),T.length=0);var m=null===(c=e.attrs)||void 0===c?void 0:c.call(e,{coordinate:{prev:K,current:Z,next:q},bounding:a,barSpace:o,xAxis:s,yAxis:l});if(!O(m))switch(e.type){case"circle":m={x:F,y:f,r:p};break;case"rect":case"bar":var P=null!==(u=e.baseValue)&&void 0!==u?u:l.getRange().from,D=l.convertToPixel(P),A=Math.abs(D-f);P!==G[e.key]&&(A=Math.max(1,A));m={x:F-p,y:f>D?D:f,width:g,height:A};break;case"line":O(z[r])||(z[r]=[]),B(Z[e.key])&&B(q[e.key])&&z[r].push({coordinates:[{x:Z.x,y:Z[e.key]},{x:q.x,y:q[e.key]}],styles:n});break;case"text":m={x:F,y:f,text:e.textMessage}}var L=e.type;O(m)&&"line"!==L&&(null===(h=i.createFigure({name:"bar"===L?"rect":L,attrs:m,styles:n}))||void 0===h||h.draw(t))}}))})),z.forEach((function(e){if(e.length>1){for(var n=[{coordinates:[e[0].coordinates[0],e[0].coordinates[1]],styles:e[0].styles}],o=1;o<e.length;o++){var r=n[n.length-1],a=e[o],c=r.coordinates[r.coordinates.length-1];c.x===a.coordinates[0].x&&c.y===a.coordinates[0].y&&r.styles.style===a.styles.style&&r.styles.color===a.styles.color&&r.styles.size===a.styles.size&&r.styles.smooth===a.styles.smooth&&r.styles.dashedValue[0]===a.styles.dashedValue[0]&&r.styles.dashedValue[1]===a.styles.dashedValue[1]?r.coordinates.push(a.coordinates[1]):n.push({coordinates:[a.coordinates[0],a.coordinates[1]],styles:a.styles})}F&&function(t,e,i,n,o){var r=i.getParent().getChart().getChartStore().getTimeScaleStore(),a=[],s=[],l=[],c=d({},o.tooltip.text);c.weight="bold",c.color="#FFFFFF",c.borderRadius=4,c.paddingTop=5,c.paddingBottom=3,c.paddingLeft=5,c.paddingRight=4;for(var u=0;u<999;++u){var h=e[u];void 0!==h&&(a.push(r.dataIndexToCoordinate(u)),void 0!==h.buy?(s.push(n.convertToPixel(h.buy)),u>0&&"sell"in e[u-1]&&(c.backgroundColor="#03fc0f",ni(t,{x:a[u],y:s[u],text:"Buy"},c,""))):void 0!==h.sell&&(s.push(n.convertToPixel(h.sell)),u>0&&"buy"in e[u-1]&&(c.backgroundColor="#ff0000",ni(t,{x:a[u],y:s[u],text:"Sell"},c,""))),l.push(n.convertToPixel(h.candleStick)))}_i(t,a,s,l,"#1b0ec9"),_i(t,a,l,s,"#34eba4"),_i(t,a,l,s,"#34eba4"),_i(t,a,s,l,"#c90e14")}(t,w,s,l,v),n.forEach((function(e){var n,o=e.coordinates,r=e.styles;null===(n=i.createFigure({name:"line",attrs:{coordinates:o},styles:r}))||void 0===n||n.draw(t)}))}}))}}})),t.restore()},n}(pi),Ci=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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(W(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({name:"line",attrs:{coordinates:e},styles:o}))||void 0===n||n.draw(t))}},e}(ui),bi=function(e){function n(){var i=e.apply(this,y([],f(arguments),!1))||this;return i._boundIconClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().getActionStore().execute(t.ActionType.OnTooltipIconClick,d({},e)),!0}},i._boundIconMouseMoveEvent=function(t){return function(){return i.getWidget().getPane().getChart().getChartStore().getTooltipStore().setActiveIcon(d({},t)),!0}},i}return i(n,e),n.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=i.getChart().getChartStore(),o=n.getTooltipStore().getCrosshair();if(O(o.kLineData)){var r=e.getBounding(),a=n.getCustomApi(),s=n.getThousandsSeparator(),l=n.getDecimalFoldThreshold(),c=n.getIndicatorStore().getInstances(i.getId()),u=n.getTooltipStore().getActiveIcon(),h=n.getStyles().indicator,d=h.tooltip,p=d.offsetLeft,g=d.offsetTop,v=d.offsetRight;this.drawIndicatorTooltip(t,i.getId(),n.getDataList(),o,u,c,a,s,l,p,g,r.width-v,h)}},n.prototype.drawIndicatorTooltip=function(t,e,i,n,o,r,a,s,l,c,u,h,d){var p=this,g=d.tooltip;if(this.isDrawTooltip(n,g)){var v=g.text;r.forEach((function(r){var y=0,m={x:c,y:u},_=p.getIndicatorTooltipData(i,n,r,a,s,l,d),x=_.name,S=_.calcParamsText,C=_.values,b=_.icons,T=x.length>0,w=C.length>0;if(T||w){var E=f(p.classifyTooltipIcons(b),3),I=E[0],P=E[1],D=E[2];if(y=p.drawStandardTooltipIcons(t,o,I,m,e,r.name,c,y,h),T){var M=x;S.length>0&&(M="".concat(M).concat(S)),y=p.drawStandardTooltipLegends(t,[{title:{text:"",color:v.color},value:{text:M,color:v.color}}],m,c,y,h,v)}y=p.drawStandardTooltipIcons(t,o,P,m,e,r.name,c,y,h),w&&(y=p.drawStandardTooltipLegends(t,C,m,c,y,h,g.text)),y=p.drawStandardTooltipIcons(t,o,D,m,e,r.name,c,y,h),u=m.y+y}}))}return u},n.prototype.drawStandardTooltipIcons=function(t,e,i,n,o,r,a,s,l){var c=this;if(i.length>0){var u=0,h=0;i.forEach((function(e){var i=e.marginLeft,n=void 0===i?0:i,o=e.marginTop,r=void 0===o?0:o,a=e.marginRight,s=void 0===a?0:a,l=e.marginBottom,c=void 0===l?0:l,d=e.paddingLeft,p=void 0===d?0:d,g=e.paddingTop,v=void 0===g?0:g,f=e.paddingRight,y=void 0===f?0:f,m=e.paddingBottom,_=void 0===m?0:m,x=e.size,S=e.fontFamily,C=e.icon;t.font=Q(x,"normal",S),u+=n+p+t.measureText(C).width+y+s,h=Math.max(h,r+v+x+_+c)})),n.x+u>l?(n.x=a,n.y+=s,s=h):s=Math.max(s,h),i.forEach((function(i){var a,s=i.marginLeft,l=void 0===s?0:s,u=i.marginTop,h=void 0===u?0:u,d=i.marginRight,p=void 0===d?0:d,g=i.paddingLeft,v=void 0===g?0:g,f=i.paddingTop,y=void 0===f?0:f,m=i.paddingRight,_=void 0===m?0:m,x=i.paddingBottom,S=void 0===x?0:x,C=i.color,b=i.activeColor,T=i.size,w=i.fontFamily,E=i.icon,I=i.backgroundColor,P=i.activeBackgroundColor,D=(null==e?void 0:e.paneId)===o&&(null==e?void 0:e.indicatorName)===r&&(null==e?void 0:e.iconId)===i.id;null===(a=c.createFigure({name:"text",attrs:{text:E,x:n.x+l,y:n.y+h},styles:{paddingLeft:v,paddingTop:y,paddingRight:_,paddingBottom:S,color:D?b:C,size:T,family:w,backgroundColor:D?P:I}},{mouseClickEvent:c._boundIconClickEvent({paneId:o,indicatorName:r,iconId:i.id}),mouseMoveEvent:c._boundIconMouseMoveEvent({paneId:o,indicatorName:r,iconId:i.id})}))||void 0===a||a.draw(t),n.x+=l+v+t.measureText(E).width+_+p}))}return s},n.prototype.drawStandardTooltipLegends=function(t,e,i,n,o,r,a){var s=this;if(e.length>0){var l=a.marginLeft,c=a.marginTop,u=a.marginRight,h=a.marginBottom,d=a.size,p=a.family,g=a.weight;t.font=Q(d,g,p),e.forEach((function(e){var a,v,f=e.title,y=e.value,m=t.measureText(f.text).width,_=m+t.measureText(y.text).width,x=c+d+h;i.x+l+_+u>r?(i.x=n,i.y+=o,o=x):o=Math.max(o,x),f.text.length>0&&(null===(a=s.createFigure({name:"text",attrs:{x:i.x+l,y:i.y+c,text:f.text},styles:{color:f.color,size:d,family:p,weight:g}}))||void 0===a||a.draw(t)),null===(v=s.createFigure({name:"text",attrs:{x:i.x+l+m,y:i.y+c,text:y.text},styles:{color:y.color,size:d,family:p,weight:g}}))||void 0===v||v.draw(t),i.x+=l+_+u}))}return o},n.prototype.isDrawTooltip=function(e,i){var n=i.showRule;return n===t.TooltipShowRule.Always||n===t.TooltipShowRule.FollowCross&&W(e.paneId)},n.prototype.getIndicatorTooltipData=function(t,e,i,n,o,r,a){var s,l,c=a.tooltip,u=c.showName?i.shortName:"",h="",d=i.calcParams;d.length>0&&c.showParams&&(h="(".concat(d.join(","),")"));var p={name:u,calcParamsText:h,values:[],icons:c.icons},g=e.dataIndex,v=null!==(s=i.result)&&void 0!==s?s:[],f=[];if(i.visible){var y=null!==(l=v[g])&&void 0!==l?l:{};it(t,i,g,a,(function(t,e){if(W(t.title)){var a=e.color,s=y[t.key];B(s)&&(s=j(s,i.precision),i.shouldFormatBigNumber&&(s=n.formatBigNumber(s))),f.push({title:{text:t.title,color:a},value:{text:q(Z(null!=s?s:c.defaultValue,o),r),color:a}})}})),p.values=f}if(null!==i.createTooltipDataSource){var m=this.getWidget(),_=m.getPane(),x=_.getChart().getChartStore(),S=i.createTooltipDataSource({kLineDataList:t,indicator:i,visibleRange:x.getTimeScaleStore().getVisibleRange(),bounding:m.getBounding(),crosshair:e,defaultStyles:a,xAxis:_.getChart().getXAxisPane().getAxisComponent(),yAxis:_.getAxisComponent()}),C=S.name,b=S.calcParamsText,T=S.values,w=S.icons;if(W(C)&&c.showName&&(p.name=C),W(b)&&c.showParams&&(p.calcParamsText=b),O(w)&&(p.icons=w),O(T)&&i.visible){var E=[],I=a.tooltip.text.color;T.forEach((function(t){var e={text:"",color:I};R(t.title)?e=t.title:e.text=t.title;var i={text:"",color:I};R(t.value)?i=t.value:i.text=t.value,i.text=q(Z(i.text,o),r),E.push({title:e,value:i})})),p.values=E}}return p},n.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]},n}(ui),Ti=function(e){function n(t){var i=e.call(this,t)||this;return i._initEvent(),i}return i(n,e),n.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,c="".concat(at,"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,d({overlay:a,figureKey:c,figureIndex:l},e))),t._figureMouseMoveEvent(a,1,c,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 c=s.points.length-1,u="".concat(at,"point_").concat(c);return s.isDrawing()&&l===i&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(o=s.onDrawing)||void 0===o||o.call(s,d({overlay:s,figureKey:u,figureIndex:c},e)),s.nextStep(),s.isDrawing()||(n.progressInstanceComplete(),null===(r=s.onDrawEnd)||void 0===r||r.call(s,d({overlay:s,figureKey:u,figureIndex:c},e)))),t._figureMouseClickEvent(s,1,u,c,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,c="".concat(at,"point_").concat(l);null===(o=a.onDrawEnd)||void 0===o||o.call(a,d({overlay:a,figureKey:c,figureIndex:l},e))}var u=a.points.length-1;return t._figureMouseClickEvent(a,1,"".concat(at,"point_").concat(u),u,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(at,"point_").concat(r),r,0)(e)}}return!1})).registerEvent("mouseUpEvent",(function(t){var e,o=n.getPressedInstanceInfo(),r=o.instance,a=o.figureIndex,s=o.figureKey;return null!==r&&(null===(e=r.onPressedMoveEnd)||void 0===e||e.call(r,d({overlay:r,figureKey:s,figureIndex:a},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,c=r.figureKey;if(null!==a){if(!(a.lock||null!==(o=null===(i=a.onPressedMoving)||void 0===i?void 0:i.call(a,d({overlay:a,figureIndex:l,figureKey:c},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}))},n.prototype._createFigureEvents=function(t,e,i,n,o,r){var a;if(!t.isDrawing()){var s=[];if(O(r)&&(V(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},n.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}},n.prototype._figureMouseDownEvent=function(t,e,i,n,o){var r=this;return function(a){var s,l=r.getWidget().getPane(),c=l.getId(),u=l.getChart().getChartStore().getOverlayStore();return t.startPressedMove(r._coordinateToPoint(t,a)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,d({overlay:t,figureIndex:n,figureKey:i},a)),u.setPressedInstanceInfo({paneId:c,instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o}),!0}},n.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}},n.prototype._figureMouseDoubleClickEvent=function(t,e,i,n,o){return function(e){var o;return null===(o=t.onDoubleClick)||void 0===o||o.call(t,d(d({},e),{figureIndex:n,figureKey:i,overlay:t})),!0}},n.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,d({overlay:t,figureIndex:n,figureKey:i},e)))&&void 0!==a&&a||r.getWidget().getPane().getChart().getChartStore().getOverlayStore().removeInstance(t);return!0}},n.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 c=a.getXAxisPane().getAxisComponent().convertFromPixel(i.x),u=null!==(n=l.dataIndexToTimestamp(c))&&void 0!==n?n:void 0;o.dataIndex=c,o.timestamp=u}if(this.coordinateToPointValueFlag()){var h=r.getAxisComponent(),d=h.convertFromPixel(i.y);if(e.mode!==t.OverlayMode.Normal&&s===Ie&&B(o.dataIndex)){var p=l.getDataByDataIndex(o.dataIndex);if(null!==p){var g=e.modeSensitivity;if(d>p.high)if(e.mode===t.OverlayMode.WeakMagnet){var v=h.convertToPixel(p.high);d<h.convertFromPixel(v-g)&&(d=p.high)}else d=p.high;else if(d<p.low)if(e.mode===t.OverlayMode.WeakMagnet){var f=h.convertToPixel(p.low);d>h.convertFromPixel(f-g)&&(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?d-y<p.high-d?y:p.high:d<m?d-p.low<m-d?p.low:m:y-d<d-m?y:m}}}o.value=d}return o},n.prototype.coordinateToPointValueFlag=function(){return!0},n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.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)},n.prototype.checkEventOn=function(){return!0},n.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(),c=r.getChartStore(),u=c.getCustomApi(),h=c.getThousandsSeparator(),d=c.getDecimalFoldThreshold(),p=c.getTimeScaleStore(),g=p.getDateTimeFormat(),v=p.getBarSpace(),f=c.getPrecision(),y=c.getStyles().overlay,m=c.getOverlayStore(),_=m.getHoverInstanceInfo(),x=m.getClickInstanceInfo();this.getCompleteOverlays(m,o).forEach((function(i){i.visible&&e._drawOverlay(t,i,l,v,f,g,u,h,d,y,s,a,_,x,p)}));var S=m.getProgressInstanceInfo();if(null!==S){var C=this.getProgressOverlay(S,o);null!==C&&C.visible&&this._drawOverlay(t,C,l,v,f,g,u,h,d,y,s,a,_,x,p)}},n.prototype._drawOverlay=function(t,e,i,n,o,r,a,s,l,c,u,h,d,p,g){var v=e.points.map((function(t){var e,i,n=t.dataIndex;B(t.timestamp)&&(n=g.timestampToDataIndex(t.timestamp));var o={x:0,y:0};return B(n)&&(o.x=null!==(e=null==u?void 0:u.convertToPixel(n))&&void 0!==e?e:0),B(t.value)&&(o.y=null!==(i=null==h?void 0:h.convertToPixel(t.value))&&void 0!==i?i:0),o}));if(v.length>0){var f=(new Array).concat(this.getFigures(e,v,i,n,o,s,l,r,c,u,h));this.drawFigures(t,e,f,c)}this.drawDefaultFigures(t,e,v,i,o,r,a,s,l,c,u,h,d,p)},n.prototype.drawFigures=function(t,e,i,n){var o=this;i.forEach((function(i,r){var a=i.type,s=i.styles,l=i.attrs,c=i.ignoreEvent;[].concat(l).forEach((function(l,u){var h,p,g,v=o._createFigureEvents(e,2,null!==(h=i.key)&&void 0!==h?h:"",r,u,c),f=d(d(d({},n[a]),null===(p=e.styles)||void 0===p?void 0:p[a]),s);null===(g=o.createFigure({name:a,attrs:l,styles:f},v))||void 0===g||g.draw(t)}))}))},n.prototype.getCompleteOverlays=function(t,e){return t.getInstances(e)},n.prototype.getProgressOverlay=function(t,e){return t.paneId===e?t.instance:null},n.prototype.getFigures=function(t,e,i,n,o,r,a,s,l,c,u){var h,d;return null!==(d=null===(h=t.createPointFigures)||void 0===h?void 0:h.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:o,thousandsSeparator:r,decimalFoldThreshold:a,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==d?d:[]},n.prototype.drawDefaultFigures=function(t,e,i,n,o,r,a,s,l,c,u,h,p,g){var v,f,y=this;if(e.needDefaultPointFigure&&((null===(v=p.instance)||void 0===v?void 0:v.id)===e.id&&0!==p.figureType||(null===(f=g.instance)||void 0===f?void 0:f.id)===e.id&&0!==g.figureType)){var m=e.styles,_=d(d({},c.point),null==m?void 0:m.point);i.forEach((function(i,n){var o,r,a,s=i.x,l=i.y,c=_.radius,u=_.color,h=_.borderColor,d=_.borderSize;(null===(o=p.instance)||void 0===o?void 0:o.id)===e.id&&1===p.figureType&&p.figureIndex===n&&(c=_.activeRadius,u=_.activeColor,h=_.activeBorderColor,d=_.activeBorderSize),null===(r=y.createFigure({name:"circle",attrs:{x:s,y:l,r:c+d},styles:{color:h}},y._createFigureEvents(e,1,"".concat(at,"point_").concat(n),n,0)))||void 0===r||r.draw(t),null===(a=y.createFigure({name:"circle",attrs:{x:s,y:l,r:c},styles:{color:u}}))||void 0===a||a.draw(t)}))}},n}(ui),wi=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._gridView=new hi(n),n._indicatorView=new Si(n),n._crosshairLineView=new Ci(n),n._tooltipView=n.createTooltipView(),n._overlayView=new Ti(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 i(e,t),e.prototype.getName=function(){return Ne},e.prototype.updateMain=function(t){this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t)},e.prototype.createTooltipView=function(){return new bi(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){this._overlayView.draw(t),this._crosshairLineView.draw(t),this._tooltipView.draw(t)},e}(Xe),Ei=function(){function t(t){this._options={duration:500,iterationCount:1},this._currentIterationCount=0,this._running=!1,this._time=0,A(this._options,t)}return t.prototype._loop=function(){var t=this;this._running=!0;var e=function(){var i;if(t._running){var n=(new Date).getTime()-t._time;n<t._options.duration?(null===(i=t._doFrameCallback)||void 0===i||i.call(t,n),Ve(e)):(t.stop(),t._currentIterationCount++,t._currentIterationCount<t._options.iterationCount&&t.start())}};Ve(e)},t.prototype.doFrame=function(t){return this._doFrameCallback=t,this},t.prototype.setDuration=function(t){return this._options.duration=t,this},t.prototype.setIterationCount=function(t){return this._options.iterationCount=t,this},t.prototype.start=function(){this._running||(this._time=(new Date).getTime(),this._loop())},t.prototype.stop=function(){var t;this._running&&(null===(t=this._doFrameCallback)||void 0===t||t.call(this,this._options.duration)),this._running=!1},t}(),Ii=function(t){function e(){var e=t.apply(this,y([],f(arguments),!1))||this;return e._ripplePoint=e.createFigure({name:"circle",attrs:{x:0,y:0,r:0},styles:{style:"fill"}}),e._animationFrameTime=0,e._animation=new Ei({iterationCount:1/0}).doFrame((function(t){e._animationFrameTime=t;var i=e.getWidget().getPane();i.getChart().updatePane(0,i.getId())})),e}return i(e,t),e.prototype.drawImp=function(t){var e,i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=a.getDataList().length-1,l=o.getBounding(),c=r.getAxisComponent(),u=a.getStyles().candle.area,h=[],d=Number.MAX_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER,g=null;if(this.eachChildren((function(t){var e=t.data,i=t.x,n=null==e?void 0:e[u.value];if(B(n)){var o=c.convertToPixel(n);p===Number.MIN_SAFE_INTEGER&&(p=i),h.push({x:i,y:o}),d=Math.min(d,o),t.dataIndex===s&&(g={x:i,y:o})}})),h.length>0){null===(e=this.createFigure({name:"line",attrs:{coordinates:h},styles:{color:u.lineColor,size:u.lineSize,smooth:u.smooth}}))||void 0===e||e.draw(t);var v=u.backgroundColor,f=void 0;if(F(v)){var y=t.createLinearGradient(0,l.height,0,d);try{v.forEach((function(t){var e=t.offset,i=t.color;y.addColorStop(e,i)}))}catch(t){}f=y}else f=v;t.fillStyle=f,t.beginPath(),t.moveTo(p,l.height),t.lineTo(h[0].x,h[0].y),de(t,h,u.smooth),t.lineTo(h[h.length-1].x,l.height),t.closePath(),t.fill()}var m=u.point;if(m.show&&O(g)){null===(i=this.createFigure({name:"circle",attrs:{x:g.x,y:g.y,r:m.radius},styles:{style:"fill",color:m.color}}))||void 0===i||i.draw(t);var _=m.rippleRadius;m.animation&&(_=m.radius+this._animationFrameTime/m.animationDuration*(m.rippleRadius-m.radius),this._animation.setDuration(m.animationDuration).start()),null===(n=this._ripplePoint)||void 0===n||n.setAttrs({x:g.x,y:g.y,r:_}).setStyles({style:"fill",color:m.rippleColor}).draw(t)}else this.stopAnimation()},e.prototype.stopAnimation=function(){this._animation.stop()},e}(di),Pi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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.getDecimalFoldThreshold(),l=i.getPrecision(),c=e.getAxisComponent(),u=Number.MIN_SAFE_INTEGER,h=0,d=Number.MAX_SAFE_INTEGER,p=0;this.eachChildren((function(t){var e=t.data,i=t.x;O(e)&&(u<e.high&&(u=e.high,h=i),d>e.low&&(d=e.low,p=i))}));var g=c.convertToPixel(u),v=c.convertToPixel(d);o.show&&u!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,q(Z(j(u,l.price),a),s),{x:h,y:g},g<v?[-2,-5]:[2,5],o),r.show&&d!==Number.MAX_SAFE_INTEGER&&this._drawMark(t,q(Z(j(d,l.price),a),s),{x:p,y:v},g<v?[2,5]:[-2,-5],r)}},e.prototype._drawMark=function(t,e,i,n,o){var r,a,s,l,c,u,h=i.x,d=i.y+n[0];null===(r=this.createFigure({name:"line",attrs:{coordinates:[{x:h-2,y:d+n[0]},{x:h,y:d},{x:h+2,y:d+n[0]}]},styles:{color:o.color}}))||void 0===r||r.draw(t),h>this.getWidget().getBounding().width/2?(c=(l=h-5)-o.textOffset,u="right"):(u="left",c=(l=h+5)+o.textOffset);var p=d+n[1];null===(a=this.createFigure({name:"line",attrs:{coordinates:[{x:h,y:d},{x:h,y:p},{x:l,y:p}]},styles:{color:o.color}}))||void 0===a||a.draw(t),null===(s=this.createFigure({name:"text",attrs:{x:c,y:p,text:e,align:u,baseline:"middle"},styles:{color:o.color,size:o.textSize,family:o.textFamily,weight:o.textWeight}}))||void 0===s||s.draw(t)},e}(di),Di=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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 c=n.getAxisComponent(),u=r.getDataList(),h=u[u.length-1];if(null!=h){var d=h.close,p=h.open,g=c.convertToNicePixel(d),v=void 0;v=d>p?s.upColor:d<p?s.downColor:s.noChangeColor,null===(e=this.createFigure({name:"line",attrs:{coordinates:[{x:0,y:g},{x:o.width,y:g}]},styles:{style:l.style,color:v,size:l.size,dashedValue:l.dashedValue}}))||void 0===e||e.draw(t)}}},e}(ui),Mi={"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 ki=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.drawImp=function(e){var i=this.getWidget(),n=i.getPane(),o=n.getId(),r=n.getChart().getChartStore(),a=r.getTooltipStore().getCrosshair();if(O(a.kLineData)){var s=i.getBounding(),l=n.getYAxisWidget().getBounding(),c=r.getDataList(),u=r.getPrecision(),h=r.getLocale(),d=r.getCustomApi(),p=r.getThousandsSeparator(),g=r.getDecimalFoldThreshold(),v=r.getTooltipStore().getActiveIcon(),f=r.getIndicatorStore().getInstances(n.getId()),y=r.getTimeScaleStore().getDateTimeFormat(),m=r.getStyles(),_=m.candle,x=m.indicator;if(_.tooltip.showType===t.TooltipShowType.Rect&&x.tooltip.showType===t.TooltipShowType.Rect){var S=this.isDrawTooltip(a,_.tooltip),C=this.isDrawTooltip(a,x.tooltip);this._drawRectTooltip(e,c,f,s,l,a,u,y,h,d,p,g,S,C,_.tooltip.offsetTop,m)}else if(_.tooltip.showType===t.TooltipShowType.Standard&&x.tooltip.showType===t.TooltipShowType.Standard){var b=_.tooltip,T=b.offsetLeft,w=b.offsetTop,E=b.offsetRight,I=s.width-E,P=this._drawCandleStandardTooltip(e,c,o,a,v,u,y,h,d,p,g,T,w,I,_);this.drawIndicatorTooltip(e,o,c,a,v,f,d,p,g,T,P,I,x)}else if(_.tooltip.showType===t.TooltipShowType.Rect&&x.tooltip.showType===t.TooltipShowType.Standard){var D=_.tooltip,M=(T=D.offsetLeft,w=D.offsetTop,E=D.offsetRight,I=s.width-E,this.drawIndicatorTooltip(e,o,c,a,v,f,d,p,g,T,w,I,x));S=this.isDrawTooltip(a,_.tooltip);this._drawRectTooltip(e,c,f,s,l,a,u,y,h,d,p,g,S,!1,M,m)}else{var k=_.tooltip,A=(T=k.offsetLeft,w=k.offsetTop,E=k.offsetRight,I=s.width-E,this._drawCandleStandardTooltip(e,c,o,a,v,u,y,h,d,p,g,T,w,I,_));C=this.isDrawTooltip(a,x.tooltip);this._drawRectTooltip(e,c,f,s,l,a,u,y,h,d,p,g,!1,C,A,m)}}},n.prototype._drawCandleStandardTooltip=function(t,e,i,n,o,r,a,s,l,c,u,h,d,p,g){var v,y,m,_=g.tooltip,x=_.text,S=0,C={x:h,y:d};if(this.isDrawTooltip(n,_)){var b=null!==(v=n.dataIndex)&&void 0!==v?v:0,T=this._getCandleTooltipLegends({prev:null!==(y=e[b-1])&&void 0!==y?y:null,current:n.kLineData,next:null!==(m=e[b+1])&&void 0!==m?m:null},r,a,s,l,c,u,g),w=f(this.classifyTooltipIcons(_.icons),3),E=w[0],I=w[1],P=w[2];S=this.drawStandardTooltipIcons(t,o,E,C,i,"",h,S,p),S=this.drawStandardTooltipIcons(t,o,I,C,i,"",h,S,p),T.length>0&&(S=this.drawStandardTooltipLegends(t,T,C,h,S,p,x)),S=this.drawStandardTooltipIcons(t,o,P,C,i,"",h,S,p)}return C.y+S},n.prototype._drawRectTooltip=function(e,i,n,o,r,a,s,c,u,h,d,p,g,v,f,y){var m,_,x,S,C,b=this,T=y.candle,w=y.indicator,E=T.tooltip,I=w.tooltip;if(g||v){var P=null!==(m=a.dataIndex)&&void 0!==m?m:0,D=this._getCandleTooltipLegends({prev:null!==(_=i[P-1])&&void 0!==_?_:null,current:a.kLineData,next:null!==(x=i[P+1])&&void 0!==x?x:null},s,c,u,h,d,p,T),M=E.offsetLeft,k=E.offsetTop,A=E.offsetRight,L=E.offsetBottom,F=E.text,N=F.marginLeft,R=F.marginRight,B=F.marginTop,O=F.marginBottom,V=F.size,W=F.weight,z=F.family,H=E.rect,Y=H.position,X=H.paddingLeft,U=H.paddingRight,G=H.paddingTop,j=H.paddingBottom,K=H.offsetLeft,Z=H.offsetRight,q=H.offsetTop,$=H.offsetBottom,J=H.borderSize,tt=H.borderRadius,et=H.borderColor,it=H.color,nt=0,ot=0,rt=0;g&&(e.font=Q(V,W,z),D.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+N+R;nt=Math.max(nt,r)})),rt+=(O+B+V)*D.length);var at=I.text,st=at.marginLeft,lt=at.marginRight,ct=at.marginTop,ut=at.marginBottom,ht=at.size,dt=at.weight,pt=at.family,gt=[];if(v&&(e.font=Q(ht,dt,pt),n.forEach((function(t){var n,o=null!==(n=b.getIndicatorTooltipData(i,a,t,h,d,p,w).values)&&void 0!==n?n:[];gt.push(o),o.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+st+lt;nt=Math.max(nt,r),rt+=ct+ut+ht}))}))),0!==(ot+=nt)&&0!==rt){ot+=2*J+X+U,rt+=2*J+G+j;var vt=o.width/2,ft=Y===l.Pointer&&a.paneId===Ie,yt=(null!==(S=a.realX)&&void 0!==S?S:0)>vt,mt=0;if(ft){var _t=a.realX;mt=yt?_t-Z-ot:_t+K}else yt?(mt=K+M,y.yAxis.inside&&y.yAxis.position===t.YAxisPosition.Left&&(mt+=r.width)):(mt=o.width-Z-ot-A,y.yAxis.inside&&y.yAxis.position===t.YAxisPosition.Right&&(mt-=r.width));var xt=f+q;if(ft)(xt=a.y-rt/2)+rt>o.height-$-L&&(xt=o.height-$-rt-L),xt<f+q&&(xt=f+q+k);null===(C=this.createFigure({name:"rect",attrs:{x:mt,y:xt,width:ot,height:rt},styles:{style:t.PolygonType.StrokeFill,color:it,borderColor:et,borderSize:J,borderRadius:tt}}))||void 0===C||C.draw(e);var St=mt+J+X+N,Ct=xt+J+G;if(g&&D.forEach((function(t){var i,n;Ct+=B;var o=t.title;null===(i=b.createFigure({name:"text",attrs:{x:St,y:Ct,text:o.text},styles:{color:o.color,size:V,family:z,weight:W}}))||void 0===i||i.draw(e);var r=t.value;null===(n=b.createFigure({name:"text",attrs:{x:mt+ot-J-R-U,y:Ct,text:r.text,align:"right"},styles:{color:r.color,size:V,family:z,weight:W}}))||void 0===n||n.draw(e),Ct+=V+O})),v){var bt=mt+J+X+st;gt.forEach((function(t){t.forEach((function(t){var i,n;Ct+=ct;var o=t.title,r=t.value;null===(i=b.createFigure({name:"text",attrs:{x:bt,y:Ct,text:o.text},styles:{color:o.color,size:ht,family:pt,weight:dt}}))||void 0===i||i.draw(e),null===(n=b.createFigure({name:"text",attrs:{x:mt+ot-J-lt-U,y:Ct,text:r.text,align:"right"},styles:{color:r.color,size:ht,family:pt,weight:dt}}))||void 0===n||n.draw(e),Ct+=ht+ut}))}))}}}},n.prototype._getCandleTooltipLegends=function(e,i,n,o,r,a,s,l){var c,u,h,p,g,v=l.tooltip,f=v.text.color,y=e.current,m=null!==(u=null===(c=e.prev)||void 0===c?void 0:c.close)&&void 0!==u?u:y.close,_=y.close-m,x=i.price,S=i.volume,C={"{time}":r.formatDate(n,y.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Tooltip),"{open}":q(Z(j(y.open,x),a),s),"{high}":q(Z(j(y.high,x),a),s),"{low}":q(Z(j(y.low,x),a),s),"{close}":q(Z(j(y.close,x),a),s),"{volume}":q(Z(r.formatBigNumber(j(null!==(h=y.volume)&&void 0!==h?h:v.defaultValue,S)),a),s),"{turnover}":q(Z(j(null!==(p=y.turnover)&&void 0!==p?p:v.defaultValue,x),a),s),"{change}":0===m?v.defaultValue:"".concat(Z(j(_/m*100),a),"%")};return(null!==(g=N(v.custom)?v.custom(e,l):v.custom)&&void 0!==g?g:[]).map((function(t){var e,i=t.title,n=t.value,r={text:"",color:""};R(i)?r=d({},i):(r.text=i,r.color=f),r.text=function(t,e){var i,n;return null!==(n=null===(i=Mi[e])||void 0===i?void 0:i[t])&&void 0!==n?n:t}(r.text,o);var a={text:v.defaultValue,color:""};R(n)?a=d({},n):(a.text=n,a.color=f);var s=a.text.match(/{(\S*)}/);if(null!==s&&s.length>1){var c="{".concat(s[1],"}");a.text=a.text.replace(c,null!==(e=C[c])&&void 0!==e?e:v.defaultValue),"{change}"===c&&(a.color=0===_?l.priceMark.last.noChangeColor:_>0?l.priceMark.last.upColor:l.priceMark.last.downColor)}return{title:r,value:a}}))},n}(bi),Ai=function(e){function n(t,i){var n=e.call(this,t,i)||this;return n._candleBarView=new pi(n),n._candleAreaView=new Ii(n),n._candleHighLowPriceView=new Pi(n),n._candleLastPriceLineView=new Di(n),n.addChild(n._candleBarView),n}return i(n,e),n.prototype.updateMainContent=function(e){this.getPane().getChart().getStyles().candle.type!==t.CandleType.Area?(this._candleBarView.draw(e),this._candleHighLowPriceView.draw(e),this._candleAreaView.stopAnimation()):this._candleAreaView.draw(e),this._candleLastPriceLineView.draw(e)},n.prototype.createTooltipView=function(){return new ki(this)},n}(wi),Li=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i,n=this,o=this.getWidget(),r=o.getPane(),a=o.getBounding(),s=r.getAxisComponent(),l=this.getAxisStyles(r.getChart().getStyles());if(l.show){l.axisLine.show&&(null===(e=this.createFigure({name:"line",attrs:this.createAxisLine(a,l),styles:l.axisLine}))||void 0===e||e.draw(t));var c=s.getTicks();if(l.tickLine.show)this.createTickLines(c,a,l).forEach((function(e){var i;null===(i=n.createFigure({name:"line",attrs:e,styles:l.tickLine}))||void 0===i||i.draw(t)}));if(l.tickText.show){var u=this.createTickTexts(c,a,l);null===(i=this.createFigure({name:"text",attrs:u,styles:l.tickText}))||void 0===i||i.draw(t)}}},e}(ui),Fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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}(Li),Ni=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.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,c=l.text;if(s.show&&l.show&&c.show){var u=a.getPrecision(),h=o.getAxisComponent(),p=a.getDataList(),g=a.getVisibleDataList(),v=p[p.length-1];if(O(v)){var f=v.close,y=v.open,m=h.convertToNicePixel(f),_=void 0;_=f>y?l.upColor:f<y?l.downColor:l.noChangeColor;var x=void 0;if(h.getType()===t.YAxisType.Percentage){var S=g[0].data.close;x="".concat(((f-S)/S*100).toFixed(2),"%")}else x=j(f,u.price);x=q(Z(x,a.getThousandsSeparator()),a.getDecimalFoldThreshold());var C=void 0,b=void 0;h.isFromZero()?(C=0,b="left"):(C=r.width,b="right"),null===(i=this.createFigure({name:"text",attrs:{x:C,y:m,text:x,align:b,baseline:"middle"},styles:d(d({},c),{backgroundColor:_})}))||void 0===i||i.draw(e)}}},n}(ui),Ri=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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,c=l.text;if(l.show){var u=n.getAxisComponent(),h=r.getDataList(),p=h.length-1,g=r.getIndicatorStore().getInstances(n.getId()),v=r.getThousandsSeparator(),f=r.getDecimalFoldThreshold();g.forEach((function(i){var n=i.result[p];if(O(n)&&i.visible){var r=i.precision;it(h,i,p,s,(function(s,l){var h,p=n[s.key];if(B(p)){var g=u.convertToNicePixel(p),y=j(p,r);i.shouldFormatBigNumber&&(y=a.formatBigNumber(y)),y=q(Z(y,v),f);var m=void 0,_=void 0;u.isFromZero()?(m=0,_="left"):(m=o.width,_="right"),null===(h=e.createFigure({name:"text",attrs:{x:m,y:g,text:y,align:_,baseline:"middle"},styles:d(d({},c),{backgroundColor:l.color})}))||void 0===h||h.draw(t)}}))}}))}},e}(ui),Bi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!1},e.prototype.drawDefaultFigures=function(t,e,i,n,o,r,a,s,l,c,u,h,d,p){this.drawFigures(t,e,this.getDefaultFigures(e,i,n,o,r,a,s,l,u,h,p),c)},e.prototype.getDefaultFigures=function(t,e,i,n,o,r,a,s,l,c,u){var h,d,p=[];if(t.needDefaultYAxisFigure&&t.id===(null===(h=u.instance)||void 0===h?void 0:h.id)&&u.paneId===this.getWidget().getPane().getId()){var g,v,f=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER;null!==(d=null==c?void 0:c.isFromZero())&&void 0!==d&&d?(g="left",v=0):(g="right",v=i.width),e.forEach((function(e,i){var o=t.points[i];if(B(o.value)){f=Math.min(f,e.y),y=Math.max(y,e.y);var r=q(Z(j(o.value,n.price),a),s);p.push({type:"text",attrs:{x:v,y:e.y,text:r,align:g,baseline:"middle"},ignoreEvent:!0})}})),e.length>1&&p.unshift({type:"rect",attrs:{x:0,y:f,width:i.width,height:y-f},ignoreEvent:!0})}return p},e.prototype.getFigures=function(t,e,i,n,o,r,a,s,l,c,u){var h,d;return null!==(d=null===(h=t.createYAxisFigures)||void 0===h?void 0:h.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:o,thousandsSeparator:r,decimalFoldThreshold:a,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==d?d:[]},e}(Ti),Oi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.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(W(a.paneId)&&this.compare(a,n.getId())&&s.show){var l=this.getDirectionStyles(s),c=l.text;if(l.show&&c.show){var u=n.getAxisComponent(),h=this.getText(a,r,u);t.font=Q(c.size,c.weight,c.family),null===(e=this.createFigure({name:"text",attrs:this.getTextAttrs(h,t.measureText(h).width,a,o,u,c),styles:c}))||void 0===e||e.draw(t)}}},n.prototype.compare=function(t,e){return t.paneId===e},n.prototype.getDirectionStyles=function(t){return t.horizontal},n.prototype.getText=function(e,i,n){var o,r,a=n,s=n.convertFromPixel(e.y);if(a.getType()===t.YAxisType.Percentage){var l=null===(o=i.getVisibleDataList()[0])||void 0===o?void 0:o.data;r="".concat(((s-l.close)/l.close*100).toFixed(2),"%")}else{var c=i.getIndicatorStore().getInstances(e.paneId),u=0,h=!1;a.isInCandle()?u=i.getPrecision().price:c.forEach((function(t){u=Math.max(t.precision,u),h||(h=t.shouldFormatBigNumber)})),r=j(s,u),h&&(r=i.getCustomApi().formatBigNumber(r))}return q(Z(r,i.getThousandsSeparator()),i.getDecimalFoldThreshold())},n.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"}},n}(ui),Vi=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._yAxisView=new Fi(n),n._candleLastPriceLabelView=new Ni(n),n._indicatorLastValueView=new Ri(n),n._overlayYAxisView=new Bi(n),n._crosshairHorizontalLabelView=new Oi(n),n.getContainer().style.cursor="ns-resize",n.addChild(n._overlayYAxisView),n}return i(e,t),e.prototype.getName=function(){return Be},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}(Xe),Wi=function(){function t(t){this._range={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0},this._prevRange={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0},this._ticks=[],this._autoCalcTickFlag=!0,this._parent=t}return t.prototype.getParent=function(){return this._parent},t.prototype.buildTicks=function(t){if(this._autoCalcTickFlag&&(this._range=this.calcRange()),this._prevRange.from!==this._range.from||this._prevRange.to!==this._range.to||t){this._prevRange=this._range;var e=this.optimalTicks(this._calcTicks());return this._ticks=this.createTicks({range:this._range,bounding:this.getSelfBounding(),defaultTicks:e}),!0}return!1},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.setRange=function(t){this._autoCalcTickFlag=!1,this._range=t},t.prototype.getRange=function(){return this._range},t.prototype.setAutoCalcTickFlag=function(t){this._autoCalcTickFlag=t},t.prototype.getAutoCalcTickFlag=function(){return this._autoCalcTickFlag},t.prototype._calcTicks=function(){var t=this._range,e=t.realFrom,i=t.realTo,n=t.realRange,o=[];if(n>=0){var r=f(this._calcTickInterval(n),2),a=r[0],s=r[1],l=vt(Math.ceil(e/a)*a,s),c=vt(Math.floor(i/a)*a,s),u=0,h=l;if(0!==a)for(;h<=c;){var d=h.toFixed(s);o[u]={text:d,coord:0,value:d},++u,h+=a}}return o},t.prototype._calcTickInterval=function(t){var e,i,n,o,r=(e=t/8,i=Math.floor(yt(e)),n=mt(i),e=((o=e/n)<1.5?1:o<2.5?2:o<3.5?3:o<4.5?4:o<5.5?5:o<6.5?6:8)*n,i>=-20?+e.toFixed(i<0?-i:0):e),a=function(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var o=e.indexOf(".");return o<0?0:e.length-1-o}(r);return[r,a]},t}(),zi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.calcRange=function(){var e,i,n,o,r,a=this.getParent(),s=a.getChart(),l=s.getChartStore(),c=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,h=[],d=!1,p=Number.MAX_SAFE_INTEGER,g=Number.MIN_SAFE_INTEGER,v=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),v=Math.min(v,t.precision),B(t.minValue)&&(p=Math.min(p,t.minValue)),B(t.maxValue)&&(g=Math.max(g,t.maxValue)),h.push({figures:null!==(i=t.figures)&&void 0!==i?i:[],result:null!==(n=t.result)&&void 0!==n?n:[]})}));var f=4,y=this.isInCandle();if(y){var m=l.getPrecision().price;f=v!==Number.MAX_SAFE_INTEGER?Math.min(v,m):m}else v!==Number.MAX_SAFE_INTEGER&&(f=v);var _=l.getVisibleDataList(),x=s.getStyles().candle,S=x.type===t.CandleType.Area,C=x.area.value,b=y&&!S||!y&&d;_.forEach((function(t){var e=t.dataIndex,i=t.data;if(O(i)&&(b&&(c=Math.min(c,i.low),u=Math.max(u,i.high)),y&&S)){var n=i[C];B(n)&&(c=Math.min(c,n),u=Math.max(u,n))}h.forEach((function(t){var i,n=t.figures,o=null!==(i=t.result[e])&&void 0!==i?i:{};n.forEach((function(t){var e=o[t.key];B(e)&&(c=Math.min(c,e),u=Math.max(u,e))}))}))})),c!==Number.MAX_SAFE_INTEGER&&u!==Number.MIN_SAFE_INTEGER?(c=Math.min(p,c),u=Math.max(g,u)):(c=0,u=10);var T,w=this.getType();switch(w){case t.YAxisType.Percentage:var E=null===(e=_[0])||void 0===e?void 0:e.data;O(E)&&B(E.close)&&(c=(c-E.close)/E.close*100,u=(u-E.close)/E.close*100),T=Math.pow(10,-2);break;case t.YAxisType.Log:c=yt(c),u=yt(u),T=.05*mt(-f);break;default:T=mt(-f)}if(c===u||Math.abs(c-u)<T){var I=p===c,P=g===u;c=I?c:P?c-8*T:c-4*T,u=P?u:I?u+8*T:u+4*T}var D=null!==(n=null===(i=this.getParent().getYAxisWidget())||void 0===i?void 0:i.getBounding().height)&&void 0!==n?n:0,M=a.getOptions().gap,k=null!==(o=null==M?void 0:M.top)&&void 0!==o?o:.2;k>=1&&(k/=D);var A=null!==(r=null==M?void 0:M.bottom)&&void 0!==r?r:.1;A>=1&&(A/=D);var L,F,N,R=Math.abs(u-c);return c-=R*A,u+=R*k,R=Math.abs(u-c),w===t.YAxisType.Log?(L=mt(c),F=mt(u),N=Math.abs(F-L)):(L=c,F=u,N=R),{from:c,to:u,range:R,realFrom:L,realTo:F,realRange:N}},n.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.getRange(),r=(t-o.from)/o.range;return this.isReverse()?Math.round(r*n):Math.round((1-r)*n)},n.prototype.isInCandle=function(){return this.getParent().getId()===Ie},n.prototype.getType=function(){return this.isInCandle()?this.getParent().getChart().getStyles().yAxis.type:t.YAxisType.Normal},n.prototype.getPosition=function(){return this.getParent().getChart().getStyles().yAxis.position},n.prototype.isReverse=function(){return!!this.isInCandle()&&this.getParent().getChart().getStyles().yAxis.reverse},n.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},n.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(),c=[],u=this.getType(),h=s.getIndicatorStore().getInstances(r.getId()),d=s.getThousandsSeparator(),p=s.getDecimalFoldThreshold(),g=0,v=!1;this.isInCandle()?g=s.getPrecision().price:h.forEach((function(t){g=Math.max(g,t.precision),v||(v=t.shouldFormatBigNumber)}));var f,y=s.getStyles().xAxis.tickText.size;return e.forEach((function(e){var i,n=e.value,r=o._innerConvertToPixel(+n);switch(u){case t.YAxisType.Percentage:i="".concat(j(n,2),"%");break;case t.YAxisType.Log:r=o._innerConvertToPixel(yt(+n)),i=j(n,g);break;default:i=j(n,g),v&&(i=l.formatBigNumber(n))}i=q(Z(i,d),p);var s=B(f);r>y&&r<a-y&&(s&&Math.abs(f-r)>2*y||!s)&&(c.push({text:i,coord:r,value:n}),f=r)})),c},n.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 c=0;this.getTicks().forEach((function(t){c=Math.max(c,J(t.text,o.tickText.size,o.tickText.weight,o.tickText.family))})),l+=o.tickText.marginStart+o.tickText.marginEnd+c}var u=n.crosshair,h=0;if(u.show&&u.horizontal.show&&u.horizontal.text.show){var d=a.getIndicatorStore().getInstances(e.getId()),p=0,g=!1;d.forEach((function(t){p=Math.max(t.precision,p),g||(g=t.shouldFormatBigNumber)}));var v=2;if(this.getType()!==t.YAxisType.Percentage)if(this.isInCandle()){var f=a.getPrecision().price,y=n.indicator.lastValueMark;v=y.show&&y.text.show?Math.max(p,f):f}else v=p;var m=j(this.getRange().to,v);g&&(m=s.formatBigNumber(m)),m=q(m,a.getDecimalFoldThreshold()),h+=u.horizontal.text.paddingLeft+u.horizontal.text.paddingRight+2*u.horizontal.text.borderSize+J(m,u.horizontal.text.size,u.horizontal.text.weight,u.horizontal.text.family)}return Math.max(l,h)},n.prototype.getSelfBounding=function(){return this.getParent().getYAxisWidget().getBounding()},n.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.getRange(),s=a.from,l=a.range,c=(this.isReverse()?e/r:1-e/r)*l+s;switch(this.getType()){case t.YAxisType.Percentage:var u=null===(o=this.getParent().getChart().getChartStore().getVisibleDataList()[0])||void 0===o?void 0:o.data;return O(u)&&B(u.close)?u.close*c/100+u.close:0;case t.YAxisType.Log:return mt(c);default:return c}},n.prototype.convertToRealValue=function(e){var i=e;return this.getType()===t.YAxisType.Log&&(i=mt(e)),i},n.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;O(o)&&B(o.close)&&(n=(e-o.close)/o.close*100);break;case t.YAxisType.Log:n=yt(e);break;default:n=e}return this._innerConvertToPixel(n)},n.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)))},n.extend=function(t){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.createTicks=function(e){return t.createTicks(e)},n}(n);return e},n}(Wi),Hi={default:zi.extend({name:"default",createTicks:function(t){return t.defaultTicks}})};var Yi=function(){function t(t,e,i,n){this._bounding=He(),this._chart=i,this._id=n,this._init(t,e)}return t.prototype._init=function(t,e){this._rootContainer=t,this._container=pt("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.clientHeight&&(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}(),Xi=function(t){function e(e,i,n,o,r){var a=t.call(this,e,i,n,o)||this;a._yAxisWidget=null,a._options={minHeight:30,dragEnabled:!0,gap:{top:.2,bottom:.1},axisOptions:{name:"default",scrollZoomEnabled:!0}};var s=a.getContainer();return a._mainWidget=a.createMainWidget(s),a._yAxisWidget=a.createYAxisWidget(s),a.setOptions(r),a}return i(e,t),e.prototype.setOptions=function(t){var e,i,n,o,r,a=null===(e=t.axisOptions)||void 0===e?void 0:e.name;return(this._options.axisOptions.name!==a&&W(a)||!O(this._axis))&&(this._axis=this.createAxisComponent(null!=a?a:"default")),A(this._options,t),this.getId()===De?(o=this.getMainWidget().getContainer(),r="ew-resize"):(o=this.getYAxisWidget().getContainer(),r="ns-resize"),null===(n=null===(i=t.axisOptions)||void 0===i?void 0:i.scrollZoomEnabled)||void 0===n||n?o.style.cursor=r:o.style.cursor="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;A(this.getBounding(),t);var r={};return O(t.height)&&(r.height=t.height),O(t.top)&&(r.top=t.top),this._mainWidget.setBounding(r),null===(n=this._yAxisWidget)||void 0===n||n.setBounding(r),O(e)&&this._mainWidget.setBounding(e),O(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.destroy=function(){var e;t.prototype.destroy.call(this),this._mainWidget.destroy(),null===(e=this._yAxisWidget)||void 0===e||e.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=pt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=$(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}(Yi),Ui=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Hi[t])&&void 0!==e?e:Hi.default}(null!=t?t:"default");return new e(this)},e.prototype.createMainWidget=function(t){return new wi(t,this)},e.prototype.createYAxisWidget=function(t){return new Vi(t,this)},e}(Xi),Gi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createMainWidget=function(t){return new Ai(t,this)},e}(Ui),ji=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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}(Li),Ki=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.prototype.coordinateToPointValueFlag=function(){return!1},n.prototype.getCompleteOverlays=function(t){return t.getInstances()},n.prototype.getProgressOverlay=function(t){return t.instance},n.prototype.getDefaultFigures=function(e,i,n,o,r,a,s,l,c,u,h){var d,p=[];if(e.needDefaultXAxisFigure&&e.id===(null===(d=h.instance)||void 0===d?void 0:d.id)){var g=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER;i.forEach((function(i,n){g=Math.min(g,i.x),v=Math.max(v,i.x);var o=e.points[n];if(B(o.timestamp)){var s=a.formatDate(r,o.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair);p.push({type:"text",attrs:{x:i.x,y:0,text:s,align:"center"},ignoreEvent:!0})}})),i.length>1&&p.unshift({type:"rect",attrs:{x:g,y:0,width:v-g,height:n.height},ignoreEvent:!0})}return p},n.prototype.getFigures=function(t,e,i,n,o,r,a,s,l,c,u){var h,d;return null!==(d=null===(h=t.createXAxisFigures)||void 0===h?void 0:h.call(t,{overlay:t,coordinates:e,bounding:i,barSpace:n,precision:o,thousandsSeparator:r,decimalFoldThreshold:a,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==d?d:[]},n}(Bi),Zi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.compare=function(t){return O(t.kLineData)&&t.dataIndex===t.realDataIndex},n.prototype.getDirectionStyles=function(t){return t.vertical},n.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)},n.prototype.getTextAttrs=function(t,e,i,n,o,r){var a,s=i.realX,l="center";return s-e/2-r.paddingLeft<0?(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"}},n}(Oi),qi=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._xAxisView=new ji(n),n._overlayXAxisView=new Ki(n),n._crosshairVerticalLabelView=new Zi(n),n.getContainer().style.cursor="ew-resize",n.addChild(n._overlayXAxisView),n}return i(e,t),e.prototype.getName=function(){return Re},e.prototype.updateMain=function(t){this._xAxisView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayXAxisView.draw(t),this._crosshairVerticalLabelView.draw(t)},e}(Xe),$i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.calcRange=function(){var t=this.getParent().getChart().getChartStore().getTimeScaleStore().getVisibleRange(),e=t.from,i=t.to,n=i-1,o=i-e;return{from:e,to:n,range:o,realFrom:e,realTo:n,realRange:o}},n.prototype.optimalTicks=function(e){var i,n,o=this.getParent().getChart(),r=o.getChartStore(),a=r.getCustomApi().formatDate,s=[],l=e.length,c=r.getDataList();if(l>0){var u=r.getTimeScaleStore().getDateTimeFormat(),h=o.getStyles().xAxis.tickText,d=J("00-00 00:00",h.size,h.weight,h.family),p=parseInt(e[0].value,10),g=this.convertToPixel(p),v=1;if(l>1){var f=parseInt(e[1].value,10),y=this.convertToPixel(f),m=Math.abs(y-g);m<d&&(v=Math.ceil(d/m))}for(var _=0;_<l;_+=v){var x=parseInt(e[_].value,10),S=c[x].timestamp,C=a(u,S,"HH:mm",t.FormatDateType.XAxis);if(0!==_){var b=c[parseInt(e[_-v].value,10)].timestamp;C=null!==(i=this._optimalTickLabel(a,u,S,b))&&void 0!==i?i:C}var T=this.convertToPixel(x);s.push({text:C,coord:T,value:S})}if(1===s.length)s[0].text=a(u,s[0].value,"YYYY-MM-DD HH:mm",t.FormatDateType.XAxis);else{var w=s[0].value,E=s[1].value;if(O(s[2])){var I=s[2].text;/^[0-9]{2}-[0-9]{2}$/.test(I)?s[0].text=a(u,w,"MM-DD",t.FormatDateType.XAxis):/^[0-9]{4}-[0-9]{2}$/.test(I)?s[0].text=a(u,w,"YYYY-MM",t.FormatDateType.XAxis):/^[0-9]{4}$/.test(I)&&(s[0].text=a(u,w,"YYYY",t.FormatDateType.XAxis))}else s[0].text=null!==(n=this._optimalTickLabel(a,u,w,E))&&void 0!==n?n:s[0].text}}return s},n.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},n.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)},n.prototype.getSelfBounding=function(){return this.getParent().getMainWidget().getBounding()},n.prototype.convertTimestampFromPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),i=e.coordinateToDataIndex(t);return e.dataIndexToTimestamp(i)},n.prototype.convertTimestampToPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),i=e.timestampToDataIndex(t);return e.dataIndexToCoordinate(i)},n.prototype.convertFromPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().coordinateToDataIndex(t)},n.prototype.convertToPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().dataIndexToCoordinate(t)},n.extend=function(t){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.createTicks=function(e){return t.createTicks(e)},n}(n);return e},n}(Wi),Qi={default:$i.extend({name:"default",createTicks:function(t){return t.defaultTicks}})};var Ji=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Qi[t])&&void 0!==e?e:Qi.default}(t);return new e(this)},e.prototype.createMainWidget=function(t){return new qi(t,this)},e}(Xi);var tn=function(e){function n(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>o&&(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 i(n,e),n.prototype.getName=function(){return Oe},n.prototype.checkEventOn=function(){return!0},n.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},n.prototype._mouseUpEvent=function(){return this._dragFlag=!1,this._mouseLeaveEvent()},n.prototype._pressedTouchMouseMoveEvent=function(e){var i=e.pageY-this._dragStartY,n=this.getPane(),o=n.getTopPane(),r=n.getBottomPane(),a=i<0;if(null!==o&&(null==r?void 0:r.getOptions().dragEnabled)){var s=void 0,l=void 0,c=void 0,u=void 0;a?(s=o,l=r,c=this._topPaneHeight,u=this._bottomPaneHeight):(s=r,l=o,c=this._bottomPaneHeight,u=this._topPaneHeight);var h=s.getOptions().minHeight;if(c>h){var d=Math.max(c-Math.abs(i),h),p=c-d;s.setBounding({height:d}),l.setBounding({height:u+p});var g=n.getChart();g.getChartStore().getActionStore().execute(t.ActionType.OnPaneDrag,{paneId:n.getId()}),g.adjustPaneViewport(!0,!0,!0,!0,!0)}}return!0},n.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},n.prototype._mouseLeaveEvent=function(){return!this._dragFlag&&(this.getContainer().style.background="",!0)},n.prototype.createContainer=function(){return pt("div",{width:"100%",height:"".concat(7,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},n.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")}},n}(Ye),en=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 tn(s.getContainer(),s),s}return i(e,t),e.prototype.setBounding=function(t){return A(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=pt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),s=$(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}(Yi);function nn(){var t;return"undefined"!=typeof window&&(null!==(t=window.navigator.userAgent.toLowerCase().indexOf("firefox"))&&void 0!==t?t:-1)>-1}function on(){return"undefined"!=typeof window&&/iPhone|iPad|iPod/.test(window.navigator.platform)}var rn,an=function(){function t(t,e,i){var n=this;this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},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=!on(),this._onFirefoxOutsideMouseUp=function(t){n._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){n._firesTouchEvents(t)?(++n._tapCount,null!==n._tapTimeoutId&&n._tapCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._tapCoordinate).manhattanDistance<30&&!n._cancelTap&&n._processEvent(n._makeCompatEvent(t),n._handler.doubleTapEvent),n._resetTapTimeout())):(++n._clickCount,null!==n._clickTimeoutId&&n._clickCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._clickCoordinate).manhattanDistance<5&&!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:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._resetTapTimeout=function(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},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(!O(this._handler.mouseWheelHortEvent))return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(!O(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.xOffset,o=i.yOffset,r=i.manhattanDistance;if(this._touchMoveExceededManhattanDistance||!(r<5)){if(!this._touchMoveExceededManhattanDistance){var a=.5*n,s=o>=a&&!this._options.treatVertDragAsPageScroll(),l=a>o&&!this._options.treatHorzDragAsPageScroll();s||l||(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&&(this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._mouseMoveStartCoordinate).manhattanDistance>=5&&(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)this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance<30&&!this._cancelTap&&this._processEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout();else this._cancelTap||(this._processEvent(i,this._handler.tapEvent),O(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),nn())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)this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance<5&&!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;nn()&&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}),on()&&(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;(O(this._handler.pinchStartEvent)||O(this._handler.pinchEvent)||O(this._handler.pinchEndEvent))&&(this._target.addEventListener("touchstart",(function(e){t._checkPinchState(e.touches)}),{passive:!0}),this._target.addEventListener("touchmove",(function(e){if(2===e.touches.length&&null!==t._startPinchMiddleCoordinate&&O(t._handler.pinchEvent)){var i=t._getTouchDistance(e.touches[0],e.touches[1])/t._startPinchDistance;t._handler.pinchEvent(d(d({},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]),O(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,O(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=!on())},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 O(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&&"wheel"!==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;i<t.length;++i)if(t[i].identifier===e)return t[i];return null},t}(),sn=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._prevYAxisRange=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 an(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())!==De&&(null==o?void 0:o.getName())===Ne){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=this._findWidgetByEvent(t).widget,n=this._makeWidgetEvent(t,i);return(null==i?void 0:i.getName())===Ne&&(this._chart.getChartStore().getTimeScaleStore().zoom(e,{x:n.x,y:n.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 Oe:return r.dispatchEvent("mouseDownEvent",a);case Ne:var s=null!==(e=o.getAxisComponent().getRange())&&void 0!==e?e:null;return this._prevYAxisRange=null===s?s:d({},s),this._startScrollCoordinate={x:a.x,y:a.y},this._chart.getChartStore().getTimeScaleStore().startScroll(),r.dispatchEvent("mouseDownEvent",a);case Re:return(l=r.dispatchEvent("mouseDownEvent",a))&&this._chart.updatePane(1),this._xAxisStartScaleCoordinate={x:a.x,y:a.y},this._xAxisStartScaleDistance=a.pageX,l;case Be:var l;(l=r.dispatchEvent("mouseDownEvent",a))&&this._chart.updatePane(1);s=null!==(i=o.getAxisComponent().getRange())&&void 0!==i?i:null;return this._prevYAxisRange=null===s?s:d({},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 Ne:var l=a.dispatchEvent("mouseMoveEvent",s),c=this._chart.getChartStore(),u={x:s.x,y:s.y,paneId:null==r?void 0:r.getId()};return l&&null!==c.getTooltipStore().getActiveIcon()&&(u=void 0,null!==a&&(a.getContainer().style.cursor="pointer")),this._chart.getChartStore().getTooltipStore().setCrosshair(u),l;case Oe:case Re:case Be: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()===Oe)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 c=this._makeWidgetEvent(t,l);switch(l.getName()){case Ne:var u=l.getBounding();if(!(C=l.dispatchEvent("pressedMouseMoveEvent",c))&&null!==this._startScrollCoordinate){var h=s.getAxisComponent();if(null!==this._prevYAxisRange&&!h.getAutoCalcTickFlag()&&h.getScrollZoomEnabled()){var d=this._prevYAxisRange,p=d.from,g=d.to,v=p+(w=(b=d.range)*(T=(null!==(n=null==h?void 0:h.isReverse())&&void 0!==n&&n?this._startScrollCoordinate.y-c.y:c.y-this._startScrollCoordinate.y)/u.height)),f=g+w,y=h.convertToRealValue(v),m=h.convertToRealValue(f);h.setRange({from:v,to:f,range:f-v,realFrom:y,realTo:m,realRange:m-y})}var _=c.x-this._startScrollCoordinate.x;this._chart.getChartStore().getTimeScaleStore().scroll(_)}return this._chart.getChartStore().getTooltipStore().setCrosshair({x:c.x,y:c.y,paneId:null==s?void 0:s.getId()}),C;case Re:if(C=l.dispatchEvent("pressedMouseMoveEvent",c))this._chart.updatePane(1);else{var x=s.getAxisComponent();if(null===(o=null==x?void 0:x.getScrollZoomEnabled())||void 0===o||o){var S=10*((T=this._xAxisStartScaleDistance/c.pageX)-this._xAxisScale);this._xAxisScale=T,this._chart.getChartStore().getTimeScaleStore().zoom(S,null!==(r=this._xAxisStartScaleCoordinate)&&void 0!==r?r:void 0)}}return C;case Be:var C;if(C=l.dispatchEvent("pressedMouseMoveEvent",c))this._chart.updatePane(1);else{h=s.getAxisComponent();if(null!==this._prevYAxisRange&&h.getScrollZoomEnabled()){var b,T,w,E=this._prevYAxisRange,I=(p=E.from,g=E.to,(b=E.range)*(T=c.pageY/this._yAxisStartScaleDistance));v=p-(w=(I-b)/2),f=g+w,y=h.convertToRealValue(v),m=h.convertToRealValue(f);h.setRange({from:v,to:f,range:I,realFrom:y,realTo:m,realRange:m-y}),this._chart.adjustPaneViewport(!1,!0,!0,!0)}}return C}}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 Ne:case Oe:case Re:case Be:i=e.dispatchEvent("mouseUpEvent",n)}i&&this._chart.updatePane(1)}return this._mouseDownWidget=null,this._startScrollCoordinate=null,this._prevYAxisRange=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 Ne:case Re:case Be: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 Ne:var o=this._makeWidgetEvent(t,n);return n.dispatchEvent("mouseDoubleClickEvent",o);case Be: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 Ne: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&&(We(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;Math.sqrt(s*s+l*l)<10?(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 Re:case Be:var c=n.dispatchEvent("mouseDownEvent",o);return c&&this._chart.updatePane(1),c}}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(),c=this._chart.getChartStore(),u=c.getTooltipStore();switch(l){case Ne:if(a.dispatchEvent("pressedMouseMoveEvent",s))return null===(e=s.preventDefault)||void 0===e||e.call(s),u.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._touchCoordinate)null===(i=s.preventDefault)||void 0===i||i.call(s),u.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;c.getTimeScaleStore().scroll(h)}return!0;case Re:case Be: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 Ne: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(o<200&&Math.abs(r)>0){var a=this._chart.getChartStore().getTimeScaleStore(),s=function(){e._flingScrollRequestId=Ve((function(){a.startScroll(),a.scroll(r),r*=.975,Math.abs(r)<1?null!==e._flingScrollRequestId&&(We(e._flingScrollRequestId),e._flingScrollRequestId=null):s()}))};s()}}return!0;case Re:case Be: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()===Ne){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()===Ne){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 c=v(s),u=c.next();!u.done;u=c.next()){var h=f(u.value,2)[1],d=(_=h.getBounding()).top-Math.round((7-l)/2);if(r>=_.left&&r<=_.left+_.width&&a>=d&&a<=d+7)return{pane:h,widget:h.getWidget()}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}var p=this._chart.getAllDrawPanes(),g=null;try{for(var y=v(p),m=y.next();!m.done;m=y.next()){var _,x=m.value;if(r>=(_=x.getBounding()).left&&r<=_.left+_.width&&a>=_.top&&a<=_.top+_.height){g=x;break}}}catch(t){n={error:t}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}var S=null;if(null!==g){if(null===S){var C=g.getMainWidget(),b=C.getBounding();r>=b.left&&r<=b.left+b.width&&a>=b.top&&a<=b.top+b.height&&(S=C)}if(null===S){var T=g.getYAxisWidget();if(null!==T){var w=T.getBounding();r>=w.left&&r<=w.left+w.width&&a>=w.top&&a<=w.top+w.height&&(S=T)}}}return{pane:g,widget:S}},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 d(d({},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}();t.DomPosition=void 0,(rn=t.DomPosition||(t.DomPosition={})).Root="root",rn.Main="main",rn.YAxis="yAxis";var ln=function(){function e(t,e){this._drawPanes=[],this._separatorPanes=new Map,this._initContainer(t),this._chartEvent=new sn(this._chartContainer,this),this._chartStore=new Fe(this,e),this._initPanes(e),this.adjustPaneViewport(!0,!0,!0)}return e.prototype._initContainer=function(t){this._container=t,this._chartContainer=pt("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(Ji,De,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:{};A(s,{id:Ie}),i._candlePane=i._createPane(Gi,Ie,s),(l=null!==(n=t.content)&&void 0!==n?n:[]).forEach((function(t){i.createIndicator(t,!0,s)})),o=!0}break;case"indicator":var l,c;if((l=null!==(r=t.content)&&void 0!==r?r:[]).length>0)l.forEach((function(e){O(c)?i.createIndicator(e,!0,{id:c}):c=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=null,r=null;switch(null==i?void 0:i.position){case"top":var a=this._drawPanes[0];O(a)&&(r=new t(this._chartContainer,a.getContainer(),this,e,null!=i?i:{}),o=0);break;case"bottom":break;default:for(var s=this._drawPanes.length-1;s>-1;s--){var l=this._drawPanes[s],c=this._drawPanes[s-1];if("bottom"===(null==l?void 0:l.getOptions().position)&&"bottom"!==(null==c?void 0:c.getOptions().position)){r=new t(this._chartContainer,l.getContainer(),this,e,null!=i?i:{}),o=s;break}}}if(O(r)||(r=new t(this._chartContainer,null,this,e,null!=i?i:{})),B(o)?(this._drawPanes.splice(o,0,r),n=o):(this._drawPanes.push(r),n=this._drawPanes.length-1),r.getId()!==De){var u=this._drawPanes[n+1];if(O(u)&&u.getId()===De&&(u=this._drawPanes[n+2]),O(u))O(d=this._separatorPanes.get(u))?d.setTopPane(r):(d=new en(this._chartContainer,u.getContainer(),this,"",r,u),this._separatorPanes.set(u,d));var h=this._drawPanes[n-1];if(O(h)&&h.getId()===De&&(h=this._drawPanes[n-2]),O(h)){var d=new en(this._chartContainer,r.getContainer(),this,"",h,r);this._separatorPanes.set(r,d)}}return r},e.prototype._measurePaneHeight=function(){var t,e=this,i=Math.floor(this._container.clientHeight),n=this._chartStore.getStyles().separator.size,o=this._xAxisPane.getAxisComponent().getAutoSize(),r=i-o-this._separatorPanes.size*n;r<0&&(r=0);var a=0;this._drawPanes.forEach((function(t){if(t.getId()!==Ie&&t.getId()!==De){var e=t.getBounding().height,i=t.getOptions().minHeight;e<i&&(e=i),a+e>r?(a=r,e=Math.max(r-a,0)):a+=e,t.setBounding({height:e})}}));var s=r-a;null===(t=this._candlePane)||void 0===t||t.setBounding({height:s}),this._xAxisPane.setBounding({height:o});var l=0;this._drawPanes.forEach((function(t){var i=e._separatorPanes.get(t);O(i)&&(i.setBounding({height:n,top:l}),l+=n),t.setBounding({top:l}),l+=t.getBounding().height}))},e.prototype._measurePaneWidth=function(){var e=this,i=Math.floor(this._container.clientWidth),n=this._chartStore.getStyles(),o=n.yAxis,r=o.position===t.YAxisPosition.Left,a=!o.inside,s=0,l=0,c=0,u=0;this._drawPanes.forEach((function(t){t.getId()!==De&&(l=Math.max(l,t.getAxisComponent().getAutoSize()))})),l>i&&(l=i),a?(s=i-l,r?(c=0,u=l):(c=i-l,u=0)):(s=i,u=0,c=r?0:i-l),this._chartStore.getTimeScaleStore().setTotalBarSpace(s);var h,d={width:i},p={width:s,left:u},g={width:l,left:c},v=n.separator.fill;h=a&&!v?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,g)}))},e.prototype._setPaneOptions=function(t,e){var i,n;if(W(t.id)){var o=this.getDrawPaneById(t.id),r=!1;if(null!==o){var a=e;if(t.id!==Ie&&B(t.height)&&t.height>0){var s=Math.max(null!==(i=t.minHeight)&&void 0!==i?i:o.getOptions().minHeight,0),l=Math.max(s,t.height);o.setBounding({height:l}),a=!0,r=!0}(W(null===(n=t.axisOptions)||void 0===n?void 0:n.name)||O(t.gap))&&(a=!0),o.setOptions(t),a&&this.adjustPaneViewport(r,!0,!0,!0,!0)}}},e.prototype.getDrawPaneById=function(t){if(t===Ie)return this._candlePane;if(t===De)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.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(O(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})),W(e.paneId)&&n.execute(t.ActionType.OnCrosshairChange,d(d({},e),{indicatorData:o}))}},e.prototype.getDom=function(e,i){var n,o;if(!W(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(!O(e))return{width:Math.floor(this._chartContainer.clientWidth),height:Math.floor(this._chartContainer.clientHeight),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}),O(null===(e=null==(n=W(t)?Le(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.setMaxOffsetLeftDistance=function(t){t<0||this._chartStore.getTimeScaleStore().setMaxOffsetLeftDistance(t)},e.prototype.setMaxOffsetRightDistance=function(t){t<0||this._chartStore.getTimeScaleStore().setMaxOffsetRightDistance(t)},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.addData(t,ct.Init,e).then((function(){})).catch((function(){})).finally((function(){null==i||i()}))},e.prototype.applyMoreData=function(t,e,i){this._chartStore.addData(t,ct.Forward,null==e||e).then((function(){})).catch((function(){})).finally((function(){null==i||i()}))},e.prototype.updateData=function(t,e){this._chartStore.addData(t).then((function(){})).catch((function(){})).finally((function(){null==e||e()}))},e.prototype.loadMore=function(t){this._chartStore.setLoadMoreCallback(t)},e.prototype.setLoadDataCallback=function(t){this._chartStore.setLoadDataCallback(t)},e.prototype.createIndicator=function(t,e,i,n){var o,r=this,a=W(t)?{name:t}:t;if(null===ee(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=dt(Pe));var c=this._createPane(Ui,s,null!=i?i:{}),u=null!==(o=null==i?void 0:i.height)&&void 0!==o?o:100;c.setBounding({height:u}),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=f(t,2),o=e[0],r=e[1];(o||r)&&(n.adjustPaneViewport(!1,r,!0,r),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!==Ie&&!r.hasInstances(t)){var s=this.getDrawPaneById(t),l=this._drawPanes.findIndex((function(e){return e.getId()===t}));if(null!==s){a=!0;var c=this._separatorPanes.get(s);if(O(c)){var u=null==c?void 0:c.getTopPane();try{for(var h=v(this._separatorPanes),d=h.next();!d.done;d=h.next()){var p=d.value;if(p[1].getTopPane().getId()===s.getId()){p[1].setTopPane(u);break}}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}c.destroy(),this._separatorPanes.delete(s)}this._drawPanes.splice(l,1),s.destroy();var g=this._drawPanes[0];O(g)&&g.getId()===De&&(g=this._drawPanes[1]),null===(o=this._separatorPanes.get(g))||void 0===o||o.destroy(),this._separatorPanes.delete(g)}}this.adjustPaneViewport(a,!0,!0,!0,!0)}},e.prototype.createOverlay=function(t,e){var i=[];if(W(t))i=[{name:t}];else if(F(t))i=t.map((function(t){return W(t)?{name:t}:t}));else{i=[t]}var n=!0;O(e)&&null!==this.getDrawPaneById(e)||(e=Ie,n=!1);var o=this._chartStore.getOverlayStore().addInstances(i,e,n);return F(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;O(t)&&(e=W(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=B(e)&&e>0?e:0,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,s=a?t:t*e;n.scroll(s),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.getLastBarRightSideDiffBarCount()-e.getInitialOffsetRightDistance()/i)*i;this.scrollByDistance(n,t)},e.prototype.scrollToDataIndex=function(t,e){var i=this._chartStore.getTimeScaleStore(),n=(i.getLastBarRightSideDiffBarCount()+(this.getDataList().length-1-t))*i.getBarSpace().bar;this.scrollByDistance(n,e)},e.prototype.scrollToTimestamp=function(t,e){var i=gt(this.getDataList(),"timestamp",t);this.scrollToDataIndex(i,e)},e.prototype.zoomAtCoordinate=function(t,e,i){var n=B(i)&&i>0?i:0,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,c=i?a:a*t;o.zoom(c/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=gt(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,n,i)},e.prototype.convertToPixel=function(t,e){var i,n=e.paneId,o=void 0===n?Ie:n,r=e.absolute,a=void 0!==r&&r,s=[];if(o!==De){var l=this.getDrawPaneById(o);if(null!==l){var c=this._chartStore.getTimeScaleStore(),u=l.getBounding(),h=(new Array).concat(t),d=this._xAxisPane.getAxisComponent(),p=l.getAxisComponent();s=h.map((function(t){var e={},i=t.dataIndex;if(B(t.timestamp)&&(i=c.timestampToDataIndex(t.timestamp)),B(i)&&(e.x=null==d?void 0:d.convertToPixel(i)),B(t.value)){var n=null==p?void 0:p.convertToPixel(t.value);e.y=a?u.top+n:n}return e}))}}return F(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?Ie:n,r=e.absolute,a=void 0!==r&&r,s=[];if(o!==De){var l=this.getDrawPaneById(o);if(null!==l){var c=this._chartStore.getTimeScaleStore(),u=l.getBounding(),h=(new Array).concat(t),d=this._xAxisPane.getAxisComponent(),p=l.getAxisComponent();s=h.map((function(t){var e,i,n={};if(B(t.x)){var o=null!==(e=null==d?void 0:d.convertFromPixel(t.x))&&void 0!==e?e:-1;n.dataIndex=o,n.timestamp=null!==(i=c.dataIndexToTimestamp(o))&&void 0!==i?i:void 0}if(B(t.y)){var r=a?t.y-u.top:t.y;n.value=p.convertFromPixel(r)}return n}))}}return F(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=d({},i);o.paneId=null!==(n=o.paneId)&&void 0!==n?n:Ie,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.clientWidth,r=this._chartContainer.clientHeight,a=pt("canvas",{width:"".concat(o,"px"),height:"".concat(r,"px"),boxSizing:"border-box"}),s=a.getContext("2d"),l=$(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 c=null!=t&&t;return this._drawPanes.forEach((function(t){var e=n._separatorPanes.get(t);if(O(e)){var i=e.getBounding();s.drawImage(e.getImage(c),i.left,i.top,i.width,i.height)}var r=t.getBounding();s.drawImage(t.getImage(c),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._separatorPanes.forEach((function(t){t.destroy()})),this._separatorPanes.clear(),this._container.removeChild(this._chartContainer)},e}(),cn=new Map,un=1;var hn={clone:L,merge:A,isString:W,isNumber:B,isValid:O,isObject:R,isArray:F,isFunction:N,isBoolean:V,formatValue:U,formatPrecision:j,formatBigNumber:K,formatDate:G,formatThousands:Z,formatFoldDecimal:q,calcTextWidth:J,getLinearSlopeIntercept:he,getLinearYFromSlopeIntercept:ce,getLinearYFromCoordinates:ue,checkCoordinateOnArc:ai,checkCoordinateOnCircle:Ge,checkCoordinateOnLine:le,checkCoordinateOnPolygon:Ze,checkCoordinateOnRect:Qe,checkCoordinateOnText:ii,drawArc:si,drawCircle:je,drawLine:pe,drawLineBetweenTwoPoints:ge,drawPolygon:qe,drawRect:Je,drawText:ni,drawRectText:ri};t.dispose=function(t){var e,i,n;if(t instanceof ln)n=t.id;else{var o=void 0;n=null!==(e=null==(o=W(t)?document.getElementById(t):t)?void 0:o.getAttribute("k-line-chart-id"))&&void 0!==e?e:null}null!==n&&(null===(i=cn.get(n))||void 0===i||i.destroy(),cn.delete(n))},t.getFigureClass=function(t){var e;return null!==(e=ci[t])&&void 0!==e?e:null},t.getOverlayClass=function(t){var e;return null!==(e=we[t])&&void 0!==e?e:null},t.getSupportedFigures=function(){return Object.keys(ci)},t.getSupportedIndicators=function(){return Object.keys(Jt)},t.getSupportedLocales=function(){return Object.keys(Mi)},t.getSupportedOverlays=function(){return Object.keys(we)},t.init=function(t,e){var i;if(null===(i=W(t)?document.getElementById(t):t))return null;var n=cn.get(i.id);if(O(n))return n;var o="k_line_chart_".concat(un++);return(n=new ln(i,e)).id=o,i.setAttribute("k-line-chart-id",o),cn.set(o,n),n},t.registerFigure=function(t){ci[t.name]=se.extend(t)},t.registerIndicator=function(t){Jt[t.name]=ot.extend(t)},t.registerLocale=function(t,e){Mi[t]=d(d({},Mi[t]),e)},t.registerOverlay=function(t){we[t.name]=lt.extend(t)},t.registerStyles=function(t,e){Ae[t]=e},t.registerXAxis=function(t){Qi[t.name]=$i.extend(t)},t.registerYAxis=function(t){Hi[t.name]=zi.extend(t)},t.utils=hn,t.version=function(){return"1.0.0"}}));
|
|
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=function(t,i){return e=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])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n,o,r,a,s,l,u,c=function(){return c=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},c.apply(this,arguments)};function h(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}function d(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 p(t,e){var i,n,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)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 r.label++,{value:s[1],done:!1};case 5:r.label++,n=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}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 g(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 v(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 f(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;o<r;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.LineType=void 0,(n=t.LineType||(t.LineType={})).Dashed="dashed",n.Solid="solid",t.PolygonType=void 0,(o=t.PolygonType||(t.PolygonType={})).Stroke="stroke",o.Fill="fill",o.StrokeFill="stroke_fill",t.TooltipShowRule=void 0,(r=t.TooltipShowRule||(t.TooltipShowRule={})).Always="always",r.FollowCross="follow_cross",r.None="none",t.TooltipShowType=void 0,(a=t.TooltipShowType||(t.TooltipShowType={})).Standard="standard",a.Rect="rect",t.TooltipIconPosition=void 0,(s=t.TooltipIconPosition||(t.TooltipIconPosition={})).Left="left",s.Middle="middle",s.Right="right",t.CandleTooltipRectPosition=void 0,(l=t.CandleTooltipRectPosition||(t.CandleTooltipRectPosition={})).Fixed="fixed",l.Pointer="pointer",t.CandleType=void 0,(u=t.CandleType||(t.CandleType={})).HeikinAshi="heikin_ashi",u.CandleSolid="candle_solid",u.CandleStroke="candle_stroke",u.CandleUpStroke="candle_up_stroke",u.CandleDownStroke="candle_down_stroke",u.Ohlc="ohlc",u.Area="area";var y="#F92855",m="rgba(249, 40, 85, .7)",_="#2DC08E",x="rgba(45, 192, 142, .7)",C="#888888",b="#FFFFFF",T="#1677FF",w="#76808F",S="#DDDDDD";function P(t){return"rgba(22, 119, 255, ".concat(t,")")}function E(){function e(){return{show:!0,size:1,color:"#EDEDED",style:t.LineType.Dashed,dashedValue:[2,2]}}return{show:!0,horizontal:e(),vertical:e()}}function I(){return{show:!0,size:"auto",axisLine:{show:!0,color:S,size:1},tickText:{show:!0,color:w,size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:6},tickLine:{show:!0,size:1,length:3,color:S}}}function k(){function e(){return{show:!0,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,2],size:1,color:w},text:{show:!0,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:w,borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:w}}}return{show:!0,horizontal:e(),vertical:e()}}function M(t,e){if(B(t)||B(e))for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=t[i],o=e[i];B(o)&&B(n)?M(n,o):L(e[i])&&(t[i]=D(e[i]))}}function D(t){if(!B(t))return t;var e=null;for(var i in e=A(t)?[]:{},t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];B(n)?e[i]=D(n):e[i]=n}return e}function A(t){return"[object Array]"===Object.prototype.toString.call(t)}function F(t){return"function"==typeof t}function B(t){return"object"==typeof t&&L(t)}function R(t){return"number"==typeof t&&Number.isFinite(t)}function L(t){return null!=t}function O(t){return"boolean"==typeof t}function W(t){return"string"==typeof t}var z=/\\(\\)?/g,V=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g");function N(t,e,i){if(L(t)){var n=[];e.replace(V,(function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var o=t;return L(e[1])?o=e[2].replace(z,"$1"):L(e[0])&&(o=e[0].trim()),n.push(o),""}));for(var o=t,r=0,a=n.length;L(o)&&r<a;)o=null==o?void 0:o[n[r++]];return L(o)?o:null!=i?i:"--"}return null!=i?i:"--"}function Y(t,e){var i={};return t.formatToParts(new Date(e)).forEach((function(t){var e=t.type,n=t.value;switch(e){case"year":i.YYYY=n;break;case"month":i.MM=n;break;case"day":i.DD=n;break;case"hour":i.HH="24"===n?"00":n;break;case"minute":i.mm=n;break;case"second":i.ss=n}})),i}function H(t,e,i){var n=Y(t,e);return i.replace(/YYYY|MM|DD|HH|mm|ss/g,(function(t){return n[t]}))}function X(t,e){var i=+t;return R(i)?i.toFixed(null!=e?e:2):"".concat(t)}function G(t){var e=+t;if(R(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 K(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)}))}function U(t,e){var i="".concat(t);if(new RegExp("\\.0{"+e+",}[1-9][0-9]*$").test(i)){var n=i.split("."),o=n.length-1,r=n[o],a=/0*/.exec(r);if(L(a)){var s=a[0].length;return n[o]=r.replace(/0*/,"0{".concat(s,"}")),n.join(".")}}return i}var j,Z=null;function q(t){var e,i;return null!==(i=null===(e=t.ownerDocument.defaultView)||void 0===e?void 0:e.devicePixelRatio)&&void 0!==i?i:1}function J(t,e,i){return"".concat(null!=e?e:"normal"," ").concat(null!=t?t:12,"px ").concat(null!=i?i:"Helvetica Neue")}function Q(t,e,i,n){if(!L(Z)){var o=document.createElement("canvas"),r=q(o);(Z=o.getContext("2d")).scale(r,r)}return Z.font=J(e,i,n),Math.round(Z.measureText(t).width)}t.ActionType=void 0,(j=t.ActionType||(t.ActionType={})).OnZoom="onZoom",j.OnScroll="onScroll",j.OnVisibleRangeChange="onVisibleRangeChange",j.OnTooltipIconClick="onTooltipIconClick",j.OnCrosshairChange="onCrosshairChange",j.OnCandleBarClick="onCandleBarClick",j.OnPaneDrag="onPaneDrag";var $,tt,et=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){this._callbacks.indexOf(t)<0&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){if(F(t)){var e=this._callbacks.indexOf(t);e>-1&&this._callbacks.splice(e,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}();function it(t,e,i,n){var o,r=t.result,a=t.figures,s=t.styles,l=N(s,"circles",i.circles),u=l.length,h=N(s,"bars",i.bars),d=h.length,p=N(s,"lines",i.lines),g=p.length,v=0,f=0,y=0,m=0;a.forEach((function(a){var s;switch(a.type){case"circle":m=v;var _=l[v%u];o=c(c({},_),{color:_.noChangeColor}),v++;break;case"bar":m=f;var x=h[f%d];o=c(c({},x),{color:x.noChangeColor}),f++;break;case"line":m=y,o=p[y%g],y++}if(L(a.type)){var C=null===(s=a.styles)||void 0===s?void 0:s.call(a,{data:{prev:r[e-1],current:r[e],next:r[e+1]},indicator:t,defaultStyles:i});n(a,c(c({},o),C),m)}}))}t.IndicatorSeries=void 0,($=t.IndicatorSeries||(t.IndicatorSeries={})).Normal="normal",$.Price="price",$.Volume="volume",function(t){t.Loading="loading",t.Error="error",t.Ready="ready"}(tt||(tt={}));var nt,ot=function(){function e(e){this.precision=4,this.calcParams=[],this.shouldOhlc=!1,this.shouldFormatBigNumber=!1,this.visible=!0,this.zLevel=0,this.series=t.IndicatorSeries.Normal,this.figures=[],this.minValue=null,this.maxValue=null,this.styles=null,this.shouldUpdate=function(t,e){var i=JSON.stringify(t.calcParams)!==JSON.stringify(e.calcParams)||t.figures!==e.figures||t.calc!==e.calc;return{calc:i,draw:i||t.shortName!==e.shortName||t.series!==e.series||t.minValue!==e.minValue||t.maxValue!==e.maxValue||t.precision!==e.precision||t.shouldOhlc!==e.shouldOhlc||t.shouldFormatBigNumber!==e.shouldFormatBigNumber||t.visible!==e.visible||t.zLevel!==e.zLevel||t.extendData!==e.extendData||t.regenerateFigures!==e.regenerateFigures||t.createTooltipDataSource!==e.createTooltipDataSource||t.draw!==e.draw}},this.calc=function(){return[]},this.regenerateFigures=null,this.createTooltipDataSource=null,this.draw=null,this.onDataStateChange=null,this.result=[],this._lockSeriesPrecision=!1,this.override(e),this._lockSeriesPrecision=!1}return e.prototype.override=function(t){var e,i,n=this.result,o=h(this,["result"]);this._prevIndicator=c(c({},D(o)),{result:n});var r=t.name,a=t.shortName,s=t.precision,l=t.styles,u=t.figures,d=t.calcParams,p=h(t,["name","shortName","precision","styles","figures","calcParams"]);W(this.name)||(this.name=null!=r?r:""),this.shortName=null!==(e=null!=a?a:this.shortName)&&void 0!==e?e:this.name,R(s)&&(this.precision=s,this._lockSeriesPrecision=!0),L(l)&&(null!==(i=this.styles)&&void 0!==i||(this.styles={}),M(this.styles,l)),M(this,p),L(d)&&(this.calcParams=d,F(this.regenerateFigures)&&(this.figures=this.regenerateFigures(this.calcParams))),this.figures=null!=u?u:this.figures},e.prototype.setSeriesPrecision=function(t){this._lockSeriesPrecision||(this.precision=t)},e.prototype.shouldUpdateImp=function(){var t=this._prevIndicator.zLevel!==this.zLevel,e=this.shouldUpdate(this._prevIndicator,this);return O(e)?{calc:e,draw:e,sort:t}:c(c({},e),{sort:t})},e.prototype.calcImp=function(t){return d(this,void 0,void 0,(function(){var e;return p(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 n(){return e.call(this,t)||this}return i(n,e),n}(e)},e}();t.OverlayMode=void 0,(nt=t.OverlayMode||(t.OverlayMode={})).Normal="normal",nt.WeakMagnet="weak_magnet",nt.StrongMagnet="strong_magnet";var rt,at="overlay_figure_",st=function(){function e(e){this.groupId="",this.totalStep=1,this.currentStep=1,this.lock=!1,this.visible=!0,this.zLevel=0,this.needDefaultPointFigure=!1,this.needDefaultXAxisFigure=!1,this.needDefaultYAxisFigure=!1,this.mode=t.OverlayMode.Normal,this.modeSensitivity=8,this.points=[],this.extendData=null,this.styles=null,this.createPointFigures=null,this.createXAxisFigures=null,this.createYAxisFigures=null,this.performEventPressedMove=null,this.performEventMoveForDrawing=null,this.onDrawStart=null,this.onDrawing=null,this.onDrawEnd=null,this.onClick=null,this.onDoubleClick=null,this.onRightClick=null,this.onPressedMoveStart=null,this.onPressedMoving=null,this.onPressedMoveEnd=null,this.onMouseEnter=null,this.onMouseLeave=null,this.onRemoved=null,this.onSelected=null,this.onDeselected=null,this._prevPressedPoint=null,this._prevPressedPoints=[],this.override(e)}return e.prototype.override=function(t){var e,i;this._prevOverlay=D(this);var n=t.id,o=t.name;t.currentStep;var r=t.points,a=t.styles;if(M(this,h(t,["id","name","currentStep","points","styles"])),W(this.name)||(this.name=null!=o?o:""),!W(this.id)&&W(n)&&(this.id=n),L(a)&&(null!==(e=this.styles)&&void 0!==e||(this.styles={}),M(this.styles,a)),A(r)&&r.length>0){var s=0;if(this.points=f([],v(r),!1),r.length>=this.totalStep-1?(this.currentStep=-1,s=this.totalStep-1):(this.currentStep=r.length+1,s=r.length),F(this.performEventMoveForDrawing))for(var l=0;l<s;l++)this.performEventMoveForDrawing({currentStep:l+2,mode:this.mode,points:this.points,performPointIndex:l,performPoint:this.points[l]});-1===this.currentStep&&(null===(i=this.performEventPressedMove)||void 0===i||i.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:this.points.length-1,performPoint:this.points[this.points.length-1]}))}},e.prototype.shouldUpdate=function(){var t=this._prevOverlay.zLevel!==this.zLevel;return{sort:t,draw:t||JSON.stringify(this._prevOverlay)!==JSON.stringify(this.points)||this._prevOverlay.visible!==this.visible||this._prevOverlay.extendData!==this.extendData||this._prevOverlay.styles!==this.styles}},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={};R(t.timestamp)&&(n.timestamp=t.timestamp),R(t.dataIndex)&&(n.dataIndex=t.dataIndex),R(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;this.points[e].timestamp=t.timestamp,R(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=c({},t),this._prevPressedPoints=D(this.points)},e.prototype.eventPressedOtherMove=function(t,e){if(null!==this._prevPressedPoint){var i=null;R(t.dataIndex)&&R(this._prevPressedPoint.dataIndex)&&(i=t.dataIndex-this._prevPressedPoint.dataIndex);var n=null;R(t.value)&&R(this._prevPressedPoint.value)&&(n=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map((function(t){var o;R(t.timestamp)&&(t.dataIndex=e.timestampToDataIndex(t.timestamp));var r=c({},t);return R(i)&&R(t.dataIndex)&&(r.dataIndex=t.dataIndex+i,r.timestamp=null!==(o=e.dataIndexToTimestamp(r.dataIndex))&&void 0!==o?o:void 0),R(n)&&R(t.value)&&(r.value=t.value+n),r}))}},e.extend=function(t){return function(e){function n(){return e.call(this,t)||this}return i(n,e),n}(e)},e}();function lt(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return L(t)&&M(e,t),e}t.FormatDateType=void 0,(rt=t.FormatDateType||(t.FormatDateType={}))[rt.Tooltip=0]="Tooltip",rt[rt.Crosshair=1]="Crosshair",rt[rt.XAxis=2]="XAxis";var ut=-1;function ct(t){return F(window.requestAnimationFrame)?window.requestAnimationFrame(t):window.setTimeout(t,20)}function ht(t){F(window.cancelAnimationFrame)?window.cancelAnimationFrame(t):window.clearTimeout(t)}function dt(t){if(F(window.requestIdleCallback))return window.requestIdleCallback(t);var e=performance.now();return window.setTimeout((function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(performance.now()-e))}})}),1)}var pt,gt=function(){function t(t){this._options={duration:500,iterationCount:1},this._currentIterationCount=0,this._running=!1,this._time=0,M(this._options,t)}return t.prototype._loop=function(){var t=this;this._running=!0;var e=function(){var i;if(t._running){var n=(new Date).getTime()-t._time;n<t._options.duration?(null===(i=t._doFrameCallback)||void 0===i||i.call(t,n),ct(e)):(t.stop(),t._currentIterationCount++,t._currentIterationCount<t._options.iterationCount&&t.start())}};ct(e)},t.prototype.doFrame=function(t){return this._doFrameCallback=t,this},t.prototype.setDuration=function(t){return this._options.duration=t,this},t.prototype.setIterationCount=function(t){return this._options.iterationCount=t,this},t.prototype.start=function(){this._running||(this._time=(new Date).getTime(),this._loop())},t.prototype.stop=function(){var t;this._running&&(null===(t=this._doFrameCallback)||void 0===t||t.call(this,this._options.duration)),this._running=!1},t}(),vt=1,ft=(new Date).getTime();function yt(t){var e=(new Date).getTime();return e===ft?++vt:vt=1,ft=e,"".concat(null!=t?t:"").concat(e,"_").concat(vt)}function mt(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 _t(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,a<=2)break}return n}function xt(t,e){e=Math.max(0,null!=e?e:0);var i=Math.pow(10,e);return Math.round(t*i)/i}function Ct(t,e,i){for(var n,o,r=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],a=t.length,s=0;s<a;){var l=t[s];r[0]=Math.max(null!==(n=l[e])&&void 0!==n?n:Number.MIN_SAFE_INTEGER,r[0]),r[1]=Math.min(null!==(o=l[i])&&void 0!==o?o:Number.MAX_SAFE_INTEGER,r[1]),++s}return r}function bt(t){return 0===t?0:Math.log10(t)}function Tt(t){return Math.pow(10,t)}function wt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.join("_")}!function(t){t.Init="init",t.Forward="forward",t.Backward="backward",t.Update="update"}(pt||(pt={}));var St=function(){function t(t){this._requestIdleCallbackId=ut,this._tasks=null!=t?t:[],this._operateTasks()}return t.prototype._operateTasks=function(t){var e,i=this;this._requestIdleCallbackId!==ut&&(e=this._requestIdleCallbackId,F(window.cancelIdleCallback)?window.cancelIdleCallback(e):window.clearTimeout(e),this._requestIdleCallbackId=ut),null==t||t(),this._requestIdleCallbackId=dt((function(t){i._runTasks(t)}))},t.prototype._runTasks=function(t){for(var e=this;t.timeRemaining()>0&&this._tasks.length>0;){var i=this._tasks.shift();null==i||i.handler()}this._tasks.length>0&&(this._requestIdleCallbackId=dt((function(t){e._runTasks(t)})))},t.prototype.addTask=function(t){var e=this;return this._operateTasks((function(){var i=e._tasks.findIndex((function(e){return e.id===t.id}));i>-1?e._tasks[i]=t:e._tasks.push(t)})),this},t.prototype.removeTask=function(t){var e=this;return this._operateTasks((function(){var i=e._tasks.findIndex((function(e){return e.id===t}));i>-1&&e._tasks.splice(i,1)})),this},t}(),Pt=31536e3,Et=2592e3,It=86400,kt=3600,Mt=60,Dt=1;function At(t,e,i,n,o,r){var a;void 0===n&&(n=0);for(var s=null,l=null!=r?r:null,u=0;u<e.length;u++){var c=e[u].timestamp,h=Dt,d=Y(i,c);L(s)&&(h=d.YYYY!==s.YYYY?Pt:d.MM!==s.MM?Et:d.DD!==s.DD?It:d.HH!==s.HH?kt:d.mm!==s.mm?Mt:Dt),R(l)&&R(null==o?void 0:o.value)&&(o.value=Math.min(o.value,c-l));var p=null!==(a=t.get(h))&&void 0!==a?a:[];p.push({dataIndex:u+n,weight:h,timestamp:c}),t.set(h,p),s=d,l=c}}function Ft(t,e){var i=Math.max(Q("0000-00-00 00:00:00",e.size,e.weight,e.family),146);return Math.ceil(i/t)}function Bt(t,e,i){var n=Ft(e,i),o=[];return Array.from(t.keys()).sort((function(t,e){return e-t})).forEach((function(e){var i=t.get(e),r=o;o=[];for(var a=r.length,s=0,l=i.length,u=1/0,c=-1/0,h=0;h<l;h++){for(var d=i[h],p=d.dataIndex;s<a;){var g=r[s],v=g.dataIndex;if(!(v<p)){u=v;break}s++,o.push(g),c=v,u=1/0}u-p>=n&&p-c>=n&&(o.push(d),c=p)}for(;s<a;s++)o.push(r[s])})),o}var Rt={name:"AVP",shortName:"AVP",series:t.IndicatorSeries.Price,precision:2,styles:{lines:[{color:"#A020F0",size:1}]},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=t.turnover)&&void 0!==n?n:0,s=null!==(o=t.volume)&&void 0!==o?o:0;return e+=a,0!==(i+=s)&&(r.avp=e/i),r}))}},Lt={name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(e){var i,n,o=e.data,r=e.indicator,a=e.defaultStyles,s=o.prev,l=o.current,u=null!==(i=null==s?void 0:s.ao)&&void 0!==i?i:Number.MIN_SAFE_INTEGER,c=null!==(n=null==l?void 0:l.ao)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,h="";return{color:h=c>u?N(r.styles,"bars[0].upColor",a.bars[0].upColor):N(r.styles,"bars[0].downColor",a.bars[0].downColor),style:c>u?t.PolygonType.Stroke:t.PolygonType.Fill,borderColor:h}}}],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=(e.low+e.high)/2;if(o+=c,r+=c,l>=i[0]-1){a=o/i[0];var h=t[l-(i[0]-1)];o-=(h.low+h.high)/2}if(l>=i[1]-1){s=r/i[1];h=t[l-(i[1]-1)];r-=(h.low+h.high)/2}return l>=n-1&&(u.ao=a-s),u}))}};var Ot={name:"BOLL",shortName:"BOLL",series:t.IndicatorSeries.Price,calcParams:[20,2],precision:2,shouldOhlc:!0,styles:{lines:[{color:"#FF6E6E",size:1},{color:"#FFD700",size:1},{color:"#00CD00",size:1}]},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=e.close,s={};if(o+=a,r>=n){s.mid=o/i[0];var l=function(t,e){var i=t.length,n=0;return t.forEach((function(t){var i=t.close-e;n+=i*i})),n=Math.abs(n),Math.sqrt(n/i)}(t.slice(r-n,r+1),s.mid);s.up=s.mid+i[1]*l,s.dn=s.mid-i[1]*l,o-=t[r-n].close}return s}))}},Wt={name:"BBI",shortName:"BBI",series:t.IndicatorSeries.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,styles:{lines:[{color:"#A020F0"}]},figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max.apply(Math,f([],v(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,a>=e-1&&(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}))}},zt={name:"CCI",shortName:"CCI",calcParams:[20],styles:{lines:[{color:"#007FFF",size:1}]},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;var p=(t[a-n].high+t[a-n].low+t[a-n].close)/3;o-=p}return s}))}},Vt={name:"CR",shortName:"CR",calcParams:[26,10,20,40,60],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#FFFF00",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},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,g=[],v=[];return t.forEach((function(e,f){var y,m,_,x,C,b={},T=null!==(y=t[f-1])&&void 0!==y?y:e,w=(T.high+T.close+T.low+T.open)/4,S=Math.max(0,e.high-w),P=Math.max(0,w-e.low);f>=i[0]-1&&(b.cr=0!==P?S/P*100:0,s+=b.cr,u+=b.cr,h+=b.cr,p+=b.cr,f>=i[0]+i[1]-2&&(l.push(s/i[1]),f>=i[0]+i[1]+n-3&&(b.ma1=l[l.length-1-n]),s-=null!==(m=v[f-(i[1]-1)].cr)&&void 0!==m?m:0),f>=i[0]+i[2]-2&&(c.push(u/i[2]),f>=i[0]+i[2]+o-3&&(b.ma2=c[c.length-1-o]),u-=null!==(_=v[f-(i[2]-1)].cr)&&void 0!==_?_:0),f>=i[0]+i[3]-2&&(d.push(h/i[3]),f>=i[0]+i[3]+r-3&&(b.ma3=d[d.length-1-r]),h-=null!==(x=v[f-(i[3]-1)].cr)&&void 0!==x?x:0),f>=i[0]+i[4]-2&&(g.push(p/i[4]),f>=i[0]+i[4]+a-3&&(b.ma4=g[g.length-1-a]),p-=null!==(C=v[f-(i[4]-1)].cr)&&void 0!==C?C:0)),v.push(b)})),v}},Nt={name:"DMA",shortName:"DMA",calcParams:[10,50,10],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},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(l>=i[0]-1&&(d=o/i[0],o-=t[l-(i[0]-1)].close),l>=i[1]-1&&(p=r/i[1],r-=t[l-(i[1]-1)].close),l>=n-1){var g=d-p;c.dma=g,a+=g,l>=n+i[2]-2&&(c.ama=a/i[2],a-=null!==(u=s[l-(i[2]-1)].dma)&&void 0!==u?u:0)}s.push(c)})),s}},Yt={name:"DMI",shortName:"DMI",calcParams:[14,6],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},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,g,v={},f=null!==(p=t[d-1])&&void 0!==p?p:e,y=f.close,m=e.high,_=e.low,x=m-_,C=Math.abs(m-y),b=Math.abs(y-_),T=m-f.high,w=f.low-_,S=Math.max(Math.max(x,C),b),P=T>0&&T>w?T:0,E=w>0&&w>T?w:0;if(n+=S,o+=P,r+=E,d>=i[0]-1){d>i[0]-1?(a=a-a/i[0]+S,s=s-s/i[0]+P,l=l-l/i[0]+E):(a=n,s=o,l=r);var I=0,k=0;0!==a&&(I=100*s/a,k=100*l/a),v.pdi=I,v.mdi=k;var M=0;k+I!==0&&(M=Math.abs(k-I)/(k+I)*100),u+=M,d>=2*i[0]-2&&(c=d>2*i[0]-2?(c*(i[0]-1)+M)/i[0]:u/i[0],v.adx=c,d>=2*i[0]+i[1]-3&&(v.adxr=((null!==(g=h[d-(i[1]-1)].adx)&&void 0!==g?g:0)+c)/2))}h.push(v)})),h}},Ht={name:"EMA",shortName:"EMA",series:t.IndicatorSeries.Price,calcParams:[6,12,20],styles:{lines:[{color:"#FF6E6E",size:1},{color:"#FFD700",size:1},{color:"#00CD00",size:1}]},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){e>=t-1&&(r[i]=e>t-1?(2*s+(t-1)*r[i])/(t+1):o/t,a[n[i].key]=r[i])})),a}))}},Xt={name:"MA",shortName:"MA",series:t.IndicatorSeries.Price,calcParams:[5,10,30,60],precision:2,shouldOhlc:!0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA30: ",type:"line"},{key:"ma4",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,r>=e-1&&(a[n[i].key]=o[i]/e,o[i]-=t[r-(e-1)].close)})),a}))}},Gt={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){var i,n,o=e.data,r=e.indicator,a=e.defaultStyles,s=o.prev,l=o.current,u=null!==(i=null==s?void 0:s.macd)&&void 0!==i?i:Number.MIN_SAFE_INTEGER,c=null!==(n=null==l?void 0:l.macd)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,h="";return h=c>0?N(r.styles,"bars[0].upColor",a.bars[0].upColor):c<0?N(r.styles,"bars[0].downColor",a.bars[0].downColor):N(r.styles,"bars[0].noChangeColor",a.bars[0].noChangeColor),{style:u<c?t.PolygonType.Stroke:t.PolygonType.Fill,color:h,borderColor:h}}}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=Math.max(i[0],i[1]);return t.map((function(t,e){var c={},h=t.close;return n+=h,e>=i[0]-1&&(o=e>i[0]-1?(2*h+(i[0]-1)*o)/(i[0]+1):n/i[0]),e>=i[1]-1&&(r=e>i[1]-1?(2*h+(i[1]-1)*r)/(i[1]+1):n/i[1]),e>=u-1&&(a=o-r,c.dif=a,s+=a,e>=u+i[2]-2&&(l=e>u+i[2]-2?(2*a+l*(i[2]-1))/(i[2]+1):s/i[2],c.macd=2*(a-l),c.dea=l)),c}))}},Kt={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=i,r=[],a=[];return t.map((function(e,i){var s,l={},u=(null!==(s=t[i-1])&&void 0!==s?s:e).close,c=e.close-u;return o.forEach((function(e,o){var s,u,h;if(c>0?r[o]=(null!==(s=r[o])&&void 0!==s?s:0)+c:a[o]=(null!==(u=a[o])&&void 0!==u?u:0)+Math.abs(c),i>=e-1){0!==a[o]?l[n[o].key]=100-100/(1+r[o]/a[o]):l[n[o].key]=0;var d=t[i-(e-1)],p=null!==(h=t[i-e])&&void 0!==h?h:d,g=d.close-p.close;g>0?r[o]-=g:a[o]-=Math.abs(g)}})),l}))}},Ut={name:"SMA",shortName:"SMA",series:t.IndicatorSeries.Price,calcParams:[12,2],precision:2,styles:{lines:[{color:"#A020F0"}]},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,e>=i[0]-1&&(o=e>i[0]-1?(a*i[1]+o*(i[0]-i[1]+1))/(i[0]+1):n/i[0],r.sma=o),r}))}},jt={name:"KDJ",shortName:"KDJ",calcParams:[9,3,3],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},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=Ct(t.slice(o-(i[0]-1),o+1),"high","low"),d=h[0],p=h[1],g=d-p,v=(c-p)/(0===g?1:g)*100;u.k=((i[1]-1)*(null!==(a=null===(r=n[o-1])||void 0===r?void 0:r.k)&&void 0!==a?a:50)+v)/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}},Zt={name:"SAR",shortName:"SAR",series:t.IndicatorSeries.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,styles:{circles:[{upColor:"#FF7F50",downColor:"#A020F0",noChangeColor:"#A8A8A8"}]},figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(t){var e,i,n,o=t.data,r=t.indicator,a=t.defaultStyles,s=o.current;return{color:(null!==(e=null==s?void 0:s.sar)&&void 0!==e?e:Number.MIN_SAFE_INTEGER)<((null!==(i=null==s?void 0:s.high)&&void 0!==i?i:0)+(null!==(n=null==s?void 0:s.low)&&void 0!==n?n:0))/2?N(r.styles,"circles[0].upColor",a.circles[0].upColor):N(r.styles,"circles[0].downColor",a.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||s<h)&&(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 g=Math.max(t[Math.max(1,i)-1].high,h);u<e.high?(u=s,a=0,s=-100,l=!l):u<g&&(u=g)}return{high:h,low:d,sar:u}}))}};function qt(){return{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t){var e=t.data,i=t.indicator,n=t.defaultStyles,o=e.current,r=N(i.styles,"bars[0].noChangeColor",n.bars[0].noChangeColor);return L(o)&&(o.close>o.open?r=N(i.styles,"bars[0].upColor",n.bars[0].upColor):o.close<o.open&&(r=N(i.styles,"bars[0].downColor",n.bars[0].downColor))),{color:r}}}}var Jt={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"},qt()],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(qt()),e},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i,r=[];return t.map((function(e,i){var a,s=null!==(a=e.volume)&&void 0!==a?a:0,l={volume:s,open:e.open,close:e.close};return o.forEach((function(e,o){var a,u;r[o]=(null!==(a=r[o])&&void 0!==a?a:0)+s,i>=e-1&&(l[n[o].key]=r[o]/e,r[o]-=null!==(u=t[i-(e-1)].volume)&&void 0!==u?u:0)})),l}))}},Qt={name:"WR",shortName:"WR",calcParams:[6,10,14],styles:{lines:[{color:"#A020F0",size:1},{color:"#FFD700",size:1},{color:"#FF6E6E",size:1}]},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,o=i;return t.map((function(e,i){var r={},a=e.close;return o.forEach((function(e,o){var s=e-1;if(i>=s){var l=Ct(t.slice(i-s,i+1),"high","low"),u=l[0],c=u-l[1];r[n[o].key]=0===c?0:(a-u)/c*100}})),r}))}},$t={},te=[Rt,Lt,{name:"BIAS",shortName:"BIAS",calcParams:[6,12,24],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#ff0000",size:1}]},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=i,r=[];return t.map((function(e,i){var a={},s=e.close;return o.forEach((function(e,l){var u;if(r[l]=(null!==(u=r[l])&&void 0!==u?u:0)+s,i>=e-1){var c=r[l]/o[l];a[n[l].key]=(s-c)/c*100,r[l]-=t[i-(e-1)].close}})),a}))}},Ot,{name:"BRAR",shortName:"BRAR",calcParams:[26],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},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,g=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(r+=h-p,a+=p-d,n+=h-g,o+=g-d,s>=i[0]-1){c.ar=0!==a?r/a*100:0,c.br=0!==o?n/o*100:0;var v=t[s-(i[0]-1)],f=v.high,y=v.low,m=v.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}))}},Wt,zt,Vt,Nt,Yt,{name:"EMV",shortName:"EMV",calcParams:[14,9],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},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{var p=h/1e8/(u-c);s.emv=d/p}n+=s.emv,o.push(s.emv),r>=i[0]&&(s.maEmv=n/i[0],n-=o[r-i[0]])}return s}))}},Ht,{name:"MTM",shortName:"MTM",calcParams:[12,6],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},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={};if(r>=i[0]){var l=e.close,u=t[r-i[0]].close;s.mtm=l-u,n+=s.mtm,r>=i[0]+i[1]-1&&(s.maMtm=n/i[1],n-=null!==(a=o[r-(i[1]-1)].mtm)&&void 0!==a?a:0)}o.push(s)})),o}},Xt,Gt,{name:"OBV",shortName:"OBV",calcParams:[30],styles:{lines:[{color:"#A020F0",size:1},{color:"#007FFF",size:1}]},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;e.close<h.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,a>=i[0]-1&&(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",styles:{lines:[{color:"#ff0000",size:1}]},figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(t){var e=0;return t.map((function(i,n){var o,r,a={},s=i.close,l=null!==(o=i.volume)&&void 0!==o?o:1,u=(null!==(r=t[n-1])&&void 0!==r?r:i).close,c=0,h=u*l;return 0!==h&&(c=(s-u)/h),e+=c,a.pvt=e,a}))}},{name:"PSY",shortName:"PSY",calcParams:[12,6],styles:{lines:[{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},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,s>=i[0]-1&&(c.psy=n/i[0]*100,o+=c.psy,s>=i[0]+i[1]-2&&(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],styles:{lines:[{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},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=e.close,c=(null!==(a=t[r-i[0]])&&void 0!==a?a:t[r-(i[0]-1)]).close;l.roc=0!==c?(u-c)/c*100:0,o+=l.roc,r>=i[0]-1+i[1]-1&&(l.maRoc=o/i[1],o-=null!==(s=n[r-(i[1]-1)].roc)&&void 0!==s?s:0)}n.push(l)})),n}},Kt,Ut,jt,Zt,{name:"TRIX",shortName:"TRIX",calcParams:[12,9],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"trix",title:"TRIX: ",type:"line"},{key:"maTrix",title:"MATRIX: ",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=[];return t.forEach((function(t,e){var h,d={},p=t.close;if(n+=p,e>=i[0]-1&&(o=e>i[0]-1?(2*p+(i[0]-1)*o)/(i[0]+1):n/i[0],s+=o,e>=2*i[0]-2&&(r=e>2*i[0]-2?(2*o+(i[0]-1)*r)/(i[0]+1):s/i[0],l+=r,e>=3*i[0]-3))){var g=0,v=0;e>3*i[0]-3?v=((g=(2*r+(i[0]-1)*a)/(i[0]+1))-a)/a*100:g=l/i[0],a=g,d.trix=v,u+=v,e>=3*i[0]+i[1]-4&&(d.maTrix=u/i[1],u-=null!==(h=c[e-(i[1]-1)].trix)&&void 0!==h?h:0)}c.push(d)})),c}},Jt,{name:"VR",shortName:"VR",calcParams:[26,6],styles:{lines:[{color:"#FF6E6E",size:2},{color:"#FFD700",size:4}]},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,g={},v=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(v>f?n+=y:v<f?o+=y:r+=y,l>=i[0]-1){var m=r/2;g.vr=o+m===0?0:(n+m)/(o+m)*100,a+=g.vr,l>=i[0]+i[1]-2&&(g.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:_,C=_.close,b=null!==(p=_.volume)&&void 0!==p?p:0;C>x.close?n-=b:C<x.close?o-=b:r-=b}s.push(g)})),s}},Qt];function ee(t){var e;return null!==(e=$t[t])&&void 0!==e?e:null}te.forEach((function(t){$t[t.name]=ot.extend(t)}));var ie={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,i,n=t.chart,o=t.coordinates,r=t.bounding,a=t.overlay,s=t.yAxis,l=a.points;if(o.length>0){var u=0;if(null===(e=null==s?void 0:s.isInCandle())||void 0===e||e)u=n.getPrecision().price;else(null!==(i=n.getIndicators({paneId:a.paneId}).get(a.paneId))&&void 0!==i?i:[]).forEach((function(t){u=Math.max(u,t.precision)}));var c=[],h=[],d=r.width;if(o.length>1&&R(l[0].value)&&R(l[1].value)){var p=o[0].y-o[1].y,g=l[0].value-l[1].value;[1,.786,.618,.5,.382,.236,0].forEach((function(t){var e,i=o[1].y+p*t,r=n.getDecimalFold().format(n.getThousandsSeparator().format(((null!==(e=l[1].value)&&void 0!==e?e:0)+g*t).toFixed(u)));c.push({coordinates:[{x:0,y:i},{x:d,y:i}]}),h.push({x:0,y:i,text:"".concat(r," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})}))}return[{type:"line",attrs:c},{type:"text",isCheckEvent:!1,attrs:h}]}return[]}},ne={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n={x:0,y:e[0].y};return L(e[1])&&e[0].x<e[1].x&&(n.x=i.width),[{type:"line",attrs:{coordinates:[e[0],n]}}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},oe=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!(!L(n)||!this.checkEventOn(e))&&n(e,i)},t.prototype.checkEventOn=function(t){var e,i;try{for(var n=g(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}(),re=function(t){function e(e){var i=t.call(this)||this;return i.attrs=e.attrs,i.styles=e.styles,i}return i(e,t),e.prototype.checkEventOn=function(t){return this.checkEventOnImp(t,this.attrs,this.styles)},e.prototype.setAttrs=function(t){return this.attrs=t,this},e.prototype.setStyles=function(t){return this.styles=t,this},e.prototype.draw=function(t){this.drawImp(t,this.attrs,this.styles)},e.extend=function(t){var n=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.checkEventOnImp=function(e,i,n){return t.checkEventOn(e,i,n)},n.prototype.drawImp=function(e,i,n){t.draw(e,i,n)},n}(e);return n},e}(oe);function ae(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value.coordinates;if(s.length>1)for(var l=1;l<s.length;l++){var u=s[l-1],c=s[l];if(u.x===c.x){if(Math.abs(u.y-t.y)+Math.abs(c.y-t.y)-Math.abs(u.y-c.y)<4&&Math.abs(t.x-u.x)<2)return!0}else{var h=ue(u,c),d=se(h,t),p=Math.abs(d-t.y);if(Math.abs(u.x-t.x)+Math.abs(c.x-t.x)-Math.abs(u.x-c.x)<4&&p*p/(h[0]*h[0]+1)<4)return!0}}}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}function se(t,e){return null!==t?e.x*t[0]+t[1]:e.y}function le(t,e,i){return se(ue(t,e),i)}function ue(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 ce(t,e,i){var n=e.length,o=R(i)?i>0&&i<1?i:0:i?.5:0;if(o>0&&n>2){for(var r=e[0].x,a=e[0].y,s=1;s<n-1;s++){var l=e[s-1],u=e[s],c=e[s+1],h=u.x-l.x,d=u.y-l.y,p=c.x-u.x,g=c.y-u.y,v=c.x-l.x,f=c.y-l.y,y=Math.sqrt(h*h+d*d),m=Math.sqrt(p*p+g*g),_=m/(m+y),x=u.x+v*o*_,C=u.y+f*o*_;x=Math.min(x,Math.max(c.x,u.x)),C=Math.min(C,Math.max(c.y,u.y)),x=Math.max(x,Math.min(c.x,u.x)),C=Math.max(C,Math.min(c.y,u.y)),v=x-u.x,f=C-u.y;var b=u.x-v*y/m,T=u.y-f*y/m;b=Math.min(b,Math.max(l.x,u.x)),T=Math.min(T,Math.max(l.y,u.y)),b=Math.max(b,Math.min(l.x,u.x)),T=Math.max(T,Math.min(l.y,u.y)),v=u.x-b,f=u.y-T,x=u.x+v*m/y,C=u.y+f*m/y,t.bezierCurveTo(r,a,b,T,u.x,u.y),r=x,a=C}var w=e[n-1];t.bezierCurveTo(r,a,w.x,w.y,w.x,w.y)}else for(s=1;s<n;s++)t.lineTo(e[s].x,e[s].y)}var he={name:"line",checkEventOn:ae,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.smooth,l=void 0!==s&&s,u=n.size,c=void 0===u?1:u,h=n.color,d=void 0===h?"currentColor":h,p=n.dashedValue,g=void 0===p?[2,2]:p;e.lineWidth=c,e.strokeStyle=d,a===t.LineType.Dashed?e.setLineDash(g):e.setLineDash([]);var v=c%2==1?.5:0;o.forEach((function(t){var i=t.coordinates;i.length>1&&(2!==i.length||i[0].x!==i[1].x&&i[0].y!==i[1].y?(e.save(),c%2==1&&e.translate(.5,.5),e.beginPath(),e.moveTo(i[0].x,i[0].y),ce(e,i,l),e.stroke(),e.closePath(),e.restore()):(e.beginPath(),i[0].x===i[1].x?(e.moveTo(i[0].x+v,i[0].y),e.lineTo(i[1].x+v,i[1].y)):(e.moveTo(i[0].x,i[0].y+v),e.lineTo(i[1].x,i[1].y+v)),e.stroke(),e.closePath()))}))}(e,i,n)}};function de(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;s<n;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=ue(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;s<n;s++){var g=d+a*(s+1);o.push({coordinates:[{x:0,y:0*h+g},{x:u,y:u*h+g}]})}}}return o}var pe={name:"parallelStraightLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:de(t.coordinates,t.bounding)}]}},ge={name:"priceChannelLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:de(t.coordinates,t.bounding,1)}]}},ve={name:"priceLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,i,n=t.chart,o=t.coordinates,r=t.bounding,a=t.overlay,s=t.yAxis,l=0;null===(e=null==s?void 0:s.isInCandle())||void 0===e||e?l=n.getPrecision().price:(null!==(i=n.getIndicators({paneId:a.paneId}).get(a.paneId))&&void 0!==i?i:[]).forEach((function(t){l=Math.max(l,t.precision)}));var u=a.points[0].value,c=void 0===u?0:u;return[{type:"line",attrs:{coordinates:[o[0],{x:r.width,y:o[0].y}]}},{type:"text",ignoreEvent:!0,attrs:{x:o[0].x,y:o[0].y,text:n.getDecimalFold().format(n.getThousandsSeparator().format(c.toFixed(l))),baseline:"bottom"}}]}};function fe(t,e){if(t.length>1){var i={x:0,y:0};return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[0].y<t[1].y?{x:t[0].x,y:e.height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:le(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:le(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],i]}}return[]}var ye={name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:fe(t.coordinates,t.bounding)}]}},me={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:le(e[0],e[1],{x:0,y:e[0].y})},{x:i.width,y:le(e[0],e[1],{x:i.width,y:e[0].y})}]}}]:[]}},_e={name:"simpleAnnotation",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e,i=t.overlay,n=t.coordinates,o="";L(i.extendData)&&(o=F(i.extendData)?i.extendData(i):null!==(e=i.extendData)&&void 0!==e?e:"");var r=n[0].x,a=n[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:o,align:"center",baseline:"bottom"},ignoreEvent:!0}]}},xe={name:"simpleTag",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e=t.bounding,i=t.coordinates;return{type:"line",attrs:{coordinates:[{x:0,y:i[0].y},{x:e.width,y:i[0].y}]},ignoreEvent:!0}},createYAxisFigures:function(t){var e,i,n=t.chart,o=t.overlay,r=t.coordinates,a=t.bounding,s=t.yAxis,l="left",u=0;null!==(e=null==s?void 0:s.isFromZero())&&void 0!==e&&e?(l="left",u=0):(l="right",u=a.width);var c="";return L(o.extendData)&&(c=F(o.extendData)?o.extendData(o):null!==(i=o.extendData)&&void 0!==i?i:""),!L(c)&&R(o.points[0].value)&&(c=X(o.points[0].value,n.getPrecision().price)),{type:"text",attrs:{x:u,y:r[0].y,text:c,align:l,baseline:"middle"}}}},Ce={};function be(t){var e;return null!==(e=Ce[t])&&void 0!==e?e:null}[ie,ne,{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){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},{name:"horizontalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:i.width,y:e[0].y}]}}]}},pe,ge,ve,ye,{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}}]:[]}},me,{name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;if(2===e.length){var n={x:e[0].x,y:0};return e[0].y<e[1].y&&(n.y=i.height),[{type:"line",attrs:{coordinates:[e[0],n]}}]}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.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.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.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},{name:"verticalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]}},_e,xe].forEach((function(t){Ce[t.name]=st.extend(t)}));var Te={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 we(t){var e;return null!==(e=Te[t])&&void 0!==e?e:null}var Se="candle_pane",Pe="indicator_pane_",Ee="x_axis_pane",Ie=1,ke=50,Me=function(){function e(e,i){var n,o,r,a,s=this;this._styles={grid:E(),candle:(a={show:!0,color:w,textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"},{type:t.CandleType.CandleSolid,bar:{upColor:_,downColor:y,noChangeColor:C,upBorderColor:_,downBorderColor:y,noChangeBorderColor:C,upWickColor:_,downWickColor:y,noChangeWickColor:C},area:{lineSize:2,lineColor:T,smooth:!1,value:"close",backgroundColor:[{offset:0,color:P(.01)},{offset:1,color:P(.2)}],point:{show:!0,color:T,radius:4,rippleColor:P(.3),rippleRadius:8,animation:!0,animationDuration:1e3}},priceMark:{show:!0,high:c({},a),low:c({},a),last:{show:!0,upColor:_,downColor:y,noChangeColor:C,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:b,family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,custom:[{title:"time",value:"{time}"},{title:"open",value:"{open}"},{title:"high",value:"{high}"},{title:"low",value:"{low}"},{title:"close",value:"{close}"},{title:"volume",value:"{volume}"}],defaultValue:"n/a",rect:{position:t.CandleTooltipRectPosition.Fixed,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,offsetLeft:4,offsetTop:4,offsetRight:4,offsetBottom:4,borderRadius:4,borderSize:1,borderColor:"#F2F3F5",color:"#FEFEFE"},text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]},renko:{brick:{size:10}}}),indicator:(r=["#FF9600","#935EBD",T,"#E11D74","#01C5C4"].map((function(e){return{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:e}})),{ohlc:{upColor:x,downColor:m,noChangeColor:C},bars:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:x,downColor:m,noChangeColor:C}],lines:r,circles:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:x,downColor:m,noChangeColor:C}],lastValueMark:{show:!1,text:{show:!1,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderColor:"transparent",borderSize:0,borderDashedValue:[2,2],paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderRadius:2}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}),xAxis:I(),yAxis:I(),separator:{size:1,color:S,fill:!0,activeBackgroundColor:P(.08)},crosshair:k(),overlay:(n=P(.35),o=P(.25),{point:{color:T,borderColor:n,borderSize:1,radius:5,activeColor:T,activeBorderColor:n,activeBorderSize:3,activeRadius:5},line:{style:t.LineType.Solid,smooth:!1,color:T,size:1,dashedValue:[2,2]},rect:{style:t.PolygonType.Fill,color:o,borderColor:T,borderSize:1,borderRadius:0,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},polygon:{style:t.PolygonType.Fill,color:T,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},circle:{style:t.PolygonType.Fill,color:o,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},arc:{style:t.LineType.Solid,color:T,size:1,dashedValue:[2,2]},text:{style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:T,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:T}})},this._customApi={formatDate:function(t,e){return H(s._dateTimeFormat,t,e)},formatBigNumber:G},this._locale="en-US",this._thousandsSeparator={sign:",",format:function(t){return K(t,s._thousandsSeparator.sign)}},this._decimalFold={threshold:3,format:function(t){return U(t,s._decimalFold.threshold)}},this._precision={price:2,volume:0},this._dataList=[],this._loadMoreDataCallback=null,this._loading=!0,this._loadDataMore={forward:!1,backward:!1},this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=10,this._offsetRightDistance=80,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._timeWeightTickMap=new Map,this._timeWeightTickList=[],this._minTimeDifference=Number.MAX_SAFE_INTEGER,this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}],this._crosshair={},this._activeTooltipIcon=null,this._actions=new Map,this._indicators=new Map,this._taskScheduler=new St,this._overlays=new Map,this._progressOverlayInfo=null,this._pressedOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._hoverOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._clickOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._chart=e,this._calcOptimalBarSpace(),this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace;var l=null!=i?i:{},u=l.styles,h=l.locale,d=l.timezone,p=l.customApi,g=l.thousandsSeparator,v=l.decimalFold;L(u)&&this.setStyles(u),W(h)&&this.setLocale(h),this.setTimezone(null!=d?d:""),L(p)&&this.setCustomApi(p),L(g)&&this.setThousandsSeparator(g),L(v)&&this.setDecimalFold(v)}return e.prototype.setStyles=function(t){var e,i,n=null;n=W(t)?we(t):t,M(this._styles,n),A(null===(i=null===(e=null==n?void 0:n.candle)||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.custom)&&(this._styles.candle.tooltip.custom=n.candle.tooltip.custom)},e.prototype.getStyles=function(){return this._styles},e.prototype.setCustomApi=function(t){M(this._customApi,t)},e.prototype.getCustomApi=function(){return this._customApi},e.prototype.setLocale=function(t){this._locale=t},e.prototype.getLocale=function(){return this._locale},e.prototype.setTimezone=function(t){if(!L(this._dateTimeFormat)||this.getTimezone()!==t){var e={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"};t.length>0&&(e.timeZone=t);var i=null;try{i=new Intl.DateTimeFormat("en",e)}catch(t){}null!==i&&(this._classifyTimeWeightTicks(this._dataList),this._dateTimeFormat=i)}},e.prototype.getTimezone=function(){return this._dateTimeFormat.resolvedOptions().timeZone},e.prototype.getDateTimeFormat=function(){return this._dateTimeFormat},e.prototype.setThousandsSeparator=function(t){M(this._thousandsSeparator,t)},e.prototype.getThousandsSeparator=function(){return this._thousandsSeparator},e.prototype.setDecimalFold=function(t){M(this._decimalFold,t)},e.prototype.getDecimalFold=function(){return this._decimalFold},e.prototype.getPrecision=function(){return this._precision},e.prototype.setPrecision=function(t){M(this._precision,t),this._synchronizeIndicatorSeriesPrecision()},e.prototype.getDataList=function(){return this._dataList},e.prototype.getVisibleRangeDataList=function(){return this._visibleRangeDataList},e.prototype.getVisibleRangeHighLowPrice=function(){return this._visibleRangeHighLowPrice},e.prototype.addData=function(t,e,i){var n,o,r,a,s=this,l=!1,u=!1,c=0;if(A(t)){switch(c=t.length,e){case pt.Init:this.clearData(),this._dataList=t,this._loadDataMore.backward=null!==(n=null==i?void 0:i.forward)&&void 0!==n&&n,this._loadDataMore.forward=null!==(o=null==i?void 0:i.forward)&&void 0!==o&&o,this._classifyTimeWeightTicks(this._dataList),this.setOffsetRightDistance(this._offsetRightDistance),u=!0;break;case pt.Backward:this._classifyTimeWeightTicks(t,!0),this._dataList=this._dataList.concat(t),this._loadDataMore.backward=null!==(r=null==i?void 0:i.backward)&&void 0!==r&&r,u=c>0;break;case pt.Forward:this._dataList=t.concat(this._dataList),this._classifyTimeWeightTicks(this._dataList),this._loadDataMore.forward=null!==(a=null==i?void 0:i.forward)&&void 0!==a&&a,u=c>0}this._loading=!1,l=!0}else{var h=this._dataList.length,d=t.timestamp,p=N(this._dataList[h-1],"timestamp",0);if(d>p){this._classifyTimeWeightTicks([t],!0),this._dataList.push(t);var g=this.getLastBarRightSideDiffBarCount();g<0&&this.setLastBarRightSideDiffBarCount(--g),c=1,l=!0,u=!0}else d===p&&(this._dataList[h-1]=t,l=!0,u=!0)}l&&(u&&(this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this.getIndicatorsByFilter({}).forEach((function(t,i){t.forEach((function(t){s._addIndicatorCalcTask(i,t,e)}))})),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})))},e.prototype.setLoadMoreDataCallback=function(t){this._loadMoreDataCallback=t},e.prototype._calcOptimalBarSpace=function(){var t=1-.2*Math.atan(Math.max(4,this._barSpace)-4)/(.5*Math.PI),e=Math.min(Math.floor(this._barSpace*t),Math.floor(this._barSpace));e%2==0&&e+2>=this._barSpace&&--e,this._gapBarSpace=Math.max(1,e)},e.prototype._classifyTimeWeightTicks=function(t,e){var i=0,n=null;null!=e&&e?(i=this._dataList.length,n=this._dataList[i-1].timestamp):(this._timeWeightTickMap.clear(),this._minTimeDifference=Number.MAX_SAFE_INTEGER);var o={value:this._minTimeDifference};At(this._timeWeightTickMap,t,this._dateTimeFormat,i,o,n),this._minTimeDifference=o.value,this._timeWeightTickList=Bt(this._timeWeightTickMap,this._barSpace,this._styles.xAxis.tickText)},e.prototype.getTimeWeightTickList=function(){return this._timeWeightTickList},e.prototype._adjustVisibleRange=function(){var e,i,n=this,o=this._dataList.length,r=this._totalBarSpace/this._barSpace,a=0,s=0;1===this._scrollLimitRole?(a=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,s=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(a=this._minVisibleBarCount.left,s=this._minVisibleBarCount.right),a=Math.max(0,a),s=Math.max(0,s);var l=r-Math.min(a,o);this._lastBarRightSideDiffBarCount>l&&(this._lastBarRightSideDiffBarCount=l);var u=-o+Math.min(s,o);this._lastBarRightSideDiffBarCount<u&&(this._lastBarRightSideDiffBarCount=u);var c=Math.round(this._lastBarRightSideDiffBarCount+o+.5),h=c;c>o&&(c=o);var d=Math.round(c-r)-1;d<0&&(d=0);var p=this._lastBarRightSideDiffBarCount>0?Math.round(o+this._lastBarRightSideDiffBarCount-r)-1:d;this._visibleRange={from:d,to:c,realFrom:p,realTo:h},this.executeAction(t.ActionType.OnVisibleRangeChange,this._visibleRange),this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}];for(var g=p;g<h;g++){var v=this._dataList[g],f=this.dataIndexToCoordinate(g);this._visibleRangeDataList.push({dataIndex:g,x:f,data:v}),L(v)&&(this._visibleRangeHighLowPrice[0].price<v.high&&(this._visibleRangeHighLowPrice[0].price=v.high,this._visibleRangeHighLowPrice[0].x=f),this._visibleRangeHighLowPrice[1].price>v.low&&(this._visibleRangeHighLowPrice[1].price=v.low,this._visibleRangeHighLowPrice[1].x=f))}if(!this._loading&&L(this._loadMoreDataCallback)){var y=null;0===d?this._loadDataMore.forward&&(this._loading=!0,y={type:pt.Forward,data:null!==(e=this._dataList[0])&&void 0!==e?e:null,callback:function(t,e){n.addData(t,pt.Forward,{forward:null!=e&&e,backward:null!=e&&e})}}):c===o&&this._loadDataMore.backward&&(this._loading=!0,y={type:pt.Backward,data:null!==(i=this._dataList[o-1])&&void 0!==i?i:null,callback:function(t,e){n.addData(t,pt.Backward,{forward:null!=e&&e,backward:null!=e&&e})}}),L(y)&&this._loadMoreDataCallback(y)}},e.prototype.getBarSpace=function(){return{bar:this._barSpace,halfBar:this._barSpace/2,gapBar:this._gapBarSpace,halfGapBar:Math.floor(this._gapBarSpace/2)}},e.prototype.setBarSpace=function(t,e){t<Ie||t>ke||this._barSpace===t||(this._barSpace=t,this._timeWeightTickList=Bt(this._timeWeightTickMap,this._barSpace,this._styles.xAxis.tickText),this._calcOptimalBarSpace(),null==e||e(),this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}))},e.prototype.setTotalBarSpace=function(t){this._totalBarSpace!==t&&(this._totalBarSpace=t,this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0))},e.prototype.setOffsetRightDistance=function(t,e){return this._offsetRightDistance=1===this._scrollLimitRole?Math.min(this._maxOffsetDistance.right,t):t,this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace,null!=e&&e&&(this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})),this},e.prototype.getInitialOffsetRightDistance=function(){return this._offsetRightDistance},e.prototype.getOffsetRightDistance=function(){return Math.max(0,this._lastBarRightSideDiffBarCount*this._barSpace)},e.prototype.getLastBarRightSideDiffBarCount=function(){return this._lastBarRightSideDiffBarCount},e.prototype.setLastBarRightSideDiffBarCount=function(t){this._lastBarRightSideDiffBarCount=t},e.prototype.setMaxOffsetLeftDistance=function(t){this._scrollLimitRole=1,this._maxOffsetDistance.left=t},e.prototype.setMaxOffsetRightDistance=function(t){this._scrollLimitRole=1,this._maxOffsetDistance.right=t},e.prototype.setLeftMinVisibleBarCount=function(t){this._scrollLimitRole=0,this._minVisibleBarCount.left=t},e.prototype.setRightMinVisibleBarCount=function(t){this._scrollLimitRole=0,this._minVisibleBarCount.right=t},e.prototype.getVisibleRange=function(){return this._visibleRange},e.prototype.startScroll=function(){this._startLastBarRightSideDiffBarCount=this._lastBarRightSideDiffBarCount},e.prototype.scroll=function(e){if(this._scrollEnabled){var i=e/this._barSpace,n=this._lastBarRightSideDiffBarCount*this._barSpace;this._lastBarRightSideDiffBarCount=this._startLastBarRightSideDiffBarCount-i,this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0});var o=Math.round(n-this._lastBarRightSideDiffBarCount*this._barSpace);0!==o&&this.executeAction(t.ActionType.OnScroll,{distance:o})}},e.prototype.getDataByDataIndex=function(t){var e;return null!==(e=this._dataList[t])&&void 0!==e?e:null},e.prototype.coordinateToFloatIndex=function(t){var e=this._dataList.length,i=(this._totalBarSpace-t)/this._barSpace,n=e+this._lastBarRightSideDiffBarCount-i;return Math.round(1e6*n)/1e6},e.prototype.dataIndexToTimestamp=function(t){var e=this._dataList.length;if(0===e)return null;var i=this.getDataByDataIndex(t);if(L(i))return i.timestamp;var n=e-1;return t>n?this._dataList[n].timestamp+this._minTimeDifference*(t-n):t<0?this._dataList[0].timestamp-this._minTimeDifference*Math.abs(t):null},e.prototype.timestampToDataIndex=function(t){var e=this._dataList.length;if(0===e)return 0;var i=e-1,n=this._dataList[i].timestamp;if(t>n)return i+Math.floor((t-n)/this._minTimeDifference);var o=this._dataList[0].timestamp;return t<o?Math.floor((t-o)/this._minTimeDifference):_t(this._dataList,"timestamp",t)},e.prototype.dataIndexToCoordinate=function(t){var e=this._dataList.length+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(e-.5)*this._barSpace+.5)},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){var r=null!=i?i:null;R(null==r?void 0:r.x)||(r={x:null!==(n=this._crosshair.x)&&void 0!==n?n:this._totalBarSpace/2});var a=r.x,s=this.coordinateToFloatIndex(a),l=this._barSpace,u=this._barSpace+e*(this._barSpace/10);this.setBarSpace(u,(function(){o._lastBarRightSideDiffBarCount+=s-o.coordinateToFloatIndex(a)}));var c=this._barSpace/l;1!==c&&this.executeAction(t.ActionType.OnZoom,{scale:c})}},e.prototype.setZoomEnabled=function(t){this._zoomEnabled=t},e.prototype.isZoomEnabled=function(){return this._zoomEnabled},e.prototype.setScrollEnabled=function(t){this._scrollEnabled=t},e.prototype.isScrollEnabled=function(){return this._scrollEnabled},e.prototype.setCrosshair=function(t,e){var i,n=null!=t?t:{},o=0,r=0;r=R(n.x)?(o=this.coordinateToDataIndex(n.x))<0?0:o>this._dataList.length-1?this._dataList.length-1:o:o=this._dataList.length-1;var a=this._dataList[r],s=this.dataIndexToCoordinate(o),l=this._crosshair.x,u=this._crosshair.y,h=this._crosshair.paneId;this._crosshair=c(c({},n),{realX:s,kLineData:a,realDataIndex:o,dataIndex:r,timestamp:null!==(i=this.dataIndexToTimestamp(o))&&void 0!==i?i:void 0}),l===n.x&&u===n.y&&h===n.paneId||(L(a)&&this._chart.crosshairChange(this._crosshair),null!=e&&e||this._chart.updatePane(1))},e.prototype.getCrosshair=function(){return this._crosshair},e.prototype.setActiveTooltipIcon=function(t){this._activeTooltipIcon=null!=t?t:null},e.prototype.getActiveTooltipIcon=function(){return this._activeTooltipIcon},e.prototype.executeAction=function(t,e){var i;null===(i=this._actions.get(t))||void 0===i||i.execute(e)},e.prototype.subscribeAction=function(t,e){var i;this._actions.has(t)||this._actions.set(t,new et),null===(i=this._actions.get(t))||void 0===i||i.subscribe(e)},e.prototype.unsubscribeAction=function(t,e){var i=this._actions.get(t);L(i)&&(i.unsubscribe(e),i.isEmpty()&&this._actions.delete(t))},e.prototype.hasAction=function(t){var e=this._actions.get(t);return L(e)&&!e.isEmpty()},e.prototype._sortIndicators=function(t){var e;W(t)?null===(e=this._indicators.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._indicators.forEach((function(t){t.sort((function(t,e){return t.zLevel-e.zLevel}))}))},e.prototype._addIndicatorCalcTask=function(t,e,i){var n=this;this._taskScheduler.addTask({id:wt(t,e.name),handler:function(){var t;null===(t=e.onDataStateChange)||void 0===t||t.call(e,{state:tt.Loading,type:i,indicator:e}),e.calcImp(n._dataList).then((function(t){var o;t&&(n._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}),null===(o=e.onDataStateChange)||void 0===o||o.call(e,{state:tt.Ready,type:i,indicator:e}))})).catch((function(){var t;null===(t=e.onDataStateChange)||void 0===t||t.call(e,{state:tt.Error,type:i,indicator:e})}))}})},e.prototype.addIndicator=function(t,e,i){var n=t.name,o=this._indicators.get(e);if(L(o)&&L(o.find((function(t){return t.name===n}))))return!1;L(o)||(o=[]);var r=new(ee(n));return this._synchronizeIndicatorSeriesPrecision(r),r.override(t),i||(this.removeIndicator({paneId:e}),o=[]),o.push(r),this._indicators.set(e,o),this._sortIndicators(e),this._addIndicatorCalcTask(e,r,pt.Init),!0},e.prototype.getIndicatorsByPaneId=function(t){var e;return null!==(e=this._indicators.get(t))&&void 0!==e?e:[]},e.prototype.getIndicatorsByFilter=function(t){var e=function(t,e){return t.filter((function(t){return!L(e)||t.name===e}))},i=t.paneId,n=t.name,o=new Map;if(L(i)){var r=this.getIndicatorsByPaneId(i);o.set(i,e(r,n))}else L(n)?this._indicators.forEach((function(t,i){o.set(i,e(t,n))})):this._indicators.forEach((function(t,i){o.set(i,e(t))}));return o},e.prototype.removeIndicator=function(t){var e=this,i=!1;return this.getIndicatorsByFilter(t).forEach((function(t,n){var o=e.getIndicatorsByPaneId(n);t.forEach((function(t){var r=o.findIndex((function(e){return e.name===t.name}));r>-1&&(e._taskScheduler.removeTask(wt(n,t.name)),o.splice(r,1),i=!0)})),0===o.length&&e._indicators.delete(n)})),i},e.prototype.hasIndicators=function(t){return this._indicators.has(t)},e.prototype._synchronizeIndicatorSeriesPrecision=function(e){var i=this._precision,n=i.price,o=i.volume,r=function(e){switch(e.series){case t.IndicatorSeries.Price:e.setSeriesPrecision(n);break;case t.IndicatorSeries.Volume:e.setSeriesPrecision(o)}};L(e)?r(e):this._indicators.forEach((function(t){t.forEach((function(t){r(t)}))}))},e.prototype.overrideIndicator=function(t,e){var i=this,n=t.name,o=new Map;if(L(e)){var r=this._indicators.get(e);L(r)&&o.set(e,r)}else o=this._indicators;var a=!1,s=!1;return o.forEach((function(e,o){var r=e.find((function(t){return t.name===n}));if(L(r)){r.override(t);var l=r.shouldUpdateImp(),u=l.calc,c=l.draw;l.sort&&(s=!0),u?i._addIndicatorCalcTask(o,r,pt.Update):c&&(a=!0)}})),s&&this._sortIndicators(),!!a&&(this._chart.layout({update:!0}),!0)},e.prototype.getOverlaysByFilter=function(t){var e,i,n=t.id,o=t.groupId,r=t.paneId,a=t.name,s=function(t){return t.filter((function(t){return L(n)?t.id===n:L(o)?t.groupId===o&&(!L(a)||t.name===a):!L(a)||t.name===a}))},l=new Map;if(L(r)){var u=this.getOverlaysByPaneId(r);l.set(r,s(u))}else this._overlays.forEach((function(t,e){l.set(e,s(t))}));var c=null===(e=this._progressOverlayInfo)||void 0===e?void 0:e.overlay;if(L(c)){var h=null!==(i=l.get(c.paneId))&&void 0!==i?i:[];h.push(c),l.set(c.paneId,h)}return l},e.prototype.getOverlaysByPaneId=function(t){var e;if(!W(t)){var i=[];return this._overlays.forEach((function(t){i=i.concat(t)})),i}return null!==(e=this._overlays.get(t))&&void 0!==e?e:[]},e.prototype._sortOverlays=function(t){var e;W(t)?null===(e=this._overlays.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._overlays.forEach((function(t){t.sort((function(t,e){return t.zLevel-e.zLevel}))}))},e.prototype.addOverlays=function(t,e){var i=this,n=[],o=t.map((function(t,o){var r,a,s,l,u,c;if(L(t.id)){var h=null;try{for(var d=g(i._overlays),p=d.next();!p.done;p=d.next()){if(L(m=v(p.value,2)[1].find((function(e){return e.id===t.id})))){h=m;break}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(r)throw r.error}}if(L(h))return t.id}var f=be(t.name);if(L(f)){var y=null!==(s=t.id)&&void 0!==s?s:yt("overlay_"),m=new f;t.id=y,null!==(l=t.groupId)&&void 0!==l||(t.groupId=y),m.override(t);var _=m.paneId;return n.includes(_)||n.push(_),m.isDrawing()?i._progressOverlayInfo={paneId:_,overlay:m,appointPaneFlag:e[o]}:(i._overlays.has(_)||i._overlays.set(_,[]),null===(u=i._overlays.get(_))||void 0===u||u.push(m)),m.isStart()&&(null===(c=m.onDrawStart)||void 0===c||c.call(m,{overlay:m,chart:i._chart})),y}return null}));return n.length>0&&(this._sortOverlays(),n.forEach((function(t){i._chart.updatePane(1,t)})),this._chart.updatePane(1,Ee)),o},e.prototype.getProgressOverlayInfo=function(){return this._progressOverlayInfo},e.prototype.progressOverlayComplete=function(){var t;if(null!==this._progressOverlayInfo){var e=this._progressOverlayInfo,i=e.overlay,n=e.paneId;i.isDrawing()||(this._overlays.has(n)||this._overlays.set(n,[]),null===(t=this._overlays.get(n))||void 0===t||t.push(i),this._sortOverlays(n),this._progressOverlayInfo=null)}},e.prototype.updateProgressOverlayInfo=function(t,e){null!==this._progressOverlayInfo&&(O(e)&&e&&(this._progressOverlayInfo.appointPaneFlag=e),this._progressOverlayInfo.paneId=t,this._progressOverlayInfo.overlay.override({paneId:t}))},e.prototype.overrideOverlay=function(t){var e=this,i=!1,n=[];return this.getOverlaysByFilter(t).forEach((function(e,o){e.forEach((function(e){e.override(t);var r=e.shouldUpdate(),a=r.sort,s=r.draw;a&&(i=!0),(a||s)&&(n.includes(o)||n.push(o))}))})),i&&this._sortOverlays(),n.length>0&&(n.forEach((function(t){e._chart.updatePane(1,t)})),this._chart.updatePane(1,Ee),!0)},e.prototype.removeOverlay=function(t){var e=this,i=[];return this.getOverlaysByFilter(t).forEach((function(t,n){var o=e.getOverlaysByPaneId(n);t.forEach((function(t){var r;if(null===(r=t.onRemoved)||void 0===r||r.call(t,{overlay:t,chart:e._chart}),i.includes(n)||i.push(n),t.isDrawing())e._progressOverlayInfo=null;else{var a=o.findIndex((function(e){return e.id===t.id}));a>-1&&o.splice(a,1)}0===o.length&&e._overlays.delete(n)}))})),i.length>0&&(i.forEach((function(t){e._chart.updatePane(1,t)})),this._chart.updatePane(1,Ee),!0)},e.prototype.setPressedOverlayInfo=function(t){this._pressedOverlayInfo=t},e.prototype.getPressedOverlayInfo=function(){return this._pressedOverlayInfo},e.prototype.setHoverOverlayInfo=function(t,e){var i=this._hoverOverlayInfo,n=i.overlay,o=i.figureType,r=i.figureKey,a=i.figureIndex,s=t.overlay;if(((null==n?void 0:n.id)!==(null==s?void 0:s.id)||o!==t.figureType||a!==t.figureIndex)&&(this._hoverOverlayInfo=t,(null==n?void 0:n.id)!==(null==s?void 0:s.id))){var l=!1,u=!1;null!==n&&(u=!0,F(n.onMouseLeave)&&(n.onMouseLeave(c({chart:this._chart,overlay:n,figureKey:r,figureIndex:a},e)),l=!0)),null!==s&&(u=!0,F(s.onMouseEnter)&&(s.onMouseEnter(c({chart:this._chart,overlay:s,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),l=!0)),u&&this._sortOverlays(),l||this._chart.updatePane(1)}},e.prototype.getHoverOverlayInfo=function(){return this._hoverOverlayInfo},e.prototype.setClickOverlayInfo=function(t,e){var i,n,o,r,a=this._clickOverlayInfo,s=a.paneId,l=a.overlay,u=a.figureType,h=a.figureKey,d=a.figureIndex,p=t.overlay;null!==(i=null==p?void 0:p.isDrawing())&&void 0!==i&&i||null===(n=null==p?void 0:p.onClick)||void 0===n||n.call(p,c({chart:this._chart,overlay:p,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),(null==l?void 0:l.id)===(null==p?void 0:p.id)&&u===t.figureType&&d===t.figureIndex||(this._clickOverlayInfo=t,(null==l?void 0:l.id)!==(null==p?void 0:p.id)&&(null===(o=null==l?void 0:l.onDeselected)||void 0===o||o.call(l,c({chart:this._chart,overlay:l,figureKey:h,figureIndex:d},e)),null===(r=null==p?void 0:p.onSelected)||void 0===r||r.call(p,c({chart:this._chart,overlay:p,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),this._chart.updatePane(1,t.paneId),s!==t.paneId&&this._chart.updatePane(1,s),this._chart.updatePane(1,Ee)))},e.prototype.getClickOverlayInfo=function(){return this._clickOverlayInfo},e.prototype.isOverlayEmpty=function(){return 0===this._overlays.size&&null===this._progressOverlayInfo},e.prototype.isOverlayDrawing=function(){var t,e;return null!==(e=null===(t=this._progressOverlayInfo)||void 0===t?void 0:t.overlay.isDrawing())&&void 0!==e&&e},e.prototype.clearData=function(){this._loadDataMore.backward=!1,this._loadDataMore.forward=!1,this._loading=!0,this._dataList=[],this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}],this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._timeWeightTickMap.clear(),this._timeWeightTickList=[],this._crosshair={},this._activeTooltipIcon=null},e.prototype.getChart=function(){return this._chart},e}(),De="main",Ae="xAxis",Fe="yAxis",Be="separator";var Re=function(){function t(t,e){var i=this;this._supportedDevicePixelContentBox=!1,this._width=0,this._height=0,this._pixelWidth=0,this._pixelHeight=0,this._nextPixelWidth=0,this._nextPixelHeight=0,this._requestAnimationId=ut,this._mediaQueryListener=function(){var t=q(i._element);i._nextPixelWidth=Math.round(i._element.clientWidth*t),i._nextPixelHeight=Math.round(i._element.clientHeight*t),i._resetPixelRatio()},this._listener=e,this._element=mt("canvas",t),this._ctx=this._element.getContext("2d"),function(){return d(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var e=new ResizeObserver((function(i){t(i.every((function(t){return"devicePixelContentBoxSize"in t}))),e.disconnect()}));e.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1}))];case 1:return[2,t.sent()]}}))}))}().then((function(t){i._supportedDevicePixelContentBox=t,t?(i._resizeObserver=new ResizeObserver((function(t){var e=t.find((function(t){return t.target===i._element})),n=null==e?void 0:e.devicePixelContentBoxSize[0];L(n)&&(i._nextPixelWidth=n.inlineSize,i._nextPixelHeight=n.blockSize,i._pixelWidth===i._nextPixelWidth&&i._pixelHeight===i._nextPixelHeight||i._resetPixelRatio())})),i._resizeObserver.observe(i._element,{box:"device-pixel-content-box"})):(i._mediaQueryList=window.matchMedia("(resolution: ".concat(q(i._element),"dppx)")),i._mediaQueryList.addListener(i._mediaQueryListener))})).catch((function(t){return!1}))}return t.prototype._resetPixelRatio=function(){var t=this;this._executeListener((function(){var e=t._element.clientWidth,i=t._element.clientHeight;t._width=e,t._height=i,t._pixelWidth=t._nextPixelWidth,t._pixelHeight=t._nextPixelHeight,t._element.width=t._nextPixelWidth,t._element.height=t._nextPixelHeight;var n=t._nextPixelWidth/e,o=t._nextPixelHeight/i;t._ctx.scale(n,o)}))},t.prototype._executeListener=function(t){var e=this;this._requestAnimationId===ut&&(this._requestAnimationId=ct((function(){e._ctx.clearRect(0,0,e._width,e._height),null==t||t(),e._listener(),e._requestAnimationId=ut})))},t.prototype.update=function(t,e){if(this._width!==t||this._height!==e){if(this._element.style.width="".concat(t,"px"),this._element.style.height="".concat(e,"px"),!this._supportedDevicePixelContentBox){var i=q(this._element);this._nextPixelWidth=Math.round(t*i),this._nextPixelHeight=Math.round(e*i),this._resetPixelRatio()}}else this._executeListener()},t.prototype.getElement=function(){return this._element},t.prototype.getContext=function(){return this._ctx},t.prototype.destroy=function(){L(this._resizeObserver)&&this._resizeObserver.unobserve(this._element),L(this._mediaQueryList)&&this._mediaQueryList.removeListener(this._mediaQueryListener)},t}(),Le=function(t){function e(e,i){var n=t.call(this)||this;return n._bounding=lt(),n._pane=i,n._rootContainer=e,n._container=n.createContainer(),e.appendChild(n._container),n}return i(e,t),e.prototype.setBounding=function(t){return M(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}(oe),Oe=function(t){function e(e,i){var n=t.call(this,e,i)||this;n._mainCanvas=new Re({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){n.updateMain(n._mainCanvas.getContext())})),n._overlayCanvas=new Re({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){n.updateOverlay(n._overlayCanvas.getContext())}));var o=n.getContainer();return o.appendChild(n._mainCanvas.getElement()),o.appendChild(n._overlayCanvas.getElement()),n}return i(e,t),e.prototype.createContainer=function(){return mt("div",{margin:"0",padding:"0",position:"absolute",top:"0",overflow:"hidden",boxSizing:"border-box",zIndex:"1"})},e.prototype.updateImp=function(t,e,i){var n=e.width,o=e.height,r=e.left;t.style.left="".concat(r,"px");var a=i,s=t.clientWidth,l=t.clientHeight;switch(n===s&&o===l||(t.style.width="".concat(n,"px"),t.style.height="".concat(o,"px"),a=3),a){case 0:this._mainCanvas.update(n,o);break;case 1:this._overlayCanvas.update(n,o);break;case 3:case 4:this._mainCanvas.update(n,o),this._overlayCanvas.update(n,o)}},e.prototype.destroy=function(){this._mainCanvas.destroy(),this._overlayCanvas.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=q(o);return o.width=i*a,o.height=n*a,r.scale(a,a),r.drawImage(this._mainCanvas.getElement(),0,0,i,n),t&&r.drawImage(this._overlayCanvas.getElement(),0,0,i,n),o},e}(Le);function We(t){return"transparent"===t||"none"===t||/^[rR][gG][Bb][Aa]\(([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\s]*,){3}[\s]*0[\s]*\)$/.test(t)||/^[hH][Ss][Ll][Aa]\(([\s]*(360|3[0-5][0-9]|[012]?[0-9][0-9]?)[\s]*,)([\s]*((100|[0-9][0-9]?)%|0)[\s]*,){2}([\s]*0[\s]*)\)$/.test(t)}function ze(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value,l=s.x,u=s.y,c=s.r,h=t.x-l,d=t.y-u;if(!(h*h+d*d>c*c))return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}var Ve={name:"circle",checkEventOn:ze,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,u=n.borderSize,c=void 0===u?1:u,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v,y=!(a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&We(l));y&&(e.fillStyle=l,o.forEach((function(t){var i=t.x,n=t.y,o=t.r;e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&c>0&&!We(d)&&(e.strokeStyle=d,e.lineWidth=c,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r;(!y||o>c)&&(e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.stroke())})))}(e,i,n)}};function Ne(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){for(var s=a.value,l=!1,u=s.coordinates,c=0,h=u.length-1;c<u.length;h=c++)u[c].y>t.y!=u[h].y>t.y&&t.x<(u[h].x-u[c].x)*(t.y-u[c].y)/(u[h].y-u[c].y)+u[c].x&&(l=!l);if(l)return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}var Ye={name:"polygon",checkEventOn:Ne,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,u=n.borderSize,c=void 0===u?1:u,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v;a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&We(l)||(e.fillStyle=l,o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&c>0&&!We(d)&&(e.strokeStyle=d,e.lineWidth=c,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.stroke()})))}(e,i,n)}};function He(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value,l=s.x,u=s.width;u<4&&(l-=2,u=4);var c=s.y,h=s.height;if(h<4&&(c-=2,h=4),t.x>=l&&t.x<=l+u&&t.y>=c&&t.y<=c+h)return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}function Xe(e,i,n){var o,r=[];r=r.concat(i);var a=n.style,s=void 0===a?t.PolygonType.Fill:a,l=n.color,u=void 0===l?"transparent":l,c=n.borderSize,h=void 0===c?1:c,d=n.borderColor,p=void 0===d?"transparent":d,g=n.borderStyle,v=void 0===g?t.LineType.Solid:g,f=n.borderRadius,y=void 0===f?0:f,m=n.borderDashedValue,_=void 0===m?[2,2]:m,x=null!==(o=e.roundRect)&&void 0!==o?o:e.rect,C=!(s!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(u)&&We(u));if(C&&(e.fillStyle=u,r.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;e.beginPath(),x.call(e,i,n,o,r,y),e.closePath(),e.fill()}))),(s===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&h>0&&!We(p)){e.strokeStyle=p,e.fillStyle=p,e.lineWidth=h,v===t.LineType.Dashed?e.setLineDash(_):e.setLineDash([]);var b=h%2==1?.5:0,T=Math.round(2*b);r.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;o>2*h&&r>2*h?(e.beginPath(),x.call(e,i+b,n+b,o-T,r-T,y),e.closePath(),e.stroke()):C||e.fillRect(i,n,o,r)}))}}var Ge={name:"rect",checkEventOn:He,draw:function(t,e,i){Xe(t,e,i)}};function Ke(t,e){var i=e.size,n=void 0===i?12:i,o=e.paddingLeft,r=void 0===o?0:o,a=e.paddingTop,s=void 0===a?0:a,l=e.paddingRight,u=void 0===l?0:l,c=e.paddingBottom,h=void 0===c?0:c,d=e.weight,p=void 0===d?"normal":d,g=e.family,v=t.x,f=t.y,y=t.text,m=t.align,_=void 0===m?"left":m,x=t.baseline,C=void 0===x?"top":x,b=t.width,T=t.height,w=null!=b?b:r+Q(y,n,p,g)+u,S=null!=T?T:s+n+h,P=0;switch(_){case"left":case"start":P=v;break;case"right":case"end":P=v-w;break;default:P=v-w/2}var E=0;switch(C){case"top":case"hanging":E=f;break;case"bottom":case"ideographic":case"alphabetic":E=f-S;break;default:E=f-S/2}return{x:P,y:E,width:w,height:S}}function Ue(t,e,i){var n,o,r=[];r=r.concat(e);try{for(var a=g(r),s=a.next();!s.done;s=a.next()){var l=Ke(s.value,i),u=l.x,c=l.y,h=l.width,d=l.height;if(t.x>=u&&t.x<=u+h&&t.y>=c&&t.y<=c+d)return!0}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return!1}var je={name:"text",checkEventOn:Ue,draw:function(t,e,i){!function(t,e,i){var n=[];n=n.concat(e);var o=i.color,r=void 0===o?"currentColor":o,a=i.size,s=void 0===a?12:a,l=i.family,u=i.weight,h=i.paddingLeft,d=void 0===h?0:h,p=i.paddingTop,g=void 0===p?0:p,v=i.paddingRight,f=void 0===v?0:v,y=n.map((function(t){return Ke(t,i)}));Xe(t,y,c(c({},i),{color:i.backgroundColor})),t.textAlign="left",t.textBaseline="top",t.font=J(s,u,l),t.fillStyle=r,n.forEach((function(e,i){var n=y[i];t.fillText(e.text,n.x+d,n.y+g,n.width-d-f)}))}(t,e,i)}};function Ze(t,e){var i,n,o,r,a,s,l=[];l=l.concat(e);try{for(var u=g(l),c=u.next();!c.done;c=u.next()){var h=c.value;if(Math.abs((r=h,a=void 0,s=void 0,a=(o=t).x-r.x,s=o.y-r.y,Math.sqrt(a*a+s*s)-h.r))<2){var d=h.r,p=h.startAngle,v=h.endAngle,f=d*Math.cos(p)+h.x,y=d*Math.sin(p)+h.y,m=d*Math.cos(v)+h.x,_=d*Math.sin(v)+h.y;if(t.x<=Math.max(f,m)+2&&t.x>=Math.min(f,m)-2&&t.y<=Math.max(y,_)+2&&t.y>=Math.min(y,_)-2)return!0}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return!1}var qe={name:"arc",checkEventOn:Ze,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.size,l=void 0===s?1:s,u=n.color,c=void 0===u?"currentColor":u,h=n.dashedValue,d=void 0===h?[2,2]:h;e.lineWidth=l,e.strokeStyle=c,a===t.LineType.Dashed?e.setLineDash(d):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r,r=t.startAngle,a=t.endAngle;e.beginPath(),e.arc(i,n,o,r,a),e.stroke(),e.closePath()}))}(e,i,n)}},Je={};[Ve,he,Ye,Ge,je,qe].forEach((function(t){Je[t.name]=re.extend(t)}));var Qe,$e=function(t){function e(e){var i=t.call(this)||this;return i._widget=e,i}return i(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e){var i,n,o=(i=t.name,null!==(n=Je[i])&&void 0!==n?n:null);if(null!==o){var r=new o(t);if(L(e)){for(var a in e)e.hasOwnProperty(a)&&r.registerEvent(a,e[a]);this.addChild(r)}return r}return null},e.prototype.draw=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.clear(),this.drawImp(t,e)},e}(oe),ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i,n=this.getWidget(),o=this.getWidget().getPane(),r=o.getChart(),a=n.getBounding(),s=r.getStyles().grid;if(s.show){t.save(),t.globalCompositeOperation="destination-over";var l=s.horizontal;if(l.show){var u=o.getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:0,y:t.coord},{x:a.width,y:t.coord}]}}));null===(e=this.createFigure({name:"line",attrs:u,styles:l}))||void 0===e||e.draw(t)}var c=s.vertical;if(c.show){u=r.getXAxisPane().getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:a.height}]}}));null===(i=this.createFigure({name:"line",attrs:u,styles:c}))||void 0===i||i.draw(t)}t.restore()}},e}($e),ei=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.eachChildren=function(t){for(var e=this.getWidget().getPane().getChart().getChartStore(),i=e.getVisibleRangeDataList(),n=e.getBarSpace(),o=i.length,r=0;r<o;)t(i[r],n,r),++r},e}($e),ii=function(e){function n(){var i=e.apply(this,f([],v(arguments),!1))||this;return i._heikinAshiCache=new Map,i._boundCandleBarClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().executeAction(t.ActionType.OnCandleBarClick,e),!1}},i}return i(n,e),n.prototype.drawImp=function(e){var i=this,n=this.getWidget().getPane(),o=n.getId()===Se,r=n.getChart().getChartStore(),a=this.getCandleBarOptions();if(null!==a){var s=0,l=0;if(a.type===t.CandleType.Ohlc){var u=r.getBarSpace().gapBar;(s=Math.min(Math.max(Math.round(.2*u),1),8))>2&&s%2==1&&s--,l=Math.floor(l/2)}a.type!==t.CandleType.HeikinAshi&&this._heikinAshiCache.clear();var c=n.getAxisComponent();this.eachChildren((function(n,r){var u=n.data,h=n.x;if(L(u)){var d=u.open,p=u.high,g=u.low,v=u.close,f=a.type,y=a.styles,m=[];v>d?(m[0]=y.upColor,m[1]=y.upBorderColor,m[2]=y.upWickColor):v<d?(m[0]=y.downColor,m[1]=y.downBorderColor,m[2]=y.downWickColor):(m[0]=y.noChangeColor,m[1]=y.noChangeBorderColor,m[2]=y.noChangeWickColor);var _=c.convertToPixel(d),x=c.convertToPixel(v),C=[_,x,c.convertToPixel(p),c.convertToPixel(g)];C.sort((function(t,e){return t-e}));var b=r.gapBar%2==0?1:0,T=[];switch(f){case t.CandleType.CandleSolid:T=i._createSolidBar(h,C,r,m,b);break;case t.CandleType.CandleStroke:T=i._createStrokeBar(h,C,r,m,b);break;case t.CandleType.CandleUpStroke:T=v>d?i._createStrokeBar(h,C,r,m,b):i._createSolidBar(h,C,r,m,b);break;case t.CandleType.CandleDownStroke:T=d>v?i._createStrokeBar(h,C,r,m,b):i._createSolidBar(h,C,r,m,b);break;case t.CandleType.Ohlc:T=[{name:"rect",attrs:[{x:h-l,y:C[0],width:s,height:C[3]-C[0]},{x:h-r.halfGapBar,y:_+s>C[3]?C[3]-s:_,width:r.halfGapBar,height:s},{x:h+l,y:x+s>C[3]?C[3]-s:x,width:r.halfGapBar-l,height:s}],styles:{color:m[0]}}];break;case t.CandleType.HeikinAshi:var w=i._calculateHeikinAshi(n);m=i._getHeikinAshiColors(w.haValues.open,w.haValues.close,d,v,y),T=i._createSolidBar(h,w.priceY,r,m,b)}T.forEach((function(t){var r,a=null;o&&(a={mouseClickEvent:i._boundCandleBarClickEvent(n)}),null===(r=i.createFigure(t,null!=a?a:void 0))||void 0===r||r.draw(e)}))}}))}},n.prototype.getCandleBarOptions=function(){var t=this.getWidget().getPane().getChart().getStyles().candle;return{type:t.type,styles:t.bar}},n.prototype._createSolidBar=function(e,i,n,o,r){return[{name:"rect",attrs:{x:e,y:i[0],width:1,height:i[3]-i[0]},styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar,y:i[1],width:n.gapBar+r,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.StrokeFill,color:o[0],borderColor:o[1]}}]},n.prototype._createStrokeBar=function(e,i,n,o,r){return[{name:"rect",attrs:[{x:e,y:i[0],width:1,height:i[1]-i[0]},{x:e,y:i[2],width:1,height:i[3]-i[2]}],styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar,y:i[1],width:n.gapBar+r,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.Stroke,borderColor:o[1]}}]},n.prototype._calculateHeikinAshi=function(t){var e=t.data,i=t.dataIndex,n=e,o=n.open,r=n.high,a=n.low,s=n.close,l=this._heikinAshiCache.get(i);if(void 0!==l){var u=this.getWidget().getPane().getAxisComponent(),c=[u.convertToPixel(l.open),u.convertToPixel(l.close),u.convertToPixel(l.high),u.convertToPixel(l.low)];return c.sort((function(t,e){return t-e})),{priceY:c,haValues:l}}var h=(o+r+a+s)/4,d=0;if(i>0){var p=this._getHeikinAshiValues(i-1);if(null!==p)d=(p.open+p.close)/2;else{var g=this.getPreviousData(i);d=null!==g?(g.open+g.close)/2:o}}else d=(o+s)/2;var v=Math.max(r,d,h),f=Math.min(a,d,h),y={open:d,high:v,low:f,close:h};this._heikinAshiCache.set(i,y);var m=this.getWidget().getPane().getAxisComponent(),_=[m.convertToPixel(d),m.convertToPixel(h),m.convertToPixel(v),m.convertToPixel(f)];return _.sort((function(t,e){return t-e})),{priceY:_,haValues:y}},n.prototype._getHeikinAshiValues=function(t){var e=this._heikinAshiCache.get(t);if(void 0!==e)return e;var i=this.getWidget().getPane().getChart().getChartStore().getDataList();if(t<0||t>=i.length)return null;var n=i[t],o=null;t>0&&(o=this._getHeikinAshiValues(t-1));var r=n.open,a=n.high,s=n.low,l=n.close,u=(r+a+s+l)/4,c=0,h={open:c=null!==o?(o.open+o.close)/2:(r+l)/2,high:Math.max(a,c,u),low:Math.min(s,c,u),close:u};return this._heikinAshiCache.set(t,h),h},n.prototype.getPreviousData=function(t){var e=this.getWidget().getPane().getChart().getChartStore().getDataList();return t<=0||t>=e.length?null:t>0&&t<e.length?e[t-1]:null},n.prototype._getHeikinAshiColors=function(t,e,i,n,o){var r=[],a=e-t;return a>1e-6?(r[0]=o.upColor,r[1]=o.upBorderColor,r[2]=o.upWickColor):a<-1e-6?(r[0]=o.downColor,r[1]=o.downBorderColor,r[2]=o.downWickColor):n>i?(r[0]=o.upColor,r[1]=o.upBorderColor,r[2]=o.upWickColor):n<i?(r[0]=o.downColor,r[1]=o.downBorderColor,r[2]=o.downWickColor):(r[0]=o.noChangeColor,r[1]=o.noChangeBorderColor,r[2]=o.noChangeWickColor),r},n}(ei),ni=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.getCandleBarOptions=function(){var e,i,n=this.getWidget().getPane();if(!n.getAxisComponent().isInCandle()){var o=n.getChart().getChartStore(),r=o.getIndicatorsByPaneId(n.getId());try{for(var a=g(r),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.shouldOhlc&&l.visible){var u=l.styles,c=o.getStyles().indicator,h=N(u,"ohlc.upColor",c.ohlc.upColor),d=N(u,"ohlc.downColor",c.ohlc.downColor),p=N(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){e={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}}return null},n.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.getIndicatorsByPaneId(o.getId()),h=u.getStyles().indicator;t.save(),c.forEach((function(e){if(e.visible){e.zLevel<0?t.globalCompositeOperation="destination-over":t.globalCompositeOperation="source-over";var n=!1;if(null!==e.draw&&(t.save(),n=e.draw({ctx:t,chart:r,indicator:e,bounding:a,xAxis:s,yAxis:l}),t.restore()),!n){var o=e.result,u=[];i.eachChildren((function(n,r){var c,d,p,g=r.halfGapBar,v=n.dataIndex,f=n.x,y=s.convertToPixel(v-1),m=s.convertToPixel(v+1),_=null!==(c=o[v-1])&&void 0!==c?c:null,x=null!==(d=o[v])&&void 0!==d?d:null,C=null!==(p=o[v+1])&&void 0!==p?p:null,b={x:y},T={x:f},w={x:m};e.figures.forEach((function(t){var e=t.key,i=null==_?void 0:_[e];R(i)&&(b[e]=l.convertToPixel(i));var n=null==x?void 0:x[e];R(n)&&(T[e]=l.convertToPixel(n));var o=null==C?void 0:C[e];R(o)&&(w[e]=l.convertToPixel(o))})),it(e,v,h,(function(e,n,o){var c,h,d;if(L(null==x?void 0:x[e.key])){var p=T[e.key],v=null===(c=e.attrs)||void 0===c?void 0:c.call(e,{data:{prev:_,current:x,next:C},coordinate:{prev:b,current:T,next:w},bounding:a,barSpace:r,xAxis:s,yAxis:l});if(!L(v))switch(e.type){case"circle":v={x:f,y:p,r:Math.max(1,g)};break;case"rect":case"bar":var y=null!==(h=e.baseValue)&&void 0!==h?h:l.getRange().from,m=l.convertToPixel(y),S=Math.abs(m-p);y!==(null==x?void 0:x[e.key])&&(S=Math.max(1,S));v={x:f-g,y:p>m?m:p,width:Math.max(1,2*g),height:S};break;case"line":L(u[o])||(u[o]=[]),R(T[e.key])&&R(w[e.key])&&u[o].push({coordinates:[{x:T.x,y:T[e.key]},{x:w.x,y:w[e.key]}],styles:n})}var P=e.type;L(v)&&"line"!==P&&(null===(d=i.createFigure({name:"bar"===P?"rect":P,attrs:v,styles:n}))||void 0===d||d.draw(t))}}))})),u.forEach((function(e){var n,o,r,a;if(e.length>1){for(var s=[{coordinates:[e[0].coordinates[0],e[0].coordinates[1]],styles:e[0].styles}],l=1;l<e.length;l++){var u=s[s.length-1],c=e[l],h=u.coordinates[u.coordinates.length-1];h.x===c.coordinates[0].x&&h.y===c.coordinates[0].y&&u.styles.style===c.styles.style&&u.styles.color===c.styles.color&&u.styles.size===c.styles.size&&u.styles.smooth===c.styles.smooth&&(null===(n=u.styles.dashedValue)||void 0===n?void 0:n[0])===(null===(o=c.styles.dashedValue)||void 0===o?void 0:o[0])&&(null===(r=u.styles.dashedValue)||void 0===r?void 0:r[1])===(null===(a=c.styles.dashedValue)||void 0===a?void 0:a[1])?u.coordinates.push(c.coordinates[1]):s.push({coordinates:[c.coordinates[0],c.coordinates[1]],styles:c.styles})}s.forEach((function(e){var n,o=e.coordinates,r=e.styles;null===(n=i.createFigure({name:"line",attrs:{coordinates:o},styles:r}))||void 0===n||n.draw(t)}))}}))}}})),t.restore()},n}(ii),oi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=e.getBounding(),o=e.getPane().getChart().getChartStore(),r=o.getCrosshair(),a=o.getStyles().crosshair;if(W(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({name:"line",attrs:{coordinates:e},styles:o}))||void 0===n||n.draw(t))}},e}($e),ri=function(e){function n(){var i=e.apply(this,f([],v(arguments),!1))||this;return i._boundIconClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().executeAction(t.ActionType.OnTooltipIconClick,c({},e)),!0}},i._boundIconMouseMoveEvent=function(t){return function(){return i.getWidget().getPane().getChart().getChartStore().setActiveTooltipIcon(c({},t)),!0}},i}return i(n,e),n.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane().getChart().getChartStore();if(L(i.getCrosshair().kLineData)){var n=e.getBounding(),o=i.getStyles().indicator.tooltip,r=o.offsetLeft,a=o.offsetTop,s=o.offsetRight;this.drawIndicatorTooltip(t,r,a,n.width-s)}},n.prototype.drawIndicatorTooltip=function(t,e,i,n){var o=this,r=this.getWidget().getPane(),a=r.getChart().getChartStore(),s=a.getStyles().indicator.tooltip;if(this.isDrawTooltip(a.getCrosshair(),s)){var l=a.getIndicatorsByPaneId(r.getId()),u=s.text;l.forEach((function(r){var a=0,l={x:e,y:i},c=o.getIndicatorTooltipData(r),h=c.name,d=c.calcParamsText,p=c.legends,g=c.icons,f=h.length>0,y=p.length>0;if(f||y){var m=v(o.classifyTooltipIcons(g),3),_=m[0],x=m[1],C=m[2];if(a=o.drawStandardTooltipIcons(t,_,l,r.name,e,a,n),f){var b=h;d.length>0&&(b="".concat(b).concat(d)),a=o.drawStandardTooltipLegends(t,[{title:{text:"",color:u.color},value:{text:b,color:u.color}}],l,e,a,n,u)}a=o.drawStandardTooltipIcons(t,x,l,r.name,e,a,n),y&&(a=o.drawStandardTooltipLegends(t,p,l,e,a,n,s.text)),a=o.drawStandardTooltipIcons(t,C,l,r.name,e,a,n),i=l.y+a}}))}return i},n.prototype.drawStandardTooltipIcons=function(t,e,i,n,o,r,a){var s=this;if(e.length>0){var l=0,u=0;e.forEach((function(e){var i=e.marginLeft,n=void 0===i?0:i,o=e.marginTop,r=void 0===o?0:o,a=e.marginRight,s=void 0===a?0:a,c=e.marginBottom,h=void 0===c?0:c,d=e.paddingLeft,p=void 0===d?0:d,g=e.paddingTop,v=void 0===g?0:g,f=e.paddingRight,y=void 0===f?0:f,m=e.paddingBottom,_=void 0===m?0:m,x=e.size,C=e.fontFamily,b=e.icon;t.font=J(x,"normal",C),l+=n+p+t.measureText(b).width+y+s,u=Math.max(u,r+v+x+_+h)})),i.x+l>a?(i.x=o,i.y+=r,r=u):r=Math.max(r,u);var c=this.getWidget().getPane(),h=c.getId(),d=c.getChart().getChartStore().getActiveTooltipIcon();e.forEach((function(e){var o,r=e.marginLeft,a=void 0===r?0:r,l=e.marginTop,u=void 0===l?0:l,c=e.marginRight,p=void 0===c?0:c,g=e.paddingLeft,v=void 0===g?0:g,f=e.paddingTop,y=void 0===f?0:f,m=e.paddingRight,_=void 0===m?0:m,x=e.paddingBottom,C=void 0===x?0:x,b=e.color,T=e.activeColor,w=e.size,S=e.fontFamily,P=e.icon,E=e.backgroundColor,I=e.activeBackgroundColor,k=(null==d?void 0:d.paneId)===h&&d.indicatorName===n&&d.iconId===e.id;null===(o=s.createFigure({name:"text",attrs:{text:P,x:i.x+a,y:i.y+u},styles:{paddingLeft:v,paddingTop:y,paddingRight:_,paddingBottom:C,color:k?T:b,size:w,family:S,backgroundColor:k?I:E}},{mouseClickEvent:s._boundIconClickEvent({paneId:h,indicatorName:n,iconId:e.id}),mouseMoveEvent:s._boundIconMouseMoveEvent({paneId:h,indicatorName:n,iconId:e.id})}))||void 0===o||o.draw(t),i.x+=a+v+t.measureText(P).width+_+p}))}return r},n.prototype.drawStandardTooltipLegends=function(t,e,i,n,o,r,a){var s=this;if(e.length>0){var l=a.marginLeft,u=a.marginTop,c=a.marginRight,h=a.marginBottom,d=a.size,p=a.family,g=a.weight;t.font=J(d,g,p),e.forEach((function(e){var a,v,f=e.title,y=e.value,m=t.measureText(f.text).width,_=m+t.measureText(y.text).width,x=u+d+h;i.x+l+_+c>r?(i.x=n,i.y+=o,o=x):o=Math.max(o,x),f.text.length>0&&(null===(a=s.createFigure({name:"text",attrs:{x:i.x+l,y:i.y+u,text:f.text},styles:{color:f.color,size:d,family:p,weight:g}}))||void 0===a||a.draw(t)),null===(v=s.createFigure({name:"text",attrs:{x:i.x+l+m,y:i.y+u,text:y.text},styles:{color:y.color,size:d,family:p,weight:g}}))||void 0===v||v.draw(t),i.x+=l+_+c}))}return o},n.prototype.isDrawTooltip=function(e,i){var n=i.showRule;return n===t.TooltipShowRule.Always||n===t.TooltipShowRule.FollowCross&&W(e.paneId)},n.prototype.getIndicatorTooltipData=function(t){var e,i,n=this.getWidget().getPane().getChart().getChartStore(),o=n.getStyles().indicator,r=o.tooltip,a=r.showName?t.shortName:"",s="",l=t.calcParams;l.length>0&&r.showParams&&(s="(".concat(l.join(","),")"));var u={name:a,calcParamsText:s,legends:[],icons:r.icons},c=n.getCrosshair().dataIndex,h=t.result,d=n.getCustomApi(),p=n.getDecimalFold(),g=n.getThousandsSeparator(),v=[];if(t.visible){var f=null!==(i=null!==(e=h[c])&&void 0!==e?e:h[c-1])&&void 0!==i?i:{};it(t,c,o,(function(e,i){if(W(e.title)){var n=i.color,o=f[e.key];R(o)&&(o=X(o,t.precision),t.shouldFormatBigNumber&&(o=d.formatBigNumber(o)),o=p.format(g.format(o))),v.push({title:{text:e.title,color:n},value:{text:null!=o?o:r.defaultValue,color:n}})}})),u.legends=v}if(F(t.createTooltipDataSource)){var y=this.getWidget(),m=y.getPane(),_=m.getChart(),x=t.createTooltipDataSource({chart:_,indicator:t,crosshair:n.getCrosshair(),bounding:y.getBounding(),xAxis:m.getChart().getXAxisPane().getAxisComponent(),yAxis:m.getAxisComponent()}),C=x.name,b=x.calcParamsText,T=x.legends,w=x.icons;if(W(C)&&r.showName&&(u.name=C),W(b)&&r.showParams&&(u.calcParamsText=b),L(w)&&(u.icons=w),L(T)&&t.visible){var S=[],P=o.tooltip.text.color;T.forEach((function(t){var e={text:"",color:P};B(t.title)?e=t.title:e.text=t.title;var i={text:"",color:P};B(t.value)?i=t.value:i.text=t.value,R(Number(i.text))&&(i.text=p.format(g.format(i.text))),S.push({title:e,value:i})})),u.legends=S}}return u},n.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]},n}($e),ai=function(e){function n(t){var i=e.call(this,t)||this;return i._initEvent(),i}return i(n,e),n.prototype._initEvent=function(){var t=this,e=this.getWidget().getPane(),i=e.getId(),n=e.getChart(),o=n.getChartStore();this.registerEvent("mouseMoveEvent",(function(e){var r,a=o.getProgressOverlayInfo();if(null!==a){var s=a.overlay,l=a.paneId;s.isStart()&&(o.updateProgressOverlayInfo(i),l=i);var u=s.points.length-1,h="".concat(at,"point_").concat(u);return s.isDrawing()&&l===i&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(r=s.onDrawing)||void 0===r||r.call(s,c({chart:n,overlay:s,figureKey:h,figureIndex:u},e))),t._figureMouseMoveEvent(s,1,h,u,0)(e)}return o.setHoverOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseClickEvent",(function(e){var r,a,s=o.getProgressOverlayInfo();if(null!==s){var l=s.overlay,u=s.paneId;l.isStart()&&(o.updateProgressOverlayInfo(i,!0),u=i);var h=l.points.length-1,d="".concat(at,"point_").concat(h);return l.isDrawing()&&u===i&&(l.eventMoveForDrawing(t._coordinateToPoint(l,e)),null===(r=l.onDrawing)||void 0===r||r.call(l,c({chart:n,overlay:l,figureKey:d,figureIndex:h},e)),l.nextStep(),l.isDrawing()||(o.progressOverlayComplete(),null===(a=l.onDrawEnd)||void 0===a||a.call(l,c({chart:n,overlay:l,figureKey:d,figureIndex:h},e)))),t._figureMouseClickEvent(l,1,d,h,0)(e)}return o.setClickOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseDoubleClickEvent",(function(e){var r,a=o.getProgressOverlayInfo();if(null!==a){var s=a.overlay,l=a.paneId;if(s.isDrawing()&&l===i&&(s.forceComplete(),!s.isDrawing())){o.progressOverlayComplete();var u=s.points.length-1,h="".concat(at,"point_").concat(u);null===(r=s.onDrawEnd)||void 0===r||r.call(s,c({chart:n,overlay:s,figureKey:h,figureIndex:u},e))}var d=s.points.length-1;return t._figureMouseClickEvent(s,1,"".concat(at,"point_").concat(d),d,0)(e)}return!1})).registerEvent("mouseRightClickEvent",(function(e){var i=o.getProgressOverlayInfo();if(null!==i){var n=i.overlay;if(n.isDrawing()){var r=n.points.length-1;return t._figureMouseRightClickEvent(n,1,"".concat(at,"point_").concat(r),r,0)(e)}}return!1})).registerEvent("mouseUpEvent",(function(t){var e,r=o.getPressedOverlayInfo(),a=r.overlay,s=r.figureIndex,l=r.figureKey;return null!==a&&(null===(e=a.onPressedMoveEnd)||void 0===e||e.call(a,c({chart:n,overlay:a,figureKey:l,figureIndex:s},t))),o.setPressedOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1}),!1})).registerEvent("pressedMouseMoveEvent",(function(e){var i,r,a=o.getPressedOverlayInfo(),s=a.overlay,l=a.figureType,u=a.figureIndex,h=a.figureKey;if(null!==s){if(!(s.lock||null!==(r=null===(i=s.onPressedMoving)||void 0===i?void 0:i.call(s,c({chart:n,overlay:s,figureIndex:u,figureKey:h},e)))&&void 0!==r&&r)){var d=t._coordinateToPoint(s,e);1===l?s.eventPressedPointMove(d,u):s.eventPressedOtherMove(d,t.getWidget().getPane().getChart().getChartStore())}return!0}return!1}))},n.prototype._createFigureEvents=function(t,e,i,n,o,r){var a=null;if(!t.isDrawing()){var s=[];if(L(r)&&(O(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 null!=a?a:void 0},n.prototype._figureMouseMoveEvent=function(t,e,i,n,o){var r=this;return function(a){var s=r.getWidget().getPane();return s.getChart().getChartStore().setHoverOverlayInfo({paneId:s.getId(),overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},n.prototype._figureMouseDownEvent=function(t,e,i,n,o){var r=this;return function(a){var s,l=r.getWidget().getPane(),u=l.getId();return t.startPressedMove(r._coordinateToPoint(t,a)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,c({chart:l.getChart(),overlay:t,figureIndex:n,figureKey:i},a)),l.getChart().getChartStore().setPressedOverlayInfo({paneId:u,overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o}),!0}},n.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().setClickOverlayInfo({paneId:l,overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},n.prototype._figureMouseDoubleClickEvent=function(t,e,i,n,o){var r=this;return function(e){var o;return null===(o=t.onDoubleClick)||void 0===o||o.call(t,c(c({},e),{chart:r.getWidget().getPane().getChart(),figureIndex:n,figureKey:i,overlay:t})),!0}},n.prototype._figureMouseRightClickEvent=function(t,e,i,n,o){var r=this;return function(e){var o,a;return null!==(a=null===(o=t.onRightClick)||void 0===o?void 0:o.call(t,c({chart:r.getWidget().getPane().getChart(),overlay:t,figureIndex:n,figureKey:i},e)))&&void 0!==a&&a||r.getWidget().getPane().getChart().getChartStore().removeOverlay(t),!0}},n.prototype._coordinateToPoint=function(e,i){var n,o={},r=this.getWidget().getPane(),a=r.getChart(),s=r.getId(),l=a.getChartStore();if(this.coordinateToPointTimestampDataIndexFlag()){var u=a.getXAxisPane().getAxisComponent().convertFromPixel(i.x),c=null!==(n=l.dataIndexToTimestamp(u))&&void 0!==n?n:void 0;o.timestamp=c,o.dataIndex=u}if(this.coordinateToPointValueFlag()){var h=r.getAxisComponent(),d=h.convertFromPixel(i.y);if(e.mode!==t.OverlayMode.Normal&&s===Se&&R(o.dataIndex)){var p=l.getDataByDataIndex(o.dataIndex);if(null!==p){var g=e.modeSensitivity;if(d>p.high)if(e.mode===t.OverlayMode.WeakMagnet){var v=h.convertToPixel(p.high);d<h.convertFromPixel(v-g)&&(d=p.high)}else d=p.high;else if(d<p.low)if(e.mode===t.OverlayMode.WeakMagnet){var f=h.convertToPixel(p.low);d>h.convertFromPixel(f-g)&&(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?d-y<p.high-d?y:p.high:d<m?d-p.low<m-d?p.low:m:y-d<d-m?y:m}}}o.value=d}return o},n.prototype.coordinateToPointValueFlag=function(){return!0},n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.prototype.dispatchEvent=function(t,i,n){return this.getWidget().getPane().getChart().getChartStore().isOverlayDrawing()?this.onEvent(t,i,n):e.prototype.dispatchEvent.call(this,t,i,n)},n.prototype.checkEventOn=function(){return!0},n.prototype.drawImp=function(t){var e=this;this.getCompleteOverlays().forEach((function(i){i.visible&&e._drawOverlay(t,i)}));var i=this.getProgressOverlay();L(i)&&i.visible&&this._drawOverlay(t,i)},n.prototype._drawOverlay=function(t,e){var i=e.points,n=this.getWidget().getPane(),o=n.getChart(),r=o.getChartStore(),a=n.getAxisComponent(),s=o.getXAxisPane().getAxisComponent(),l=i.map((function(t){var e,i=null;R(t.timestamp)&&(i=r.timestampToDataIndex(t.timestamp));var n={x:0,y:0};return R(i)&&(n.x=s.convertToPixel(i)),R(t.value)&&(n.y=null!==(e=null==a?void 0:a.convertToPixel(t.value))&&void 0!==e?e:0),n}));if(l.length>0){var u=[].concat(this.getFigures(e,l));this.drawFigures(t,e,u)}this.drawDefaultFigures(t,e,l)},n.prototype.drawFigures=function(t,e,i){var n=this,o=this.getWidget().getPane().getChart().getStyles().overlay;i.forEach((function(i,r){var a=i.type,s=i.styles,l=i.attrs,u=i.ignoreEvent;[].concat(l).forEach((function(l,h){var d,p,g,v=n._createFigureEvents(e,2,null!==(d=i.key)&&void 0!==d?d:"",r,h,u),f=c(c(c({},o[a]),null===(p=e.styles)||void 0===p?void 0:p[a]),s);null===(g=n.createFigure({name:a,attrs:l,styles:f},v))||void 0===g||g.draw(t)}))}))},n.prototype.getCompleteOverlays=function(){var t=this.getWidget().getPane();return t.getChart().getChartStore().getOverlaysByPaneId(t.getId())},n.prototype.getProgressOverlay=function(){var t=this.getWidget().getPane(),e=t.getChart().getChartStore().getProgressOverlayInfo();return L(e)&&e.paneId===t.getId()?e.overlay:null},n.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createPointFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},n.prototype.drawDefaultFigures=function(t,e,i){var n,o,r=this;if(e.needDefaultPointFigure){var a=this.getWidget().getPane().getChart().getChartStore(),s=a.getHoverOverlayInfo(),l=a.getClickOverlayInfo();if((null===(n=s.overlay)||void 0===n?void 0:n.id)===e.id&&0!==s.figureType||(null===(o=l.overlay)||void 0===o?void 0:o.id)===e.id&&0!==l.figureType){var u=a.getStyles().overlay,h=e.styles,d=c(c({},u.point),null==h?void 0:h.point);i.forEach((function(i,n){var o,a,l,u=i.x,c=i.y,h=d.radius,p=d.color,g=d.borderColor,v=d.borderSize;(null===(o=s.overlay)||void 0===o?void 0:o.id)===e.id&&1===s.figureType&&s.figureIndex===n&&(h=d.activeRadius,p=d.activeColor,g=d.activeBorderColor,v=d.activeBorderSize),null===(a=r.createFigure({name:"circle",attrs:{x:u,y:c,r:h+v},styles:{color:g}},r._createFigureEvents(e,1,"".concat(at,"point_").concat(n),n,0)))||void 0===a||a.draw(t),null===(l=r.createFigure({name:"circle",attrs:{x:u,y:c,r:h},styles:{color:p}}))||void 0===l||l.draw(t)}))}}},n}($e),si=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._gridView=new ti(n),n._indicatorView=new ni(n),n._crosshairLineView=new oi(n),n._tooltipView=n.createTooltipView(),n._overlayView=new ai(n),n.addChild(n._tooltipView),n.addChild(n._overlayView),n.getContainer().style.cursor="crosshair",n.registerEvent("mouseMoveEvent",(function(){return i.getChart().getChartStore().setActiveTooltipIcon(),!1})),n}return i(e,t),e.prototype.getName=function(){return De},e.prototype.updateMain=function(t){"minimize"!==this.getPane().getOptions().state&&(this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t))},e.prototype.createTooltipView=function(){return new ri(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){"minimize"!==this.getPane().getOptions().state&&(this._overlayView.draw(t),this._crosshairLineView.draw(t)),this._tooltipView.draw(t)},e}(Oe),li=function(t){function e(){var e=t.apply(this,f([],v(arguments),!1))||this;return e._ripplePoint=e.createFigure({name:"circle",attrs:{x:0,y:0,r:0},styles:{style:"fill"}}),e._animationFrameTime=0,e._animation=new gt({iterationCount:1/0}).doFrame((function(t){e._animationFrameTime=t;var i=e.getWidget().getPane();i.getChart().updatePane(0,i.getId())})),e}return i(e,t),e.prototype.drawImp=function(t){var e,i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=a.getDataList().length-1,l=o.getBounding(),u=r.getAxisComponent(),c=a.getStyles().candle.area,h=[],d=Number.MAX_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER,g=null;if(this.eachChildren((function(t){var e=t.data,i=t.x,n=null==e?void 0:e[c.value];if(R(n)){var o=u.convertToPixel(n);p===Number.MIN_SAFE_INTEGER&&(p=i),h.push({x:i,y:o}),d=Math.min(d,o),t.dataIndex===s&&(g={x:i,y:o})}})),h.length>0){null===(e=this.createFigure({name:"line",attrs:{coordinates:h},styles:{color:c.lineColor,size:c.lineSize,smooth:c.smooth}}))||void 0===e||e.draw(t);var v=c.backgroundColor,f="";if(A(v)){var y=t.createLinearGradient(0,l.height,0,d);try{v.forEach((function(t){var e=t.offset,i=t.color;y.addColorStop(e,i)}))}catch(t){}f=y}else f=v;t.fillStyle=f,t.beginPath(),t.moveTo(p,l.height),t.lineTo(h[0].x,h[0].y),ce(t,h,c.smooth),t.lineTo(h[h.length-1].x,l.height),t.closePath(),t.fill()}var m=c.point;if(m.show&&L(g)){null===(i=this.createFigure({name:"circle",attrs:{x:g.x,y:g.y,r:m.radius},styles:{style:"fill",color:m.color}}))||void 0===i||i.draw(t);var _=m.rippleRadius;m.animation&&(_=m.radius+this._animationFrameTime/m.animationDuration*(m.rippleRadius-m.radius),this._animation.setDuration(m.animationDuration).start()),null===(n=this._ripplePoint)||void 0===n||n.setAttrs({x:g.x,y:g.y,r:_}).setStyles({style:"fill",color:m.rippleColor}).draw(t)}else this.stopAnimation()},e.prototype.stopAnimation=function(){this._animation.stop()},e}(ei),ui=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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.getVisibleRangeHighLowPrice(),s=i.getPrecision(),l=e.getAxisComponent(),u=a[0],c=u.price,h=u.x,d=a[1],p=d.price,g=d.x,v=l.convertToPixel(c),f=l.convertToPixel(p),y=i.getDecimalFold(),m=i.getThousandsSeparator();o.show&&c!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,y.format(m.format(X(c,s.price))),{x:h,y:v},v<f?[-2,-5]:[2,5],o),r.show&&p!==Number.MAX_SAFE_INTEGER&&this._drawMark(t,y.format(m.format(X(p,s.price))),{x:g,y:f},v<f?[2,5]:[-2,-5],r)}},e.prototype._drawMark=function(t,e,i,n,o){var r,a,s,l=i.x,u=i.y+n[0];null===(r=this.createFigure({name:"line",attrs:{coordinates:[{x:l-2,y:u+n[0]},{x:l,y:u},{x:l+2,y:u+n[0]}]},styles:{color:o.color}}))||void 0===r||r.draw(t);var c=0,h=0,d="left";l>this.getWidget().getBounding().width/2?(h=(c=l-5)-o.textOffset,d="right"):(d="left",h=(c=l+5)+o.textOffset);var p=u+n[1];null===(a=this.createFigure({name:"line",attrs:{coordinates:[{x:l,y:u},{x:l,y:p},{x:c,y:p}]},styles:{color:o.color}}))||void 0===a||a.draw(t),null===(s=this.createFigure({name:"text",attrs:{x:h,y:p,text:e,align:d,baseline:"middle"},styles:{color:o.color,size:o.textSize,family:o.textFamily,weight:o.textWeight}}))||void 0===s||s.draw(t)},e}($e),ci=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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(L(h)){var d=h.close,p=h.open,g=u.convertToNicePixel(d),v="";v=d>p?s.upColor:d<p?s.downColor:s.noChangeColor,null===(e=this.createFigure({name:"line",attrs:{coordinates:[{x:0,y:g},{x:o.width,y:g}]},styles:{style:l.style,color:v,size:l.size,dashedValue:l.dashedValue}}))||void 0===e||e.draw(t)}}},e}($e);!function(t){t.Left="left",t.Right="right"}(Qe||(Qe={}));var hi=function(){function t(t){this.scrollZoomEnabled=!0,this._range={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0,displayFrom:0,displayTo:0,displayRange:0},this._prevRange={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0,displayFrom:0,displayTo:0,displayRange: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._range=this.createRangeImp()),!(this._prevRange.from===this._range.from&&this._prevRange.to===this._range.to&&!t)&&(this._prevRange=this._range,this._ticks=this.createTicksImp(),!0)},t.prototype.getTicks=function(){return this._ticks},t.prototype.setRange=function(t){this._autoCalcTickFlag=!1,this._range=t},t.prototype.getRange=function(){return this._range},t.prototype.setAutoCalcTickFlag=function(t){this._autoCalcTickFlag=t},t.prototype.getAutoCalcTickFlag=function(){return this._autoCalcTickFlag},t}(),di={"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 pi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.drawImp=function(e){var i=this.getWidget(),n=i.getPane().getChart().getChartStore(),o=n.getCrosshair();if(L(o.kLineData)){var r=i.getBounding(),a=n.getStyles(),s=a.candle,l=a.indicator;if(s.tooltip.showType===t.TooltipShowType.Rect&&l.tooltip.showType===t.TooltipShowType.Rect){var u=this.isDrawTooltip(o,s.tooltip),c=this.isDrawTooltip(o,l.tooltip);this._drawRectTooltip(e,u,c,s.tooltip.offsetTop)}else if(s.tooltip.showType===t.TooltipShowType.Standard&&l.tooltip.showType===t.TooltipShowType.Standard){var h=s.tooltip,d=h.offsetLeft,p=h.offsetTop,g=h.offsetRight,v=r.width-g,f=this._drawCandleStandardTooltip(e,d,p,v);this.drawIndicatorTooltip(e,d,f,v)}else if(s.tooltip.showType===t.TooltipShowType.Rect&&l.tooltip.showType===t.TooltipShowType.Standard){var y=s.tooltip,m=(d=y.offsetLeft,p=y.offsetTop,g=y.offsetRight,v=r.width-g,this.drawIndicatorTooltip(e,d,p,v));u=this.isDrawTooltip(o,s.tooltip);this._drawRectTooltip(e,u,!1,m)}else{var _=s.tooltip,x=(d=_.offsetLeft,p=_.offsetTop,g=_.offsetRight,v=r.width-g,this._drawCandleStandardTooltip(e,d,p,v));c=this.isDrawTooltip(o,l.tooltip);this._drawRectTooltip(e,!1,c,x)}}},n.prototype._drawCandleStandardTooltip=function(t,e,i,n){var o=this.getWidget().getPane().getChart().getChartStore(),r=o.getStyles().candle.tooltip,a=r.text,s=0,l={x:e,y:i},u=o.getCrosshair();if(this.isDrawTooltip(u,r)){var c=this._getCandleTooltipLegends(),h=v(this.classifyTooltipIcons(r.icons),3),d=h[0],p=h[1],g=h[2];s=this.drawStandardTooltipIcons(t,d,l,"",e,s,n),s=this.drawStandardTooltipIcons(t,p,l,"",e,s,n),c.length>0&&(s=this.drawStandardTooltipLegends(t,c,l,e,s,n,a)),s=this.drawStandardTooltipIcons(t,g,l,"",e,s,n)}return l.y+s},n.prototype._drawRectTooltip=function(e,i,n,o){var r,a,s=this,l=this.getWidget(),u=l.getPane(),c=u.getChart().getChartStore(),h=c.getStyles(),d=h.candle,p=h.indicator,g=d.tooltip,v=p.tooltip;if(i||n){var f=this._getCandleTooltipLegends(),y=g.offsetLeft,m=g.offsetTop,_=g.offsetRight,x=g.offsetBottom,C=g.text,b=C.marginLeft,T=C.marginRight,w=C.marginTop,S=C.marginBottom,P=C.size,E=C.weight,I=C.family,k=g.rect,M=k.position,D=k.paddingLeft,A=k.paddingRight,F=k.paddingTop,B=k.paddingBottom,R=k.offsetLeft,L=k.offsetRight,O=k.offsetTop,W=k.offsetBottom,z=k.borderSize,V=k.borderRadius,N=k.borderColor,Y=k.color,H=0,X=0,G=0;i&&(e.font=J(P,E,I),f.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+b+T;H=Math.max(H,r)})),G+=(S+w+P)*f.length);var K=v.text,U=K.marginLeft,j=K.marginRight,Z=K.marginTop,q=K.marginBottom,Q=K.size,$=K.weight,tt=K.family,et=[];if(n){var it=c.getIndicatorsByPaneId(u.getId());e.font=J(Q,$,tt),it.forEach((function(t){var i=s.getIndicatorTooltipData(t).legends;et.push(i),i.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+U+j;H=Math.max(H,r),G+=Z+q+Q}))}))}if(0!==(X+=H)&&0!==G){var nt=c.getCrosshair(),ot=l.getBounding(),rt=u.getYAxisWidget().getBounding();X+=2*z+D+A,G+=2*z+F+B;var at=ot.width/2,st=M===t.CandleTooltipRectPosition.Pointer&&nt.paneId===Se,lt=(null!==(r=nt.realX)&&void 0!==r?r:0)>at,ut=0;if(st){var ct=nt.realX;ut=lt?ct-L-X:ct+R}else{var ht=this.getWidget().getPane().getAxisComponent();lt?(ut=R+y,ht.inside&&ht.position===Qe.Left&&(ut+=rt.width)):(ut=ot.width-L-X-_,ht.inside&&ht.position===Qe.Right&&(ut-=rt.width))}var dt=o+O;if(st)(dt=nt.y-G/2)+G>ot.height-W-x&&(dt=ot.height-W-G-x),dt<o+O&&(dt=o+O+m);null===(a=this.createFigure({name:"rect",attrs:{x:ut,y:dt,width:X,height:G},styles:{style:t.PolygonType.StrokeFill,color:Y,borderColor:N,borderSize:z,borderRadius:V}}))||void 0===a||a.draw(e);var pt=ut+z+D+b,gt=dt+z+F;if(i&&f.forEach((function(t){var i,n;gt+=w;var o=t.title;null===(i=s.createFigure({name:"text",attrs:{x:pt,y:gt,text:o.text},styles:{color:o.color,size:P,family:I,weight:E}}))||void 0===i||i.draw(e);var r=t.value;null===(n=s.createFigure({name:"text",attrs:{x:ut+X-z-T-A,y:gt,text:r.text,align:"right"},styles:{color:r.color,size:P,family:I,weight:E}}))||void 0===n||n.draw(e),gt+=P+S})),n){var vt=ut+z+D+U;et.forEach((function(t){t.forEach((function(t){var i,n;gt+=Z;var o=t.title,r=t.value;null===(i=s.createFigure({name:"text",attrs:{x:vt,y:gt,text:o.text},styles:{color:o.color,size:Q,family:tt,weight:$}}))||void 0===i||i.draw(e),null===(n=s.createFigure({name:"text",attrs:{x:ut+X-z-j-A,y:gt,text:r.text,align:"right"},styles:{color:r.color,size:Q,family:tt,weight:$}}))||void 0===n||n.draw(e),gt+=Q+q}))}))}}}},n.prototype._getCandleTooltipLegends=function(){var e,i,n,o,r,a,s=this.getWidget().getPane().getChart().getChartStore(),l=s.getStyles().candle,u=s.getDataList(),h=s.getCustomApi(),d=s.getDecimalFold(),p=s.getThousandsSeparator(),g=s.getLocale(),v=s.getPrecision(),f=v.price,y=v.volume,m=null!==(e=s.getCrosshair().dataIndex)&&void 0!==e?e:0,_=l.tooltip,x=_.text.color,C=null!==(i=u[m-1])&&void 0!==i?i:null,b=u[m],T=null!==(n=null==C?void 0:C.close)&&void 0!==n?n:b.close,w=b.close-T,S={"{time}":h.formatDate(b.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Tooltip),"{open}":d.format(p.format(X(b.open,f))),"{high}":d.format(p.format(X(b.high,f))),"{low}":d.format(p.format(X(b.low,f))),"{close}":d.format(p.format(X(b.close,f))),"{volume}":d.format(p.format(h.formatBigNumber(X(null!==(o=b.volume)&&void 0!==o?o:_.defaultValue,y)))),"{turnover}":d.format(p.format(X(null!==(r=b.turnover)&&void 0!==r?r:_.defaultValue,f))),"{change}":0===T?_.defaultValue:"".concat(p.format(X(w/T*100)),"%")};return(F(_.custom)?_.custom({prev:C,current:b,next:null!==(a=u[m+1])&&void 0!==a?a:null},l):_.custom).map((function(t){var e,i=t.title,n=t.value,o={text:"",color:x};B(i)?o=c({},i):o.text=i,o.text=function(t,e){var i;return null!==(i=di[e][t])&&void 0!==i?i:t}(o.text,g);var r={text:_.defaultValue,color:x};B(n)?r=c({},n):r.text=n;var a=/{(\S*)}/.exec(r.text);if(null!==a&&a.length>1){var s="{".concat(a[1],"}");r.text=r.text.replace(s,null!==(e=S[s])&&void 0!==e?e:_.defaultValue),"{change}"===s&&(r.color=0===w?l.priceMark.last.noChangeColor:w>0?l.priceMark.last.upColor:l.priceMark.last.downColor)}return{title:o,value:r}}))},n}(ri),gi=function(e){function n(t,i){var n=e.call(this,t,i)||this;return n._candleBarView=new ii(n),n._candleAreaView=new li(n),n._candleHighLowPriceView=new ui(n),n._candleLastPriceLineView=new ci(n),n.addChild(n._candleBarView),n}return i(n,e),n.prototype.updateMainContent=function(e){this.getPane().getChart().getStyles().candle.type!==t.CandleType.Area?(this._candleBarView.draw(e),this._candleHighLowPriceView.draw(e),this._candleAreaView.stopAnimation()):this._candleAreaView.draw(e),this._candleLastPriceLineView.draw(e)},n.prototype.createTooltipView=function(){return new pi(this)},n}(si),vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t,e){var i,n,o=this,r=this.getWidget(),a=r.getPane(),s=r.getBounding(),l=a.getAxisComponent(),u=this.getAxisStyles(a.getChart().getStyles());if(u.show&&(u.axisLine.show&&(null===(i=this.createFigure({name:"line",attrs:this.createAxisLine(s,u),styles:u.axisLine}))||void 0===i||i.draw(t)),!e[0])){var c=l.getTicks();if(u.tickLine.show)this.createTickLines(c,s,u).forEach((function(e){var i;null===(i=o.createFigure({name:"line",attrs:e,styles:u.tickLine}))||void 0===i||i.draw(t)}));if(u.tickText.show){var h=this.createTickTexts(c,s,u);null===(n=this.createFigure({name:"text",attrs:h,styles:u.tickText}))||void 0===n||n.draw(t)}}},e}($e),fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getAxisStyles=function(t){return t.yAxis},e.prototype.createAxisLine=function(t,e){var i=this.getWidget().getPane().getAxisComponent(),n=e.axisLine.size,o=0;return{coordinates:[{x:o=i.isFromZero()?0:t.width-n,y:0},{x:o,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}(vi),yi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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.text;if(a.show&&s.show&&l.show){var u=r.getPrecision(),h=n.getAxisComponent(),d=r.getDataList(),p=d[d.length-1];if(L(p)){var g=p.close,v=p.open,f=h.convertToNicePixel(g),y="";y=g>v?s.upColor:g<v?s.downColor:s.noChangeColor;var m=h.getRange(),_=h.displayValueToText(h.realValueToDisplayValue(h.valueToRealValue(g,{range:m}),{range:m}),u.price);_=r.getDecimalFold().format(r.getThousandsSeparator().format(_));var x=0,C="left";h.isFromZero()?(x=0,C="left"):(x=o.width,C="right"),null===(e=this.createFigure({name:"text",attrs:{x:x,y:f,text:_,align:C,baseline:"middle"},styles:c(c({},l),{backgroundColor:y})}))||void 0===e||e.draw(t)}}},e}($e),mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(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.getStyles().indicator,s=a.lastValueMark,l=s.text;if(s.show){var u=n.getAxisComponent(),h=u.getRange(),d=r.getDataList().length-1,p=r.getIndicatorsByPaneId(n.getId()),g=r.getCustomApi(),v=r.getDecimalFold(),f=r.getThousandsSeparator();p.forEach((function(i){var n,r,s=i.result,p=null!==(r=null!==(n=s[d])&&void 0!==n?n:s[d-1])&&void 0!==r?r:{};if(L(p)&&i.visible){var y=i.precision;it(i,d,a,(function(n,r){var a,s=p[n.key];if(R(s)){var d=u.convertToNicePixel(s),m=u.displayValueToText(u.realValueToDisplayValue(u.valueToRealValue(s,{range:h}),{range:h}),y);i.shouldFormatBigNumber&&(m=g.formatBigNumber(m)),m=v.format(f.format(m));var _=0,x="left";u.isFromZero()?(_=0,x="left"):(_=o.width,x="right"),null===(a=e.createFigure({name:"text",attrs:{x:_,y:d,text:m,align:x,baseline:"middle"},styles:c(c({},l),{backgroundColor:r.color})}))||void 0===a||a.draw(t)}}))}}))}},e}($e),_i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!1},e.prototype.drawDefaultFigures=function(t,e,i){this.drawFigures(t,e,this.getDefaultFigures(e,i))},e.prototype.getDefaultFigures=function(t,e){var i,n=this.getWidget(),o=n.getPane(),r=o.getChart().getChartStore(),a=r.getClickOverlayInfo(),s=[];if(t.needDefaultYAxisFigure&&t.id===(null===(i=a.overlay)||void 0===i?void 0:i.id)&&a.paneId===o.getId()){var l=o.getAxisComponent(),u=n.getBounding(),c=Number.MAX_SAFE_INTEGER,h=Number.MIN_SAFE_INTEGER,d=l.isFromZero(),p="left",g=0;d?(p="left",g=0):(p="right",g=u.width);var v=r.getDecimalFold(),f=r.getThousandsSeparator();e.forEach((function(e,i){var n=t.points[i];if(R(n.value)){c=Math.min(c,e.y),h=Math.max(h,e.y);var o=v.format(f.format(X(n.value,r.getPrecision().price)));s.push({type:"text",attrs:{x:g,y:e.y,text:o,align:p,baseline:"middle"},ignoreEvent:!0})}})),e.length>1&&s.unshift({type:"rect",attrs:{x:0,y:c,width:u.width,height:h-c},ignoreEvent:!0})}return s},e.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createYAxisFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},e}(ai),xi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=i.getPane().getChart().getChartStore(),a=r.getCrosshair(),s=r.getStyles().crosshair;if(W(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=J(u.size,u.weight,u.family),null===(e=this.createFigure({name:"text",attrs:this.getTextAttrs(h,t.measureText(h).width,a,o,c,u),styles:u}))||void 0===e||e.draw(t)}}},e.prototype.compare=function(t,e){return t.paneId===e},e.prototype.getDirectionStyles=function(t){return t.horizontal},e.prototype.getText=function(t,e,i){var n=i,o=i.convertFromPixel(t.y),r=0,a=!1;n.isInCandle()?r=e.getPrecision().price:e.getIndicatorsByPaneId(t.paneId).forEach((function(t){r=Math.max(t.precision,r),a||(a=t.shouldFormatBigNumber)}));var s=n.getRange(),l=n.displayValueToText(n.realValueToDisplayValue(n.valueToRealValue(o,{range:s}),{range:s}),r);return a&&(l=e.getCustomApi().formatBigNumber(l)),e.getDecimalFold().format(e.getThousandsSeparator().format(l))},e.prototype.getTextAttrs=function(t,e,i,n,o,r){var a=0,s="left";return o.isFromZero()?(a=0,s="left"):(a=n.width,s="right"),{x:a,y:i.y,text:t,align:s,baseline:"middle"}},e}($e),Ci=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._yAxisView=new fi(n),n._candleLastPriceLabelView=new yi(n),n._indicatorLastValueView=new mi(n),n._overlayYAxisView=new _i(n),n._crosshairHorizontalLabelView=new xi(n),n.getContainer().style.cursor="ns-resize",n.addChild(n._overlayYAxisView),n}return i(e,t),e.prototype.getName=function(){return Fe},e.prototype.updateMain=function(t){var e="minimize"===this.getPane().getOptions().state;this._yAxisView.draw(t,e),e||(this.getPane().getAxisComponent().isInCandle()&&this._candleLastPriceLabelView.draw(t),this._indicatorLastValueView.draw(t))},e.prototype.updateOverlay=function(t){"minimize"!==this.getPane().getOptions().state&&(this._overlayYAxisView.draw(t),this._crosshairHorizontalLabelView.draw(t))},e}(Oe),bi=function(e){function n(t,i){var n=e.call(this,t)||this;return n.reverse=!1,n.inside=!1,n.position=Qe.Right,n.gap={top:.2,bottom:.1},n.createRange=function(t){return t.defaultRange},n.minSpan=function(t){return Tt(-t)},n.valueToRealValue=function(t){return t},n.realValueToDisplayValue=function(t){return t},n.displayValueToRealValue=function(t){return t},n.realValueToValue=function(t){return t},n.displayValueToText=function(t,e){return X(t,e)},n.override(i),n}return i(n,e),n.prototype.override=function(t){var e=t.name,i=t.gap,n=h(t,["name","gap"]);W(this.name)||(this.name=e),M(this.gap,i),M(this,n)},n.prototype.createRangeImp=function(){var e=this.getParent(),i=e.getChart(),n=i.getChartStore(),o=e.getId(),r=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,s=!1,l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,h=n.getIndicatorsByPaneId(o);h.forEach((function(t){s||(s=t.shouldOhlc),c=Math.min(c,t.precision),R(t.minValue)&&(l=Math.min(l,t.minValue)),R(t.maxValue)&&(u=Math.max(u,t.maxValue))}));var d=4,p=this.isInCandle();if(p){var g=n.getPrecision().price;d=c!==Number.MAX_SAFE_INTEGER?Math.min(c,g):g}else c!==Number.MAX_SAFE_INTEGER&&(d=c);var v=n.getVisibleRangeDataList(),f=i.getStyles().candle,y=f.type===t.CandleType.Area,m=f.area.value,_=p&&!y||!p&&s;v.forEach((function(t){var e=t.dataIndex,i=t.data;if(L(i)&&(_&&(r=Math.min(r,i.low),a=Math.max(a,i.high)),p&&y)){var n=i[m];R(n)&&(r=Math.min(r,n),a=Math.max(a,n))}h.forEach((function(t){var i,n=t.result,o=t.figures,s=null!==(i=n[e])&&void 0!==i?i:{};o.forEach((function(t){var e=s[t.key];R(e)&&(r=Math.min(r,e),a=Math.max(a,e))}))}))})),r!==Number.MAX_SAFE_INTEGER&&a!==Number.MIN_SAFE_INTEGER?(r=Math.min(l,r),a=Math.max(u,a)):(r=0,a=10);var x=a-r,C={from:r,to:a,range:x,realFrom:r,realTo:a,realRange:x,displayFrom:r,displayTo:a,displayRange:x},b=this.createRange({chart:i,paneId:o,defaultRange:C}),T=b.realFrom,w=b.realTo,S=b.realRange,P=this.minSpan(d);if(T===w||S<P){var E=l===T,I=u===w;T=E?T:I?T-8*P:T-4*P,w=I?w:E?w+8*P:w+4*P}var k=this.getBounding().height,M=this.gap,D=M.top;D>=1&&(D/=k);var A=M.bottom;A>=1&&(A/=k),T-=(S=w-T)*A,w+=S*D;var F=this.realValueToValue(T,{range:b}),B=this.realValueToValue(w,{range:b}),O=this.realValueToDisplayValue(T,{range:b}),W=this.realValueToDisplayValue(w,{range:b});return{from:F,to:B,range:B-F,realFrom:T,realTo:w,realRange:w-T,displayFrom:O,displayTo:W,displayRange:W-O}},n.prototype.isInCandle=function(){return this.getParent().getId()===Se},n.prototype.isFromZero=function(){return this.position===Qe.Left&&this.inside||this.position===Qe.Right&&!this.inside},n.prototype.createTicksImp=function(){var t,e,i=this,n=this.getRange(),o=n.displayFrom,r=n.displayTo,a=n.displayRange,s=[];if(a>=0){var l=function(t){var e=Math.floor(bt(t)),i=Tt(e),n=t/i;return+(t=(n<1.5?1:n<2.5?2:n<3.5?3:n<4.5?4:n<5.5?5:n<6.5?6:8)*i).toFixed(Math.abs(e))}(a/8),u=function(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var o=e.indexOf(".");return o<0?0:e.length-1-o}(l),c=xt(Math.ceil(o/l)*l,u),h=xt(Math.floor(r/l)*l,u),d=0,p=c;if(0!==l)for(;p<=h;){var g=p.toFixed(u);s[d]={text:g,coord:0,value:g},++d,p+=l}}var v=this.getParent(),f=null!==(e=null===(t=v.getYAxisWidget())||void 0===t?void 0:t.getBounding().height)&&void 0!==e?e:0,y=v.getChart().getChartStore(),m=[],_=y.getIndicatorsByPaneId(v.getId()),x=y.getStyles(),C=0,b=!1;this.isInCandle()?C=y.getPrecision().price:_.forEach((function(t){C=Math.max(C,t.precision),b||(b=t.shouldFormatBigNumber)}));var T=y.getCustomApi(),w=y.getThousandsSeparator(),S=y.getDecimalFold(),P=x.xAxis.tickText.size,E=NaN;return s.forEach((function(t){var e=t.value,o=i.displayValueToText(+e,C),r=i.convertToPixel(i.realValueToValue(i.displayValueToRealValue(+e,{range:n}),{range:n}));b&&(o=T.formatBigNumber(e)),o=S.format(w.format(o));var a=R(E);r>P&&r<f-P&&(a&&Math.abs(E-r)>2*P||!a)&&(m.push({text:o,coord:r,value:e}),E=r)})),F(this.createTicks)?this.createTicks({range:this.getRange(),bounding:this.getBounding(),defaultTicks:m}):m},n.prototype.getAutoSize=function(){var t=this.getParent(),e=t.getChart().getChartStore(),i=e.getStyles(),n=i.yAxis,o=n.size;if("auto"!==o)return o;var r=0;if(n.show&&(n.axisLine.show&&(r+=n.axisLine.size),n.tickLine.show&&(r+=n.tickLine.length),n.tickText.show)){var a=0;this.getTicks().forEach((function(t){a=Math.max(a,Q(t.text,n.tickText.size,n.tickText.weight,n.tickText.family))})),r+=n.tickText.marginStart+n.tickText.marginEnd+a}var s=i.crosshair,l=0;if(s.show&&s.horizontal.show&&s.horizontal.text.show){var u=e.getIndicatorsByPaneId(t.getId()),c=0,h=!1;u.forEach((function(t){c=Math.max(t.precision,c),h||(h=t.shouldFormatBigNumber)}));var d=2;if(this.isInCandle()){var p=e.getPrecision().price,g=i.indicator.lastValueMark;d=g.show&&g.text.show?Math.max(c,p):p}else d=c;var v=X(this.getRange().displayTo,d);h&&(v=e.getCustomApi().formatBigNumber(v)),v=e.getDecimalFold().format(v),l+=s.horizontal.text.paddingLeft+s.horizontal.text.paddingRight+2*s.horizontal.text.borderSize+Q(v,s.horizontal.text.size,s.horizontal.text.weight,s.horizontal.text.family)}return Math.max(r,l)},n.prototype.getBounding=function(){return this.getParent().getYAxisWidget().getBounding()},n.prototype.convertFromPixel=function(t){var e=this.getBounding().height,i=this.getRange(),n=i.realFrom,o=i.realRange,r=(this.reverse?t/e:1-t/e)*o+n;return this.realValueToValue(r,{range:i})},n.prototype.convertToPixel=function(t){var e,i,n=this.getRange(),o=this.valueToRealValue(t,{range:n}),r=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,a=(o-n.realFrom)/n.realRange;return this.reverse?Math.round(a*r):Math.round((1-a)*r)},n.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)))},n.extend=function(t){var e=function(e){function n(i){return e.call(this,i,t)||this}return i(n,e),n}(n);return e},n}(hi),Ti={name:"percentage",minSpan:function(){return Math.pow(10,-2)},displayValueToText:function(t){return"".concat(X(t,2),"%")},valueToRealValue:function(t,e){var i=e.range;return(t-i.from)/i.range*i.realRange+i.realFrom},realValueToValue:function(t,e){var i=e.range;return(t-i.realFrom)/i.realRange*i.range+i.from},createRange:function(t){var e=t.chart,i=t.defaultRange,n=e.getDataList()[e.getVisibleRange().from];if(L(n)){var o=i.from,r=i.to,a=i.range,s=(i.from-n.close)/n.close*100,l=(i.to-n.close)/n.close*100,u=l-s;return{from:o,to:r,range:a,realFrom:s,realTo:l,realRange:u,displayFrom:s,displayTo:l,displayRange:u}}return i}},wi={name:"logarithm",minSpan:function(t){return.05*Tt(-t)},valueToRealValue:function(t){return t<0?-bt(Math.abs(t)):bt(t)},realValueToDisplayValue:function(t){return t<0?-Tt(Math.abs(t)):Tt(t)},displayValueToRealValue:function(t){return t<0?-bt(Math.abs(t)):bt(t)},realValueToValue:function(t){return t<0?-Tt(Math.abs(t)):Tt(t)},createRange:function(t){var e=t.defaultRange,i=e.from,n=e.to,o=e.range,r=i<0?-bt(Math.abs(i)):bt(i),a=n<0?-bt(Math.abs(n)):bt(n);return{from:i,to:n,range:o,realFrom:r,realTo:a,realRange:a-r,displayFrom:i,displayTo:n,displayRange:o}}},Si={normal:bi.extend({name:"normal"}),percentage:bi.extend(Ti),logarithm:bi.extend(wi)};var Pi=function(){function t(t,e,i,n){this._bounding=lt(),this._originalBounding=lt(),this._visible=!0,this._chart=i,this._id=n,this._init(t,e)}return t.prototype._init=function(t,e){this._rootContainer=t,this._container=mt("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.setVisible=function(t){this._visible!==t&&(this._container.style.display=t?"block":"none",this._visible=t)},t.prototype.getVisible=function(){return this._visible},t.prototype.getId=function(){return this._id},t.prototype.getChart=function(){return this._chart},t.prototype.getBounding=function(){return this._bounding},t.prototype.setOriginalBounding=function(t){M(this._originalBounding,t)},t.prototype.getOriginalBounding=function(){return this._originalBounding},t.prototype.update=function(t){this._bounding.height!==this._container.clientHeight&&(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}(),Ei=function(t){function e(e,i,n,o,r){var a=t.call(this,e,i,n,o)||this;a._yAxisWidget=null,a._options={id:"",minHeight:30,dragEnabled:!0,order:0,height:100,state:"normal",axis:{name:"normal",scrollZoomEnabled:!0}};var s=a.getContainer();return a._mainWidget=a.createMainWidget(s),a._yAxisWidget=a.createYAxisWidget(s),a.setOptions(r),a}return i(e,t),e.prototype.setOptions=function(t){var e,i,n,o,r,a=this.getId();if(a===Se||a===Ee){var s=null===(e=t.axis)||void 0===e?void 0:e.name;(!L(this._axis)||L(s)&&this._options.axis.name!==s)&&(this._axis=this.createAxisComponent(null!=s?s:"normal"))}else L(this._axis)||(this._axis=this.createAxisComponent("normal"));this._axis instanceof bi&&this._axis.setAutoCalcTickFlag(!0),M(this._options,t),this._axis.override(c(c({},this._options.axis),{name:null!==(n=null===(i=t.axis)||void 0===i?void 0:i.name)&&void 0!==n?n:"normal"}));var l=null,u="default";return this.getId()===Ee?(l=this.getMainWidget().getContainer(),u="ew-resize"):(l=this.getYAxisWidget().getContainer(),u="ns-resize"),null===(r=null===(o=t.axis)||void 0===o?void 0:o.scrollZoomEnabled)||void 0===r||r?l.style.cursor=u:l.style.cursor="default",this},e.prototype.getOptions=function(){return this._options},e.prototype.getAxisComponent=function(){return this._axis},e.prototype.setBounding=function(t,e,i,n){var o,r,a,s;M(this.getBounding(),t);var l={};L(t.height)&&(l.height=t.height),L(t.top)&&(l.top=t.top),this._mainWidget.setBounding(l);var u=L(e);(u&&this._mainWidget.setBounding(e),L(this._yAxisWidget))&&(this._yAxisWidget.setBounding(l),this._axis.position===Qe.Left?L(i)&&this._yAxisWidget.setBounding(c(c({},i),{left:0})):L(n)&&(this._yAxisWidget.setBounding(n),u&&this._yAxisWidget.setBounding({left:(null!==(o=e.left)&&void 0!==o?o:0)+(null!==(r=e.width)&&void 0!==r?r:0)+(null!==(a=e.right)&&void 0!==a?a:0)-(null!==(s=n.width)&&void 0!==s?s:0)})));return 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.destroy=function(){var e;t.prototype.destroy.call(this),this._mainWidget.destroy(),null===(e=this._yAxisWidget)||void 0===e||e.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=q(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}(Pi),Ii=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Si[t])&&void 0!==e?e:Si.normal}(null!=t?t:"default");return new e(this)},e.prototype.createMainWidget=function(t){return new si(t,this)},e.prototype.createYAxisWidget=function(t){return new Ci(t,this)},e}(Ei),ki=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createMainWidget=function(t){return new gi(t,this)},e}(Ii),Mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getAxisStyles=function(t){return t.xAxis},e.prototype.createAxisLine=function(t){return{coordinates:[{x:0,y:0},{x:t.width,y:0}]}},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}(vi),Di=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.prototype.coordinateToPointValueFlag=function(){return!1},n.prototype.getCompleteOverlays=function(){return this.getWidget().getPane().getChart().getChartStore().getOverlaysByPaneId()},n.prototype.getProgressOverlay=function(){var t,e;return null!==(e=null===(t=this.getWidget().getPane().getChart().getChartStore().getProgressOverlayInfo())||void 0===t?void 0:t.overlay)&&void 0!==e?e:null},n.prototype.getDefaultFigures=function(e,i){var n,o=[],r=this.getWidget(),a=r.getPane().getChart().getChartStore(),s=a.getClickOverlayInfo();if(e.needDefaultXAxisFigure&&e.id===(null===(n=s.overlay)||void 0===n?void 0:n.id)){var l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;i.forEach((function(i,n){l=Math.min(l,i.x),u=Math.max(u,i.x);var r=e.points[n];if(R(r.timestamp)){var s=a.getCustomApi().formatDate(r.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair);o.push({type:"text",attrs:{x:i.x,y:0,text:s,align:"center"},ignoreEvent:!0})}})),i.length>1&&o.unshift({type:"rect",attrs:{x:l,y:0,width:u-l,height:r.getBounding().height},ignoreEvent:!0})}return o},n.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createXAxisFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},n}(_i),Ai=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.compare=function(t){return L(t.timestamp)},n.prototype.getDirectionStyles=function(t){return t.vertical},n.prototype.getText=function(e,i){var n=e.timestamp;return i.getCustomApi().formatDate(n,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair)},n.prototype.getTextAttrs=function(t,e,i,n,o,r){var a=i.realX,s=0,l="center";return a-e/2-r.paddingLeft<0?(s=0,l="left"):a+e/2+r.paddingRight>n.width?(s=n.width,l="right"):s=a,{x:s,y:0,text:t,align:l,baseline:"top"}},n}(xi),Fi=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._xAxisView=new Mi(n),n._overlayXAxisView=new Di(n),n._crosshairVerticalLabelView=new Ai(n),n.getContainer().style.cursor="ew-resize",n.addChild(n._overlayXAxisView),n}return i(e,t),e.prototype.getName=function(){return Ae},e.prototype.updateMain=function(t){this._xAxisView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayXAxisView.draw(t),this._crosshairVerticalLabelView.draw(t)},e}(Oe),Bi=function(e){function n(t,i){var n=e.call(this,t)||this;return n.override(i),n}return i(n,e),n.prototype.override=function(t){var e=t.name,i=t.scrollZoomEnabled,n=t.createTicks;W(this.name)||(this.name=e),this.scrollZoomEnabled=null!=i?i:this.scrollZoomEnabled,this.createTicks=null!=n?n:this.createTicks},n.prototype.createRangeImp=function(){var t=this.getParent().getChart().getChartStore().getVisibleRange(),e=t.realFrom,i=t.realTo,n=i-e+1;return{from:e,to:i,range:n,realFrom:e,realTo:i,realRange:n,displayFrom:e,displayTo:i,displayRange:n}},n.prototype.createTicksImp=function(){var e=this,i=this.getRange(),n=i.realFrom,o=i.realTo,r=this.getParent().getChart().getChartStore(),a=r.getCustomApi().formatDate,s=r.getTimeWeightTickList(),l=[],u=function(i,n){var r,s;try{for(var u=g(i),c=u.next();!c.done;c=u.next()){var h=c.value;if(h.dataIndex>=n&&h.dataIndex<o){var d=h.timestamp,p=h.weight,v=h.dataIndex,f="";switch(p){case Pt:f=a(d,"YYYY",t.FormatDateType.XAxis);break;case Et:f=a(d,"YYYY-MM",t.FormatDateType.XAxis);break;case It:f=a(d,"MM-DD",t.FormatDateType.XAxis);break;case kt:case Mt:f=a(d,"HH:mm",t.FormatDateType.XAxis);break;case Dt:f=a(d,"mm:ss",t.FormatDateType.XAxis);break;default:f=a(d,"YYYY-MM-DD HH:mm",t.FormatDateType.XAxis)}l.push({coord:e.convertToPixel(v),value:d,text:f})}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}};if(u(s,n),s.length>0){for(var c=r.getBarSpace().bar,h=r.getStyles().xAxis.tickText,d=Ft(c,h),p=s[s.length-1].dataIndex+d-1,v=[],f=p;f<o;f++){var y=r.dataIndexToTimestamp(f);R(y)&&v.push({timestamp:y})}if(v.length>0){var m=new Map;At(m,v,r.getDateTimeFormat(),p),u(Bt(m,c,h),p)}}return F(this.createTicks)?this.createTicks({range:this.getRange(),bounding:this.getBounding(),defaultTicks:l}):l},n.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)},n.prototype.getBounding=function(){return this.getParent().getMainWidget().getBounding()},n.prototype.convertTimestampFromPixel=function(t){var e=this.getParent().getChart().getChartStore(),i=e.coordinateToDataIndex(t);return e.dataIndexToTimestamp(i)},n.prototype.convertTimestampToPixel=function(t){var e=this.getParent().getChart().getChartStore(),i=e.timestampToDataIndex(t);return e.dataIndexToCoordinate(i)},n.prototype.convertFromPixel=function(t){return this.getParent().getChart().getChartStore().coordinateToDataIndex(t)},n.prototype.convertToPixel=function(t){return this.getParent().getChart().getChartStore().dataIndexToCoordinate(t)},n.extend=function(t){var e=function(e){function n(i){return e.call(this,i,t)||this}return i(n,e),n}(n);return e},n}(hi),Ri={normal:Bi.extend({name:"normal"})};var Li=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Ri[t])&&void 0!==e?e:Ri.normal}(t);return new e(this)},e.prototype.createMainWidget=function(t){return new Fi(t,this)},e}(Ei);var Oi=function(e){function n(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._topPane=null,a._bottomPane=null,a._pressedMouseMoveEvent=(n=a._pressedTouchMouseMoveEvent,o=20,r=0,function(){var t=Date.now();t-r>o&&(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 i(n,e),n.prototype.getName=function(){return Be},n.prototype.checkEventOn=function(){return!0},n.prototype._mouseDownEvent=function(t){var e=this;this._dragFlag=!0,this._dragStartY=t.pageY;var i=this.getPane(),n=i.getChart();this._topPane=i.getTopPane(),this._bottomPane=i.getBottomPane();var o=n.getDrawPanes();if("minimize"===this._topPane.getOptions().state)for(var r=o.findIndex((function(t){var i;return t.getId()===(null===(i=e._topPane)||void 0===i?void 0:i.getId())})),a=r-1;a>-1;a--){var s=o[a];if("minimize"!==s.getOptions().state){this._topPane=s;break}}if("minimize"===this._bottomPane.getOptions().state)for(r=o.findIndex((function(t){var i;return t.getId()===(null===(i=e._bottomPane)||void 0===i?void 0:i.getId())})),a=r+1;a<o.length;a++){var l=o[a];if("minimize"!==l.getOptions().state){this._bottomPane=l;break}}return this._topPaneHeight=this._topPane.getBounding().height,this._bottomPaneHeight=this._bottomPane.getBounding().height,!0},n.prototype._mouseUpEvent=function(){return this._dragFlag=!1,this._topPane=null,this._bottomPane=null,this._topPaneHeight=0,this._bottomPaneHeight=0,this._mouseLeaveEvent()},n.prototype._pressedTouchMouseMoveEvent=function(e){var i=e.pageY-this._dragStartY,n=i<0;if(L(this._topPane)&&L(this._bottomPane)){var o=this._bottomPane.getOptions();if("minimize"!==this._topPane.getOptions().state&&"minimize"!==o.state&&o.dragEnabled){var r=null,a=null,s=0,l=0;n?(r=this._topPane,a=this._bottomPane,s=this._topPaneHeight,l=this._bottomPaneHeight):(r=this._bottomPane,a=this._topPane,s=this._bottomPaneHeight,l=this._topPaneHeight);var u=r.getOptions().minHeight;if(s>u){var c=Math.max(s-Math.abs(i),u),h=s-c;r.setBounding({height:c}),a.setBounding({height:l+h});var d=this.getPane(),p=d.getChart();p.getChartStore().executeAction(t.ActionType.OnPaneDrag,{paneId:d.getId()}),p.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})}}}return!0},n.prototype._mouseEnterEvent=function(){var t=this.getPane();if(t.getBottomPane().getOptions().dragEnabled){var e=t.getChart().getStyles().separator;return this.getContainer().style.background=e.activeBackgroundColor,!0}return!1},n.prototype._mouseLeaveEvent=function(){return!this._dragFlag&&(this.getContainer().style.background="transparent",!0)},n.prototype.createContainer=function(){return mt("div",{width:"100%",height:"".concat(7,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},n.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")}},n}(Le),Wi=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 Oi(s.getContainer(),s),s}return i(e,t),e.prototype.setBounding=function(t){return M(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=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),s=q(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}(Pi);function zi(){return"undefined"!=typeof window&&window.navigator.userAgent.toLowerCase().includes("firefox")}function Vi(){return"undefined"!=typeof window&&/iPhone|iPad|iPod|iOS/.test(window.navigator.userAgent)}var Ni,Yi=5,Hi=5,Xi=5,Gi=30,Ki=0,Ui=1,ji=2,Zi=function(){function t(t,e,i){var n=this;this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},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=!Vi(),this._onFirefoxOutsideMouseUp=function(t){n._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){n._firesTouchEvents(t)?(++n._tapCount,null!==n._tapTimeoutId&&n._tapCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._tapCoordinate).manhattanDistance<Gi&&!n._cancelTap&&n._processEvent(n._makeCompatEvent(t),n._handler.doubleTapEvent),n._resetTapTimeout())):(++n._clickCount,null!==n._clickTimeoutId&&n._clickCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._clickCoordinate).manhattanDistance<Xi&&!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:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._resetTapTimeout=function(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},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(!L(this._handler.mouseWheelHortEvent))return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(!L(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.xOffset,o=i.yOffset,r=i.manhattanDistance;if(this._touchMoveExceededManhattanDistance||!(r<Hi)){if(!this._touchMoveExceededManhattanDistance){var a=.5*n,s=o>=a&&!this._options.treatVertDragAsPageScroll(),l=a>o&&!this._options.treatHorzDragAsPageScroll();s||l||(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){t.button===Ki&&(this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._mouseMoveStartCoordinate).manhattanDistance>=Yi&&(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)this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance<Gi&&!this._cancelTap&&this._processEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout();else this._cancelTap||(this._processEvent(i,this._handler.tapEvent),L(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(t.button===Ki){var e=this._makeCompatEvent(t);if(this._mouseMoveStartCoordinate=null,this._mousePressed=!1,null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),zi())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)this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance<Xi&&!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(t.button===ji)return this._preventDefault(t),void this._processEvent(this._makeCompatEvent(t),this._handler.mouseRightClickEvent);if(t.button===Ki){var e=this._target.ownerDocument.documentElement;zi()&&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}),Vi()&&(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(t.button===Ui)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;(L(this._handler.pinchStartEvent)||L(this._handler.pinchEvent)||L(this._handler.pinchEndEvent))&&(this._target.addEventListener("touchstart",(function(e){t._checkPinchState(e.touches)}),{passive:!0}),this._target.addEventListener("touchmove",(function(e){if(2===e.touches.length&&null!==t._startPinchMiddleCoordinate&&L(t._handler.pinchEvent)){var i=t._getTouchDistance(e.touches[0],e.touches[1])/t._startPinchDistance;t._handler.pinchEvent(c(c({},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=this._target.getBoundingClientRect();this._startPinchMiddleCoordinate={x:(t[0].clientX-e.left+(t[1].clientX-e.left))/2,y:(t[0].clientY-e.top+(t[1].clientY-e.top))/2},this._startPinchDistance=this._getTouchDistance(t[0],t[1]),L(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,L(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=!Vi())},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 L(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=this,n=null!=e?e:t,o=this._target.getBoundingClientRect();return{x:n.clientX-o.left,y:n.clientY-o.top,pageX:n.pageX,pageY:n.pageY,isTouch:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type&&"wheel"!==t.type,preventDefault:function(){"touchstart"!==t.type&&i._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;i<t.length;++i)if(t[i].identifier===e)return t[i];return null},t}(),qi=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._prevYAxisRange=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().zoom(.5);break;case"Minus":i._chart.getChartStore().zoom(-.5);break;case"ArrowLeft":(e=i._chart.getChartStore()).startScroll(),e.scroll(-3*e.getBarSpace().bar);break;case"ArrowRight":var e;(e=i._chart.getChartStore()).startScroll(),e.scroll(3*e.getBarSpace().bar)}},this._container=t,this._chart=e,this._event=new Zi(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())!==Ee&&(null==o?void 0:o.getName())===De){var r=this._makeWidgetEvent(t,o),a=5*(e-this._pinchScale);return this._pinchScale=e,this._chart.getChartStore().zoom(a,{x:r.x,y:r.y}),!0}return!1},t.prototype.mouseWheelHortEvent=function(t,e){var i=this._chart.getChartStore();return i.startScroll(),i.scroll(e),!0},t.prototype.mouseWheelVertEvent=function(t,e){var i=this._findWidgetByEvent(t).widget,n=this._makeWidgetEvent(t,i);return(null==i?void 0:i.getName())===De&&(this._chart.getChartStore().zoom(e,{x:n.x,y:n.y}),!0)},t.prototype.mouseDownEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(this._mouseDownWidget=n,null!==n){var o=this._makeWidgetEvent(t,n);switch(n.getName()){case Be:return n.dispatchEvent("mouseDownEvent",o);case De:var r=i.getAxisComponent().getRange();return this._prevYAxisRange=c({},r),this._startScrollCoordinate={x:o.x,y:o.y},this._chart.getChartStore().startScroll(),n.dispatchEvent("mouseDownEvent",o);case Ae:return(a=n.dispatchEvent("mouseDownEvent",o))&&this._chart.updatePane(1),this._xAxisStartScaleCoordinate={x:o.x,y:o.y},this._xAxisStartScaleDistance=o.pageX,a;case Fe:var a;(a=n.dispatchEvent("mouseDownEvent",o))&&this._chart.updatePane(1);r=i.getAxisComponent().getRange();return this._prevYAxisRange=c({},r),this._yAxisStartScaleDistance=o.pageY,a}}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 De: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.getActiveTooltipIcon()&&(c=void 0,a.getContainer().style.cursor="pointer"),this._chart.getChartStore().setCrosshair(c),l;case Be:case Ae:case Fe:l=a.dispatchEvent("mouseMoveEvent",s);return this._chart.getChartStore().setCrosshair(),l}return!1},t.prototype.pressedMouseMoveEvent=function(t){var e,i,n;if(null!==this._mouseDownWidget&&this._mouseDownWidget.getName()===Be)return this._mouseDownWidget.dispatchEvent("pressedMouseMoveEvent",t);var o=this._findWidgetByEvent(t),r=o.pane,a=o.widget;if(null!==a&&(null===(e=this._mouseDownWidget)||void 0===e?void 0:e.getPane().getId())===(null==r?void 0:r.getId())&&(null===(i=this._mouseDownWidget)||void 0===i?void 0:i.getName())===a.getName()){var s=this._makeWidgetEvent(t,a);switch(a.getName()){case De:var l=a.getBounding();if(!(b=a.dispatchEvent("pressedMouseMoveEvent",s))&&null!==this._startScrollCoordinate){var u=r.getAxisComponent();if(null!==this._prevYAxisRange&&!u.getAutoCalcTickFlag()&&u.scrollZoomEnabled){var c=this._prevYAxisRange,h=c.from,d=c.to,p=h+(w=(T=c.range)*(x=(u.reverse?this._startScrollCoordinate.y-s.y:s.y-this._startScrollCoordinate.y)/l.height)),g=d+w,v=u.valueToRealValue(p,{range:this._prevYAxisRange}),f=u.valueToRealValue(g,{range:this._prevYAxisRange}),y=u.realValueToDisplayValue(v,{range:this._prevYAxisRange}),m=u.realValueToDisplayValue(f,{range:this._prevYAxisRange});u.setRange({from:p,to:g,range:g-p,realFrom:v,realTo:f,realRange:f-v,displayFrom:y,displayTo:m,displayRange:m-y})}var _=s.x-this._startScrollCoordinate.x;this._chart.getChartStore().scroll(_)}return this._chart.getChartStore().setCrosshair({x:s.x,y:s.y,paneId:null==r?void 0:r.getId()}),b;case Ae:if(b=a.dispatchEvent("pressedMouseMoveEvent",s))this._chart.updatePane(1);else if(r.getAxisComponent().scrollZoomEnabled){var x=this._xAxisStartScaleDistance/s.pageX;if(Number.isFinite(x)){var C=10*(x-this._xAxisScale);this._xAxisScale=x,this._chart.getChartStore().zoom(C,null!==(n=this._xAxisStartScaleCoordinate)&&void 0!==n?n:void 0)}}return b;case Fe:var b;if(b=a.dispatchEvent("pressedMouseMoveEvent",s))this._chart.updatePane(1);else{u=r.getAxisComponent();if(null!==this._prevYAxisRange&&u.scrollZoomEnabled){var T,w,S=this._prevYAxisRange,P=(h=S.from,d=S.to,(T=S.range)*(x=s.pageY/this._yAxisStartScaleDistance));p=h-(w=(P-T)/2),g=d+w,v=u.valueToRealValue(p,{range:this._prevYAxisRange}),f=u.valueToRealValue(g,{range:this._prevYAxisRange}),y=u.realValueToDisplayValue(v,{range:this._prevYAxisRange}),m=u.realValueToDisplayValue(f,{range:this._prevYAxisRange});u.setRange({from:p,to:g,range:P,realFrom:v,realTo:f,realRange:f-v,displayFrom:y,displayTo:m,displayRange:m-y}),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})}}return b}}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 De:case Be:case Ae:case Fe:i=e.dispatchEvent("mouseUpEvent",n)}i&&this._chart.updatePane(1)}return this._mouseDownWidget=null,this._startScrollCoordinate=null,this._prevYAxisRange=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 De:case Ae:case Fe: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 De:var o=this._makeWidgetEvent(t,n);return n.dispatchEvent("mouseDoubleClickEvent",o);case Fe:var r=i.getAxisComponent();if(!r.getAutoCalcTickFlag())return r.setAutoCalcTickFlag(!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}),!0}return!1},t.prototype.mouseLeaveEvent=function(){return this._chart.getChartStore().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 De:var r=this._chart.getChartStore();if(n.dispatchEvent("mouseDownEvent",o))return this._touchCancelCrosshair=!0,this._touchCoordinate=null,r.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._flingScrollRequestId&&(ht(this._flingScrollRequestId),this._flingScrollRequestId=null),this._flingStartTime=(new Date).getTime(),this._startScrollCoordinate={x:o.x,y:o.y},r.startScroll(),this._touchZoomed=!1,null!==this._touchCoordinate){var a=o.x-this._touchCoordinate.x,s=o.y-this._touchCoordinate.y;Math.sqrt(a*a+s*s)<10?(this._touchCoordinate={x:o.x,y:o.y},r.setCrosshair({x:o.x,y:o.y,paneId:null==i?void 0:i.getId()})):(this._touchCoordinate=null,this._touchCancelCrosshair=!0,r.setCrosshair())}return!0;case Ae:case Fe:var l=n.dispatchEvent("mouseDownEvent",o);return l&&this._chart.updatePane(1),l}}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();switch(l){case De:if(a.dispatchEvent("pressedMouseMoveEvent",s))return null===(e=s.preventDefault)||void 0===e||e.call(s),u.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._touchCoordinate)null===(i=s.preventDefault)||void 0===i||i.call(s),u.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 c=s.x-this._startScrollCoordinate.x;u.scroll(c)}return!0;case Ae:case Fe:var h=a.dispatchEvent("pressedMouseMoveEvent",s);return h&&(null===(n=s.preventDefault)||void 0===n||n.call(s),this._chart.updatePane(1)),h}}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 De: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(o<200&&Math.abs(r)>0){var a=this._chart.getChartStore(),s=function(){e._flingScrollRequestId=ct((function(){a.startScroll(),a.scroll(r),r*=.975,Math.abs(r)<1?null!==e._flingScrollRequestId&&(ht(e._flingScrollRequestId),e._flingScrollRequestId=null):s()}))};s()}}return!0;case Ae:case Fe: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()===De){var s=this._makeWidgetEvent(t,n),l=this._chart.getChartStore();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()===De){var o=this._makeWidgetEvent(t,n);return this._touchCoordinate={x:o.x,y:o.y},this._chart.getChartStore().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.getSeparatorPanes(),l=this._chart.getStyles().separator.size;try{for(var u=g(s),c=u.next();!c.done;c=u.next()){var h=v(c.value,2)[1],d=(_=h.getBounding()).top-Math.round((7-l)/2);if(r>=_.left&&r<=_.left+_.width&&a>=d&&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.getDrawPanes(),f=null;try{for(var y=g(p),m=y.next();!m.done;m=y.next()){var _,x=m.value;if(r>=(_=x.getBounding()).left&&r<=_.left+_.width&&a>=_.top&&a<=_.top+_.height){f=x;break}}}catch(t){n={error:t}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}var C=null;if(null!==f){if(!L(C)){var b=f.getMainWidget(),T=b.getBounding();r>=T.left&&r<=T.left+T.width&&a>=T.top&&a<=T.top+T.height&&(C=b)}if(!L(C)){var w=f.getYAxisWidget();if(null!==w){var S=w.getBounding();r>=S.left&&r<=S.left+S.width&&a>=S.top&&a<=S.top+S.height&&(C=w)}}}return{pane:f,widget:C}},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 c(c({},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}();t.DomPosition=void 0,(Ni=t.DomPosition||(t.DomPosition={})).Root="root",Ni.Main="main",Ni.YAxis="yAxis";var Ji=function(){function e(t,e){this._chartBounding=lt(),this._drawPanes=[],this._separatorPanes=new Map,this._layoutOptions={measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!1,forceBuildYAxisTick:!1},this._layoutPending=!1,this._initContainer(t),this._chartEvent=new qi(this._chartContainer,this),this._chartStore=new Me(this,e),this._initPanes(e),this._layout()}return e.prototype._initContainer=function(t){this._container=t,this._chartContainer=mt("div",{position:"relative",width:"100%",height:"100%",outline:"none",borderStyle:"none",cursor:"crosshair",boxSizing:"border-box",userSelect:"none",webkitUserSelect:"none",overflow:"hidden",msUserSelect:"none",MozUserSelect:"none",webkitTapHighlightColor:"transparent"}),this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer),this._cacheChartBounding()},e.prototype._cacheChartBounding=function(){this._chartBounding.width=Math.floor(this._chartContainer.clientWidth),this._chartBounding.height=Math.floor(this._chartContainer.clientHeight)},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=function(t){var e,n;if(!L(i._candlePane)){var o=null!==(e=t.options)&&void 0!==e?e:{};M(o,{id:Se}),i._candlePane=i._createPane(ki,Se,o),(null!==(n=t.content)&&void 0!==n?n:[]).forEach((function(t){i.createIndicator(t,!0,o)}))}},r=function(t){if(!L(i._xAxisPane)){var e=i._createPane(Li,Ee,null!=t?t:{});i._xAxisPane=e}};n.forEach((function(t){var e;switch(t.type){case"candle":o(t);break;case"indicator":var n=null!==(e=t.content)&&void 0!==e?e:[];if(n.length>0){var a=null;n.forEach((function(e){L(a)?i.createIndicator(e,!0,{id:a}):a=i.createIndicator(e,!0,t.options)}))}break;case"xAxis":r(t.options)}})),o({}),r({order:Number.MAX_SAFE_INTEGER})},e.prototype._createPane=function(t,e,i){var n,o,r,a=null,s=null,l=null!==(n=null==i?void 0:i.order)&&void 0!==n?n:0;if(this._drawPanes.length>0&&(l<this._drawPanes[0].getOptions().order&&(s=new t(this._chartContainer,this._drawPanes[0].getContainer(),this,e,null!=i?i:{}),a=0),!L(s)))for(var u=1;u<this._drawPanes.length;u++){var c=this._drawPanes[u-1],h=this._drawPanes[u];if(l>=c.getOptions().order&&l<h.getOptions().order){var d=null;d=h.getId()!==Ee?null!==(r=null===(o=this._separatorPanes.get(h))||void 0===o?void 0:o.getContainer())&&void 0!==r?r:null:h.getContainer(),s=new t(this._chartContainer,d,this,e,null!=i?i:{}),a=u;break}}L(s)||(s=new t(this._chartContainer,null,this,e,null!=i?i:{}));var p=0;if(R(a)?(this._drawPanes.splice(a,0,s),p=a):(this._drawPanes.push(s),p=this._drawPanes.length-1),s.getId()!==Ee){var g=this._drawPanes[p+1];if(L(g)&&g.getId()===Ee&&(g=this._drawPanes[p+2]),L(g))L(v=this._separatorPanes.get(g))?v.setTopPane(s):(v=new Wi(this._chartContainer,g.getContainer(),this,"",s,g),this._separatorPanes.set(g,v));if(L(c=this._drawPanes[p-1])&&c.getId()===Ee&&(c=this._drawPanes[p-2]),L(c)){var v=new Wi(this._chartContainer,s.getContainer(),this,"",c,s);this._separatorPanes.set(s,v)}}return s},e.prototype._recalculatePaneHeight=function(t,e,i){if(0===i)return!1;var n=this._drawPanes.filter((function(e){var i=e.getId();return"normal"===e.getOptions().state&&i!==t.getId()&&i!==Ee})),o=n.length;if(0===o)return!1;if(t.getId()!==Se&&L(this._candlePane)&&"normal"===this._candlePane.getOptions().state){var r=this._candlePane.getBounding().height;if(r>0){var a=this._candlePane.getOptions().minHeight,s=r+i;s<a&&(e-=r+i-(s=a)),this._candlePane.setBounding({height:s})}}else{var l=i,u=Math.floor(i/o);n.forEach((function(t,e){var i=t.getBounding().height,n=0;(n=e===o-1?i+l:i+u)<t.getOptions().minHeight&&(n=t.getOptions().minHeight),t.setBounding({height:n}),l-=n-i})),Math.abs(l)>0&&(e-=l)}return t.setBounding({height:e}),!0},e.prototype.getDrawPaneById=function(t){if(t===Se)return this._candlePane;if(t===Ee)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.getXAxisPane=function(){return this._xAxisPane},e.prototype.getDrawPanes=function(){return this._drawPanes},e.prototype.getSeparatorPanes=function(){return this._separatorPanes},e.prototype.layout=function(t){var e,i,n,o,r,a=this;null!==(e=t.measureHeight)&&void 0!==e&&e&&(this._layoutOptions.measureHeight=t.measureHeight),null!==(i=t.measureWidth)&&void 0!==i&&i&&(this._layoutOptions.measureWidth=t.measureWidth),null!==(n=t.update)&&void 0!==n&&n&&(this._layoutOptions.update=t.update),null!==(o=t.buildYAxisTick)&&void 0!==o&&o&&(this._layoutOptions.buildYAxisTick=t.buildYAxisTick),null!==(r=t.buildYAxisTick)&&void 0!==r&&r&&(this._layoutOptions.forceBuildYAxisTick=t.forceBuildYAxisTick),this._layoutPending||(this._layoutPending=!0,Promise.resolve().then((function(t){a._layout(),a._layoutPending=!1})).catch((function(t){})))},e.prototype._layout=function(){var t=this,e=this._layoutOptions,i=e.measureHeight,n=e.measureWidth,o=e.update,r=e.buildYAxisTick,a=e.forceBuildYAxisTick;if(i){var s=this._chartBounding.height,l=this.getStyles().separator.size,u=this._xAxisPane.getAxisComponent().getAutoSize(),c=s-u;c<0&&(c=0),this._drawPanes.forEach((function(e){var i=e.getId();if(L(t._separatorPanes.get(e))&&(c-=l),i!==Ee&&i!==Se&&e.getVisible()){var n=e.getBounding().height;n>c?(n=c,c=0):c-=n,e.setBounding({height:n})}})),this._candlePane.setBounding({height:Math.max(c,0)}),this._xAxisPane.setBounding({height:u});var h=0;this._drawPanes.forEach((function(e){var i=t._separatorPanes.get(e);L(i)&&(i.setBounding({height:l,top:h}),h+=l),e.setBounding({top:h}),h+=e.getBounding().height}))}var d=n;if((r||a)&&this._drawPanes.forEach((function(t){var e=t.getAxisComponent().buildTicks(a);d||(d=e)})),d){var p=this._chartBounding.width,g=this.getStyles(),v=0,f=!0,y=0,m=!0;this._drawPanes.forEach((function(t){if(t.getId()!==Ee){var e=t.getAxisComponent(),i=e.inside,n=e.getAutoSize();e.position===Qe.Left?(v=Math.max(v,n),i&&(f=!1)):(y=Math.max(y,n),i&&(m=!1))}}));var _=p,x=0,C=0;f&&(_-=v,x=v),m&&(_-=y,C=y),this._chartStore.setTotalBarSpace(_);var b={width:p},T={width:_,left:x,right:C},w={width:v},S={width:y},P=g.separator.fill,E={};E=P?b:T,this._drawPanes.forEach((function(e){var i;null===(i=t._separatorPanes.get(e))||void 0===i||i.setBounding(E),e.setBounding(b,T,w,S)}))}o&&(this._xAxisPane.getAxisComponent().buildTicks(!0),this.updatePane(4)),this._layoutOptions={measureHeight:!1,measureWidth:!1,update:!1,buildYAxisTick:!1,forceBuildYAxisTick:!1}},e.prototype.updatePane=function(t,e){var i=this;if(L(e)){var n=this.getDrawPaneById(e);null==n||n.update(t)}else this._drawPanes.forEach((function(e){var n;e.update(t),null===(n=i._separatorPanes.get(e))||void 0===n||n.update(t)}))},e.prototype.crosshairChange=function(e){var i=this;if(this._chartStore.hasAction(t.ActionType.OnCrosshairChange)){var n={};this._drawPanes.forEach((function(t){var o=t.getId(),r={};i._chartStore.getIndicatorsByPaneId(o).forEach((function(t){var i,n=t.result;r[t.name]=n[null!==(i=e.dataIndex)&&void 0!==i?i:n.length-1]})),n[o]=r})),W(e.paneId)&&this._chartStore.executeAction(t.ActionType.OnCrosshairChange,c(c({},e),{indicatorData:n}))}},e.prototype.getDom=function(e,i){var n,o;if(!L(e))return this._chartContainer;var r=this.getDrawPaneById(e);if(L(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(!L(e))return this._chartBounding;var r=this.getDrawPaneById(e);if(L(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.setPrecision=function(t){this._chartStore.setPrecision(t)},e.prototype.getPrecision=function(){return this._chartStore.getPrecision()},e.prototype.setStyles=function(t){var e=this;this._setOptions((function(){e._chartStore.setStyles(t)}))},e.prototype.getStyles=function(){return this._chartStore.getStyles()},e.prototype.setCustomApi=function(t){var e=this;this._setOptions((function(){e._chartStore.setCustomApi(t)}))},e.prototype.getCustomApi=function(){return this._chartStore.getCustomApi()},e.prototype.setLocale=function(t){var e=this;this._setOptions((function(){e._chartStore.setLocale(t)}))},e.prototype.getLocale=function(){return this._chartStore.getLocale()},e.prototype.setTimezone=function(t){var e=this;this._setOptions((function(){e._chartStore.setTimezone(t)}))},e.prototype.getTimezone=function(){return this._chartStore.getTimezone()},e.prototype.setThousandsSeparator=function(t){var e=this;this._setOptions((function(){e._chartStore.setThousandsSeparator(t)}))},e.prototype.getThousandsSeparator=function(){return this._chartStore.getThousandsSeparator()},e.prototype.setDecimalFold=function(t){var e=this;this._setOptions((function(){e._chartStore.setDecimalFold(t)}))},e.prototype.getDecimalFold=function(){return this._chartStore.getDecimalFold()},e.prototype._setOptions=function(t){t(),this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.setOffsetRightDistance=function(t){this._chartStore.setOffsetRightDistance(t,!0)},e.prototype.getOffsetRightDistance=function(){return this._chartStore.getOffsetRightDistance()},e.prototype.setMaxOffsetLeftDistance=function(t){t<0||this._chartStore.setMaxOffsetLeftDistance(t)},e.prototype.setMaxOffsetRightDistance=function(t){t<0||this._chartStore.setMaxOffsetRightDistance(t)},e.prototype.setLeftMinVisibleBarCount=function(t){t<0||this._chartStore.setLeftMinVisibleBarCount(Math.ceil(t))},e.prototype.setRightMinVisibleBarCount=function(t){t<0||this._chartStore.setRightMinVisibleBarCount(Math.ceil(t))},e.prototype.setBarSpace=function(t){this._chartStore.setBarSpace(t)},e.prototype.getBarSpace=function(){return this._chartStore.getBarSpace()},e.prototype.getVisibleRange=function(){return this._chartStore.getVisibleRange()},e.prototype.clearData=function(){this._chartStore.clearData()},e.prototype.getDataList=function(){return this._chartStore.getDataList()},e.prototype.applyNewData=function(t,e){this._drawPanes.forEach((function(t){t.getAxisComponent().setAutoCalcTickFlag(!0)}));var i={forward:!1,backward:!1};O(e)?(i.forward=e,i.backward=e):i=c(c({},i),e),this._chartStore.addData(t,pt.Init,i)},e.prototype.updateData=function(t){this._chartStore.addData(t,pt.Update)},e.prototype.setLoadMoreDataCallback=function(t){this._chartStore.setLoadMoreDataCallback(t)},e.prototype.createIndicator=function(t,e,i){var n,o=W(t)?{name:t}:t;if(null===ee(o.name))return null;var r=c({},i);W(r.id)||(r.id=yt(Pe));var a=this.getDrawPaneById(r.id);return L(a)||(a=this._createPane(Ii,r.id,r),null!==(n=r.height)&&void 0!==n||(r.height=100)),this.setPaneOptions(r),this._chartStore.addIndicator(o,r.id,null!=e&&e)&&this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0}),r.id},e.prototype.overrideIndicator=function(t,e){return this._chartStore.overrideIndicator(t,e)},e.prototype.getIndicators=function(t){return this._chartStore.getIndicatorsByFilter(null!=t?t:{})},e.prototype.removeIndicator=function(t){var e=this,i=this._chartStore.removeIndicator(null!=t?t:{});if(i){var n=!1,o=[];this._drawPanes.forEach((function(t){var e=t.getId();e!==Se&&e!==Ee&&o.push(e)})),o.forEach((function(t){var i,o,r;if(!e._chartStore.hasIndicators(t)){var a=e._drawPanes.findIndex((function(e){return e.getId()===t})),s=e._drawPanes[a];if(L(s)){n=!0;var l=e._separatorPanes.get(s);if(L(l)){var u=l.getTopPane();try{for(var c=g(e._separatorPanes),h=c.next();!h.done;h=c.next()){var d=h.value;if(d[1].getTopPane().getId()===t){d[1].setTopPane(u);break}}}catch(t){i={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}l.destroy(),e._separatorPanes.delete(s)}e._recalculatePaneHeight(s,0,s.getBounding().height),e._drawPanes.splice(a,1),s.destroy();var p=e._drawPanes[0];L(p)&&p.getId()===Ee&&(p=e._drawPanes[1]),null===(r=e._separatorPanes.get(p))||void 0===r||r.destroy(),e._separatorPanes.delete(p)}}})),2===this._drawPanes.length&&(this._candlePane.setVisible(!0),this._candlePane.setBounding({height:this._chartBounding.height-this._xAxisPane.getBounding().height})),this.layout({measureHeight:n,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})}return i},e.prototype.createOverlay=function(t){var e=this,i=[],n=[],o=function(t){L(t.paneId)&&null!==e.getDrawPaneById(t.paneId)?n.push(!0):(t.paneId=Se,n.push(!1)),i.push(t)};W(t)?o({name:t}):A(t)?t.forEach((function(t){var e=null;e=W(t)?{name:t}:t,o(e)})):o(t);var r=this._chartStore.addOverlays(i,n);return A(t)?r:r[0]},e.prototype.getOverlays=function(t){return this._chartStore.getOverlaysByFilter(null!=t?t:{})},e.prototype.overrideOverlay=function(t){return this._chartStore.overrideOverlay(t)},e.prototype.removeOverlay=function(t){return this._chartStore.removeOverlay(null!=t?t:{})},e.prototype.setPaneOptions=function(t){var e,i,n,o=this,r=!1,a=!1,s=L(t.id),l=function(e){var i=e.getId();if(s&&t.id===i||!s){if(i!==Ee){if(R(t.height)&&t.height>0){var l=Math.max(null!==(n=t.minHeight)&&void 0!==n?n:e.getOptions().minHeight,0),h=Math.max(l,t.height);a=!0,r=!0,e.setOriginalBounding({height:h}),u._recalculatePaneHeight(e,h,-h)}if(L(t.state)&&e.getOptions().state!==t.state){r=!0,a=!0;var d=t.state;switch(d){case"maximize":if(!L(u._drawPanes.find((function(t){var e=t.getId();return"maximize"===t.getOptions().state&&e!==Ee})))){"normal"===e.getOptions().state&&e.setOriginalBounding({height:e.getBounding().height}),e.setOptions({state:d});var p=u._chartBounding.height;e.setBounding({height:p-u._xAxisPane.getBounding().height}),u._drawPanes.forEach((function(t){var e;t.getId()!==Ee&&t.getId()!==i&&(t.setBounding({height:t.getOriginalBounding().height}),t.setVisible(!1),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!1))}))}break;case"minimize":h=e.getBounding().height;var g=e.getOptions().state,v=h-30;"maximize"===g&&(v=e.getOriginalBounding().height-30),u._recalculatePaneHeight(e,30,v)&&("normal"===g&&e.setOriginalBounding({height:h}),e.setOptions({state:d})),u._drawPanes.forEach((function(t){var e;t.getId()!==Ee&&(t.setVisible(!0),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!0))}));break;default:h=e.getOriginalBounding().height;u._recalculatePaneHeight(e,h,e.getBounding().height-h)&&e.setOptions({state:d}),u._drawPanes.forEach((function(t){var e;t.getId()!==Ee&&(t.setVisible(!0),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!0))}))}}}L(t.axis)&&(a=!0);var f=c({},t);if(delete f.state,e.setOptions(f),i===t.id)return"break"}},u=this;try{for(var h=g(this._drawPanes),d=h.next();!d.done;d=h.next()){if("break"===l(d.value))break}}catch(t){e={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}a&&this.layout({measureHeight:r,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.getPaneOptions=function(t){var e;if(L(t)){var i=this.getDrawPaneById(t);return null!==(e=null==i?void 0:i.getOptions())&&void 0!==e?e:null}return this._drawPanes.map((function(t){return t.getOptions()}))},e.prototype.setZoomEnabled=function(t){this._chartStore.setZoomEnabled(t)},e.prototype.isZoomEnabled=function(){return this._chartStore.isZoomEnabled()},e.prototype.setScrollEnabled=function(t){this._chartStore.setScrollEnabled(t)},e.prototype.isScrollEnabled=function(){return this._chartStore.isScrollEnabled()},e.prototype.scrollByDistance=function(t,e){var i=this,n=R(e)&&e>0?e:0;if(this._chartStore.startScroll(),n>0){var o=new gt({duration:n});o.doFrame((function(e){var o=t*(e/n);i._chartStore.scroll(o)})),o.start()}else this._chartStore.scroll(t)},e.prototype.scrollToRealTime=function(t){var e=this._chartStore.getBarSpace().bar,i=(this._chartStore.getLastBarRightSideDiffBarCount()-this._chartStore.getInitialOffsetRightDistance()/e)*e;this.scrollByDistance(i,t)},e.prototype.scrollToDataIndex=function(t,e){var i=(this._chartStore.getLastBarRightSideDiffBarCount()+(this.getDataList().length-1-t))*this._chartStore.getBarSpace().bar;this.scrollByDistance(i,e)},e.prototype.scrollToTimestamp=function(t,e){var i=_t(this.getDataList(),"timestamp",t);this.scrollToDataIndex(i,e)},e.prototype.zoomAtCoordinate=function(t,e,i){var n=this,o=R(i)&&i>0?i:0,r=this._chartStore.getBarSpace().bar,a=r*t-r;if(o>0){var s=0,l=new gt({duration:o});l.doFrame((function(t){var i=a*(t/o),r=(i-s)/n._chartStore.getBarSpace().bar*10;n._chartStore.zoom(r,e),s=i})),l.start()}else this._chartStore.zoom(a/r*10,e)},e.prototype.zoomAtDataIndex=function(t,e,i){var n=this._chartStore.dataIndexToCoordinate(e);this.zoomAtCoordinate(t,{x:n,y:0},i)},e.prototype.zoomAtTimestamp=function(t,e,i){var n=_t(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,n,i)},e.prototype.convertToPixel=function(t,e){var i,n=this,o=null!=e?e:{},r=o.paneId,a=void 0===r?Se:r,s=o.absolute,l=void 0!==s&&s,u=[];if(a!==Ee){var c=this.getDrawPaneById(a);if(null!==c){var h=c.getBounding(),d=[].concat(t),p=this._xAxisPane.getAxisComponent(),g=c.getAxisComponent();u=d.map((function(t){var e={},i=t.dataIndex;if(R(t.timestamp)&&(i=n._chartStore.timestampToDataIndex(t.timestamp)),R(i)&&(e.x=p.convertToPixel(i)),R(t.value)){var o=g.convertToPixel(t.value);e.y=l?h.top+o:o}return e}))}}return A(t)?u:null!==(i=u[0])&&void 0!==i?i:{}},e.prototype.convertFromPixel=function(t,e){var i,n=this,o=null!=e?e:{},r=o.paneId,a=void 0===r?Se:r,s=o.absolute,l=void 0!==s&&s,u=[];if(a!==Ee){var c=this.getDrawPaneById(a);if(null!==c){var h=c.getBounding(),d=[].concat(t),p=this._xAxisPane.getAxisComponent(),g=c.getAxisComponent();u=d.map((function(t){var e,i={};if(R(t.x)){var o=p.convertFromPixel(t.x);i.dataIndex=o,i.timestamp=null!==(e=n._chartStore.dataIndexToTimestamp(o))&&void 0!==e?e:void 0}if(R(t.y)){var r=l?t.y-h.top:t.y;i.value=g.convertFromPixel(r)}return i}))}}return A(t)?u:null!==(i=u[0])&&void 0!==i?i:{}},e.prototype.executeAction=function(e,i){var n;if(e===t.ActionType.OnCrosshairChange){var o=c({},i);null!==(n=o.paneId)&&void 0!==n||(o.paneId=Se),this._chartStore.setCrosshair(o)}},e.prototype.subscribeAction=function(t,e){this._chartStore.subscribeAction(t,e)},e.prototype.unsubscribeAction=function(t,e){this._chartStore.unsubscribeAction(t,e)},e.prototype.getConvertPictureUrl=function(t,e,i){var n=this,o=this._chartBounding,r=o.width,a=o.height,s=mt("canvas",{width:"".concat(r,"px"),height:"".concat(a,"px"),boxSizing:"border-box"}),l=s.getContext("2d"),u=q(s);s.width=r*u,s.height=a*u,l.scale(u,u),l.fillStyle=null!=i?i:"#FFFFFF",l.fillRect(0,0,r,a);var c=null!=t&&t;return this._drawPanes.forEach((function(t){var e=n._separatorPanes.get(t);if(L(e)){var i=e.getBounding();l.drawImage(e.getImage(c),i.left,i.top,i.width,i.height)}var o=t.getBounding();l.drawImage(t.getImage(c),0,o.top,r,o.height)})),s.toDataURL("image/".concat(null!=e?e:"jpeg"))},e.prototype.resize=function(){this._cacheChartBounding(),this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.destroy=function(){var t=this;this._chartEvent.destroy(),this._drawPanes.forEach((function(e){var i;e.destroy(),null===(i=t._separatorPanes.get(e))||void 0===i||i.destroy()})),this._drawPanes=[],this._separatorPanes.clear(),this._container.removeChild(this._chartContainer)},e}(),Qi=new Map,$i=1;var tn={clone:D,merge:M,isString:W,isNumber:R,isValid:L,isObject:B,isArray:A,isFunction:F,isBoolean:O,formatValue:N,formatPrecision:X,formatBigNumber:G,formatDate:H,formatThousands:K,formatFoldDecimal:U,calcTextWidth:Q,getLinearSlopeIntercept:ue,getLinearYFromSlopeIntercept:se,getLinearYFromCoordinates:le,checkCoordinateOnArc:Ze,checkCoordinateOnCircle:ze,checkCoordinateOnLine:ae,checkCoordinateOnPolygon:Ne,checkCoordinateOnRect:He,checkCoordinateOnText:Ue};t.dispose=function(t){var e,i,n=null;if(t instanceof Ji)n=t.id;else{var o=null;n=null!==(e=null==(o=W(t)?document.getElementById(t):t)?void 0:o.getAttribute("k-line-chart-id"))&&void 0!==e?e:null}null!==n&&(null===(i=Qi.get(n))||void 0===i||i.destroy(),Qi.delete(n))},t.getFigureClass=function(t){var e;return null!==(e=Je[t])&&void 0!==e?e:null},t.getOverlayClass=function(t){var e;return null!==(e=Ce[t])&&void 0!==e?e:null},t.getSupportedFigures=function(){return Object.keys(Je)},t.getSupportedIndicators=function(){return Object.keys($t)},t.getSupportedLocales=function(){return Object.keys(di)},t.getSupportedOverlays=function(){return Object.keys(Ce)},t.init=function(t,e){var i=null;if(null===(i=W(t)?document.getElementById(t):t))return null;var n=Qi.get(i.id);if(L(n))return n;var o="k_line_chart_".concat($i++);return(n=new Ji(i,e)).id=o,i.setAttribute("k-line-chart-id",o),Qi.set(o,n),n},t.registerFigure=function(t){Je[t.name]=re.extend(t)},t.registerIndicator=function(t){$t[t.name]=ot.extend(t)},t.registerLocale=function(t,e){di[t]=c(c({},di[t]),e)},t.registerOverlay=function(t){Ce[t.name]=st.extend(t)},t.registerStyles=function(t,e){Te[t]=e},t.registerXAxis=function(t){Ri[t.name]=Bi.extend(t)},t.registerYAxis=function(t){Si[t.name]=bi.extend(t)},t.utils=tn,t.version=function(){return"10.0.0-alpha2"}}));
|