@ulachart/pro
Version:
Financial chart built out of the box based on Ula charts.
6 lines • 420 kB
JavaScript
(function(Me,Se){typeof exports=="object"&&typeof module<"u"?Se(exports):typeof define=="function"&&define.amd?define(["exports"],Se):(Me=typeof globalThis<"u"?globalThis:Me||self,Se(Me.chartspro={}))})(this,function(Me){"use strict";var wd=Object.defineProperty;var Sd=(Me,Se,W)=>Se in Me?wd(Me,Se,{enumerable:!0,configurable:!0,writable:!0,value:W}):Me[Se]=W;var rn=(Me,Se,W)=>(Sd(Me,typeof Se!="symbol"?Se+"":Se,W),W);/**
* @license
* @ula/charts v0.0.2
* Copyright (c) 2025 Exi.
* Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
*/var Se=function(e,t){return Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])},Se(e,t)};function W(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Se(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var V=function(){return V=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},V.apply(this,arguments)};function St(e,t,n,r){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function s(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):a(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})}function kt(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,a,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,a&&(i=c[0]&2?a.return:c[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,c[1])).done)return i;switch(a=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(u){c=[6,u],a=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function ft(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ke(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),a,i=[],o;try{for(;(t===void 0||t-- >0)&&!(a=r.next()).done;)i.push(a.value)}catch(s){o={error:s}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function Kt(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var ne;(function(e){e.Dashed="dashed",e.Solid="solid"})(ne||(ne={}));var J;(function(e){e.Stroke="stroke",e.Fill="fill",e.StrokeFill="stroke_fill"})(J||(J={}));var Mt;(function(e){e.Always="always",e.FollowCross="follow_cross",e.None="none"})(Mt||(Mt={}));var Xe;(function(e){e.Standard="standard",e.Rect="rect"})(Xe||(Xe={}));var Qe;(function(e){e.Left="left",e.Middle="middle",e.Right="right"})(Qe||(Qe={}));var an;(function(e){e.Fixed="fixed",e.Pointer="pointer"})(an||(an={}));var De;(function(e){e.CandleSolid="candle_solid",e.CandleStroke="candle_stroke",e.CandleUpStroke="candle_up_stroke",e.CandleDownStroke="candle_down_stroke",e.Ohlc="ohlc",e.Area="area"})(De||(De={}));var it;(function(e){e.Left="left",e.Right="right"})(it||(it={}));var be;(function(e){e.Normal="normal",e.Percentage="percentage",e.Log="log"})(be||(be={}));var on="#F92855",Bn="rgba(249, 40, 85, .7)",sn="#2DC08E",Rn="rgba(45, 192, 142, .7)",gt="#888888",ln="#FFFFFF",Te="#1677FF",pt="#76808F",Fn="#DDDDDD";function Tt(e){return"rgba(22, 119, 255, ".concat(e,")")}function lo(){function e(){return{show:!0,size:1,color:"#EDEDED",style:ne.Dashed,dashedValue:[2,2]}}return{show:!0,horizontal:e(),vertical:e()}}function co(){var e={show:!0,color:pt,textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"};return{type:De.CandleSolid,bar:{upColor:sn,downColor:on,noChangeColor:gt,upBorderColor:sn,downBorderColor:on,noChangeBorderColor:gt,upWickColor:sn,downWickColor:on,noChangeWickColor:gt},area:{lineSize:2,lineColor:Te,smooth:!1,value:"close",backgroundColor:[{offset:0,color:Tt(.01)},{offset:1,color:Tt(.2)}],point:{show:!0,color:Te,radius:4,rippleColor:Tt(.3),rippleRadius:8,animation:!0,animationDuration:1e3}},priceMark:{show:!0,high:V({},e),low:V({},e),last:{show:!0,upColor:sn,downColor:on,noChangeColor:gt,line:{show:!0,style:ne.Dashed,dashedValue:[4,4],size:1},text:{show:!0,style:J.Fill,size:12,paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderColor:"transparent",borderStyle:ne.Solid,borderSize:0,borderDashedValue:[2,2],color:ln,family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:Mt.Always,showType:Xe.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:an.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:pt,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}}function uo(){var e=["#FF9600","#935EBD",Te,"#E11D74","#01C5C4"].map(function(t){return{style:ne.Solid,smooth:!1,size:1,dashedValue:[2,2],color:t}});return{ohlc:{upColor:Rn,downColor:Bn,noChangeColor:gt},bars:[{style:J.Fill,borderStyle:ne.Solid,borderSize:1,borderDashedValue:[2,2],upColor:Rn,downColor:Bn,noChangeColor:gt}],lines:e,circles:[{style:J.Fill,borderStyle:ne.Solid,borderSize:1,borderDashedValue:[2,2],upColor:Rn,downColor:Bn,noChangeColor:gt}],lastValueMark:{show:!1,text:{show:!1,style:J.Fill,color:ln,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:ne.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:Mt.Always,showType:Xe.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:pt,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}}function Ar(){return{show:!0,size:"auto",axisLine:{show:!0,color:Fn,size:1},tickText:{show:!0,color:pt,size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:4},tickLine:{show:!0,size:1,length:3,color:Fn}}}function ho(){var e=Ar();return e.type=be.Normal,e.position=it.Right,e.inside=!1,e.reverse=!1,e}function vo(){function e(){return{show:!0,line:{show:!0,style:ne.Dashed,dashedValue:[4,2],size:1,color:pt},text:{show:!0,style:J.Fill,color:ln,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:ne.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:pt,borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:pt}}}return{show:!0,horizontal:e(),vertical:e()}}function fo(){var e=Tt(.35),t=Tt(.25);function n(){return{style:J.Fill,color:ln,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:ne.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:Te,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:Te}}return{point:{color:Te,borderColor:e,borderSize:1,radius:5,activeColor:Te,activeBorderColor:e,activeBorderSize:3,activeRadius:5},line:{style:ne.Solid,smooth:!1,color:Te,size:1,dashedValue:[2,2]},rect:{style:J.Fill,color:t,borderColor:Te,borderSize:1,borderRadius:0,borderStyle:ne.Solid,borderDashedValue:[2,2]},polygon:{style:J.Fill,color:Te,borderColor:Te,borderSize:1,borderStyle:ne.Solid,borderDashedValue:[2,2]},circle:{style:J.Fill,color:t,borderColor:Te,borderSize:1,borderStyle:ne.Solid,borderDashedValue:[2,2]},arc:{style:ne.Solid,color:Te,size:1,dashedValue:[2,2]},text:n(),rectText:n()}}function go(){return{size:1,color:Fn,fill:!0,activeBackgroundColor:Tt(.08)}}function po(){return{grid:lo(),candle:co(),indicator:uo(),xAxis:Ar(),yAxis:ho(),separator:go(),crosshair:vo(),overlay:fo()}}var _o=process.env.NODE_ENV==="development";function Nn(e,t,n,r,a,i){if(_o){var o=r!==""?"Call api `".concat(r,"`").concat(a!==""||i!==""?", ":"."):"",s=a!==""?"invalid parameter `".concat(a,"`").concat(i!==""?", ":"."):"",l=i!==""?i:"";console.log(e,t,n,o,s,l)}}function Ve(e,t,n){Nn("%c😑 klinecharts warning%c %s%s%s","padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#FF9600","color:#FF9600",e,t,n??"")}function mo(e,t,n){Nn("%c😟 klinecharts error%c %s%s%s","padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#F92855;","color:#F92855;",e,t,n)}function yo(){Nn("%c❤️ Welcome to klinecharts. Version is 0.0.2","border-radius:4px;border:dashed 1px #1677FF;line-height:70px;padding:0 20px;margin:16px 0;font-size:14px;color:#1677FF;","","","","")}function Le(e,t){if(!(!Ue(e)&&!Ue(t))){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=e[n],a=t[n];Ue(a)&&Ue(r)?Le(r,a):L(t[n])&&(e[n]=Lt(t[n]))}}}function Lt(e){if(!Ue(e))return e;var t;Be(e)?t=[]:t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];Ue(r)?t[n]=Lt(r):t[n]=r}return t}function Be(e){return Object.prototype.toString.call(e)==="[object Array]"}function Ye(e){return typeof e=="function"}function Ue(e){return typeof e=="object"&&L(e)}function O(e){return typeof e=="number"&&!isNaN(e)}function L(e){return e!=null}function ot(e){return typeof e=="boolean"}function K(e){return typeof e=="string"}var $o=/\\(\\)?/g,Co=RegExp(`[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,"g");function me(e,t,n){if(L(e)){var r=[];t.replace(Co,function(s){for(var l=[],c=1;c<arguments.length;c++)l[c-1]=arguments[c];var u=s;return L(l[1])?u=l[2].replace($o,"$1"):L(l[0])&&(u=l[0].trim()),r.push(u),""});for(var a=e,i=0,o=r.length;L(a)&&i<o;)a=a==null?void 0:a[r[i++]];return L(a)?a:n??"--"}return n??"--"}function Ir(e,t,n){var r={};return e.formatToParts(new Date(t)).forEach(function(a){var i=a.type,o=a.value;switch(i){case"year":{r.YYYY=o;break}case"month":{r.MM=o;break}case"day":{r.DD=o;break}case"hour":{r.HH=o==="24"?"00":o;break}case"minute":{r.mm=o;break}case"second":{r.ss=o;break}}}),n.replace(/YYYY|MM|DD|HH|mm|ss/g,function(a){return r[a]})}function ue(e,t){var n=+e;return O(n)?n.toFixed(t??2):"".concat(e)}function Er(e){var t=+e;if(O(t)){if(t>1e9)return"".concat(+(t/1e9).toFixed(3),"B");if(t>1e6)return"".concat(+(t/1e6).toFixed(3),"M");if(t>1e3)return"".concat(+(t/1e3).toFixed(3),"K")}return"".concat(e)}function ge(e,t){var n="".concat(e);if(t.length===0)return n;if(n.includes(".")){var r=n.split(".");return"".concat(r[0].replace(/(\d)(?=(\d{3})+$)/g,function(a){return"".concat(a).concat(t)}),".").concat(r[1])}return n.replace(/(\d)(?=(\d{3})+$)/g,function(a){return"".concat(a).concat(t)})}function pe(e,t){var n="".concat(e),r=new RegExp("\\.0{"+t+",}[1-9][0-9]*$");if(r.test(n)){var a=n.split("."),i=a[a.length-1],o=i.match(/0*/);if(L(o)){var s=o[0].length;return a[a.length-1]=i.replace(/0*/,"0{".concat(s,"}")),a.join(".")}}return n}var Xt;function st(e){var t,n,r;return(r=(n=(t=e.ownerDocument)===null||t===void 0?void 0:t.defaultView)===null||n===void 0?void 0:n.devicePixelRatio)!==null&&r!==void 0?r:1}function _t(e,t,n){return"".concat(t??"normal"," ").concat(e??12,"px ").concat(n??"Helvetica Neue")}function Yt(e,t,n,r){if(!L(Xt)){var a=document.createElement("canvas"),i=st(a);Xt=a.getContext("2d"),Xt.scale(i,i)}return Xt.font=_t(t,n,r),Math.round(Xt.measureText(e).width)}var Ae;(function(e){e.OnDataReady="onDataReady",e.OnZoom="onZoom",e.OnScroll="onScroll",e.OnVisibleRangeChange="onVisibleRangeChange",e.OnTooltipIconClick="onTooltipIconClick",e.OnCrosshairChange="onCrosshairChange",e.OnCandleBarClick="onCandleBarClick",e.OnPaneDrag="onPaneDrag"})(Ae||(Ae={}));var bo=function(){function e(){this._callbacks=[]}return e.prototype.subscribe=function(t){var n,r=(n=this._callbacks.indexOf(t))!==null&&n!==void 0?n:-1;r<0&&this._callbacks.push(t)},e.prototype.unsubscribe=function(t){var n;if(Ye(t)){var r=(n=this._callbacks.indexOf(t))!==null&&n!==void 0?n:-1;r>-1&&this._callbacks.splice(r,1)}else this._callbacks=[]},e.prototype.execute=function(t){this._callbacks.forEach(function(n){n(t)})},e.prototype.isEmpty=function(){return this._callbacks.length===0},e}(),Re;(function(e){e.Init="init",e.Forward="forward",e.Backward="backward"})(Re||(Re={}));var Ie;(function(e){e.Normal="normal",e.Price="price",e.Volume="volume"})(Ie||(Ie={}));function On(e,t,n,r,a){var i=t.result,o=t.figures,s=t.styles,l=me(s,"circles",r.circles),c=l.length,u=me(s,"bars",r.bars),h=u.length,d=me(s,"lines",r.lines),f=d.length,v=0,g=0,p=0,_,y=0;o.forEach(function($){var m;switch($.type){case"circle":{y=v;var C=l[v%c];_=V(V({},C),{color:C.noChangeColor}),v++;break}case"bar":{y=g;var b=u[g%h];_=V(V({},b),{color:b.noChangeColor}),g++;break}case"line":{y=p,_=d[p%f],p++;break}}if(L(_)){var x={prev:{kLineData:e[n-1],indicatorData:i[n-1]},current:{kLineData:e[n],indicatorData:i[n]},next:{kLineData:e[n+1],indicatorData:i[n+1]}},S=(m=$.styles)===null||m===void 0?void 0:m.call($,x,t,r);a($,V(V({},_),S),y)}})}var xo=function(){function e(t){this.result=[],this._precisionFlag=!1;var n=t.name,r=t.shortName,a=t.series,i=t.calcParams,o=t.figures,s=t.precision,l=t.shouldOhlc,c=t.shouldFormatBigNumber,u=t.visible,h=t.zLevel,d=t.minValue,f=t.maxValue,v=t.styles,g=t.extendData,p=t.regenerateFigures,_=t.createTooltipDataSource,y=t.draw;this.name=n,this.shortName=r??n,this.series=a??Ie.Normal,this.precision=s??4,this.calcParams=i??[],this.figures=o??[],this.shouldOhlc=l??!1,this.shouldFormatBigNumber=c??!1,this.visible=u??!0,this.zLevel=h??0,this.minValue=d??null,this.maxValue=f??null,this.styles=Lt(v??{}),this.extendData=g,this.regenerateFigures=p??null,this.createTooltipDataSource=_??null,this.draw=y??null}return e.prototype.setShortName=function(t){return this.shortName!==t?(this.shortName=t,!0):!1},e.prototype.setSeries=function(t){return this.series!==t?(this.series=t,!0):!1},e.prototype.setPrecision=function(t,n){var r=n??!1,a=Math.floor(t);return a!==this.precision&&t>=0&&(!r||r&&!this._precisionFlag)?(this.precision=a,r||(this._precisionFlag=!0),!0):!1},e.prototype.setCalcParams=function(t){var n,r;return this.calcParams=t,this.figures=(r=(n=this.regenerateFigures)===null||n===void 0?void 0:n.call(this,t))!==null&&r!==void 0?r:this.figures,!0},e.prototype.setShouldOhlc=function(t){return this.shouldOhlc!==t?(this.shouldOhlc=t,!0):!1},e.prototype.setShouldFormatBigNumber=function(t){return this.shouldFormatBigNumber!==t?(this.shouldFormatBigNumber=t,!0):!1},e.prototype.setVisible=function(t){return this.visible!==t?(this.visible=t,!0):!1},e.prototype.setZLevel=function(t){return this.zLevel!==t?(this.zLevel=t,!0):!1},e.prototype.setStyles=function(t){return Le(this.styles,t),!0},e.prototype.setExtendData=function(t){return this.extendData!==t?(this.extendData=t,!0):!1},e.prototype.setFigures=function(t){return this.figures!==t?(this.figures=t,!0):!1},e.prototype.setMinValue=function(t){return this.minValue!==t?(this.minValue=t,!0):!1},e.prototype.setMaxValue=function(t){return this.maxValue!==t?(this.maxValue=t,!0):!1},e.prototype.setRegenerateFigures=function(t){return this.regenerateFigures!==t?(this.regenerateFigures=t,!0):!1},e.prototype.setCreateTooltipDataSource=function(t){return this.createTooltipDataSource!==t?(this.createTooltipDataSource=t,!0):!1},e.prototype.setDraw=function(t){return this.draw!==t?(this.draw=t,!0):!1},e.prototype.calcIndicator=function(t){return St(this,void 0,void 0,function(){var n;return kt(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.calc(t,this)];case 1:return n=r.sent(),this.result=n,[2,!0];case 2:return r.sent(),[2,!1];case 3:return[2]}})})},e.extend=function(t){var n=function(r){W(a,r);function a(){return r.call(this,t)||this}return a.prototype.calc=function(i,o){return t.calc(i,o)},a}(e);return n},e}(),At;(function(e){e.Normal="normal",e.WeakMagnet="weak_magnet",e.StrongMagnet="strong_magnet"})(At||(At={}));function wo(){return["mouseClickEvent","mouseDoubleClickEvent","mouseRightClickEvent","tapEvent","doubleTapEvent","mouseDownEvent","touchStartEvent","mouseMoveEvent","touchMoveEvent"]}var Pr=1,Ht=-1,So="overlay_",It="overlay_figure_",Dr=function(){function e(t){this.currentStep=Pr,this.points=[],this._prevPressedPoint=null,this._prevPressedPoints=[];var n=t.mode,r=t.modeSensitivity,a=t.extendData,i=t.styles,o=t.name,s=t.totalStep,l=t.lock,c=t.visible,u=t.zLevel,h=t.needDefaultPointFigure,d=t.needDefaultXAxisFigure,f=t.needDefaultYAxisFigure,v=t.createPointFigures,g=t.createXAxisFigures,p=t.createYAxisFigures,_=t.performEventPressedMove,y=t.performEventMoveForDrawing,$=t.onDrawStart,m=t.onDrawing,C=t.onDrawEnd,b=t.onClick,x=t.onDoubleClick,S=t.onRightClick,w=t.onPressedMoveStart,k=t.onPressedMoving,M=t.onPressedMoveEnd,I=t.onMouseEnter,D=t.onMouseLeave,B=t.onRemoved,U=t.onSelected,j=t.onDeselected;this.name=o,this.totalStep=!O(s)||s<2?1:s,this.lock=l??!1,this.visible=c??!0,this.zLevel=u??0,this.needDefaultPointFigure=h??!1,this.needDefaultXAxisFigure=d??!1,this.needDefaultYAxisFigure=f??!1,this.mode=n??At.Normal,this.modeSensitivity=r??8,this.extendData=a,this.styles=Lt(i??{}),this.createPointFigures=v??null,this.createXAxisFigures=g??null,this.createYAxisFigures=p??null,this.performEventPressedMove=_??null,this.performEventMoveForDrawing=y??null,this.onDrawStart=$??null,this.onDrawing=m??null,this.onDrawEnd=C??null,this.onClick=b??null,this.onDoubleClick=x??null,this.onRightClick=S??null,this.onPressedMoveStart=w??null,this.onPressedMoving=k??null,this.onPressedMoveEnd=M??null,this.onMouseEnter=I??null,this.onMouseLeave=D??null,this.onRemoved=B??null,this.onSelected=U??null,this.onDeselected=j??null}return e.prototype.setId=function(t){return K(this.id)?!1:(this.id=t,!0)},e.prototype.setGroupId=function(t){return K(this.groupId)?!1:(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):!1},e.prototype.setStyles=function(t){return Le(this.styles,t),!0},e.prototype.setPoints=function(t){if(t.length>0){var n=void 0;if(this.points=Kt([],Ke(t),!1),t.length>=this.totalStep-1?(this.currentStep=Ht,n=this.totalStep-1):(this.currentStep=t.length+1,n=t.length),this.performEventMoveForDrawing!==null)for(var r=0;r<n;r++)this.performEventMoveForDrawing({currentStep:r+2,mode:this.mode,points:this.points,performPointIndex:r,performPoint:this.points[r]});return this.currentStep===Ht&&this.performEventPressedMove!==null&&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):!1},e.prototype.setVisible=function(t){return this.visible!==t?(this.visible=t,!0):!1},e.prototype.setZLevel=function(t){return this.zLevel!==t?(this.zLevel=t,!0):!1},e.prototype.setMode=function(t){return this.mode!==t?(this.mode=t,!0):!1},e.prototype.setModeSensitivity=function(t){return this.modeSensitivity!==t?(this.modeSensitivity=t,!0):!1},e.prototype.setOnDrawStartCallback=function(t){return this.onDrawStart!==t?(this.onDrawStart=t,!0):!1},e.prototype.setOnDrawingCallback=function(t){return this.onDrawing!==t?(this.onDrawing=t,!0):!1},e.prototype.setOnDrawEndCallback=function(t){return this.onDrawEnd!==t?(this.onDrawEnd=t,!0):!1},e.prototype.setOnClickCallback=function(t){return this.onClick!==t?(this.onClick=t,!0):!1},e.prototype.setOnDoubleClickCallback=function(t){return this.onDoubleClick!==t?(this.onDoubleClick=t,!0):!1},e.prototype.setOnRightClickCallback=function(t){return this.onRightClick!==t?(this.onRightClick=t,!0):!1},e.prototype.setOnPressedMoveStartCallback=function(t){return this.onPressedMoveStart!==t?(this.onPressedMoveStart=t,!0):!1},e.prototype.setOnPressedMovingCallback=function(t){return this.onPressedMoving!==t?(this.onPressedMoving=t,!0):!1},e.prototype.setOnPressedMoveEndCallback=function(t){return this.onPressedMoveEnd!==t?(this.onPressedMoveEnd=t,!0):!1},e.prototype.setOnMouseEnterCallback=function(t){return this.onMouseEnter!==t?(this.onMouseEnter=t,!0):!1},e.prototype.setOnMouseLeaveCallback=function(t){return this.onMouseLeave!==t?(this.onMouseLeave=t,!0):!1},e.prototype.setOnRemovedCallback=function(t){return this.onRemoved!==t?(this.onRemoved=t,!0):!1},e.prototype.setOnSelectedCallback=function(t){return this.onSelected!==t?(this.onSelected=t,!0):!1},e.prototype.setOnDeselectedCallback=function(t){return this.onDeselected!==t?(this.onDeselected=t,!0):!1},e.prototype.nextStep=function(){this.currentStep===this.totalStep-1?this.currentStep=Ht:this.currentStep++},e.prototype.forceComplete=function(){this.currentStep=Ht},e.prototype.isDrawing=function(){return this.currentStep!==Ht},e.prototype.isStart=function(){return this.currentStep===Pr},e.prototype.eventMoveForDrawing=function(t){var n,r=this.currentStep-1,a={};O(t.timestamp)&&(a.timestamp=t.timestamp),O(t.dataIndex)&&(a.dataIndex=t.dataIndex),O(t.value)&&(a.value=t.value),this.points[r]=a,(n=this.performEventMoveForDrawing)===null||n===void 0||n.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:r,performPoint:a})},e.prototype.eventPressedPointMove=function(t,n){var r;O(t.dataIndex)&&(this.points[n].dataIndex=t.dataIndex,this.points[n].timestamp=t.timestamp),O(t.value)&&(this.points[n].value=t.value),(r=this.performEventPressedMove)===null||r===void 0||r.call(this,{currentStep:this.currentStep,points:this.points,mode:this.mode,performPointIndex:n,performPoint:this.points[n]})},e.prototype.startPressedMove=function(t){this._prevPressedPoint=V({},t),this._prevPressedPoints=Lt(this.points)},e.prototype.eventPressedOtherMove=function(t,n){if(this._prevPressedPoint!==null){var r;O(t.dataIndex)&&O(this._prevPressedPoint.dataIndex)&&(r=t.dataIndex-this._prevPressedPoint.dataIndex);var a;O(t.value)&&O(this._prevPressedPoint.value)&&(a=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map(function(i){var o;O(i.timestamp)&&(i.dataIndex=n.timestampToDataIndex(i.timestamp));var s=V({},i);return O(r)&&O(i.dataIndex)&&(s.dataIndex=i.dataIndex+r,s.timestamp=(o=n.dataIndexToTimestamp(s.dataIndex))!==null&&o!==void 0?o:void 0),O(a)&&O(i.value)&&(s.value=i.value+a),s})}},e.extend=function(t){var n=function(r){W(a,r);function a(){return r.call(this,t)||this}return a}(e);return n},e}(),de;(function(e){e[e.Tooltip=0]="Tooltip",e[e.Crosshair=1]="Crosshair",e[e.XAxis=2]="XAxis"})(de||(de={}));function ko(){return{formatDate:Ir,formatBigNumber:Er}}var Mo="en-US",zn=-1;function cn(e){return Ye(window.requestAnimationFrame)?window.requestAnimationFrame(e):window.setTimeout(e,20)}function Br(e){Ye(window.cancelAnimationFrame)?window.cancelAnimationFrame(e):window.clearTimeout(e)}var Vn=function(){function e(t){this._options={duration:500,iterationCount:1},this._currentIterationCount=0,this._running=!1,this._time=0,Le(this._options,t)}return e.prototype._loop=function(){var t=this;this._running=!0;var n=function(){var r;if(t._running){var a=new Date().getTime()-t._time;a<t._options.duration?((r=t._doFrameCallback)===null||r===void 0||r.call(t,a),cn(n)):(t.stop(),t._currentIterationCount++,t._currentIterationCount<t._options.iterationCount&&t.start())}};cn(n)},e.prototype.doFrame=function(t){return this._doFrameCallback=t,this},e.prototype.setDuration=function(t){return this._options.duration=t,this},e.prototype.setIterationCount=function(t){return this._options.iterationCount=t,this},e.prototype.start=function(){this._running||(this._time=new Date().getTime(),this._loop())},e.prototype.stop=function(){var t;this._running&&((t=this._doFrameCallback)===null||t===void 0||t.call(this,this._options.duration)),this._running=!1},e}(),Un=1,Rr=new Date().getTime();function Fr(e){var t=new Date().getTime();return t===Rr?++Un:Un=1,Rr=t,"".concat(e??"").concat(t,"_").concat(Un)}function Je(e,t){var n,r=document.createElement(e),a=t??{};for(var i in a)r.style[i]=(n=a[i])!==null&&n!==void 0?n:"";return r}function jn(e,t,n){var r=0,a=0;for(a=e.length-1;r!==a;){var i=Math.floor((a+r)/2),o=a-r,s=e[i][t];if(n===e[r][t])return r;if(n===e[a][t])return a;if(n===s)return i;if(n>s?r=i:a=i,o<=2)break}return r}function To(e){var t=Math.floor(Zt(e)),n=mt(t),r=e/n,a=0;return r<1.5?a=1:r<2.5?a=2:r<3.5?a=3:r<4.5?a=4:r<5.5?a=5:r<6.5?a=6:a=8,e=a*n,t>=-20?+e.toFixed(t<0?-t:0):e}function Nr(e,t){t==null&&(t=10),t=Math.min(Math.max(0,t),20);var n=(+e).toFixed(t);return+n}function Lo(e){var t=e.toString(),n=t.indexOf("e");if(n>0){var r=+t.slice(n+1);return r<0?-r:0}else{var a=t.indexOf(".");return a<0?0:t.length-1-a}}function Or(e,t,n){var r=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER];return e.forEach(function(a){var i,o;r[0]=Math.max((i=a[t])!==null&&i!==void 0?i:a,r[0]),r[1]=Math.min((o=a[n])!==null&&o!==void 0?o:a,r[1])}),r}function Zt(e){return Math.log(e)/Math.log(10)}function mt(e){return Math.pow(10,e)}function zr(){return{from:0,to:0,realFrom:0,realTo:0}}var Vr={MIN:1,MAX:50},Ao=8,Io=80,Eo=.88,Wn=10,Po=function(){function e(t){this._dateTimeFormat=this._buildDateTimeFormat(),this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=Ao,this._offsetRightDistance=Io,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange=zr(),this._chartStore=t,this._gapBarSpace=this._calcGapBarSpace(),this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace}return e.prototype._calcGapBarSpace=function(){var t;return this._barSpace>3?t=Math.floor(this._barSpace*Eo):(t=Math.floor(this._barSpace),t===this._barSpace&&t--),t%2===0&&t--,t=Math.max(1,t),t},e.prototype.adjustVisibleRange=function(){var t,n,r=this._chartStore.getDataList(),a=r.length,i=this._totalBarSpace/this._barSpace,o,s;this._scrollLimitRole===1?(o=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,s=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(o=this._minVisibleBarCount.left,s=this._minVisibleBarCount.right),o=Math.max(0,o),s=Math.max(0,s);var l=i-Math.min(o,a);this._lastBarRightSideDiffBarCount>l&&(this._lastBarRightSideDiffBarCount=l);var c=-a+Math.min(s,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-i)-1;d<0&&(d=0);var f=this._lastBarRightSideDiffBarCount>0?Math.round(a+this._lastBarRightSideDiffBarCount-i)-1:d;if(this._visibleRange={from:d,to:u,realFrom:f,realTo:h},this._chartStore.getActionStore().execute(Ae.OnVisibleRangeChange,this._visibleRange),this._chartStore.adjustVisibleDataList(),d===0){var v=r[0];this._chartStore.executeLoadMoreCallback((t=v==null?void 0:v.timestamp)!==null&&t!==void 0?t:null),this._chartStore.executeLoadDataCallback({type:Re.Forward,data:v??null})}u===a&&this._chartStore.executeLoadDataCallback({type:Re.Backward,data:(n=r[a-1])!==null&&n!==void 0?n:null})},e.prototype.getDateTimeFormat=function(){return this._dateTimeFormat},e.prototype._buildDateTimeFormat=function(t){var n={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"};K(t)&&(n.timeZone=t);var r=null;try{r=new Intl.DateTimeFormat("en",n)}catch{Ve("","","Timezone is error!!!")}return r},e.prototype.setTimezone=function(t){var n=this._buildDateTimeFormat(t);n!==null&&(this._dateTimeFormat=n)},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:Math.floor(this._gapBarSpace/2)}},e.prototype.setBarSpace=function(t,n){t<Vr.MIN||t>Vr.MAX||this._barSpace===t||(this._barSpace=t,this._gapBarSpace=this._calcGapBarSpace(),n==null||n(),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,n){return this._offsetRightDistance=this._scrollLimitRole===1?Math.min(this._maxOffsetDistance.right,t):t,this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace,(n??!1)&&(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(t){if(this._scrollEnabled){var n=t/this._barSpace,r=this._lastBarRightSideDiffBarCount*this._barSpace;this._lastBarRightSideDiffBarCount=this._startLastBarRightSideDiffBarCount-n,this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0);var a=Math.round(r-this._lastBarRightSideDiffBarCount*this._barSpace);a!==0&&this._chartStore.getActionStore().execute(Ae.OnScroll,{distance:a})}},e.prototype.getDataByDataIndex=function(t){var n;return(n=this._chartStore.getDataList()[t])!==null&&n!==void 0?n:null},e.prototype.coordinateToFloatIndex=function(t){var n=this._chartStore.getDataList().length,r=(this._totalBarSpace-t)/this._barSpace,a=n+this._lastBarRightSideDiffBarCount-r;return Math.round(a*1e6)/1e6},e.prototype.dataIndexToTimestamp=function(t){var n,r=this.getDataByDataIndex(t);return(n=r==null?void 0:r.timestamp)!==null&&n!==void 0?n:null},e.prototype.timestampToDataIndex=function(t){var n=this._chartStore.getDataList();return n.length===0?0:jn(n,"timestamp",t)},e.prototype.dataIndexToCoordinate=function(t){var n=this._chartStore.getDataList().length,r=n+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(r-.5)*this._barSpace)},e.prototype.coordinateToDataIndex=function(t){return Math.ceil(this.coordinateToFloatIndex(t))-1},e.prototype.zoom=function(t,n){var r=this,a;if(this._zoomEnabled){var i=n??null;if(!O(i==null?void 0:i.x)){var o=this._chartStore.getTooltipStore().getCrosshair();i={x:(a=o==null?void 0:o.x)!==null&&a!==void 0?a:this._totalBarSpace/2}}var s=i.x,l=this.coordinateToFloatIndex(s),c=this._barSpace,u=this._barSpace+t*(this._barSpace/Wn);this.setBarSpace(u,function(){r._lastBarRightSideDiffBarCount+=l-r.coordinateToFloatIndex(s)});var h=this._barSpace/c;h!==1&&this._chartStore.getActionStore().execute(Ae.OnZoom,{scale:h})}},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=zr()},e}(),Do={name:"AVP",shortName:"AVP",series:Ie.Price,precision:2,figures:[{key:"avp",title:"AVP: ",type:"line"}],calc:function(e){var t=0,n=0;return e.map(function(r){var a,i,o={},s=(a=r==null?void 0:r.turnover)!==null&&a!==void 0?a:0,l=(i=r==null?void 0:r.volume)!==null&&i!==void 0?i:0;return t+=s,n+=l,n!==0&&(o.avp=t/n),o})}},Bo={name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(e,t,n){var r,a,i,o,s=e.prev,l=e.current,c=(a=(r=s.indicatorData)===null||r===void 0?void 0:r.ao)!==null&&a!==void 0?a:Number.MIN_SAFE_INTEGER,u=(o=(i=l.indicatorData)===null||i===void 0?void 0:i.ao)!==null&&o!==void 0?o:Number.MIN_SAFE_INTEGER,h;u>c?h=me(t.styles,"bars[0].upColor",n.bars[0].upColor):h=me(t.styles,"bars[0].downColor",n.bars[0].downColor);var d=u>c?J.Stroke:J.Fill;return{color:h,style:d,borderColor:h}}}],calc:function(e,t){var n=t.calcParams,r=Math.max(n[0],n[1]),a=0,i=0,o=0,s=0;return e.map(function(l,c){var u={},h=(l.low+l.high)/2;if(a+=h,i+=h,c>=n[0]-1){o=a/n[0];var d=e[c-(n[0]-1)];a-=(d.low+d.high)/2}if(c>=n[1]-1){s=i/n[1];var d=e[c-(n[1]-1)];i-=(d.low+d.high)/2}return c>=r-1&&(u.ao=o-s),u})}},Ro={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(e){return e.map(function(t,n){return{key:"bias".concat(n+1),title:"BIAS".concat(t,": "),type:"line"}})},calc:function(e,t){var n=t.calcParams,r=t.figures,a=[];return e.map(function(i,o){var s={},l=i.close;return n.forEach(function(c,u){var h;if(a[u]=((h=a[u])!==null&&h!==void 0?h:0)+l,o>=c-1){var d=a[u]/n[u];s[r[u].key]=(l-d)/d*100,a[u]-=e[o-(c-1)].close}}),s})}};function Fo(e,t){var n=e.length,r=0;return e.forEach(function(a){var i=a.close-t;r+=i*i}),r=Math.abs(r),Math.sqrt(r/n)}var No={name:"BOLL",shortName:"BOLL",series:Ie.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(e,t){var n=t.calcParams,r=n[0]-1,a=0;return e.map(function(i,o){var s=i.close,l={};if(a+=s,o>=r){l.mid=a/n[0];var c=Fo(e.slice(o-r,o+1),l.mid);l.up=l.mid+n[1]*c,l.dn=l.mid-n[1]*c,a-=e[o-r].close}return l})},styles:{lineStyles:{up:{color:"#FF0000",style:"solid",width:1},mid:{color:"#00FF00",style:"dashed",width:1},dn:{color:"#0000FF",style:"solid",width:1}},band:{show:!0,color:"rgba(0, 0, 255, 0.1)"}}},Oo={name:"BRAR",shortName:"BRAR",calcParams:[26],figures:[{key:"br",title:"BR: ",type:"line"},{key:"ar",title:"AR: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=0,a=0,i=0,o=0;return e.map(function(s,l){var c,u,h={},d=s.high,f=s.low,v=s.open,g=((c=e[l-1])!==null&&c!==void 0?c:s).close;if(i+=d-v,o+=v-f,r+=d-g,a+=g-f,l>=n[0]-1){o!==0?h.ar=i/o*100:h.ar=0,a!==0?h.br=r/a*100:h.br=0;var p=e[l-(n[0]-1)],_=p.high,y=p.low,$=p.open,m=((u=e[l-n[0]])!==null&&u!==void 0?u:e[l-(n[0]-1)]).close;r-=_-m,a-=m-y,i-=_-$,o-=$-y}return h})}},zo={name:"BBI",shortName:"BBI",series:Ie.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=Math.max.apply(Math,Kt([],Ke(n),!1)),a=[],i=[];return e.map(function(o,s){var l={},c=o.close;if(n.forEach(function(h,d){var f;a[d]=((f=a[d])!==null&&f!==void 0?f:0)+c,s>=h-1&&(i[d]=a[d]/h,a[d]-=e[s-(h-1)].close)}),s>=r-1){var u=0;i.forEach(function(h){u+=h}),l.bbi=u/4}return l})}},Vo={name:"CCI",shortName:"CCI",calcParams:[20],figures:[{key:"cci",title:"CCI: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=n[0]-1,a=0,i=[];return e.map(function(o,s){var l={},c=(o.high+o.low+o.close)/3;if(a+=c,i.push(c),s>=r){var u=a/n[0],h=i.slice(s-r,s+1),d=0;h.forEach(function(g){d+=Math.abs(g-u)});var f=d/n[0];l.cci=f!==0?(c-u)/f/.015:0;var v=(e[s-r].high+e[s-r].low+e[s-r].close)/3;a-=v}return l})}},Uo={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(e,t){var n=t.calcParams,r=Math.ceil(n[1]/2.5+1),a=Math.ceil(n[2]/2.5+1),i=Math.ceil(n[3]/2.5+1),o=Math.ceil(n[4]/2.5+1),s=0,l=[],c=0,u=[],h=0,d=[],f=0,v=[],g=[];return e.forEach(function(p,_){var y,$,m,C,b,x={},S=(y=e[_-1])!==null&&y!==void 0?y:p,w=(S.high+S.close+S.low+S.open)/4,k=Math.max(0,p.high-w),M=Math.max(0,w-p.low);_>=n[0]-1&&(M!==0?x.cr=k/M*100:x.cr=0,s+=x.cr,c+=x.cr,h+=x.cr,f+=x.cr,_>=n[0]+n[1]-2&&(l.push(s/n[1]),_>=n[0]+n[1]+r-3&&(x.ma1=l[l.length-1-r]),s-=($=g[_-(n[1]-1)].cr)!==null&&$!==void 0?$:0),_>=n[0]+n[2]-2&&(u.push(c/n[2]),_>=n[0]+n[2]+a-3&&(x.ma2=u[u.length-1-a]),c-=(m=g[_-(n[2]-1)].cr)!==null&&m!==void 0?m:0),_>=n[0]+n[3]-2&&(d.push(h/n[3]),_>=n[0]+n[3]+i-3&&(x.ma3=d[d.length-1-i]),h-=(C=g[_-(n[3]-1)].cr)!==null&&C!==void 0?C:0),_>=n[0]+n[4]-2&&(v.push(f/n[4]),_>=n[0]+n[4]+o-3&&(x.ma4=v[v.length-1-o]),f-=(b=g[_-(n[4]-1)].cr)!==null&&b!==void 0?b:0)),g.push(x)}),g}},jo={name:"DMA",shortName:"DMA",calcParams:[10,50,10],figures:[{key:"dma",title:"DMA: ",type:"line"},{key:"ama",title:"AMA: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=Math.max(n[0],n[1]),a=0,i=0,o=0,s=[];return e.forEach(function(l,c){var u,h={},d=l.close;a+=d,i+=d;var f=0,v=0;if(c>=n[0]-1&&(f=a/n[0],a-=e[c-(n[0]-1)].close),c>=n[1]-1&&(v=i/n[1],i-=e[c-(n[1]-1)].close),c>=r-1){var g=f-v;h.dma=g,o+=g,c>=r+n[2]-2&&(h.ama=o/n[2],o-=(u=s[c-(n[2]-1)].dma)!==null&&u!==void 0?u:0)}s.push(h)}),s}},Wo={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(e,t){var n=t.calcParams,r=0,a=0,i=0,o=0,s=0,l=0,c=0,u=0,h=[];return e.forEach(function(d,f){var v,g,p={},_=(v=e[f-1])!==null&&v!==void 0?v:d,y=_.close,$=d.high,m=d.low,C=$-m,b=Math.abs($-y),x=Math.abs(y-m),S=$-_.high,w=_.low-m,k=Math.max(Math.max(C,b),x),M=S>0&&S>w?S:0,I=w>0&&w>S?w:0;if(r+=k,a+=M,i+=I,f>=n[0]-1){f>n[0]-1?(o=o-o/n[0]+k,s=s-s/n[0]+M,l=l-l/n[0]+I):(o=r,s=a,l=i);var D=0,B=0;o!==0&&(D=s*100/o,B=l*100/o),p.pdi=D,p.mdi=B;var U=0;B+D!==0&&(U=Math.abs(B-D)/(B+D)*100),c+=U,f>=n[0]*2-2&&(f>n[0]*2-2?u=(u*(n[0]-1)+U)/n[0]:u=c/n[0],p.adx=u,f>=n[0]*2+n[1]-3&&(p.adxr=(((g=h[f-(n[1]-1)].adx)!==null&&g!==void 0?g:0)+u)/2))}h.push(p)}),h}},Ko={name:"EMV",shortName:"EMV",calcParams:[14,9],figures:[{key:"emv",title:"EMV: ",type:"line"},{key:"maEmv",title:"MAEMV: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=0,a=[];return e.map(function(i,o){var s,l={};if(o>0){var c=e[o-1],u=i.high,h=i.low,d=(s=i.volume)!==null&&s!==void 0?s:0,f=(u+h)/2-(c.high+c.low)/2;if(d===0||u-h===0)l.emv=0;else{var v=d/1e8/(u-h);l.emv=f/v}r+=l.emv,a.push(l.emv),o>=n[0]&&(l.maEmv=r/n[0],r-=a[o-n[0]])}return l})}},Xo={name:"EMA",shortName:"EMA",series:Ie.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(e){return e.map(function(t,n){return{key:"ema".concat(n+1),title:"EMA".concat(t,": "),type:"line"}})},calc:function(e,t){var n=t.calcParams,r=t.figures,a=0,i=[];return e.map(function(o,s){var l={},c=o.close;return a+=c,n.forEach(function(u,h){s>=u-1&&(s>u-1?i[h]=(2*c+(u-1)*i[h])/(u+1):i[h]=a/u,l[r[h].key]=i[h])}),l})}},Yo={name:"MTM",shortName:"MTM",calcParams:[12,6],figures:[{key:"mtm",title:"MTM: ",type:"line"},{key:"maMtm",title:"MAMTM: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=0,a=[];return e.forEach(function(i,o){var s,l={};if(o>=n[0]){var c=i.close,u=e[o-n[0]].close;l.mtm=c-u,r+=l.mtm,o>=n[0]+n[1]-1&&(l.maMtm=r/n[1],r-=(s=a[o-(n[1]-1)].mtm)!==null&&s!==void 0?s:0)}a.push(l)}),a}},Ho={name:"MA",shortName:"MA",series:Ie.Price,calcParams:[5,10,30,60],precision:2,shouldOhlc:!0,figures:[{key:"ma5",title:"MA5: ",type:"line"},{key:"ma10",title:"MA10: ",type:"line"},{key:"ma30",title:"MA30: ",type:"line"},{key:"ma60",title:"MA60: ",type:"line"}],regenerateFigures:function(e){return e.map(function(t,n){return{key:"ma".concat(n+1),title:"MA".concat(t,": "),type:"line"}})},calc:function(e,t){var n=t.calcParams,r=t.figures,a=[];return e.map(function(i,o){var s={},l=i.close;return n.forEach(function(c,u){var h;a[u]=((h=a[u])!==null&&h!==void 0?h:0)+l,o>=c-1&&(s[r[u].key]=a[u]/c,a[u]-=e[o-(c-1)].close)}),s})}},Zo={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,t,n){var r,a,i,o,s=e.prev,l=e.current,c=(a=(r=s.indicatorData)===null||r===void 0?void 0:r.macd)!==null&&a!==void 0?a:Number.MIN_SAFE_INTEGER,u=(o=(i=l.indicatorData)===null||i===void 0?void 0:i.macd)!==null&&o!==void 0?o:Number.MIN_SAFE_INTEGER,h;u>0?h=me(t.styles,"bars[0].upColor",n.bars[0].upColor):u<0?h=me(t.styles,"bars[0].downColor",n.bars[0].downColor):h=me(t.styles,"bars[0].noChangeColor",n.bars[0].noChangeColor);var d=c<u?J.Stroke:J.Fill;return{style:d,color:h,borderColor:h}}}],calc:function(e,t){var n=t.calcParams,r=0,a,i,o=0,s=0,l=0,c=Math.max(n[0],n[1]);return e.map(function(u,h){var d={},f=u.close;return r+=f,h>=n[0]-1&&(h>n[0]-1?a=(2*f+(n[0]-1)*a)/(n[0]+1):a=r/n[0]),h>=n[1]-1&&(h>n[1]-1?i=(2*f+(n[1]-1)*i)/(n[1]+1):i=r/n[1]),h>=c-1&&(o=a-i,d.dif=o,s+=o,h>=c+n[2]-2&&(h>c+n[2]-2?l=(o*2+l*(n[2]-1))/(n[2]+1):l=s/n[2],d.macd=(o-l)*2,d.dea=l)),d})}},Go={name:"OBV",shortName:"OBV",calcParams:[30],figures:[{key:"obv",title:"OBV: ",type:"line"},{key:"maObv",title:"MAOBV: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=0,a=0,i=[];return e.forEach(function(o,s){var l,c,u,h,d=(l=e[s-1])!==null&&l!==void 0?l:o;o.close<d.close?a-=(c=o.volume)!==null&&c!==void 0?c:0:o.close>d.close&&(a+=(u=o.volume)!==null&&u!==void 0?u:0);var f={obv:a};r+=a,s>=n[0]-1&&(f.maObv=r/n[0],r-=(h=i[s-(n[0]-1)].obv)!==null&&h!==void 0?h:0),i.push(f)}),i}},Qo={name:"PVT",shortName:"PVT",figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(e){var t=0;return e.map(function(n,r){var a,i,o={},s=n.close,l=(a=n.volume)!==null&&a!==void 0?a:1,c=((i=e[r-1])!==null&&i!==void 0?i:n).close,u=0,h=c*l;return h!==0&&(u=(s-c)/h),t+=u,o.pvt=t,o})}},Jo={name:"PSY",shortName:"PSY",calcParams:[12,6],figures:[{key:"psy",title:"PSY: ",type:"line"},{key:"maPsy",title:"MAPSY: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=0,a=0,i=[],o=[];return e.forEach(function(s,l){var c,u,h={},d=((c=e[l-1])!==null&&c!==void 0?c:s).close,f=s.close-d>0?1:0;i.push(f),r+=f,l>=n[0]-1&&(h.psy=r/n[0]*100,a+=h.psy,l>=n[0]+n[1]-2&&(h.maPsy=a/n[1],a-=(u=o[l-(n[1]-1)].psy)!==null&&u!==void 0?u:0),r-=i[l-(n[0]-1)]),o.push(h)}),o}},qo={name:"ROC",shortName:"ROC",calcParams:[12,6],figures:[{key:"roc",title:"ROC: ",type:"line"},{key:"maRoc",title:"MAROC: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=[],a=0;return e.forEach(function(i,o){var s,l,c={};if(o>=n[0]-1){var u=i.close,h=((s=e[o-n[0]])!==null&&s!==void 0?s:e[o-(n[0]-1)]).close;h!==0?c.roc=(u-h)/h*100:c.roc=0,a+=c.roc,o>=n[0]-1+n[1]-1&&(c.maRoc=a/n[1],a-=(l=r[o-(n[1]-1)].roc)!==null&&l!==void 0?l:0)}r.push(c)}),r}},es={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(e){return e.map(function(t,n){var r=n+1;return{key:"rsi".concat(r),title:"RSI".concat(r,": "),type:"line"}})},calc:function(e,t){var n=t.calcParams,r=t.figures,a=[],i=[];return e.map(function(o,s){var l,c={},u=((l=e[s-1])!==null&&l!==void 0?l:o).close,h=o.close-u;return n.forEach(function(d,f){var v,g,p;if(h>0?a[f]=((v=a[f])!==null&&v!==void 0?v:0)+h:i[f]=((g=i[f])!==null&&g!==void 0?g:0)+Math.abs(h),s>=d-1){i[f]!==0?c[r[f].key]=100-100/(1+a[f]/i[f]):c[r[f].key]=0;var _=e[s-(d-1)],y=(p=e[s-d])!==null&&p!==void 0?p:_,$=_.close-y.close;$>0?a[f]-=$:i[f]-=Math.abs($)}}),c})}},ts={name:"SMA",shortName:"SMA",series:Ie.Price,calcParams:[12,2],precision:2,figures:[{key:"sma",title:"SMA: ",type:"line"}],shouldOhlc:!0,calc:function(e,t){var n=t.calcParams,r=0,a=0;return e.map(function(i,o){var s={},l=i.close;return r+=l,o>=n[0]-1&&(o>n[0]-1?a=(l*n[1]+a*(n[0]-n[1]+1))/(n[0]+1):a=r/n[0],s.sma=a),s})}},ns={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(e,t){var n=t.calcParams,r=[];return e.forEach(function(a,i){var o,s,l,c,u={},h=a.close;if(i>=n[0]-1){var d=Or(e.slice(i-(n[0]-1),i+1),"high","low"),f=d[0],v=d[1],g=f-v,p=(h-v)/(g===0?1:g)*100;u.k=((n[1]-1)*((s=(o=r[i-1])===null||o===void 0?void 0:o.k)!==null&&s!==void 0?s:50)+p)/n[1],u.d=((n[2]-1)*((c=(l=r[i-1])===null||l===void 0?void 0:l.d)!==null&&c!==void 0?c:50)+u.k)/n[2],u.j=3*u.k-2*u.d}r.push(u)}),r}},rs={name:"SAR",shortName:"SAR",series:Ie.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(e,t,n){var r,a,i=e.current,o=(a=(r=i.indicatorData)===null||r===void 0?void 0:r.sar)!==null&&a!==void 0?a:Number.MIN_SAFE_INTEGER,s=i.kLineData,l=((s==null?void 0:s.high)+(s==null?void 0:s.low))/2,c=o<l?me(t.styles,"circles[0].upColor",n.circles[0].upColor):me(t.styles,"circles[0].downColor",n.circles[0].downColor);return{color:c}}}],calc:function(e,t){var n=t.calcParams,r=n[0]/100,a=n[1]/100,i=n[2]/100,o=r,s=-100,l=!1,c=0;return e.map(function(u,h){var d=c,f=u.high,v=u.low;if(l){(s===-100||s<f)&&(s=f,o=Math.min(o+a,i)),c=d+o*(s-d);var g=Math.min(e[Math.max(1,h)-1].low,v);c>u.low?(c=s,o=r,s=-100,l=!l):c>g&&(c=g)}else{(s===-100||s>v)&&(s=v,o=Math.min(o+a,i)),c=d+o*(s-d);var p=Math.max(e[Math.max(1,h)-1].high,f);c<u.high?(c=s,o=0,s=-100,l=!l):c<p&&(c=p)}return{sar:c}})}},as={name:"TRIX",shortName:"TRIX",calcParams:[12,9],figures:[{key:"trix",title:"TRIX: ",type:"line"},{key:"maTrix",title:"MATRIX: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=0,a,i,o,s=0,l=0,c=0,u=[];return e.forEach(function(h,d){var f,v={},g=h.close;if(r+=g,d>=n[0]-1&&(d>n[0]-1?a=(2*g+(n[0]-1)*a)/(n[0]+1):a=r/n[0],s+=a,d>=n[0]*2-2&&(d>n[0]*2-2?i=(2*a+(n[0]-1)*i)/(n[0]+1):i=s/n[0],l+=i,d>=n[0]*3-3))){var p=void 0,_=0;d>n[0]*3-3?(p=(2*i+(n[0]-1)*o)/(n[0]+1),_=(p-o)/o*100):p=l/n[0],o=p,v.trix=_,c+=_,d>=n[0]*3+n[1]-4&&(v.maTrix=c/n[1],c-=(f=u[d-(n[1]-1)].trix)!==null&&f!==void 0?f:0)}u.push(v)}),u}};function Ur(){return{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(e,t,n){var r=e.current.kLineData,a=me(t.styles,"bars[0].noChangeColor",n.bars[0].noChangeColor);return L(r)&&(r.close>r.open?a=me(t.styles,"bars[0].upColor",n.bars[0].upColor):r.close<r.open&&(a=me(t.styles,"bars[0].downColor",n.bars[0].downColor))),{color:a}}}}var is={name:"VOL",shortName:"VOL",series:Ie.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"},Ur()],regenerateFigures:function(e){var t=e.map(function(n,r){return{key:"ma".concat(r+1),title:"MA".concat(n,": "),type:"line"}});return t.push(Ur()),t},calc:function(e,t){var n=t.calcParams,r=t.figures,a=[];return e.map(function(i,o){var s,l=(s=i.volume)!==null&&s!==void 0?s:0,c={volume:l};return n.forEach(function(u,h){var d,f;a[h]=((d=a[h])!==null&&d!==void 0?d:0)+l,o>=u-1&&(c[r[h].key]=a[h]/u,a[h]-=(f=e[o-(u-1)].volume)!==null&&f!==void 0?f:0)}),c})}},os={name:"VR",shortName:"VR",calcParams:[26,6],figures:[{key:"vr",title:"VR: ",type:"line"},{key:"maVr",title:"MAVR: ",type:"line"}],calc:function(e,t){var n=t.calcParams,r=0,a=0,i=0,o=0,s=[];return e.forEach(function(l,c){var u,h,d,f,v,g={},p=l.close,_=((u=e[c-1])!==null&&u!==void 0?u:l).close,y=(h=l.volume)!==null&&h!==void 0?h:0;if(p>_?r+=y:p<_?a+=y:i+=y,c>=n[0]-1){var $=i/2;a+$===0?g.vr=0:g.vr=(r+$)/(a+$)*100,o+=g.vr,c>=n[0]+n[1]-2&&(g.maVr=o/n[1],o-=(d=s[c-(n[1]-1)].vr)!==null&&d!==void 0?d:0);var m=e[c-(n[0]-1)],C=(f=e[c-n[0]])!==null&&f!==void 0?f:m,b=m.close,x=(v=m.volume)!==null&&v!==void 0?v:0;b>C.close?r-=x:b<C.close?a-=x:i-=x}s.push(g)}),s}},ss={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(e){return e.map(function(t,n){return{key:"wr".concat(n+1),title:"WR".concat(n+1,": "),type:"line"}})},calc:function(e,t){var n=t.calcParams,r=t.figures;return e.map(function(a,i){var o={},s=a.close;return n.forEach(function(l,c){var u=l-1;if(