/*
    *
    * Wijmo Library 5.20181.462
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}();define(["require","exports","wijmo/wijmo","wijmo/wijmo.chart","wijmo/wijmo.chart.finance","wijmo/wijmo.chart.finance.analytics"],function(t,e,i,s,a,n){"use strict";function l(t){return isFinite(t)&&!isNaN(t)&&i.isNumber(t)}function r(t,e,s,n,l){i.asArray(t,!1),i.asArray(e,!1),i.asArray(s,!1),i.asInt(n,!1,!0),i.asNumber(l,!1,!0);var r,o,h=a._minimum(t.length,e.length,s.length),_=[],u=[],c=[];for(i.assert(h>n&&n>1,"CCI period must be an integer less than the length of the data and greater than one."),o=0;o<h;o++)_.push(a._average(t[o],e[o],s[o]));r=a._sma(_,n);var p;for(o=0;o<r.length;o++)p=_.slice(o,n+o).reduce(function(t,e){return t+Math.abs(r[o]-e)},0),u.push(p/n);for(_.splice(0,n-1),o=0;o<r.length;o++)c.push((_[o]-r[o])/(l*u[o]));return c}function o(t,e,s,n){i.asArray(t,!1),i.asArray(e,!1),i.asArray(s,!1),i.asInt(n,!1,!0);var l,r=a._minimum(t.length,e.length,s.length),o=[],h=[],_=[];for(i.assert(r>n&&n>1,"Williams %R period must be an integer less than the length of the data and greater than one."),l=n;l<=t.length;l++)o.push(a._maximum(t.slice(l-n,l))),h.push(a._minimum(e.slice(l-n,l)));for(s.splice(0,n-1),l=0;l<o.length;l++)_.push((o[l]-s[l])/(o[l]-h[l])*-100);return _}function h(t,e,s){i.asArray(t,!1),i.asInt(e,!1,!0),i.asNumber(s,!1,!0),i.assert(t.length>e&&e>1,"Bollinger Bands period must be an integer less than the length of the data and greater than one.");var n,l=a._sma(t,e),r=[];for(n=e;n<=t.length;n++)r.push(a._stdDeviation(t.slice(n-e,n)));var o=l,h=l.map(function(t,e){return t+r[e]*s});return{lowers:l.map(function(t,e){return t-r[e]*s}),middles:o,uppers:h}}function _(t,e){i.asArray(t,!1),i.asInt(e,!0,!1),i.assert(t.length>e&&e>1,"RSI period must be an integer less than the length of the data and greater than one.");var s,n,l,r,o=[],h=[],_=[],u=[];for(r=1;r<t.length;r++)o.push(t[r]-t[r-1]);for(s=o.map(function(t){return t>0?t:0}),n=o.map(function(t){return t<0?Math.abs(t):0}),r=e;r<=o.length;r++)r===e?(h.push(a._sum(s.slice(r-e,r))/e),_.push(a._sum(n.slice(r-e,r))/e)):(h.push((s[r-1]+h[r-e-1]*(e-1))/e),_.push((n[r-1]+_[r-e-1]*(e-1))/e)),l=h[r-e]/_[r-e],l=isFinite(l)?l:0,u.push(100-100/(1+l));return u}function u(t,e,s,n){i.asArray(t,!1),i.asInt(e,!1,!0),i.asInt(s,!1,!0),i.asInt(n,!1,!0);var l,r=e>s;r&&(l=s,s=e,e=l);var o,h,_=a._ema(t,e),u=a._ema(t,s),c=[],p=[];for(_.splice(0,s-e),h=0;h<_.length;h++)l=_[h]-u[h],r&&(l*=-1),c.push(l);o=a._ema(c,n);var d=c.slice(c.length-o.length,c.length);for(h=0;h<d.length;h++)p.push(d[h]-o[h]);return{macds:c,signals:o,histograms:p}}function c(t,e,s,n,l,r){i.asArray(t,!1),i.asArray(e,!1),i.asArray(s,!1),i.asInt(n,!1,!0),i.asInt(l,!1,!0),i.asInt(r,!0,!0);var o,h,_=[],u=[],c=[];for(h=n;h<=t.length;h++)_.push(a._maximum(t.slice(h-n,h))),u.push(a._minimum(e.slice(h-n,h)));for(s=s.slice(n-1),h=0;h<s.length;h++)c.push((s[h]-u[h])/(_[h]-u[h])*100);return r&&r>1&&(c=a._sma(c,r)),o=a._sma(c,l),{ks:c,ds:o}}Object.defineProperty(e,"__esModule",{value:!0});var p=n||e;window.wijmo=window.wijmo||{},window.wijmo.chart=window.wijmo.chart||{},window.wijmo.chart.finance=window.wijmo.chart.finance||{},window.wijmo.chart.finance.analytics=p;var d=function(t){function e(e){var i=t.call(this)||this;return i._levels=[0,23.6,38.2,50,61.8,100],i._uptrend=!0,i._labelPosition=s.LabelPosition.Left,i.rendering.addHandler(i._render),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"low",{get:function(){return this._low},set:function(t){t!=this._low&&(this._low=i.asNumber(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"high",{get:function(){return this._high},set:function(t){t!=this._high&&(this._high=i.asNumber(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){(t=i.asEnum(t,s.LabelPosition,!0))!=this._labelPosition&&(this._labelPosition=t,this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uptrend",{get:function(){return this._uptrend},set:function(t){t!=this._uptrend&&(this._uptrend=i.asBoolean(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!=this._levels&&(this._levels=i.asArray(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minX",{get:function(){return this._minX},set:function(t){t!=this._minX&&(this._minX=t,this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxX",{get:function(){return this._maxX},set:function(t){t!=this._maxX&&(this._maxX=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._getMinX=function(){return i.isNumber(this._minX)?this._minX:i.isDate(this._minX)?i.asDate(this._minX).valueOf():this._getAxisX().actualMin},e.prototype._getMaxX=function(){return i.isNumber(this._maxX)?this._maxX:i.isDate(this._maxX)?i.asDate(this._maxX).valueOf():this._getAxisX().actualMax},e.prototype._updateLevels=function(){var e=void 0,i=void 0;if(void 0===this._low||void 0===this._high){var s=t.prototype.getValues.call(this,0),a=t.prototype.getValues.call(this,1);if(s)for(var n=s.length,l=this._getMinX(),r=this._getMaxX(),o=0;o<n;o++){var h=s[o],_=a?a[o]:o;_<l||_>r||(isNaN(h)||((void 0===e||e>h)&&(e=h),(void 0===i||i<h)&&(i=h)))}}void 0===this._low&&void 0!==e?this._actualLow=e:this._actualLow=this._low,void 0===this._high&&void 0!==i?this._actualHigh=i:this._actualHigh=this._high},e.prototype._render=function(t,e){e.cancel=!0;var a=t;a._updateLevels();var n=a._getAxisX(),l=a._getAxisY(),r=e.engine,o=a._getSymbolStroke(a._chart.series.indexOf(a)),h=s._BasePlotter.cloneStyle(a.style,["fill"]),_=s._BasePlotter.cloneStyle(a.style,["stroke"]),u=a.chart._plotrectId;r.stroke=o,r.strokeWidth=2,r.textFill=o;var c=a._getMinX(),p=a._getMaxX();c<n.actualMin&&(c=n.actualMin),p>n.actualMax&&(p=n.actualMax),r.startGroup(null,u);for(var d=a._levels?a._levels.length:0,g=0;g<d;g++){var f=a._levels[g],y=n.convert(c),m=n.convert(p),v=a.uptrend?l.convert(a._actualLow+.01*f*(a._actualHigh-a._actualLow)):l.convert(a._actualHigh-.01*f*(a._actualHigh-a._actualLow));if(s._DataInfo.isValid(y)&&s._DataInfo.isValid(m)&&s._DataInfo.isValid(v)&&(r.drawLine(y,v,m,v,null,h),a.labelPosition!=s.LabelPosition.None)){var V=f.toFixed(1)+"%",b=0;switch((a.uptrend&&0==g||!a.uptrend&&g==d-1)&&(b=2),a.labelPosition){case s.LabelPosition.Left:s.FlexChartCore._renderText(r,V,new i.Point(y,v),0,b,null,null,_);break;case s.LabelPosition.Center:s.FlexChartCore._renderText(r,V,new i.Point(.5*(y+m),v),1,b,null,null,_);break;case s.LabelPosition.Right:s.FlexChartCore._renderText(r,V,new i.Point(m,v),2,b,null,null,_)}}}r.stroke=null,r.strokeWidth=null,r.textFill=null,r.endGroup()},e.prototype._getChartType=function(){return s.ChartType.Line},e}(s.SeriesBase);e.Fibonacci=d;var g=function(t){function e(e){var i=t.call(this)||this;return i._levels=[38.2,50,61.8],i._labelPosition=s.LabelPosition.Top,i.rendering.addHandler(i._render,i),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"start",{get:function(){return this._start},set:function(t){t!==this.start&&(this._start=i.asType(t,s.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},set:function(t){t!==this.end&&(this._end=i.asType(t,s.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!==this._levels&&(this._levels=i.asArray(t,!1),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){(t=i.asEnum(t,s.LabelPosition))!==this.labelPosition&&(this._labelPosition=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._render=function(e,a){a.cancel=!0;var n=this._getX(0),r=this._getY(0),o=this._getX(1),h=this._getY(1);if(!(t.prototype._getLength.call(this)<=1)&&l(n)&&l(r)&&l(o)&&l(h)){var _,u=this._getAxisX(),c=this._getAxisY(),p=a.engine,d=this.chart.series.indexOf(this),g=this._getSymbolStroke(d),f=s._BasePlotter.cloneStyle(this.style,["fill"]),y=s._BasePlotter.cloneStyle(this.style,["stroke"]);p.stroke=g,p.strokeWidth=2,p.textFill=g;var m,v,V,b,x,P,w,k,L,X=this.chart._plotrectId,M=h-r;_=p.startGroup(null,X),i.addClass(_,"fibonacci-arcs"),l(n)&&l(r)&&l(o)&&l(h)&&p.drawLines([u.convert(n),u.convert(o)],[c.convert(r),c.convert(h)],null,f),b=Math.sqrt(Math.pow(u.convert(o)-u.convert(n),2)+Math.pow(c.convert(h)-c.convert(r),2)),P=new i.Point(o,h);for(var I=0;I<this.levels.length;I++)if(w=.01*this.levels[I],x=Math.abs(b*w),l(P.x)&&l(P.y)&&l(x)&&(m=u.convert(P.x),v=c.convert(P.y),p.drawDonutSegment(m,v,x,x,M>0?0:Math.PI,Math.PI,null,f),this.labelPosition!==s.LabelPosition.None&&0!==w)){switch(L=i.Globalize.format(w,"p1"),k=p.measureString(L,null,null,y),V=M<=0?v-x:v+x,this.labelPosition){case s.LabelPosition.Center:V+=.5*k.height;break;case s.LabelPosition.Bottom:V+=M<=0?k.height:0;break;default:V+=M<=0?0:k.height}p.drawString(L,new i.Point(m-.5*k.width,V),null,y)}p.stroke=null,p.strokeWidth=null,p.textFill=null,p.endGroup()}},e.prototype._getX=function(t){var e=null;return 0===t&&this.start?e=this.start.x:1===t&&this.end&&(e=this.end.x),i.isDate(e)&&(e=i.asDate(e).valueOf()),e},e.prototype._getY=function(t){var e=null;return 0===t&&this.start?e=this.start.y:1===t&&this.end&&(e=this.end.y),e},e.prototype._getChartType=function(){return s.ChartType.Line},e}(s.SeriesBase);e.FibonacciArcs=g;var f=function(t){function e(e){var i=t.call(this)||this;return i._levels=[0,23.6,38.2,50,61.8,100],i._labelPosition=s.LabelPosition.Top,i.rendering.addHandler(i._render,i),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"start",{get:function(){return this._start},set:function(t){t!==this.start&&(this._start=i.asType(t,s.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},set:function(t){t!==this.end&&(this._end=i.asType(t,s.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!==this._levels&&(this._levels=i.asArray(t,!1),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){(t=i.asEnum(t,s.LabelPosition))!==this.labelPosition&&(this._labelPosition=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._updateLevels=function(){if(!this.start||!this.end){var e,i,n,r,o=this.chart._getPlotter(this),h=this._getAxisX(),_=t.prototype.getValues.call(this,0),u=t.prototype.getValues.call(this,1)||o.dataInfo.getXVals();_&&_.length>0&&(n=a._minimum(_),r=a._maximum(_)),u&&u.length>0?(e=a._minimum(u),i=a._maximum(u)):(e=h.actualMin,i=h.actualMax),l(e)&&l(n)&&l(i)&&l(r)&&(this.start=new s.DataPoint(e,n),this.end=new s.DataPoint(i,r))}},e.prototype._render=function(e,a){a.cancel=!0,this._updateLevels();var n=this._getX(0),r=this._getY(0),o=this._getX(1),h=this._getY(1);if(!(t.prototype._getLength.call(this)<=1)&&l(n)&&l(r)&&l(o)&&l(h)){var _=this._getAxisX(),u=this._getAxisY(),c=this.chart.series.indexOf(this),p=a.engine,d=this._getSymbolStroke(c),g=s._BasePlotter.cloneStyle(this.style,["fill"]),f=s._BasePlotter.cloneStyle(this.style,["stroke"]);p.stroke=d,p.strokeWidth=2,p.textFill=d;var y,m,v,V,b,x,P,w,k,L,X,M,I,B=h-r,C=o-n,D=this.chart._plotrectId;y=n,v=r,V=h;var O=m=o;p.startGroup(null,D);for(var Y=0;Y<this.levels.length;Y++)if(m=C<0?_.actualMin:_.actualMax,L=.01*this.levels[Y],V=v+L*B,w=(V-v)/(O-y),k=V-w*O,V=w*m+k,B>0&&V>u.actualMax?m=((V=u.actualMax)-k)/w:B<0&&V<u.actualMin&&(m=((V=u.actualMin)-k)/w),l(y)&&l(v)&&l(m)&&l(V)&&(b=new i.Point(_.convert(y),u.convert(v)),x=new i.Point(_.convert(m),u.convert(V)),p.drawLines([b.x,x.x],[b.y,x.y],null,g),this.labelPosition!=s.LabelPosition.None)){X=i.Globalize.format(L,"p1"),M=p.measureString(X,null,null,f),I=180*Math.atan((x.y-b.y)/(x.x-b.x))/Math.PI,P=x.clone(),x.x=C>0?x.x-M.width:x.x;var S,j=I*Math.PI/180,A=new i.Point,T=new i.Point,W=new i.Point,N=new i.Point,z=u.convert(u.actualMin),R=u.convert(u.actualMax),F=_.convert(_.actualMin),H=_.convert(_.actualMax),E=P.clone();switch(this.labelPosition){case s.LabelPosition.Center:x.y+=.5*M.height,E.y+=.5*M.height;break;case s.LabelPosition.Bottom:x.y+=M.height}C>0?(this.labelPosition===s.LabelPosition.Top||this.labelPosition===s.LabelPosition.Center?(N=E.clone(),W.x=N.x+M.height*Math.sin(j),W.y=N.y-M.height*Math.cos(j),A.x=N.x-M.width*Math.cos(j)+M.height*Math.sin(j),A.y=N.y-M.width*Math.sin(j)-M.height*Math.cos(j),T.x=N.x-M.width*Math.cos(j),T.y=N.y-M.width*Math.sin(j)):this.labelPosition===s.LabelPosition.Bottom&&(W=E.clone(),A.x=W.x-M.width*Math.cos(j),A.y=W.y-M.width*Math.sin(j),T.x=A.x-M.height*Math.sin(j),T.y=A.y+M.height*Math.cos(j),N.x=A.x+M.width*Math.cos(j)-M.height*Math.sin(j),N.y=A.y+M.width*Math.sin(j)+M.height*Math.cos(j)),B>0?(W.y<R&&(w=(u.convertBack(W.y)-u.convertBack(A.y))/(_.convertBack(W.x)-_.convertBack(A.x)),k=u.convertBack(W.y)-w*_.convertBack(W.x),S=_.convert((u.actualMax-k)/w),x.x-=Math.abs(W.x-S)),N.x>H&&(x.x-=Math.abs(H-N.x))):B<0&&(N.y>z&&(w=(u.convertBack(T.y)-u.convertBack(N.y))/(_.convertBack(T.x)-_.convertBack(N.x)),k=u.convertBack(N.y)-w*_.convertBack(N.x),S=_.convert((u.actualMin-k)/w),x.x-=Math.max(Math.abs(S-N.x),Math.abs(z-N.y))),W.x>H&&(x.x-=Math.abs(H-W.x)))):C<0&&(this.labelPosition===s.LabelPosition.Top||this.labelPosition===s.LabelPosition.Center?(T=E.clone(),A.x=T.x+M.height*Math.sin(j),A.y=T.y-M.height*Math.cos(j),N.x=T.x+M.width*Math.cos(j),N.y=T.y+M.width*Math.sin(j),W.x=A.x+M.width*Math.cos(j),W.y=A.y+M.width*Math.sin(j)):this.labelPosition===s.LabelPosition.Bottom&&(A=E.clone(),W.x=A.x+M.width*Math.cos(j),W.y=A.y+M.width*Math.sin(j),T.x=A.x-M.height*Math.sin(j),T.y=A.y+M.height*Math.cos(j),N.x=A.x+M.width*Math.cos(j)-M.height*Math.sin(j),N.y=A.y+M.width*Math.sin(j)+M.height*Math.cos(j)),B>0?(A.y<R&&(w=(u.convertBack(A.y)-u.convertBack(W.y))/(_.convertBack(A.x)-_.convertBack(W.x)),k=u.convertBack(A.y)-w*_.convertBack(A.x),S=_.convert((u.actualMax-k)/w),x.x+=Math.abs(A.x-S)),T.x<F&&(x.x+=Math.abs(F-T.x))):B<0&&(T.y>z&&(w=(u.convertBack(N.y)-u.convertBack(T.y))/(_.convertBack(N.x)-_.convertBack(T.x)),k=u.convertBack(T.y)-w*_.convertBack(T.x),S=_.convert((u.actualMin-k)/w),x.x+=Math.max(Math.abs(S-T.x),Math.abs(z-T.y))),A.x<F&&(x.x+=Math.abs(F-A.x)))),0===I?p.drawString(X,x,null,f):p.drawStringRotated(X,x,P,I,null,f)}p.stroke=null,p.strokeWidth=null,p.textFill=null,p.endGroup()}},e.prototype._getX=function(t){var e=null;return 0===t&&this.start?e=this.start.x:1===t&&this.end&&(e=this.end.x),i.isDate(e)&&(e=i.asDate(e).valueOf()),e},e.prototype._getY=function(t){var e=null;return 0===t&&this.start?e=this.start.y:1===t&&this.end&&(e=this.end.y),e},e.prototype._getChartType=function(){return s.ChartType.Line},e}(s.SeriesBase);e.FibonacciFans=f;var y=function(t){function e(e){var i=t.call(this)||this;return i._levels=[0,1,2,3,5,8,13,21,34],i._labelPosition=s.LabelPosition.Right,i.rendering.addHandler(i._render,i),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"startX",{get:function(){return this._startX},set:function(t){t!==this.startX&&(i.isDate(t)?this._startX=i.asDate(t):this._startX=i.asNumber(t),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endX",{get:function(){return this._endX},set:function(t){t!==this.endX&&(i.isDate(t)?this._endX=i.asDate(t):this._endX=i.asNumber(t),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!==this._levels&&(this._levels=i.asArray(t,!1),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){(t=i.asEnum(t,s.LabelPosition))!==this.labelPosition&&(this._labelPosition=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._render=function(e,a){a.cancel=!0,this._updateLevels();var n=this._getX(0),r=this._getX(1);if(!(t.prototype._getLength.call(this)<=1)&&l(n)&&l(r)){var o,h,_,u,c=r-n,p=this._getAxisX(),d=this._getAxisY(),g=this._chart.series.indexOf(this),f=a.engine,y=this._getSymbolStroke(g),m=s._BasePlotter.cloneStyle(this.style,["fill"]),v=s._BasePlotter.cloneStyle(this.style,["stroke"]),V=d.convert(d.actualMin),b=d.convert(d.actualMax),x=this.chart._plotrectId;if(f.stroke=y,f.strokeWidth=2,f.textFill=y,0!==c){f.startGroup(null,x);for(var P=0;P<this.levels.length;P++)if(o=this.levels[P],!((h=c*o+n)<p.actualMin||p.actualMax<h)&&l(h)&&(h=p.convert(h),f.drawLine(h,V,h,b,null,m),this.labelPosition!==s.LabelPosition.None)){switch(u=i.Globalize.format(o,"n0"),_=f.measureString(u,null,null,v),this.labelPosition){case s.LabelPosition.Left:h-=_.width+2;break;case s.LabelPosition.Center:h-=_.width/2;break;case s.LabelPosition.Right:h+=2;break;default:h=c<0?h-_.width-2:h+2}f.drawString(u,new i.Point(h,V),null,v)}f.stroke=null,f.strokeWidth=null,f.textFill=null,f.endGroup()}}},e.prototype._updateLevels=function(){var e=this.chart._getPlotter(this),s=t.prototype.getValues.call(this,1)||e.dataInfo.getXVals();if(!(t.prototype._getLength.call(this)<=1)){var a=this._getX(0),n=this._getX(1),l=i.isNumber(a)&&i.isNumber(n);l||s?!l&&s&&(this._startX=s[0],this._endX=s[1]):(this._startX=0,this._endX=1)}},e.prototype._getX=function(t){var e=null;return 0===t?e=this.startX:1===t&&(e=this.endX),i.isDate(e)&&(e=i.asDate(e).valueOf()),e},e.prototype._getChartType=function(){return s.ChartType.Line},e}(s.SeriesBase);e.FibonacciTimeZones=y;var m=function(t){function e(e){var i=t.call(this,e)||this;return i._seriesCount=1,i}return __extends(e,t),Object.defineProperty(e.prototype,"_hitTester",{get:function(){return this._plotter&&!this.__hitTester&&(this.__hitTester=this._plotter.hitTester),this.__hitTester},enumerable:!0,configurable:!0}),e.prototype._getChartType=function(){return s.ChartType.Line},e.prototype._getXValues=function(){return t.prototype.getValues.call(this,1)||this._plotter.dataInfo.getXVals()},e.prototype._getDataPoint=function(t,e,i,a,n,l){var r=new s._DataPoint(i,a,t,e);return r.y=e,r.yfmt=l._formatValue(e),r.x=t,r.xfmt=n._formatValue(t),r},e.prototype._shouldCalculate=function(){return!0},e.prototype._init=function(){},e.prototype._calculate=function(){},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this.__hitTester=null},e.prototype._getName=function(t){var e=void 0;if(this.name)if(this.name.indexOf(",")){var i=this.name.split(",");i&&i.length-1>=t&&(e=i[t].trim())}else e=this.name;return e},e.prototype._getStyles=function(t){var e=null;if(t<0||null===this._styles)return e;var i=0;for(var s in this._styles){if(i===t&&this._styles.hasOwnProperty(s)){e=this._styles[s];break}i++}return e},e.prototype.legendItemLength=function(){return this._seriesCount},e.prototype.measureLegendItem=function(t,e){var s=this._getName(e),a=new i.Size(0,0);return s&&(a=this._measureLegendItem(t,this._getName(e))),a},e.prototype.drawLegendItem=function(t,e,i){var s=this._getStyles(i)||this.style;this._getName(i)&&this._drawLegendItem(t,e,this._getChartType(),this._getName(i),s,this.symbolStyle)},e}(s.SeriesBase);e.OverlayIndicatorBase=m;var v=function(t){function e(e){var i=t.call(this,e)||this;return i._period=14,i}return __extends(e,t),Object.defineProperty(e.prototype,"period",{get:function(){return this._period},set:function(t){t!==this._period&&(this._period=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getValues=function(e){var i=null;return t.prototype._getLength.call(this)<=0?i:(this._shouldCalculate()&&(this._init(),this._calculate()),0===e?i=this._yvals:1===e&&(i=this._xvals),i)},e.prototype.getDataRect=function(e,n){if(n)return n;var l=null;if(t.prototype._getLength.call(this)<=0)return l;this._shouldCalculate()&&(this._init(),this._calculate());var r=a._minimum(this._xvals),o=a._maximum(this._xvals),h=a._minimum(this._yvals),_=a._maximum(this._yvals);return s._DataInfo.isValid(r)&&s._DataInfo.isValid(o)&&s._DataInfo.isValid(h)&&s._DataInfo.isValid(_)&&(l=new i.Rect(r,h,o-r,_-h)),l},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._xvals=null,this._yvals=null},e.prototype._shouldCalculate=function(){return!this._yvals||!this._xvals},e.prototype._init=function(){t.prototype._init.call(this),this._yvals=[],this._xvals=[]},e.prototype._getItem=function(e){return t.prototype._getLength.call(this)<=0?t.prototype._getItem.call(this,e):(this._shouldCalculate()&&(this._init(),this._calculate()),e=t.prototype._getLength.call(this)-a._minimum(this._yvals.length,this._xvals.length)+e,t.prototype._getItem.call(this,e))},e}(m);e.SingleOverlayIndicatorBase=v;var V=function(t){function e(e){var i=t.call(this)||this;return i.period=14,i.initialize(e),i}return __extends(e,t),e.prototype._calculate=function(){if(!(t.prototype._getLength.call(this)<=0)){var e=t.prototype._getBindingValues.call(this,0),i=t.prototype._getBindingValues.call(this,1),s=t.prototype._getBindingValues.call(this,3),n=this._getXValues();this._yvals=a._avgTrueRng(e,i,s,this.period),this._xvals=n?n.slice(this.period-1):a._range(this.period-1,e.length)}},e}(v);e.ATR=V;var b=function(t){function e(e){var i=t.call(this)||this;return i._constant=.015,i.period=20,i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"constant",{get:function(){return this._constant},set:function(t){t!==this._constant&&(this._constant=i.asNumber(t,!1),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype._getBindingValues.call(this,0),s=t.prototype._getBindingValues.call(this,1),n=t.prototype._getBindingValues.call(this,3),l=this._getXValues();this._yvals=r(i,s,n,this.period,this.constant),this._xvals=l?l.slice(this.period-1):a._range(this.period-1,e-1)}},e}(v);e.CCI=b,e._cci=r;var x=function(t){function e(e){var i=t.call(this)||this;return i.period=14,i.initialize(e),i}return __extends(e,t),e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype._getBindingValues.call(this,0),s=t.prototype._getBindingValues.call(this,1),n=t.prototype._getBindingValues.call(this,3),l=this._getXValues();this._yvals=o(i,s,n,this.period),this._xvals=l?l.slice(this.period-1):a._range(this.period-1,e-1)}},e}(v);e.WilliamsR=x,e._williamsR=o;var P;!function(t){t[t.Simple=0]="Simple",t[t.Exponential=1]="Exponential"}(P=e.MovingAverageType||(e.MovingAverageType={}));var w=function(t){function e(e){var i=t.call(this)||this;return i._period=20,i._type=P.Simple,i._size=.025,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"period",{get:function(){return this._period},set:function(t){t!==this._period&&(this._period=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(t){(t=i.asEnum(t,P,!1))!==this._type&&(this._type=t,this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(t){t!==this._size&&(this._size=i.asNumber(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,n){if(n)return n;var l=null;if(t.prototype._getLength.call(this)<=0)return l;this._shouldCalculate()&&(this._init(),this._calculate());var r=this._upperYVals.concat(this._lowerYVals),o=a._minimum(this._xVals),h=a._maximum(this._xVals),_=a._minimum(r),u=a._maximum(r);return s._DataInfo.isValid(o)&&s._DataInfo.isValid(h)&&s._DataInfo.isValid(_)&&s._DataInfo.isValid(u)&&(l=new i.Rect(o,_,h-o,u-_)),l},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._upperYVals=null,this._lowerYVals=null,this._xVals=null},e.prototype._init=function(){t.prototype._init.call(this),this._upperYVals=[],this._lowerYVals=[],this._xVals=[]},e.prototype._shouldCalculate=function(){return!this._upperYVals||!this._lowerYVals||!this._xVals},e.prototype._calculate=function(){var e=this;if(!(t.prototype._getLength.call(this)<=0)){var i,s=t.prototype.getValues.call(this,0),n=this._getXValues();switch(this.type){case P.Exponential:i=a._ema(s,this.period);break;case P.Simple:default:i=a._sma(s,this.period)}this._xVals=n?n.slice(this.period-1):a._range(this.period-1,t.prototype._getLength.call(this)-1),this._upperYVals=i.map(function(t){return t+t*e.size}),this._lowerYVals=i.map(function(t){return t-t*e.size})}},e.prototype._rendering=function(e,n){if(n.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var l=this.chart.series.indexOf(this),r=n.engine,o=this._getAxisX(),h=this._getAxisY(),_=a._minimum(this._upperYVals.length,this._lowerYVals.length,this._xVals.length),u=s._BasePlotter.cloneStyle(this.style,["fill"]),c=this._getSymbolStroke(l),p=this.chart._plotrectId;if(_&&!(_<=0)){r.stroke=c,r.strokeWidth=2;for(var d,g,f,y=[],m=[],v=[],V=this._getLength(),b=0;b<_;b++)f=V-_+b,y.push(o.convert(this._xVals[b])),m.push(h.convert(this._upperYVals[b])),d=this._getDataPoint(this._xVals[b],this._upperYVals[b],l,f,o,h),(g=new s._CircleArea(new i.Point(y[b],m[b]),.5*r.strokeWidth)).tag=d,this._hitTester.add(g,l),v.push(h.convert(this._lowerYVals[b])),d=this._getDataPoint(this._xVals[b],this._lowerYVals[b],l,f,o,h),(g=new s._CircleArea(new i.Point(y[b],v[b]),.5*r.strokeWidth)).tag=d,this._hitTester.add(g,l);this._hitTester.add(new s._LinesArea(y,m),l),this._hitTester.add(new s._LinesArea(y,v),l),r.drawLines(y,m,null,u,p),r.drawLines(y,v,null,u,p)}}},e.prototype.getCalculatedValues=function(e){e=i.asString(e,!1);var s=[],a=0;if(t.prototype._getLength.call(this)<=0)return s;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"upperEnvelope":for(;a<this._upperYVals.length;a++)s.push({x:this._xVals[a],y:this._upperYVals[a]});break;case"lowerEnvelope":for(;a<this._lowerYVals.length;a++)s.push({x:this._xVals[a],y:this._lowerYVals[a]})}return s},e}(m);e.Envelopes=w;var k=function(t){function e(e){var i=t.call(this)||this;return i._period=20,i._multiplier=2,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"period",{get:function(){return this._period},set:function(t){t!==this._period&&(this._period=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"multiplier",{get:function(){return this._multiplier},set:function(t){t!==this._multiplier&&(this._multiplier=i.asNumber(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,n){if(n)return n;if(t.prototype._getLength.call(this)<=0)return null;this._shouldCalculate()&&(this._init(),this._calculate());var l=this._upperYVals.concat(this._lowerYVals),r=a._minimum(this._xVals),o=a._maximum(this._xVals),h=a._minimum(l),_=a._maximum(l);return s._DataInfo.isValid(r)&&s._DataInfo.isValid(o)&&s._DataInfo.isValid(h)&&s._DataInfo.isValid(_)?new i.Rect(r,h,o-r,_-h):null},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._upperYVals=null,this._middleYVals=null,this._lowerYVals=null,this._xVals=null},e.prototype._shouldCalculate=function(){return!(this._upperYVals&&this._middleYVals&&this._lowerYVals&&this._xVals)},e.prototype._init=function(){t.prototype._init.call(this),this._upperYVals=[],this._middleYVals=[],this._lowerYVals=[],this._xVals=[]},e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype.getValues.call(this,0),s=this._getXValues(),n=h(i,this.period,this.multiplier);this._upperYVals=n.uppers,this._middleYVals=n.middles,this._lowerYVals=n.lowers,this._xVals=s?s.slice(this.period-1):a._range(this.period-1,e-1)}},e.prototype._rendering=function(e,n){if(n.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var l=this.chart.series.indexOf(this),r=n.engine,o=this._getAxisX(),h=this._getAxisY(),_=a._minimum(this._upperYVals.length,this._middleYVals.length,this._lowerYVals.length,this._xVals.length),u=s._BasePlotter.cloneStyle(this.style,["fill"]),c=this._getSymbolStroke(l),p=this.chart._plotrectId;if(_&&!(_<=0)){r.stroke=c,r.strokeWidth=2;for(var d,g,f,y=[],m=[],v=[],V=[],b=this._getLength(),x=0;x<_;x++)f=b-_+x,y.push(o.convert(this._xVals[x])),m.push(h.convert(this._upperYVals[x])),d=this._getDataPoint(this._xVals[x],this._upperYVals[x],l,f,o,h),(g=new s._CircleArea(new i.Point(y[x],m[x]),.5*r.strokeWidth)).tag=d,this._hitTester.add(g,l),v.push(h.convert(this._middleYVals[x])),d=this._getDataPoint(this._xVals[x],this._middleYVals[x],l,f,o,h),(g=new s._CircleArea(new i.Point(y[x],v[x]),.5*r.strokeWidth)).tag=d,this._hitTester.add(g,l),V.push(h.convert(this._lowerYVals[x])),d=this._getDataPoint(this._xVals[x],this._lowerYVals[x],l,f,o,h),(g=new s._CircleArea(new i.Point(y[x],V[x]),.5*r.strokeWidth)).tag=d,this._hitTester.add(g,l);this._hitTester.add(new s._LinesArea(y,m),l),this._hitTester.add(new s._LinesArea(y,v),l),this._hitTester.add(new s._LinesArea(y,V),l),r.drawLines(y,m,null,u,p),r.drawLines(y,v,null,u,p),r.drawLines(y,V,null,u,p)}}},e.prototype.getCalculatedValues=function(e){e=i.asString(e,!1);var s=[],a=0;if(t.prototype._getLength.call(this)<=0)return s;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"upperBand":for(;a<this._upperYVals.length;a++)s.push({x:this._xVals[a],y:this._upperYVals[a]});break;case"middleBand":for(;a<this._middleYVals.length;a++)s.push({x:this._xVals[a],y:this._middleYVals[a]});break;case"lowerBand":for(;a<this._lowerYVals.length;a++)s.push({x:this._xVals[a],y:this._lowerYVals[a]})}return s},e}(m);e.BollingerBands=k,e._bollingerBands=h;var L=function(t){function e(e){var i=t.call(this)||this;return i.period=14,i.initialize(e),i}return __extends(e,t),e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype._getBindingValues.call(this,0),s=this._getXValues();this._yvals=_(i,this.period),this._xvals=s?s.slice(this.period):a._range(this.period,e)}},e}(v);e.RSI=L,e._rsi=_;var X=function(t){function e(e){var i=t.call(this,e)||this;return i._fastPeriod=12,i._slowPeriod=26,i._smoothingPeriod=9,i}return __extends(e,t),Object.defineProperty(e.prototype,"fastPeriod",{get:function(){return this._fastPeriod},set:function(t){t!==this._fastPeriod&&(this._fastPeriod=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"slowPeriod",{get:function(){return this._slowPeriod},set:function(t){t!==this._slowPeriod&&(this._slowPeriod=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"smoothingPeriod",{get:function(){return this._smoothingPeriod},set:function(t){t!==this._smoothingPeriod&&(this._smoothingPeriod=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._macdVals=null,this._macdXVals=null,this._signalVals=null,this._signalXVals=null,this._histogramVals=null,this._histogramXVals=null},e.prototype._shouldCalculate=function(){return!(this._macdVals&&this._macdXVals&&this._signalVals&&this._signalXVals&&this._histogramVals&&this._histogramXVals)},e.prototype._init=function(){t.prototype._init.call(this),this._macdVals=[],this._macdXVals=[],this._signalVals=[],this._signalXVals=[],this._histogramVals=[],this._histogramXVals=[]},e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype.getValues.call(this,0),s=this._getXValues(),n=u(i,this.fastPeriod,this.slowPeriod,this.smoothingPeriod);this._macdVals=n.macds,this._signalVals=n.signals,this._histogramVals=n.histograms,this._macdXVals=s?s.slice(e-this._macdVals.length,e):a._range(e-this._macdVals.length,e-1),this._signalXVals=s?s.slice(e-this._signalVals.length,e):a._range(e-this._signalVals.length,e-1),this._histogramXVals=s?s.slice(e-this._histogramVals.length,e):a._range(e-this._histogramVals.length,e-1)}},e}(m);e.MacdBase=X;var M=function(t){function e(e){var i=t.call(this)||this;return i._seriesCount=2,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"styles",{get:function(){return this._styles},set:function(t){t!==this._styles&&(this._styles=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,n){if(n)return n;var l=null;if(t.prototype._getLength.call(this)<=0)return l;this._shouldCalculate()&&(this._init(),this._calculate());var r=[],o=[];o.push.apply(o,this._macdXVals),o.push.apply(o,this._signalXVals),r.push.apply(r,this._macdVals),r.push.apply(r,this._signalVals);var h=a._minimum(o),_=a._maximum(o),u=a._minimum(r),c=a._maximum(r);return s._DataInfo.isValid(h)&&s._DataInfo.isValid(_)&&s._DataInfo.isValid(u)&&s._DataInfo.isValid(c)&&(l=new i.Rect(h,u,_-h,c-u)),l},e.prototype._rendering=function(e,a){if(a.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var n=this.chart.series.indexOf(this),l=a.engine,r=this._getAxisX(),o=this._getAxisY(),h=s._BasePlotter.cloneStyle(this.style,["fill"]),_=this._getSymbolStroke(n),u=this.chart._plotrectId,c=null,p=_,d=2,g=null,f=_,y=2;this.styles&&i.isObject(this.styles)&&(this.styles.macdLine&&i.isObject(this.styles.macdLine)&&(p=(c=s._BasePlotter.cloneStyle(this.styles.macdLine,["fill"])).stroke?c.stroke:_,d=c.strokeWidth?c.strokeWidth:2),this.styles.signalLine&&i.isObject(this.styles.signalLine)&&(f=(g=s._BasePlotter.cloneStyle(this.styles.signalLine,["fill"])).stroke?g.stroke:_,y=g.strokeWidth?g.strokeWidth:2));var m,v,V,b,x=[],P=[],w=[],k=[],L=this._getLength();for(V=0;V<this._macdVals.length;V++)b=L-this._macdVals.length+V,P.push(r.convert(this._macdXVals[V])),x.push(o.convert(this._macdVals[V])),(m=this._getDataPoint(this._macdXVals[V],this._macdVals[V],n,b,r,o)).name=this._getName(0),(v=new s._CircleArea(new i.Point(P[V],x[V]),.5*l.strokeWidth)).tag=m,this._hitTester.add(v,n);for(this._hitTester.add(new s._LinesArea(P,x),n),l.stroke=p,l.strokeWidth=d,l.drawLines(P,x,null,h,u),V=0;V<this._signalVals.length;V++)b=L-this._signalVals.length+V,k.push(r.convert(this._signalXVals[V])),w.push(o.convert(this._signalVals[V])),(m=this._getDataPoint(this._signalXVals[V],this._signalVals[V],n,b,r,o)).name=this._getName(1),(v=new s._CircleArea(new i.Point(k[V],w[V]),.5*l.strokeWidth)).tag=m,this._hitTester.add(v,n);this._hitTester.add(new s._LinesArea(k,w),n),l.stroke=f,l.strokeWidth=y,l.drawLines(k,w,null,h,u)}},e.prototype.getCalculatedValues=function(e){e=i.asString(e,!1);var s=[],a=0;if(t.prototype._getLength.call(this)<=0)return s;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"macdLine":for(;a<this._macdVals.length;a++)s.push({x:this._macdXVals[a],y:this._macdVals[a]});break;case"signalLine":for(;a<this._signalVals.length;a++)s.push({x:this._signalXVals[a],y:this._signalVals[a]})}return s},e}(X);e.Macd=M;var I=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.getValues=function(e){var i=null;return t.prototype._getLength.call(this)<=0?i:(this._shouldCalculate()&&(this._init(),this._calculate()),0===e?i=this._histogramVals:1===e&&(i=this._histogramXVals),i)},e.prototype.getDataRect=function(e,n){if(n)return n;var l=null;if(t.prototype._getLength.call(this)<=0)return l;this._shouldCalculate()&&(this._init(),this._calculate());var r=a._minimum(this._histogramXVals),o=a._maximum(this._histogramXVals),h=a._minimum(this._histogramVals),_=a._maximum(this._histogramVals);return s._DataInfo.isValid(r)&&s._DataInfo.isValid(o)&&s._DataInfo.isValid(h)&&s._DataInfo.isValid(_)&&(l=new i.Rect(r,h,o-r,_-h)),l},e.prototype._getChartType=function(){return s.ChartType.Column},e.prototype._getItem=function(e){return e=t.prototype._getLength.call(this)-a._minimum(this._histogramVals.length,this._histogramXVals.length)+e,t.prototype._getItem.call(this,e)},e}(X);e.MacdHistogram=I,e._macd=u;var B=function(t){function e(e){var i=t.call(this)||this;return i._kPeriod=14,i._dPeriod=3,i._smoothingPeriod=1,i._seriesCount=2,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return __extends(e,t),Object.defineProperty(e.prototype,"kPeriod",{get:function(){return this._kPeriod},set:function(t){t!==this._kPeriod&&(this._kPeriod=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dPeriod",{get:function(){return this._dPeriod},set:function(t){t!==this._dPeriod&&(this._dPeriod=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"smoothingPeriod",{get:function(){return this._smoothingPeriod},set:function(t){t!==this._smoothingPeriod&&(this._smoothingPeriod=i.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"styles",{get:function(){return this._styles},set:function(t){t!==this._styles&&(this._styles=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,n){if(n)return n;var l=null;if(t.prototype._getLength.call(this)<=0)return l;this._shouldCalculate()&&(this._init(),this._calculate());var r=this._kVals.concat(this._dVals),o=this._kXVals.concat(this._dXVals),h=a._minimum(o),_=a._maximum(o),u=a._minimum(r),c=a._maximum(r);return s._DataInfo.isValid(h)&&s._DataInfo.isValid(_)&&s._DataInfo.isValid(u)&&s._DataInfo.isValid(c)&&(l=new i.Rect(h,u,_-h,c-u)),l},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._kVals=null,this._kXVals=null,this._dVals=null,this._dXVals=null},e.prototype._shouldCalculate=function(){return!(this._kVals&&this._kXVals&&this._dVals&&this._dXVals)},e.prototype._init=function(){t.prototype._init.call(this),this._kVals=[],this._kXVals=[],this._dVals=[],this._dXVals=[]},e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(t.prototype._getLength.call(this)<=0)){var i=t.prototype._getBindingValues.call(this,0),s=t.prototype._getBindingValues.call(this,1),n=t.prototype._getBindingValues.call(this,3),l=this._getXValues(),r=c(i,s,n,this.kPeriod,this.dPeriod,this.smoothingPeriod);this._kVals=r.ks,this._dVals=r.ds,this._kXVals=l?l.slice(this.kPeriod-1):a._range(this.kPeriod-1,e-1),this.smoothingPeriod&&this.smoothingPeriod>1&&(this._kXVals=this._kXVals.slice(this._kXVals.length-this._kVals.length,this._kXVals.length)),this._dXVals=this._kXVals.slice(this._kXVals.length-this._dVals.length,this._kXVals.length)}},e.prototype._rendering=function(e,a){if(a.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var n=this.chart.series.indexOf(this),l=a.engine,r=this._getAxisX(),o=this._getAxisY(),h=s._BasePlotter.cloneStyle(this.style,["fill"]),_=this._getSymbolStroke(n),u=this.chart._plotrectId,c=null,p=_,d=2,g=null,f=_,y=2;this.styles&&i.isObject(this.styles)&&(this.styles.kLine&&i.isObject(this.styles.kLine)&&(p=(c=s._BasePlotter.cloneStyle(this.styles.kLine,["fill"])).stroke?c.stroke:_,d=c.strokeWidth?c.strokeWidth:2),this.styles.dLine&&i.isObject(this.styles.dLine)&&(f=(g=s._BasePlotter.cloneStyle(this.styles.dLine,["fill"])).stroke?g.stroke:_,y=g.strokeWidth?g.strokeWidth:2));var m,v,V,b,x=[],P=[],w=[],k=[],L=this._getLength();for(V=0;V<this._kVals.length;V++)b=L-this._kVals.length+V,P.push(r.convert(this._kXVals[V])),x.push(o.convert(this._kVals[V])),(m=this._getDataPoint(this._kXVals[V],this._kVals[V],n,b,r,o)).name=this._getName(0),(v=new s._CircleArea(new i.Point(P[V],x[V]),.5*l.strokeWidth)).tag=m,this._hitTester.add(v,n);for(this._hitTester.add(new s._LinesArea(P,x),n),l.stroke=p,l.strokeWidth=d,l.drawLines(P,x,null,h,u),V=0;V<this._dVals.length;V++)b=L-this._dVals.length+V,k.push(r.convert(this._dXVals[V])),w.push(o.convert(this._dVals[V])),(m=this._getDataPoint(this._dXVals[V],this._dVals[V],n,b,r,o)).name=this._getName(1),(v=new s._CircleArea(new i.Point(k[V],w[V]),.5*l.strokeWidth)).tag=m,this._hitTester.add(v,n);this._hitTester.add(new s._LinesArea(k,w),n),l.stroke=f,l.strokeWidth=y,l.drawLines(k,w,null,h,u)}},e.prototype.getCalculatedValues=function(e){e=i.asString(e,!1);var s=[],a=0;if(t.prototype._getLength.call(this)<=0)return s;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"kLine":for(;a<this._kVals.length;a++)s.push({x:this._kXVals[a],y:this._kVals[a]});break;case"dLine":for(;a<this._dVals.length;a++)s.push({x:this._dXVals[a],y:this._dVals[a]})}return s},e}(m);e.Stochastic=B,e._stochastic=c});