commit 2019-11-20 10:12:19.883597

ConfirmDialog does not close after YES is clicked #3981
Side DOM chart does not render in certain conditions #3975
This commit is contained in:
Jenkins
2019-11-20 13:12:22 +03:00
parent e2e37b550a
commit e3327b4c77
35 changed files with 101 additions and 123 deletions

File diff suppressed because one or more lines are too long

View File

@@ -35,17 +35,17 @@ i=o>=0?e.substr(o):"",t+i)},n.cutScriptIdPart=function(e){var t=e.indexOf("$"),i
var t="study_"+e.id;return e.pine&&e.pine.version&&(t+="_"+e.pine.version.replace(".","_")),t},n.addOrReplaceStudyMetaInfo=function(e,t){var i,o,s,l,c=new n(t),h=n._findStudyMetaInfo(e,c.id),u=h[0],d=h[1];if(d){if(i=d.pine&&d.pine.version&&a.parse(d.pine.version),null!=(o=c.pine&&c.pine.version&&a.parse(c.pine.version))&&null!=i&&!o.isGreaterOrEqual(i))return c;n.removeStudyMetaInfo(e,c,u)}else n.removeStudyMetaInfo(e,c,u)&&r.logDebug("Study with id="+c.id+" already exists in the model!");return e.push(c),c.defaults&&(s=TradingView.clone(c.defaults),s.precision="default",l=n.getStudyPropertyRootName(c),defaults.create(l,s)),c},n.overrideDefaults=function(e){null!==l&&0!==e.length&&s(l,e,function(e){return TradingView.defaultProperties["study_"+e]||null})},n.setDefaultsOverrides=function(e){l=e},n.createMetaInfoStub=function(e,t){var i,n,r;return o(TradingView.isExistent(e.scriptIdPart),"scriptIdPart is missing, study: "+JSON.stringify(e)),i=e.extra&&"strategy"===e.extra.kind||!0===e.isTVScriptStrategy,n=TVScript.createScriptStudyId(e.scriptIdPart,t,i),r={isTVScriptStubToCompile:!0,id:n,scriptIdPart:e.scriptIdPart,description:e.scriptName,TVScriptSourceCode:e.scriptSource,is_hidden_study:e.extra&&e.extra.is_hidden_study,extra:e.extra,version:t},r.pine={},r.pine.version=TradingView.isExistent(e.version)?e.version:-1,r.pine.access=TVScript.Access.MAP_ID_TO_NAME[e.access],r.pine.userHaveAccess=e.userHaveAccess,!0===i&&(r.isTVScriptStrategy=!0),r},n.isScriptStrategy=function(e){if(e.extra&&e.extra.kind)return e.extra.kind===TVScript.Kinds.STRATEGY;if(!0===e.isTVScriptStrategy)return!0;var t=e.TVScriptSourceCode||e.scriptSource;return!!t&&TVScript.isStrategy(t)},n.replaceWithFullStudyMetaInfoAsync=function(e,t){var i=$.Deferred();return t.isTVScriptStubToCompile||i.resolve(t),i.promise()},n.getOrderedInputIds=function(e){var t,i,n=[],o=e.inputs;for(t=0;t<o.length;++t)i=o[t],n.push(i.id);return n},n.canBeChild=function(e){var t,i,o;if(e&&"string"==typeof e)return!0;if(!e||e.extra&&!n.isAllowedSourceInputsCount(e.extra.sourceInputsCount)||!0===e.canNotBeChild||!1===e.canBeChild||~n.CHILD_STUDY_EXCLUDE_IDS.indexOf(e.id)||e.isTVScriptStrategy||e.TVScriptSourceCode&&TVScript.isStrategy(e.TVScriptSourceCode))return!1;if(e.isTVScriptStubToCompile)return!0;for(t=e.inputs,i=0,o=0;o<t.length;++o)n.isSourceInput(t[o])&&++i;return n.isAllowedSourceInputsCount(i)},n.isAllowedSourceInputsCount=function(e){return 1===e},n.canHaveChildren=function(e){if(e){if(e.isTVScriptStrategy||e.TVScriptSourceCode&&TVScript.isStrategy(e.TVScriptSourceCode))return!1;if(e.id&&!~n.CHILD_STUDY_PARENT_EXCLUDE_IDS.indexOf(e.id)&&Array.isArray(e.plots))for(var t=0;t<e.plots.length;++t)if(~n.CHILD_STUDY_ALLOWED_PLOT_TYPES.indexOf(e.plots[t].type))return!0}return!1},TradingView.StudyMetaInfo=n,void 0!==t&&t&&t.exports&&(t.exports=n)}).call(t,i(13),i(51)(e))},function(e,t,i){"use strict";function n(e,t,i,n,o,r){var s,a,h,u;return Object(l.equalPoints)(e,t)?null:(s=new l.Point(0,0),a=new l.Point(i,n),
o?r?(h=Object(c.intersectLineAndRectangle)(Object(l.lineThroughPoints)(e,t),s,a),Array.isArray(h)?h:null):(u=Object(c.intersectRayAndRectangle)(t,e,s,a),null===u||Object(l.equalPoints)(t,u)?null:Object(l.lineSegment)(t,u)):r?(u=Object(c.intersectRayAndRectangle)(e,t,s,a),null===u||Object(l.equalPoints)(e,u)?null:Object(l.lineSegment)(e,u)):(h=Object(c.intersectLineSegmentAndRectangle)(Object(l.lineSegment)(e,t),s,a),Array.isArray(h)?h:null))}function o(e){return.3*e}function r(e){return 2+.5*e}function s(e){return null!==e&&void 0!==e&&!Object(h.isNaN)(e)}function a(e,t){void 0!==t&&Object(u.setLineStyle)(e,t)}var l,c,h,u;Object.defineProperty(t,"__esModule",{value:!0}),t.extendAndClipLineSegment=n,t.optimalBarWidth=o,t.selectionTolerance=r,t.coordinateIsValid=s,t.setValidLineStyle=a,l=i(6),i.n(l),c=i(129),i.n(c),h=i(12),i.n(h),u=i(46),i.n(u)},function(e,t,i){"use strict";(function(e){function n(){this._zorder=0,this.m_priceScale=null,this._id=s.randomHashN(6),this._ownerSource=null,this._userEditEnabled=!0,this.hasAlert=new e(!1)}function o(e){n.call(this),this._isOverlay=null,this._model=e}var r=i(3).DefaultProperty,s=i(33);n.prototype.createPropertiesObject=function(e,t,i){return new r(e,t,i)},n.prototype.id=function(){return this._id},n.prototype.preferNoScale=function(){return!1},n.prototype.idForAlert=function(){return this._id},n.prototype.setId=function(e){this._id=e},n.prototype.zorder=function(){return this._zorder},n.prototype.setZorder=function(e){"number"==typeof e&&this._zorder!==e&&(this._zorder=e)},n.prototype.title=function(){throw Error("Implement this fun in a subclass")},n.prototype.priceScale=function(){return this.m_priceScale},n.prototype.setPriceScale=function(e){this.m_priceScale=e},n.prototype.ownerSource=function(){return this._ownerSource},n.prototype.setOwnerSource=function(e){this._ownerSource=e,e&&this.setPriceScale(e.priceScale())},n.prototype.isSavedInChart=function(e){return!0},n.prototype.isSavedInStudyTemplates=function(){return!0},n.prototype.isRemovedByStudyTemplates=function(){return!0},n.prototype.hasContextMenu=function(){return!0},n.prototype.showInObjectTree=function(){return!0},n.prototype.setUserEditEnabled=function(e){this._userEditEnabled=e},n.prototype.userEditEnabled=function(){return this._userEditEnabled},n.prototype.canBeHidden=function(){return this.userEditEnabled()},n.prototype.isUserDeletable=function(){return this.userEditEnabled()},n.prototype.canHasAlert=function(){return!1},n.prototype.properties=function(){throw Error("Implement this fun in a subclass")},n.prototype.statusView=function(){return null},n.prototype.dataWindowView=function(){return null},n.prototype.legendView=function(){return null},n.prototype.priceAxisViews=function(e,t){return null},n.prototype.updateAllViews=function(){},n.prototype.paneViews=function(e){return null},n.prototype.isChildStudy=function(){return!1},n.prototype.hasChildren=function(){return!1},n.prototype.canHaveChildren=function(){return!1},n.prototype.onClickOutside=function(){},n.prototype.getInputsPropertyPage=function(){
return null},n.prototype.getStylesPropertyPage=function(){return null},n.prototype.getDisplayPropertyPage=function(){return null},n.prototype.getVisibilitiesPropertyPage=function(){return null},n.prototype.getStrategyPropertyPage=function(){return null},n.prototype.getSourceIcon=function(){return null},n.prototype.doesMovingAffectsUndo=function(){return!0},inherit(o,n),o.prototype.isNoScale=function(){return!!this._isOverlay},o.prototype.base=function(){return 0},o.prototype.formatter=function(){return null},o.prototype.model=function(){return this._model},o.prototype.priceRange=function(e,t){return null},o.prototype.isDraggable=function(){return!this._metaInfo||!this._metaInfo.linkedToSeries},o.prototype.priceLineColor=function(e){return e},t.DataSource=n,t.PriceDataSource=o}).call(t,i(16))},function(e,t,i){"use strict";function n(e,t,i){var n,o,r,l,c;if(t=t||0,!s(e))return i?Object(a.rgbaToString)(Object(a.rgba)(Object(a.parseRgb)(e),Object(a.normalizeAlphaComponent)(1-t/100))):e;if(t<0&&t>100)throw Error("invalid transparency");return n=Object(a.parseRgb)(e),o=n[0],r=n[1],l=n[2],c=Object(a.normalizeAlphaComponent)(1-t/100),Object(a.rgbaToString)([o,r,l,c])}function o(e){return s(e)?e:Object(a.rgbaToString)(Object(a.rgba)(Object(a.parseRgb)(e),Object(a.normalizeAlphaComponent)(1)))}function r(e){var t=Object(a.parseRgb)(e).map(function(e){return e/=255,e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)});return+(.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3)}function s(e){return 0===e.indexOf("#")}var a;Object.defineProperty(t,"__esModule",{value:!0}),t.generateColor=n,t.resetTransparency=o,t.getLuminance=r,t.isHexColor=s,a=i(24),i.n(a)},function(e,t,i){"use strict";function n(e,t,i){var n=t.subtract(e),o=i.subtract(e),r=o.dotProduct(n)/n.dotProduct(n);return{coeff:r,distance:e.addScaled(n,r).subtract(i).length()}}function o(e,t,i){var o,r,s=n(e,t,i);return 0<=s.coeff&&s.coeff<=1?s:(o=e.subtract(i).length(),r=t.subtract(i).length(),o<r?{coeff:0,distance:o}:{coeff:1,distance:r})}Object.defineProperty(t,"__esModule",{value:!0}),t.distanceToLine=n,t.distanceToSegment=o},function(e,t,i){"use strict";function n(e,t,i){u[e].unsubscribe(i,t)}function o(e,t,i){r(e,t,i)}function r(e,t,i,n){if(u.hasOwnProperty(e)||(u[e]=new h.a),p[e])return void t.call(i);u[e].subscribe(i,t,n)}function s(e){d.push(e)}function a(e){var t,i,n=[];for(t=1;t<arguments.length;t++)n[t-1]=arguments[t];i=[e].concat(n),d.forEach(function(e){e.apply(null,i)}),u.hasOwnProperty(e)&&u[e].fire.apply(u[e],n)}function l(e){p[e]&&console.warn("Something went wrong: emitOnce called multiple times with same event ("+e+")"),p[e]=!0,a.apply(null,arguments)}var c,h,u,d,p;Object.defineProperty(t,"__esModule",{value:!0}),t.unsubscribe=n,t.on=o,t.subscribe=r,t.subscribeToAll=s,t.emit=a,t.emitOnce=l,c=i(8),h=i.n(c),u={},d=[],p={}},function(e,t,i){"use strict";(function(t,n,o){function r(e){return"cursor"===e||"arrow"===e||"dot"===e}function s(e){!e&&u&&u.stayInDrawingMode.value()||this.tool.setValue(this.cursorTool.value())}function a(e,t){return function(t){
e.inFire||(e.inFire=!0,e.fire(t),e.inFire=!1)}}function l(){K||(y.setValue(TVSettings.getValue("chart.cursorPreference","cursor")),y.subscribe(function(e){r(e)&&g.setValue(e)},{callWithLast:!0}),g.subscribe(function(e){e&&TVSettings.setValue("chart.cursorPreference",e)}),u=new c("drawings"),d=new o,p=new o,_=new o,f=new o,d.setValue(!1),p.setValue(!1),_.setValue(!1),f.setValue(!1),y.subscribe(function(){h.emit("onSelectedLineToolChanged")}),K=!0)}var c=i(3).DefaultProperty,h=i(31),u=null,d=null,p=null,_=null,f=null,m=new t,y=new t,g=new t,v=new n,S=new n,b=new n,w=new n,P=new n,T=new n,x=new n,C=new n,L=new n,I=new n,A=new n,k=new n,E=new n,M=new n,V=new n,D=a(v),O=a(S),R=a(b),B=a(w),N=a(P),F=a(T),W=a(x),H=a(C),j=a(L),z=a(I),U=a(A),q=a(k),$=a(E),Y=a(M),G=a(V),K=!1;e.exports={tool:y,cursorTool:g,toolIsCursor:r,resetToCursor:s,init:l,createdLineTool:v,continuedLineTool:S,cancelledLineTool:b,createLineTool:D,continueLineTool:O,cancelLineTool:R,startedMovingLineTool:w,movedLineTool:P,finishedMovingLineTool:T,startMovingLineTool:B,moveLineTool:N,finishMovingLineTool:F,startedChangingLineTool:x,changedLineTool:C,finishedChangingLineTool:L,startChangingLineTool:W,changeLineTool:H,finishChangingLineTool:j,removedLineTool:I,removeLineTool:z,restoredLineTool:M,restoreLineTool:Y,restoredLineToolState:V,restoreLineToolState:G,finishedLineTool:A,finishLineTool:U,changedLineStyle:k,changeLineStyle:q,copiedLineTool:E,copyLineTool:$,properties:function(){return u},hideAllDrawings:function(){return d},hideMarksOnBars:function(){return _},lockDrawings:function(){return p},drawOnAllCharts:function(){return u.drawOnAllCharts},lockTimeAxis:function(){return f},lockTimeAxisTime:m}}).call(t,i(16),i(8),i(13))},function(e,t,i){"use strict";function n(){return s.replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function o(){return r(12)}function r(e){var t,i,n="";for(t=0;t<e;++t)i=Math.round(Math.random()*(a.length-1)),n+=a[i];return n}var s,a;Object.defineProperty(t,"__esModule",{value:!0}),t.guid=n,t.randomHash=o,t.randomHashN=r,s="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",a="0123456789abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"},function(e,t,i){"use strict";(function(t,n,o,r){function s(e,t,i,n){this._study=e,this.m_series=t,this.m_model=i,this._plotName=n,this._visible=!1,this._points=[new ie(0,0)],this._invalidated=!0,this._lineRenderer=new T}function a(){return{visible:!0,color:"#0496FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,plottype:me.Line,histogramBase:0,transparency:50,trackPrice:!1,joinPoints:!1}}function l(e,t,i,n,o){return c(e,t,i,n,pe.getStudyPropertyRootName(e),o)}function c(e,t,i,n,o,r){var s,a,l,c,h,u=d(e,t,i,n);for(r instanceof y&&(s=pe.getSourceInputIds(e),s.length>0&&(a=s[0],u.inputs[a]="{pid}$0")),l=new oe(o,u,!0),l.addExclusion("visible"),l.addExclusion("precision"),l.addExclusion("minTick"),c=0;c<e.inputs.length;++c)h=e.inputs[c],h.isHidden&&(l.addExclusion("inputs."+c),l.addExclusion("inputs."+h.id));return l}function h(e,t,i,n,o,r){
e.inFire||(e.inFire=!0,e.fire(t),e.inFire=!1)}}function l(){K||(y.setValue(TVSettings.getValue("chart.cursorPreference","cursor")),y.subscribe(function(e){r(e)&&g.setValue(e)},{callWithLast:!0}),g.subscribe(function(e){e&&TVSettings.setValue("chart.cursorPreference",e)}),u=new c("drawings"),d=new o,p=new o,_=new o,f=new o,d.setValue(!1),p.setValue(!1),_.setValue(!1),f.setValue(!1),y.subscribe(function(){h.emit("onSelectedLineToolChanged")}),K=!0)}var c=i(3).DefaultProperty,h=i(31),u=null,d=null,p=null,_=null,f=null,m=new t,y=new t,g=new t,v=new n,S=new n,b=new n,w=new n,P=new n,T=new n,x=new n,C=new n,L=new n,I=new n,A=new n,k=new n,E=new n,M=new n,V=new n,D=a(v),O=a(S),R=a(b),B=a(w),F=a(P),N=a(T),W=a(x),H=a(C),j=a(L),z=a(I),U=a(A),q=a(k),$=a(E),Y=a(M),G=a(V),K=!1;e.exports={tool:y,cursorTool:g,toolIsCursor:r,resetToCursor:s,init:l,createdLineTool:v,continuedLineTool:S,cancelledLineTool:b,createLineTool:D,continueLineTool:O,cancelLineTool:R,startedMovingLineTool:w,movedLineTool:P,finishedMovingLineTool:T,startMovingLineTool:B,moveLineTool:F,finishMovingLineTool:N,startedChangingLineTool:x,changedLineTool:C,finishedChangingLineTool:L,startChangingLineTool:W,changeLineTool:H,finishChangingLineTool:j,removedLineTool:I,removeLineTool:z,restoredLineTool:M,restoreLineTool:Y,restoredLineToolState:V,restoreLineToolState:G,finishedLineTool:A,finishLineTool:U,changedLineStyle:k,changeLineStyle:q,copiedLineTool:E,copyLineTool:$,properties:function(){return u},hideAllDrawings:function(){return d},hideMarksOnBars:function(){return _},lockDrawings:function(){return p},drawOnAllCharts:function(){return u.drawOnAllCharts},lockTimeAxis:function(){return f},lockTimeAxisTime:m}}).call(t,i(16),i(8),i(13))},function(e,t,i){"use strict";function n(){return s.replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function o(){return r(12)}function r(e){var t,i,n="";for(t=0;t<e;++t)i=Math.round(Math.random()*(a.length-1)),n+=a[i];return n}var s,a;Object.defineProperty(t,"__esModule",{value:!0}),t.guid=n,t.randomHash=o,t.randomHashN=r,s="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",a="0123456789abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"},function(e,t,i){"use strict";(function(t,n,o,r){function s(e,t,i,n){this._study=e,this.m_series=t,this.m_model=i,this._plotName=n,this._visible=!1,this._points=[new ie(0,0)],this._invalidated=!0,this._lineRenderer=new T}function a(){return{visible:!0,color:"#0496FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,plottype:me.Line,histogramBase:0,transparency:50,trackPrice:!1,joinPoints:!1}}function l(e,t,i,n,o){return c(e,t,i,n,pe.getStudyPropertyRootName(e),o)}function c(e,t,i,n,o,r){var s,a,l,c,h,u=d(e,t,i,n);for(r instanceof y&&(s=pe.getSourceInputIds(e),s.length>0&&(a=s[0],u.inputs[a]="{pid}$0")),l=new oe(o,u,!0),l.addExclusion("visible"),l.addExclusion("precision"),l.addExclusion("minTick"),c=0;c<e.inputs.length;++c)h=e.inputs[c],h.isHidden&&(l.addExclusion("inputs."+c),l.addExclusion("inputs."+h.id));return l}function h(e,t,i,n,o,r){
return u(e,t,i,n,o,pe.getStudyPropertyRootName(e),r)}function u(e,t,i,n,o,r,s){var a,l,c,h=p(e,t,i,n,o),u=new oe(r,h,!0);for(u.addExclusion("visible"),u.addExclusion("precision"),u.addExclusion("minTick"),a=t||e,l=0;l<a.inputs.length;++l)c=a.inputs[l],c.isHidden&&(u.addExclusion("inputs."+l),u.addExclusion("inputs."+c.id));return u}function d(e,n,o,r){var s,a,l,c,h,u,d,p,y=i(168);if(pe.versionOf(e)<1)throw Error("This function cannot work with metainfo of the old format version. Required format version >= 1");return s=TradingView.clone(defaults("study")),_(s,e),a=pe.getStudyPropertyRootName(e),l=TradingView.clone(defaults(a,r)),e.isTVScript&&e.TVScriptSourceCode!==l.TVScriptSourceCode&&(l=TradingView.clone(TradingView.factoryDefaults(a,r))),TradingView.merge(s,l),n&&(S(!(n instanceof t),"propsState should not be an instance of Property"),TradingView.merge(s,n)),c=TradingView.clone(e),h={},y.mergeInputsObjPart(h,c.defaults.inputs),y.mergeInputsObjPart(h,s.inputs),s.inputs=h,delete c.inputs,delete c.defaults.inputs,u={},TradingView.merge(u,c.defaults),TradingView.merge(u,TradingView.factoryDefaults("study_"+c.id)),TradingView.merge(u,s),TradingView.merge(u,c),delete u.defaults,s=u,d=null!==o?o.model().getStudyShiftColorStartOffset():void 0,p=f(o,e),TradingView.merge(s,m(s,p,d)),n&&TradingView.merge(s.styles,n.styles),s}function p(e,t,n,o,r){var s,a,l,c,h,u,d=i(168);return e.version&&n.version&&e.version!==n.version&&ve.logWarn("Serialized metaInfo version "+e.version+" is not equal to the saved state version "+n.version),s=TradingView.clone(defaults("study")),TradingView.merge(s,TradingView.factoryDefaults("study_"+e.id)),_(s,e),TradingView.merge(s,n),s=r.updateStudyState(s,e,t),a=TradingView.clone(t||e),a&&pe.versionOf(a)>=1&&(l={},d.mergeInputsObjPart(l,a.defaults.inputs),d.mergeInputsObjPart(l,s.inputs),s.inputs=l,delete a.inputs,delete a.defaults.inputs,c={},TradingView.merge(c,a.defaults),TradingView.merge(c,TradingView.factoryDefaults("study_"+a.id)),TradingView.merge(c,s),delete a.defaults,TradingView.merge(c,a),s=c),h=null!==o?o.model().getStudyShiftColorStartOffset():void 0,u=f(o,a),TradingView.merge(s,m(s,u,h)),s}function _(e,t){var i,n,o,r;if(t.plots)for(i=0;i<t.plots.length;i++)n=t.plots[i],o=n.id,fe.isColorerPlot(n)||(r=a(),fe.isBarColorerPlot(n)&&(r.transparency=0),r.plottype=n.type,r.title=o,e.styles&&o in e.styles&&TradingView.merge(r,e.styles[o]),e.styles[o]=r)}function f(e,t){var i,n,o,r,s=0;if(e)for(i=0;i<e.dataSources().length;i++)n=e.dataSources()[i],n.metaInfo&&n.metaInfo()&&(o=n.metaInfo().id===t.id,r=(n.metaInfo().pine&&n.metaInfo().pine.version)===(t.pine&&t.pine.version),o&&r&&s++);return s}function m(e,t,i){var n,o;if(!t)return e;for(n in e.styles)(o=e.styles[n].color)&&(e.styles[n].color=ne(o,t,i));return e}function y(e,t,r,s){var a,l,c,h,u,d,p,_,f,m,g=i(120);for(this._titleCache={},this._resolvedSymbols={},this._priceAxisViewsBase=[],this._paneViews=[],this._hlinesPriceAsisViews=[],this._horizlinesPriceAsisViews=[],H.call(this,e),this._model=e,this._chartApi=e._chartApi,
this._series=r instanceof TradingView.Series?r:this._model.mainSeries(),r instanceof y&&(this._source=r,this._isChildStudy=!0,this._source.setChild(this)),this._numericFormatter=new ae,this._metaInfo=s,this._properties=t,this._properties.listeners().subscribe(this,this._onPropertiesChanged),this._properties.visible.listeners().subscribe(this,this.visibleChanged),this._properties.visible.listeners().subscribe(this,this.processHibernate),a=0;a<this._metaInfo.plots.length;a++)l=this._metaInfo.plots[a].id,null!=(c=this.properties().styles[l])&&null!=c.visible&&c.visible.listeners().subscribe(this,this.processHibernate);for(h in this._metaInfo.graphics)for(u in this._metaInfo.graphics[h])d=this._properties.graphics[h][u],d.visible&&d.visible.listeners().subscribe(this,this.processHibernate);if(this._showStudyArgumentsProperty=this.model().properties().paneProperties.legendProperties.showStudyArguments,this._turnaroundCounter=0,this._turnaround="st"+this._turnaroundCounter,this._status="",this._plotFields=[],p=this.metaInfo().plots)for(a=0,_=p.length;a<_;a++)u=p[a].id,this._plotFields.push(u);this._invalidateLastNonEmptyPlotRowCache(),this.m_data=new ce(ge(this._metaInfo)),this._graphics=new J,this._plotOffsets={},this._plotOffsetsMetaInfoOverride={},this._studyModified=!1,this._tagsChanged=new n,this.createViews(),f=this,this._handler=function(e){f.onData(e)},this._handler.isTVScriptStrategy=this._metaInfo.isTVScriptStrategy,this._createFormatter(),f=this,this._properties.precision.listeners().subscribe(null,function(){f._createFormatter(),f._model.invalidate(new ee(ee.FULL_UPDATE))}),this._showStudyArgumentsProperty.listeners().subscribe(this,this.invalidateTitleCache),this._properties.description.listeners().subscribe(this,this.invalidateTitleCache),this._properties.inputs.listeners().subscribe(this,this.invalidateTitleCache),this._properties.shortDescription&&this._properties.shortDescription.listeners().subscribe(this,this.invalidateTitleCache),o.enabled("update_study_formatter_on_symbol_resolve")&&e.mainSeries().dataEvents().symbolResolved().subscribe(this,y.prototype._createFormatter),f=this,m={},this._simplePlotsCount=s.plots.filter(function(e,t){if(f.isLinePlot(t))return!0;if(f.isOHLCSeriesPlot(t)){var i=f.metaInfo().plots[t].target;return!m[i]&&(m[i]=i,!0)}return!1}).length,this._properties.showInDataWindow.listeners().subscribe(e,g.prototype.fullUpdate),this.hasBarColorer()&&this._properties.visible.listeners().subscribe(e.mainSeries(),TradingView.Series.prototype.invalidateBarStylesCache),this.onStart=new n,this._childStudyByRebind=new n,this._symbolsResolved=new n}function g(e,t){return e&&e[t]&&e[t].hasOwnProperty("showLast")?e[t].showLast.value():null}
var v=i(7),S=v.assert,b=v.ensureNotNull,w=i(259).unpackNonSeriesData,P=i(166).StudyBarColorer,T=i(110).HorizontalLineRenderer,x=i(508),C=x.BandPaneView,L=x.BandBackgroundPaneView,I=x.HlineFillPaneView,A=i(509).StudyPriceAxisView,k=i(510),E=k.StudyPaneView,M=k.StudyBackgroundPaneView,V=k.StudyPlotShapesPaneView,D=k.StudyPlotCharsPaneView,O=k.StudyPlotArrowsPaneView,R=k.StudyPlotBarsPaneView,B=k.StudyPlotCandlesPaneView,N=i(527),F=N.PlotFillPaneView,W=N.AreaBackgroundPaneView,H=i(28).PriceDataSource,j=i(100),z=i(117).StudyDataWindowView,U=i(528).StudyLegendView,q=i(119),Y=i(529),G=Y.emptyStudyGraphics,K=Y.loadStudyGraphics,Z=Y.saveStudyGraphics,J=Y.LiveStudyGraphics,X=Y.createGraphicsPaneViews,Q=Y.createGraphicsPriceAxisViews,ee=i(18),te=i(268).ChartApiInterface,ie=i(6).Point,ne=i(24).shiftColor,oe=i(3).DefaultProperty,re=i(21).PriceFormatter,se=i(530).VolumeFormatter,ae=i(106).NumericFormatter,le=i(17),ce=le.PlotList,he=le.PlotRowSearchMode,ue=le.mergeMinMax,de=i(212).MarkLocation,pe=i(26),_e=i(31),fe=i(87),me=fe.PlotType,ye=i(2).propertyPages,ge=i(269).studyPlotFunctionMap,ve=i(4).getLogger("Chart.Study");s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){this._visible=!1;var e=this._study.lastValueData(this._plotName,!0);e.noData||(this._visible=!0,this._points=[new ie(0,e.coordinate)],this._color=e.color)},s.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};return e.width=this.m_model.timeScale().width(),e.height=this._study.priceScale().height(),e.points=this._points,e.color=this._color,e.linewidth=this._study.properties().styles[this._plotName].linewidth.value(),e.linestyle=CanvasEx.LINESTYLE_DOTTED,e.visible=this._visible,this._lineRenderer.setData(e),this._lineRenderer},inherit(y,H),TradingView.Study=y,y.prototype.lastValueData=function(e,t,i){var n,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x={noData:!0};if(this._model.timeScale().isEmpty()||null==this.priceScale()||this.priceScale().isEmpty()||this.data().isEmpty())return x;if(null===(n=this._model.timeScale().visibleBars()))return x;if(!this.properties().visible.value())return x;if(o=this.properties().styles,r=this.properties().ohlcPlots,o&&o[e]&&(s=o[e]),r&&r[e]&&(s=r[e]),!s||!s.visible.value())return x;if(a=this.offset(e),null==(l=this.nearestIndex(n.lastBar()-a,he.NearestLeft))||void 0===l)return x;for(h=this.metaInfo().plots,c=0;c<h.length&&!(h[c].id===e||this.isOHLCClosePlot(c)&&h[c].target===e);c++);if(u=this._lastNonEmptyPlotRow(c),d=null!==u&&n.contains(u.index),p=null!==u?u.value:null,!(_=t||d?p:this.data().valueAt(l))||!isNumber(_[c+1]))return x;for(f={noData:!1},m=null,y=null,v=0;v<h.length;v++)h[v].target===e&&(this.isSelfColorerPlot(v)||this.isOHLCColorerPlot(v))&&(m=v,y=this.metaInfo().palettes[h[v].palette],g=this.properties().palettes[h[v].palette]);return S=_[c+1],i&&(f.price=S),(b=this.firstValue(!0))?(f.text=this.priceScale().formatPrice(S,b),w=s.color.value(),m&&_.length>m+1?(P=_[m+1],void 0!==P&&null!==P?(T=y.valToIndex?y.valToIndex[P]:P,
var v=i(7),S=v.assert,b=v.ensureNotNull,w=i(259).unpackNonSeriesData,P=i(166).StudyBarColorer,T=i(110).HorizontalLineRenderer,x=i(508),C=x.BandPaneView,L=x.BandBackgroundPaneView,I=x.HlineFillPaneView,A=i(509).StudyPriceAxisView,k=i(510),E=k.StudyPaneView,M=k.StudyBackgroundPaneView,V=k.StudyPlotShapesPaneView,D=k.StudyPlotCharsPaneView,O=k.StudyPlotArrowsPaneView,R=k.StudyPlotBarsPaneView,B=k.StudyPlotCandlesPaneView,F=i(527),N=F.PlotFillPaneView,W=F.AreaBackgroundPaneView,H=i(28).PriceDataSource,j=i(100),z=i(117).StudyDataWindowView,U=i(528).StudyLegendView,q=i(119),Y=i(529),G=Y.emptyStudyGraphics,K=Y.loadStudyGraphics,Z=Y.saveStudyGraphics,J=Y.LiveStudyGraphics,X=Y.createGraphicsPaneViews,Q=Y.createGraphicsPriceAxisViews,ee=i(18),te=i(268).ChartApiInterface,ie=i(6).Point,ne=i(24).shiftColor,oe=i(3).DefaultProperty,re=i(21).PriceFormatter,se=i(530).VolumeFormatter,ae=i(106).NumericFormatter,le=i(17),ce=le.PlotList,he=le.PlotRowSearchMode,ue=le.mergeMinMax,de=i(212).MarkLocation,pe=i(26),_e=i(31),fe=i(87),me=fe.PlotType,ye=i(2).propertyPages,ge=i(269).studyPlotFunctionMap,ve=i(4).getLogger("Chart.Study");s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){this._visible=!1;var e=this._study.lastValueData(this._plotName,!0);e.noData||(this._visible=!0,this._points=[new ie(0,e.coordinate)],this._color=e.color)},s.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};return e.width=this.m_model.timeScale().width(),e.height=this._study.priceScale().height(),e.points=this._points,e.color=this._color,e.linewidth=this._study.properties().styles[this._plotName].linewidth.value(),e.linestyle=CanvasEx.LINESTYLE_DOTTED,e.visible=this._visible,this._lineRenderer.setData(e),this._lineRenderer},inherit(y,H),TradingView.Study=y,y.prototype.lastValueData=function(e,t,i){var n,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x={noData:!0};if(this._model.timeScale().isEmpty()||null==this.priceScale()||this.priceScale().isEmpty()||this.data().isEmpty())return x;if(null===(n=this._model.timeScale().visibleBars()))return x;if(!this.properties().visible.value())return x;if(o=this.properties().styles,r=this.properties().ohlcPlots,o&&o[e]&&(s=o[e]),r&&r[e]&&(s=r[e]),!s||!s.visible.value())return x;if(a=this.offset(e),null==(l=this.nearestIndex(n.lastBar()-a,he.NearestLeft))||void 0===l)return x;for(h=this.metaInfo().plots,c=0;c<h.length&&!(h[c].id===e||this.isOHLCClosePlot(c)&&h[c].target===e);c++);if(u=this._lastNonEmptyPlotRow(c),d=null!==u&&n.contains(u.index),p=null!==u?u.value:null,!(_=t||d?p:this.data().valueAt(l))||!isNumber(_[c+1]))return x;for(f={noData:!1},m=null,y=null,v=0;v<h.length;v++)h[v].target===e&&(this.isSelfColorerPlot(v)||this.isOHLCColorerPlot(v))&&(m=v,y=this.metaInfo().palettes[h[v].palette],g=this.properties().palettes[h[v].palette]);return S=_[c+1],i&&(f.price=S),(b=this.firstValue(!0))?(f.text=this.priceScale().formatPrice(S,b),w=s.color.value(),m&&_.length>m+1?(P=_[m+1],void 0!==P&&null!==P?(T=y.valToIndex?y.valToIndex[P]:P,
f.color=g.colors[T].color.value()):f.color=w):f.color=w,f.floatCoordinate=this.priceScale().priceToCoordinate(S,b,!0),f.coordinate=Math.round(f.floatCoordinate),f.item=_,f):x},y.prototype.isFailed=function(){return this._failed},y.prototype.series=function(){return this._series},y.prototype.model=function(){return this._model},y.prototype._invalidateLastNonEmptyPlotRowCache=function(){this._lastNonEmptyPlotRowCache={}},y.prototype.clearData=function(){this._invalidateLastNonEmptyPlotRowCache(),this.m_data.clear(),this._graphics.clear&&this._graphics.clear(),this._plotOffsets={}},y.prototype.onTagsChanged=function(){return this._tagsChanged},y.prototype.properties=function(){return this._properties},y.prototype.state=function(e){var t,i,n,o,r=TradingView.className(this.constructor),s={type:r,id:this.id(),state:this.properties().state(),zorder:this.zorder()};for(this.metaInfo()instanceof pe?s.metaInfo=TradingView.clone(this.metaInfo().state()):(s.metaInfo=TradingView.clone(this.metaInfo()),s.metaInfo.id=pe.parseIdString(s.metaInfo.id+(s.metaInfo.version?"-"+s.metaInfo.version:"")).fullId),e&&(s.data=this.data().state(),s.data.symbols=this._resolvedSymbols,s.data.graphics=Z(this.graphics()),s.data.plotOffsets=this._plotOffsets),this.ownerSource()&&(s.ownerSource=this.ownerSource().id()),t=0;t<this._metaInfo.inputs.length;t++)"bar_time"===this._metaInfo.inputs[t].type&&(i=this._metaInfo.inputs[t].id,(n=s.state.inputs[i])<0&&(o=this._rightOffsetToUnixTime(-n),s.state.inputs[i]=o&&o>=0?o:0));return this._isChildStudy&&pe.patchChildStudyMetaInfoState(s),s},y.prototype._plotsForAlert=function(){var e=this,t=this._metaInfo,i=[fe.isLinePlot,fe.isShapesPlot,fe.isCharsPlot,fe.isArrowsPlot,fe.isOhlcPlot];return t.plots.map(function(e,t){return e.pinePlotIndex=t,e}).filter(function(e){return i.some(function(t){return t(e)})}).map(function(i){var n={id:i.id,type:i.type,pinePlotIndex:i.pinePlotIndex,offset:e.offset(i.id)};return t.styles&&void 0!==t.styles[i.id]&&(n.title=t.styles[i.id].title||""),i.target&&t.ohlcPlots&&t.ohlcPlots[i.target]&&(n.ohlcTitle=t.ohlcPlots[i.target].title),n})},y.prototype.isSavedInStudyTemplates=function(){for(var e=0;e<this._metaInfo.inputs.length;e++)if("bar_time"===this._metaInfo.inputs[e].type)return!1;return!0},y.prototype.restoreData=function(e){this._invalidateLastNonEmptyPlotRowCache(),this.m_data.restoreState(e),this._resolvedSymbols=e.symbols,this._graphics=e.graphics?K(e.graphics):G(),this._postProcessGraphics(),this._plotOffsets=e.plotOffsets},y.prototype.restart=function(){this._restarting=!0,this.clearData(),o.enabled("stop_study_on_restart")&&this.stop(),setTimeout(this.start.bind(this),0)},y.prototype.stop=function(e){if(!0===e&&this._children)for(var t=0;t<this._children.length;++t)this._children[t].stop(!0);this._chartApi&&this._chartApi.connected()&&this._studyId&&this._chartApi.removeStudy(this._studyId,this._handler,this._isChildStudy),
o.enabled("update_study_formatter_on_symbol_resolve")&&this._model.mainSeries().dataEvents().symbolResolved().unsubscribe(this,y.prototype._createFormatter),this._studyId=null,this.clearData(),this._unsubscribeExtendedHours(),this.recalculate()},y.prototype.symbolsResolved=function(){return this._symbolsResolved},y.prototype.resolvedSymbolInfoBySymbol=function(e){return this._resolvedSymbols&&e?this._resolvedSymbols[e]||null:null},y.prototype._resolveSymbol=function(e){var t=function(i,n){this._chartApi.resolveSymbol(this._makeNextSymbolId(),i,function(i){switch(i.method){case"symbol_resolved":this._resolvedSymbols[e]=i.params[1],this.invalidateTitleCache(!0),n.resolve(e);break;case"symbol_error":if("permission denied"===i.params[1]&&i.params[2])switch(i.params[2]){case TradingView.Series.PD_REASON_EXTENDED_HOURS:break;case TradingView.Series.PD_REASON_SYMBOL:if(i.params[3])return void t(i.params[3],n);break;default:return void t(i.params[2],n)}n.reject(e)}}.bind(this))}.bind(this),i=$.Deferred();return t(e,i),i.promise()},y.prototype._allSymbolsAreResolved=function(){var e,t,i,n,o=$.Deferred(),r=[];for(e=0;e<this._metaInfo.inputs.length;e++)"symbol"===this._metaInfo.inputs[e].type&&(t=this._metaInfo.inputs[e].id,i=this._properties.inputs[t].value(),this._resolvedSymbols[i]||(n=this._resolveSymbol(i),r.push(n)));return r.length>0?$.when.apply($,r).done(function(){0!==this._studyId&&this.stop(!0),this.start(!0),o.resolve("All symbols are resolved now"),this._symbolsResolved.fire()}.bind(this)).fail(function(e){this._status=window.t("Invalid Symbol"),this.stop(!0),this._model.updateSource(this),o.reject("Invalid symbol, "+e)}.bind(this)):o.resolve("There are no symbols to resolve"),o.promise()},y.prototype._allInputsAreValid=function(){var e,t,i;for(e=0;e<this._metaInfo.inputs.length;e++)if("bar_time"===this._metaInfo.inputs[e].type&&(t=this._metaInfo.inputs[e].id,void 0===(i=this._properties.inputs[t].value())||null==i))return!1;return!0},y.prototype.sourceId=function(){return this._studyId},y.prototype.source=function(){return this._source||this._series},y.prototype.ownerSource=function(){return this._isChildStudy?this._source:H.prototype.ownerSource.call(this)},y.prototype.getAllOwnerSources=function(){for(var e=[],t=this.ownerSource();null!=t;)e.push(t),t=t.ownerSource();return e},y.prototype.isChildStudy=function(){return!!this._isChildStudy},y.prototype.setChild=function(e){e instanceof y&&e.source()===this&&(this._children||(this._children=[]),-1===this._children.indexOf(e)&&this._children.push(e))},y.prototype.unsetChild=function(e){if(e instanceof y&&e.source()===this&&this._children){var t=this._children.indexOf(e);~t&&this._children.splice(t,1)}},y.prototype.hasChildren=function(){return!(!this._children||!this._children.length)},y.prototype.getAllChildren=function(){var e,t,i,n;if(!Array.isArray(this._children))return[];for(e=this._children.slice(),t=0;t<e.length;++t)for(i=e[t].getAllChildren(),n=0;n<i.length;++n)~e.indexOf(i[n])||e.push(i[n]);return e},y.prototype._debugId=function(){var e=[]
;return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})},y.prototype.isStarted=function(){return!!this._studyId},y.prototype.isRestarting=function(){return!!this._restarting},y.prototype.isVisible=function(){var e,t,i;if(!this.properties().visible.value())return!1;if(this._metaInfo.plots.length>0)return!0;for(e in this._metaInfo.graphics)for(t in this._metaInfo.graphics[e])if(i=this.properties().graphics[e][t],!i.visible||i.visible.value())return!0;return!!this._metaInfo.isTVScriptStrategy},y.prototype.start=function(e,t){var i,n=this._model.mainSeries();if(!n.isStarted())return void n.dataEvents().completed().subscribe(this,function(){this.start(e,t)},!0);this._isChildStudy&&this._source.isHibernated()&&this._source.start(),i=!this._isChildStudy&&!this.hasChildren()&&!this.isVisible(),!this._chartApi||!this._chartApi.connected()||i&&!0!==t||this._allSymbolsAreResolved().done(function(i){this._startAfterSymbolsResolved(e,t)}.bind(this)).fail(function(e){ve.logError("ERROR: "+this._debugId()+" start failed, "+e),delete this._restarting}.bind(this))},y.prototype._getStudyIdWithLatestVersion=function(){var e=pe.cutDollarHash(this._metaInfo.id),t=e;return e.indexOf("@tv-scripting")>=0?t+="-101!":t+="-"+this._metaInfo.version,t},y.prototype._startAfterSymbolsResolved=function(e,t){var i,n;if(!this.isStarted()||this._restarting){if(this._isChildStudy){if(!this._source.isStarted()||this._source.isRestarting())return void this._source.onStart.subscribe(this,this._startAfterSymbolsResolved,!0);pe.setChildStudyMetaInfoPropertiesSourceId(this._metaInfo,this._source.sourceId(),this._properties)}if(this._studyId=y.makeNextStudyId(),delete this._restarting,this._allInputsAreValid()&&(this._inputs=this.inputs(),i=this._getStudyIdWithLatestVersion(),this._incrementTurnaround(),this._chartApi.createStudy(this._studyId,this._turnaround,this._isChildStudy?this._source.sourceId():this._series._seriesId,i,this._inputs,this._handler,this._isChildStudy),this._studyName=i,this._subscribeExtendedHours(),this.onStart.fire(this._studyId),!0===e&&this._children))for(n=0;n<this._children.length;++n)this._children[n].start(!0,t)}},y._nextSymbolId=0,y.prototype._makeNextSymbolId=function(){return"ss_"+ ++y._nextSymbolId},y._nextStudyId=0,y.makeNextStudyId=function(){return"st"+ ++y._nextStudyId},y.prototype._rightOffsetToUnixTime=function(e){var t;return this._series.bars().size()>=e&&(t=b(this._series.bars().lastIndex())-e,b(this._series.bars().valueAt(t))[TradingView.TIME_PLOT]),null},y.prototype.getSymbolString=function(e){return this._series&&this._series.extendedHours.value()?"="+JSON.stringify({symbol:e,session:"extended"}):e},y.prototype.inputsForGUI=function(){return this.inputs({symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!1})},y.prototype.inputsForAlert=function(){var e=this.offset(),t=this.inputs();return e&&t.push(e),t},y.prototype.inputs=function(e){var t={symbolsForDisplay:!1,symbolsForChartApi:!0,
skipHiddenInputs:!1,skipFakeInputs:!1,asObject:!0};return TradingView.merge(t,e),this._buildInputs(t)},y.prototype._buildInputs=function(e){var t,i;S(!!e,"options not set"),t={};try{t=this._prepareInputs(e)}catch(e){ve.logWarn("Failed to prepare study inputs: "+e)}return e.asObject?(i={},Object.keys(t).forEach(function(e){null!=t[e]&&(i[e]=t[e])}),i):(i=[],Object.keys(t).forEach(function(e){null!=t[e]&&i.push(t[e])}),i)},y.prototype._prepareInputs=function(e){var t,i,n,r;for(S(!!e,"options not set"),t={},i=0;i<this._metaInfo.inputs.length;i++)n=this._metaInfo.inputs[i],n.isFake&&e.skipFakeInputs||n.isHidden&&e.skipHiddenInputs||"bool"===n.type&&e.skipHiddenInputs&&o.enabled("dont_show_boolean_study_arguments")||(r=this._prepareInput(n,e),t[n.id]=TradingView.clone(r));return t},y.prototype._prepareInput=function(e,t){var i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay?i:t.onlyAtomValues?i:{v:i,f:!0,t:e.type}},y.prototype._prepareInputValue=function(e,t){var i,n,o,r,s=e.id;return"symbol"===e.type?(i=this._properties.inputs[s].value(),t&&t.symbolsForDisplay?this._resolvedSymbols&&this._resolvedSymbols[i]&&(i=this._resolvedSymbols[i].exchange?this._resolvedSymbols[i].name+", "+this._resolvedSymbols[i].exchange:this._resolvedSymbols[i].name):(this._resolvedSymbols&&this._resolvedSymbols[i]&&(n=this._resolvedSymbols[i],i=n.ticker||n.full_name),t&&t.symbolsForChartApi&&(i=this.getSymbolString(i))),i):"bar_time"===e.type?(o=this._properties.inputs[s].value(),o<0&&(r=this._rightOffsetToUnixTime(-o),o=r&&r>=0?r:o),o):this._metaInfo.isTVScript||this._metaInfo.pine?"text"===s?this._metaInfo.defaults.inputs.text:"pineId"===s?this._metaInfo.scriptIdPart:"pineVersion"===s?this._metaInfo.pine?this._metaInfo.pine.version:"-1":this._properties.inputs[s].value():this._properties.inputs[s].value()},y.prototype._rebindToSource=function(e,t){var i,n,o,r,s,a,l,c,h,u,d;if(this._isChildStudy){if(this._source.unsetChild(this),delete this._nonPriceParent,n=null,e===this._model.mainSeries()){for(o=this._model.studiesMetaData(),s=0;s<o.length;++s)if(this._metaInfo.id===o[s].id){r=o[s];break}if(!r)return void ve.logError("Can not find "+this._metaInfo.id+" meta info");delete this._source,delete this._isChildStudy,delete this._ownerSource,this._metaInfo=r.state(!0),i=this._series._seriesId,n=te.REBIND_STUDY_CHILD_TO_STANDALONE}else{if(!(e instanceof y))return ve.logError("Unable to rebind study to source of this type"),!1;this._ownerSource=e,this._source=e,i=this._source.sourceId(),this._source.setChild(this),this._source.isHibernated()&&this._source.start()}this._incrementTurnaround(),this._chartApi.rebindStudy(this._studyId,this._turnaround,i,this._studyName,t,this._handler,n)}else{if(!(e instanceof y))return ve.logError("Unable to rebind study to source of this type"),!1;if(a=e.isHibernated(),a&&e.start(),l=!1,this._canCreateStudyWithRebindType(te.REBIND_STUDY_STANDALONE_TO_CHILD)&&(this._incrementTurnaround(),
l=this._chartApi.rebindStudy(this._studyId,this._turnaround,e.sourceId(),this._studyName,t,this._handler,te.REBIND_STUDY_STANDALONE_TO_CHILD)),!l)return a&&e.stop(),!1;this._metaInfo=TradingView.clone(this._metaInfo),this._isChildStudy=!0,this._ownerSource=e,this._source=e,this._source.setChild(this),this._childStudyByRebind.fire()}return c=this.m_priceScale,h=e.priceScale(),c!==h&&(u=this._model.paneForSource(this),d=this._model.paneForSource(e),u===d&&(~c.dataSources().indexOf(this)&&c.removeDataSource(this),h.addDataSource(this),this.setPriceScale(h))),!0},y.prototype.childStudyByRebind=function(){return this._childStudyByRebind},y.prototype._changeInputsImpl=function(e,t){var i,n,o,r,s=this.source(),a=this._properties.inputs&&this._properties.inputs.state(),l=pe.getSourceIdByInputs(this._metaInfo.inputs,a),c=!0;if(l)if("high"===l||"open"===l||"low"===l||"close"===l||"hl2"===l||"ohl3"===l||"ohlc4"===l)s=this._model.mainSeries();else for(i=this._model.dataSources(),n=0;n<i.length;++n)if(i[n]instanceof y&&i[n].sourceId()===l){s=i[n];break}if(s!==this.source()){if(!this._rebindToSource(s,e)&&a){for(o=null,r=null,n=0;n<t.length;++n)if(t[n]!==e[n]&&0===e[n].indexOf(l)){o=this._properties.inputs[a[n].id],r=t[n],c=!1;break}o&&o.setValue(r)}}else this._incrementTurnaround(),this._chartApi.modifyStudy(this._studyId,this._turnaround,e,this._handler);c&&(this._studyModified=c)},y.prototype._incrementTurnaround=function(){this._turnaround="st"+ ++this._turnaroundCounter},y.prototype._tryChangeInputs=function(){var e=TradingView.clone(this._inputs);this.isStarted()&&this._chartApi.connected()?this._allInputsAreValid()?this._allSymbolsAreResolved().done(function(){var t=this.inputs();JSON.stringify(t)!==JSON.stringify(this._inputs)&&(this._changeInputsImpl(t,e),this._inputs=t)}.bind(this)).fail(function(e){ve.logError("ERROR: "+this._debugId()+" _tryChangeInputs: cannot modify study, "+e)}.bind(this)):this.stop():(this.stop(!0),this.start(!0)),this._tagsChanged.fire()},y.prototype.testInputValue=function(e,t){var i,n;return!pe.canBeChild(this._metaInfo)||!pe.isSourceInput(e)||(!(i=this._properties.inputs&&this._properties.inputs[e.id])||(n=y.getInputRebindType(e,i.value(),t),!!this._canCreateStudyWithRebindType(n)))},y.prototype._canCreateStudyWithRebindType=function(e){return e!==te.REBIND_STUDY_STANDALONE_TO_CHILD||this._chartApi.isCanCreateStudy(!0)},y.prototype.changeStyles=function(){var e=null!=this._metaInfo.inputs.filter(function(e){return"symbol"===e.type})[0];!this.isStarted()&&!e||this._restarting||(this._inputs?this._tryChangeInputs():this._chartApi&&this._chartApi.connected()&&this.restart(),this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),e&&this.invalidateBarStylesCache(),this.createViews(),this.recalculate(!0),this.updateAllViews())},y.prototype._onPropertiesChanged=function(){this.changeStyles(),_e.emit("study_properties_changed",this._id)},y.prototype._isModifiedStudyInputs=function(e){if(void 0===this._oldStudyInputs)return this._oldStudyInputs=e,!0
;var t=Object.keys(this._oldStudyInputs);return S(t.length===Object.keys(e).length,"keys quantity should be equal"),t.forEach(function(t){S(e.hasOwnProperty(t),"key '"+t+"' should existing in studyInputs"),this._oldStudyInputs[t]!==e[t]&&(this._oldStudyInputs=e)},this),this._oldStudyInputs===e},y.prototype.visibleChanged=function(){this._series instanceof TradingView.Series&&this._series.invalidateBarColorerCache()},y.prototype.invalidateBarStylesCache=function(){this.m_data.each(function(e,t){t[TradingView.STYLE_PLOT]=null})},y.prototype.processHibernate=function(){this.isHibernateAllowed()&&(!this._studyId&&this.isVisible()&&this.start(),this._studyId&&!this.isVisible()&&this.stop())},y.prototype.isHibernated=function(){return!this.isVisible()&&!this._studyId},y.prototype.isHibernateAllowed=function(){return!this._isChildStudy&&!this.hasChildren()},y.prototype.lastPriceLabelFixedCoordinate=function(e){return this._priceAxisViewsCache[e]._fixedCoordinate},y.prototype.priceLabelText=function(e){var t,i,n,o;return 1===this._simplePlotsCount?this._metaInfo.shortDescription:(t=this._metaInfo.styles,i=this._metaInfo.ohlcPlots,t&&t[e]&&(n=t[e]),i&&i[e]&&(n=i[e]),o=n.title,this._metaInfo.is_price_study?this._metaInfo.shortDescription+":"+o:o)},y.prototype.createPlotLabels=function(e){for(var t=0;t<e.length;t++)this._paneViews.push(new j(this._model,this,e[t],"priceLabelText","showStudyPlotLabels"))},y.prototype.createViews=function(){var e,t,i,n,o,r,a,l,c;if(this._priceAxisViewsBase=[],this._paneViews=[],e={},this._priceAxisViewsCache={},t=[],this.metaInfo().plots)for(i=0;i<this.metaInfo().plots.length;i++)if(!(this.isSelfColorerPlot(i)||this.isTextColorerPlot(i)||this.isBarColorerPlot(i)||this.isOHLCColorerPlot(i)))if(n=this.metaInfo().plots[i].id,this.isBgColorerPlot(i))this._paneViews.push(new M(this,this._series,this._model,n));else if(this.isPlotShapesPlot(i))this._paneViews.push(new V(this,this._series,this._model,n));else if(this.isPlotCharsPlot(i))this._paneViews.push(new D(this,this._series,this._model,n));else if(this.isPlotArrowsPlot(i))this._paneViews.push(new O(this,this._series,this._model,n));else if(this.isOHLCSeriesPlot(i)){if(o=this.metaInfo().plots[i].target,e[o])continue;e[o]=o,this.isOHLCBarsPlot(i)?this._paneViews.push(new R(this,this._series,this._model,o)):this.isOHLCCandlesPlot(i)&&this._paneViews.push(new B(this,this._series,this._model,o)),r=new A(this,{plotIndex:o}),this._priceAxisViewsCache[o]=r,this._priceAxisViewsBase.push(r),t.push(o)}else r=new A(this,{plotIndex:n}),this._priceAxisViewsCache[n]=r,this._priceAxisViewsBase.push(r),this._paneViews.push(new E(this,this._series,this._model,n)),this.properties().styles[n].trackPrice.value()&&this._paneViews.push(new s(this,this._series,this._model,n)),t.push(n);if(this._properties.bands)for(i=0;i<this._properties.bands.childCount();i++)this._properties.bands[i].visible.value()&&this._paneViews.push(new C(this._properties.bands[i],this));if(this._properties.bandsBackground&&this._paneViews.push(new L(this)),a=this._paneViews,
X(this).then(function(e){for(var t=0;t<e.length;t++)a.push(e[t])}),this._properties.areaBackground&&this._paneViews.push(new W(this)),this._properties.filledAreas&&this._metaInfo.filledAreas)for(i=0;i<this._metaInfo.filledAreas.length;++i)l=this._metaInfo.filledAreas[i],c=this._properties.filledAreasStyle[l.id],l.type===pe.FilledArea.TYPE_PLOTS||l.palette?this._paneViews.push(new F(this,l,c)):l.type===pe.FilledArea.TYPE_HLINES?this._paneViews.push(new I(this,l,c)):ve.logWarn("Unsupported filledArea type: "+l.type);this.createPlotLabels(t),this._dataWindowView||(this._dataWindowView=new z(this,this._model)),this._legendView||(this._legendView=new U(this,this._model)),this._statusView||(this._statusView=new q(this,this._model.properties())),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},y.prototype.recalculate=function(e){var t=this._model.paneForSource(this);this._model.recalculatePane(t,e),this._model.updateSource(this)},y.prototype.data=function(){return this.m_data},y.prototype.metaInfo=function(){return this._metaInfo},y.prototype.status=function(){return this._status},y.prototype.title=function(e,t,i){var n,o;return i=void 0===i?!this._showStudyArgumentsProperty.value():i,n=JSON.stringify([e,t,i]),this._titleCache[n]?this._titleCache[n]:(o=this._title(e,t,i),this._titleCache[n]=o,o)},y.prototype._title=function(e,t,i){var n,o,r,s,a,l,c,h,u,d,p,_,f;if(n=e?this._metaInfo.shortDescription||this._properties.shortDescription&&this._properties.shortDescription.value()||"Study":this._metaInfo.description||this._properties.description&&this._properties.description.value()||"Study",t=t||{},n=window.t(n),!i&&(o=this.inputsForGUI()||[],o.length>0)){if(r={},this._isChildStudy)for(s=0;s<this._metaInfo.inputs.length;++s)if(a=this._metaInfo.inputs[s],pe.isSourceInput(a)){l=a.id,c=this._properties.inputs[l].value(),c.indexOf("$")>=0&&this._source&&(h=this._source.metaInfo(),u=this._source.title(e,null,!0),1===h.plots.length?r[c]=u:(d=c.split("$")[1],p=h.plots[d].id,_=h.styles&&h.styles[p]&&h.styles[p].title||p,r[c]=u+":"+_));break}f=this,o=o.map(function(e){var i=isNumber(e)?f._numericFormatter.format(e):r&&r[e]||e;return t[i]&&(i=t[i]),i}),n+=" ("+o.join(", ")+")"}return n},y.prototype.invalidateTitleCache=function(e){if(this._titleCache={},!0===e&&this._children)for(var t=0;t<this._children.length;++t)this._children[t].invalidateTitleCache(e)},y.prototype.graphics=function(){return this._graphics},y.prototype.turnaround=function(e){return!0===e?this.source().turnaround(!0)+"_"+this._turnaround:this._turnaround},y.prototype._checkTurnaround=function(e){return e===this._turnaround||e===this._model.mainSeries().turnaround()||e===this.turnaround(!0)},y.prototype.onData=function(e){var t,i,n,o,r,s=this;switch(e.method){case"study_loading":this._status=window.t("loading..."),this._failed=!1,this._statusView.update(),this._model.updateSource(this),s._loadingStartTime=(new Date).getTime();break;case"study_error":delete this._loadingStartTime,this._failed=!0,
X(this).then(function(e){for(var t=0;t<e.length;t++)a.push(e[t])}),this._properties.areaBackground&&this._paneViews.push(new W(this)),this._properties.filledAreas&&this._metaInfo.filledAreas)for(i=0;i<this._metaInfo.filledAreas.length;++i)l=this._metaInfo.filledAreas[i],c=this._properties.filledAreasStyle[l.id],l.type===pe.FilledArea.TYPE_PLOTS||l.palette?this._paneViews.push(new N(this,l,c)):l.type===pe.FilledArea.TYPE_HLINES?this._paneViews.push(new I(this,l,c)):ve.logWarn("Unsupported filledArea type: "+l.type);this.createPlotLabels(t),this._dataWindowView||(this._dataWindowView=new z(this,this._model)),this._legendView||(this._legendView=new U(this,this._model)),this._statusView||(this._statusView=new q(this,this._model.properties())),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},y.prototype.recalculate=function(e){var t=this._model.paneForSource(this);this._model.recalculatePane(t,e),this._model.updateSource(this)},y.prototype.data=function(){return this.m_data},y.prototype.metaInfo=function(){return this._metaInfo},y.prototype.status=function(){return this._status},y.prototype.title=function(e,t,i){var n,o;return i=void 0===i?!this._showStudyArgumentsProperty.value():i,n=JSON.stringify([e,t,i]),this._titleCache[n]?this._titleCache[n]:(o=this._title(e,t,i),this._titleCache[n]=o,o)},y.prototype._title=function(e,t,i){var n,o,r,s,a,l,c,h,u,d,p,_,f;if(n=e?this._metaInfo.shortDescription||this._properties.shortDescription&&this._properties.shortDescription.value()||"Study":this._metaInfo.description||this._properties.description&&this._properties.description.value()||"Study",t=t||{},n=window.t(n),!i&&(o=this.inputsForGUI()||[],o.length>0)){if(r={},this._isChildStudy)for(s=0;s<this._metaInfo.inputs.length;++s)if(a=this._metaInfo.inputs[s],pe.isSourceInput(a)){l=a.id,c=this._properties.inputs[l].value(),c.indexOf("$")>=0&&this._source&&(h=this._source.metaInfo(),u=this._source.title(e,null,!0),1===h.plots.length?r[c]=u:(d=c.split("$")[1],p=h.plots[d].id,_=h.styles&&h.styles[p]&&h.styles[p].title||p,r[c]=u+":"+_));break}f=this,o=o.map(function(e){var i=isNumber(e)?f._numericFormatter.format(e):r&&r[e]||e;return t[i]&&(i=t[i]),i}),n+=" ("+o.join(", ")+")"}return n},y.prototype.invalidateTitleCache=function(e){if(this._titleCache={},!0===e&&this._children)for(var t=0;t<this._children.length;++t)this._children[t].invalidateTitleCache(e)},y.prototype.graphics=function(){return this._graphics},y.prototype.turnaround=function(e){return!0===e?this.source().turnaround(!0)+"_"+this._turnaround:this._turnaround},y.prototype._checkTurnaround=function(e){return e===this._turnaround||e===this._model.mainSeries().turnaround()||e===this.turnaround(!0)},y.prototype.onData=function(e){var t,i,n,o,r,s=this;switch(e.method){case"study_loading":this._status=window.t("loading..."),this._failed=!1,this._statusView.update(),this._model.updateSource(this),s._loadingStartTime=(new Date).getTime();break;case"study_error":delete this._loadingStartTime,this._failed=!0,
this.clearData(),this._status="","string"==typeof e.params[2]&&(t=e.params[2],i=t.split(":",2)[0],i.length>0&&(this._status=$.t(i))),this._statusView.update(),this._model.updateSource(this);break;case"study_completed":if(!this._checkTurnaround(e.params[1]))return;n="chartSession:"+s._chartApi._sessionid,o=(new Date).getTime()-this._loadingStartTime,ve.logDebug(n+", Study "+this._metaInfo.description+" loading took "+o+" ms"),delete this._loadingStartTime,this._status="",this._statusView.update(),r=this._model.paneForSource(this),this._model.recalculatePane(r),this._updateSources(),this._model.invalidate(new ee(ee.FULL_UPDATE));break;case"study_deleted":break;case"data_update":if(e.params.customId!==this.sourceId()||!this._checkTurnaround(e.params.turnaround))return;S(!!e.params.nonseries,"data.params.nonseries is missing"),this._onDataUpdate(e.params.plots,e.params.nonseries)}},y.prototype._onDataUpdate=function(e,t){this._studyModified&&(this.clearData(),this._studyModified=!1),w(t.d).then(function(i){"nochange"!==t.indexes&&this._processPlotOffsets(i),this.transformData(e),this._mergeData(e),null!==i&&(i.indexes_replace?(S("nochange"!==t.indexes),this._graphics.replaceIndexesTo(t.indexes)):("nochange"!==t.indexes&&this._graphics.replaceIndexesTo(t.indexes),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds,this._metaInfo.graphics))),this._onDataUpdated(e,i,t.indexes)}.bind(this))},y.prototype._onDataUpdated=function(e,t,i){this.hasBarColorer()&&e.length>0&&this._model.mainSeries().invalidateBarStylesCache(e[0].index),null!==t&&this._postProcessGraphics();var n=this._model.paneForSource(this);this._model.recalculatePane(n),this._updateSources()},y.prototype.transformData=function(e){},y.prototype.moveData=function(e){this._invalidateLastNonEmptyPlotRowCache(),this.m_data.move(e)},y.prototype.replaceData=function(e,t,i){this._invalidateLastNonEmptyPlotRowCache(),this.m_data.remove(e+1),this.m_data.addTail(i,t)},y.prototype._updateSources=function(){this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())},y.processPlotOffsets=function(e,t){t&&t.indexes_replace||(e._plotOffsets=t&&t.offsets||{})},y.prototype._processPlotOffsets=function(e){y.processPlotOffsets(this,e)},y.prototype._mergeData=function(e){this._invalidateLastNonEmptyPlotRowCache(),this.m_data.merge(e)},y.prototype._postProcessGraphics=function(){this._priceAxisViews=[].concat(this._priceAxisViewsBase,Q(this))},y.prototype._getNonPriceParent=function(){var e,t;if(this._nonPriceParent)return this._nonPriceParent;for(e=this.source();e instanceof y;){if(t=e.metaInfo(),!t.is_price_study||"Compare@tv-basicstudies"===t.id)return this._nonPriceParent=e,e;e=e.source()}},y.prototype.firstValue=function(e){var t,i,n,o,r,s;return!this._isChildStudy&&"Compare@tv-basicstudies"===this._metaInfo.id||!this._metaInfo.is_price_study?null===(t=this._model.timeScale().visibleBars())?null:(i=t.firstBar(),n=t.lastBar(),0===this.data().size()?null:(r=this,this.data().range(i,n).each(function(t,i){var n,s,a
;for(n=1;n<i.length;++n)if(void 0!==i[n-1]&&null!==i[n-1]&&!r.isSelfColorerPlot(n-1)&&(s=r._metaInfo.plots[n-1].id,a=r.properties().styles[s],a.visible&&a.visible.value()&&!(e&&Math.abs(i[n])<1e-10||void 0===i[n]||null===i[n]||o)))return o=i[n],!0}),this._nonPriceFirstValue=o,o)):this._isChildStudy&&(s=this._getNonPriceParent())&&this.priceScale()===s.priceScale()?void 0!==s._nonPriceFirstValue?s._nonPriceFirstValue:s.firstValue():this._series.firstValue()},y.offset=function(e,t){var i=0;return e._plotOffsets&&void 0!==e._plotOffsets[t]&&(i+=e._plotOffsets[t]),void 0!==e._plotOffsetsMetaInfoOverride[t]?i+=e._plotOffsetsMetaInfoOverride[t]:e.properties().offsets&&void 0!==e.properties().offsets[t]&&(i+=e.properties().offsets[t].val.value()),e.properties().offset&&(i+=e.properties().offset.val.value()),i},y.prototype.offset=function(e){return y.offset(this,e)},y.prototype.priceRange=function(e,t){var i,n,o,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S;if(!TradingView.isInteger(e))return void ve.logDebug("priceRange: incorrect startBar");if(!TradingView.isInteger(t))return void ve.logDebug("priceRange: incorrect endBar");if(0===this.m_data.size())return null;if(i=null,n=this,o=n._metaInfo,0===o.plots.length)return null;for(a=[],c=null,h=0;h<o.plots.length;++h)if(!(n.isSelfColorerPlot(h)||n.isTextColorerPlot(h)||n.isBarColorerPlot(h)||n.isBgColorerPlot(h)||n.isOHLCColorerPlot(h))&&(u=o.plots[h].id,n.isOHLCSeriesPlot(h)?(p=o.plots[h].target,d=n.properties().ohlcPlots[p]):d=n.properties().styles[u],d.visible.value()&&(l=null,d.location&&(l=d.location.value()),s||(_=[de.Absolute,de.Top,de.Bottom].indexOf(l)<0,f=n.isPlotShapesPlot(h)||n.isPlotCharsPlot(h),s=f&&_||n.isPlotArrowsPlot(h)),n.isLinePlot(h)||(n.isPlotShapesPlot(h)||n.isPlotCharsPlot(h))&&d.location.value()===de.Absolute||n.isOHLCSeriesPlot(h)))){if(m={name:u,offset:n.offset(u)},y=n.properties().styles[u].plottype.value(),!n.properties().skipHistogramBaseOnAutoScale&&[me.Histogram,me.Columns,me.Area].indexOf(y)>=0){if(g=n.properties().styles[u].histogramBase.value(),!isNumber(g))continue;c=ue(c,{min:g,max:g})}a.push(m)}if(v=n.m_data.minMaxOnRangeCached(e,t,a),v=ue(c,v),s&&(a=[{name:"low",offset:0},{name:"high",offset:0}],S=n.series().data().bars().minMaxOnRangeCached(e,t,a),v=ue(v,S)),null!==v&&(i=new r(v.min,v.max)),o.bands)for(h=0;h<o.bands.length;h++)if(n.properties().bands[h].visible.value()){if(g=n.properties().bands[h].value.value(),!isNumber(g))continue;i?i.apply(g,g):i=new r(g,g)}return this._postProcessPriceRange(i)},y.prototype._postProcessPriceRange=function(e){var t,i;return e&&e.minValue()===e.maxValue()&&(t=.005*e.minValue(),e=new r(e.minValue()-t,e.maxValue()+t)),i=this.priceScale(),i&&i.isLog()&&e?new r(this.priceScale().priceToLogical(e.minValue()),this.priceScale().priceToLogical(e.maxValue())):e},y.prototype.paneViews=function(e){return this.properties().visible.value()?this._paneViews:null},y.prototype.dataWindowView=function(){return this._dataWindowView},y.prototype.legendView=function(){return this._legendView},y.prototype.statusView=function(){
return this._statusView},y.prototype.priceAxisViews=function(e,t){return this._model.paneForSource(this)===e&&t===this.priceScale()&&(this._showLastValueOnPriceScale()||this.properties().oldShowLastValue&&this.properties().oldShowLastValue.value())?this._priceAxisViews:null},y.prototype._showLastValueOnPriceScale=function(){return this._model.properties().scalesProperties.showStudyLastValue.value()},y.prototype.isLinePlot=function(e){var t=this._metaInfo.plots[e];return fe.isLinePlot(t)},y.isSelfColorerPlot=function(e,t){var i=e._metaInfo.plots[t];return fe.isColorerPlot(i)},y.prototype.isSelfColorerPlot=function(e){return y.isSelfColorerPlot(this,e)},y.prototype.isTextColorerPlot=function(e){var t=this._metaInfo.plots[e];return fe.isTextColorerPlot(t)},y.prototype.isBarColorerPlot=function(e){var t=this._metaInfo.plots[e];return fe.isBarColorerPlot(t)},y.prototype.isBgColorerPlot=function(e){var t=this._metaInfo.plots[e];return fe.isBgColorerPlot(t)},y.prototype.isPlotShapesPlot=function(e){var t=this._metaInfo.plots[e];return fe.isShapesPlot(t)},y.prototype.isPlotCharsPlot=function(e){var t=this._metaInfo.plots[e];return fe.isCharsPlot(t)},y.prototype.isPlotArrowsPlot=function(e){var t=this._metaInfo.plots[e];return fe.isArrowsPlot(t)},y.prototype.isOHLCBarsPlot=function(e){var t=this._metaInfo.plots[e].target,i=this.metaInfo().defaults.ohlcPlots[t];return i&&this.isOHLCSeriesPlot(e)&&fe.isOhlcPlotStyleBars(i)},y.prototype.isOHLCCandlesPlot=function(e){var t=this._metaInfo.plots[e].target,i=this.metaInfo().defaults.ohlcPlots[t];return i&&this.isOHLCSeriesPlot(e)&&fe.isOhlcPlotStyleCandles(i)},y.prototype.isOHLCSeriesPlot=function(e){var t=this._metaInfo.plots[e];return fe.isOhlcPlot(t)},y.prototype.isOHLCOpenPlot=function(e){var t=this._metaInfo.plots[e];return fe.isOhlcOpenPlot(t)},y.prototype.isOHLCHighPlot=function(e){var t=this._metaInfo.plots[e];return fe.isOhlcHighPlot(t)},y.prototype.isOHLCLowPlot=function(e){var t=this._metaInfo.plots[e];return fe.isOhlcLowPlot(t)},y.prototype.isOHLCClosePlot=function(e){var t=this._metaInfo.plots[e];return fe.isOhlcClosePlot(t)},y.prototype.isOHLCColorerPlot=function(e){var t=this._metaInfo.plots[e];return fe.isOhlcColorerPlot(t)},y.prototype.isDataOffsetPlot=function(e){var t=this._metaInfo.plots[e];return fe.isDataOffsetPlot(t)},y.prototype.hasBarColorer=function(){for(var e=0;e<this._metaInfo.plots.length;++e)if(this.isBarColorerPlot(e))return!0;return!1},y.prototype.barColorer=function(){var e,t,i=null;for(e=0;e<this._metaInfo.plots.length;++e)this.isBarColorerPlot(e)&&(t=new P(this,e),null==i?i=t:i.pushBackBarColorer(t));if(null==i)throw Error("Cannot create BarColorer: study doesn't have a bar_colorer plot!");return i},y.prototype.base=function(){return"Volume"===this._metaInfo.id?1:0},y.prototype._createFormatter=function(){var e,t,i;"default"===this.properties().precision.value()?this.metaInfo().defaults&&(e=parseInt(this.metaInfo().defaults.precision)):e=parseInt(this.properties().precision.value()),
@@ -62,26 +62,26 @@ this._textImageHeight=this._textCache.textImageHeight)}var o=i(6).Point,r=i(9).H
LineToolABCD:i(569).LineToolABCD,LineToolRiskReward:i(175).LineToolRiskReward,LineToolPolyline:i(571).LineToolPolyline,LineToolPrediction:i(572).LineToolPrediction,LineToolPriceLabel:i(573).LineToolPriceLabel,LineToolNote:i(276).LineToolNote,LineToolNoteAbsolute:i(276).LineToolNoteAbsolute,LineToolBrush:i(574).LineToolBrush,LineToolArc:i(575).LineToolArc,LineToolCallout:i(576).LineToolCallout,LineToolBalloon:i(577).LineToolBalloon,LineToolText:i(277).LineToolText,LineToolHorzLine:i(578).LineToolHorzLine,LineToolHorzRay:i(579).LineToolHorzRay,LineToolRectangle:i(580).LineToolRectangle,LineToolEllipse:i(581).LineToolEllipse,LineToolTimeCycles:i(582).LineToolTimeCycles,LineToolSineLine:i(583).LineToolSineLine,LineToolGhostFeed:i(584).LineToolGhostFeed,LineToolBezierQuadro:i(585).LineToolBezierQuadro,LineToolBezierCubic:i(586).LineToolBezierCubic,LineToolArrow:i(587).LineToolArrow,LineToolRay:i(588).LineToolRay,LineToolExtended:i(589).LineToolExtended,LineToolSchiffPitchfork:i(590).LineToolSchiffPitchfork,LineToolSchiffPitchfork2:i(591).LineToolSchiffPitchfork2,LineToolInsidePitchfork:i(592).LineToolInsidePitchfork,LineToolTextAbsolute:i(277).LineToolTextAbsolute,LineToolArrowMarkLeft:i(102).LineToolArrowMarkLeft,LineToolArrowMarkRight:i(102).LineToolArrowMarkRight,LineToolArrowMarkUp:i(102).LineToolArrowMarkUp,LineToolArrowMarkDown:i(102).LineToolArrowMarkDown,LineToolFlagMark:i(593).LineToolFlagMark,LineToolCypherPattern:i(594).LineToolCypherPattern,LineToolElliottImpulse:i(80).LineToolElliottImpulse,LineToolElliottTriangle:i(80).LineToolElliottTriangle,LineToolElliottTripleCombo:i(80).LineToolElliottTripleCombo,LineToolElliottCorrection:i(80).LineToolElliottCorrection,LineToolElliottDoubleCombo:i(80).LineToolElliottDoubleCombo,LineToolRiskRewardLong:i(175).LineToolRiskRewardLong,LineToolRiskRewardShort:i(175).LineToolRiskRewardShort,LineToolPosition:i(595).LineToolPosition,LineToolOrder:i(597).LineToolOrder},o=Object.keys(n),r=o.length;r--;)TradingView[o[r]]=n[o[r]];e.exports=n},function(e,t,i){"use strict";var n,o,r,s;i(246),n=i(50),o=n.greaterThan,r=n.lessThan,s=window.CanvasEx=i(85),TradingView.resizeCanvas=function(e,t,i){var n,o,r,s,a,l=e.prop("height"),c=e.prop("width");l&&c&&(l/=window.hidpiCanvasRatio||1,c/=window.hidpiCanvasRatio||1,l<1&&(l=1),c<1&&(c=1),n=$("<canvas>").prop("width",c).prop("height",l),o=n.get(0).getContext("2d"),r=Math.min(c,t),s=Math.min(l,i),r&&s&&o.drawImage(e.get(0),0,0,r,s,0,0,r,s),e.prop("height",i).prop("width",t),a=e.get(0).getContext("2d"),r&&s&&a.drawImage(n.get(0),0,0,r,s,0,0,r,s),n.remove())},s.computeDashPattern=function(e){return[[e.lineWidth,2*e.lineWidth],[5*e.lineWidth,6*e.lineWidth],[6*e.lineWidth,6*e.lineWidth],[e.lineWidth,4*e.lineWidth]][e.lineStyle-1]},s.drawLine=function(e,t,i,n,o){isFinite(t)&&isFinite(n)&&isFinite(i)&&isFinite(o)&&(e.lineStyle===s.LINESTYLE_DASHED||e.lineStyle===s.LINESTYLE_DOTTED||e.lineStyle===s.LINESTYLE_SPARSE_DOTTED?e.drawDashedLine(e,t,i,n,o):s.drawSolidLine(e,t,i,n,o))},s.drawArrow=function(e,t,i,n,o){
isFinite(t)&&isFinite(n)&&isFinite(i)&&isFinite(o)&&(e.beginPath(),e.moveTo(n,o),e.lineTo(t,i),e.moveTo(t+2,i+2),e.lineTo(t-2,i+2),e.moveTo(t-1,i+1),e.lineTo(t+1,i+1),e.stroke())},s.drawSolidLine=function(e,t,i,n,o){e.beginPath(),e.moveTo(t,i),e.lineTo(n,o),e.stroke()},s.setLineStyle=function(e,t){e.lineStyle=t;var i=[];t!==s.LINESTYLE_SOLID&&(i=s.computeDashPattern(e)),"function"==typeof e.setLineDash?e.setLineDash(i):void 0!==e.mozDash?e.mozDash=i:void 0!==e.webkitLineDash&&(e.webkitLineDash=i)},s.drawPoly=function(e,t,i){var n,o;for(e.beginPath(),e.moveTo(t[0].x,t[0].y),n=0;n<t.length;n++)o=t[n],e.lineTo(o.x,o.y);e.closePath(),e.stroke(),i&&e.fill()},s.drawRoundRect=function(e,t,i,n,o,r){e.beginPath(),e.moveTo(t+r,i),e.lineTo(t+n-r,i),e.arcTo(t+n,i,t+n,i+r,r),e.lineTo(t+n,i+o-r),e.arcTo(t+n,i+o,t+n-r,i+o,r),e.lineTo(t+r,i+o),e.arcTo(t,i+o,t,i+o-r,r),e.lineTo(t,i+r),e.arcTo(t,i,t+r,i,r)},s.drawDashedLineHorizontal=function(e,t,i,n){var o,r,a,l,c,h,u;for(e.save(),o=s.computeDashPattern(e),r=0,a=e.lineWidth,l=a/2,e.translate(-l,-l),c=!0,h=t+n;t<h;)u=o[r],c&&e.fillRect(t,i,u,a),c=!c,t+=u,r=r===o.length-1?0:r+1;e.restore()},s.drawDashedLineVertical=function(e,t,i,n){var o,r,a,l,c,h,u;for(e.save(),o=s.computeDashPattern(e),r=0,a=e.lineWidth,l=a/2,e.translate(-l,-l),c=!0,h=i+n;i<h;)u=o[r],c&&e.fillRect(t,i,a,u),c=!c,i+=u,r=r===o.length-1?0:r+1;e.restore()},s.lineStyles=[],"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.setFont=function(e){if(this.font!==e)try{this.font=e}catch(e){}},CanvasRenderingContext2D.prototype.lineStyle=s.LINESTYLE_SOLID,s.originalSave=CanvasRenderingContext2D.prototype.save,s.originalRestore=CanvasRenderingContext2D.prototype.restore,CanvasRenderingContext2D.prototype.save=function(){s.lineStyles.push(this.lineStyle),s.originalSave.call(this)},CanvasRenderingContext2D.prototype.restore=function(){s.lineStyles.length>0&&(this.lineStyle=s.lineStyles.pop(),s.originalRestore.call(this))},CanvasRenderingContext2D.prototype.drawDashedLine=function(e,t,i,n,o){e.save();var r=s.computeDashPattern(e);if(e.beginPath(),"function"==typeof e.setLineDash)e.setLineDash(r);else if(void 0!==e.mozDash)e.mozDash=r;else{if(void 0===e.webkitLineDash)return e.dashedLineTo(t,i,n,o,r),e.stroke(),void e.restore();e.webkitLineDash=r}e.moveTo(t,i),e.lineTo(n,o),e.stroke(),e.restore()},CanvasRenderingContext2D.prototype.dashedLineTo=function(e,t,i,n,s){var a,l,c,h,u,d,p={thereYet:o,cap:Math.min},_={thereYet:o,cap:Math.min};for(t-n>0&&(_.thereYet=r,_.cap=Math.max),e-i>0&&(p.thereYet=r,p.cap=Math.max),this.moveTo(e,t),a=e,l=t,c=0,h=!0;!p.thereYet(a,i)||!_.thereYet(l,n);)u=Math.atan2(n-t,i-e),d=s[c],a=p.cap(i,a+Math.cos(u)*d),l=_.cap(n,l+Math.sin(u)*d),h?this.lineTo(a,l):this.moveTo(a,l),c=(c+1)%s.length,h=!h}),e.exports=s},,function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"PriceRange",function(){return s}),n=i(12),i.n(n),o=i(4),r=Object(o.getLogger)("Chart.PriceRange"),s=function(){function e(e,t){var i,n;null!==e&&"object"==typeof e?(i=e,
this._minValue=i.m_minValue,this._maxValue=i.m_maxValue):(n=e,this._minValue=n,void 0!==t&&(this._maxValue=t))}return e.prototype.equals=function(e){return this._minValue===e._minValue&&this._maxValue===e._maxValue},e.prototype.clone=function(){return new e(this._minValue,this._maxValue)},e.prototype.minValue=function(){return this._minValue},e.prototype.setMinValue=function(e){this._minValue=e},e.prototype.maxValue=function(){return this._maxValue},e.prototype.setMaxValue=function(e){this._maxValue=e},e.prototype.length=function(){return this._maxValue-this._minValue},e.prototype.isEmpty=function(){return this._maxValue===this._minValue||this._maxValue!==this._maxValue||this._minValue!==this._minValue},e.prototype.serialize=function(){return{m_maxValue:this._maxValue,m_minValue:this._minValue}},e.prototype.state=function(){return{max:this._maxValue,min:this._minValue}},e.prototype.merge=function(t){return new e(Math.min(this.minValue(),t.minValue()),Math.max(this.maxValue(),t.maxValue()))},e.prototype.apply=function(e,t){this._minValue=Math.min(this._minValue,e),this._maxValue=Math.max(this._maxValue,t)},e.prototype.set=function(e,t){this._minValue=e,this._maxValue=t},e.prototype.scaleAroundCenter=function(e){var t,i,o,s;if(!Object(n.isNumber)(e))return void r.logDebug("PriceRange.scaleAroundCenter: invalid coeff");0!==(t=this._maxValue-this._minValue)&&(i=.5*(this._maxValue+this._minValue),o=this._maxValue-i,s=this._minValue-i,o*=e,s*=e,this._maxValue=i+o,this._minValue=i+s)},e.prototype.shift=function(e){if(!Object(n.isNumber)(e))return void r.logDebug("PriceRange.shift: invalid coeff");this._maxValue+=e,this._minValue+=e},e.prototype.containsStrictly=function(e){return e.minValue()>this._minValue&&e.maxValue()<this._maxValue},e}()},function(e,t,i){"use strict";(function(e,t){var n,o,r,s,a,l;i(71),n=i(322).regExpEscape,o=i(108).TVXWindowEvents,r=i(159).TVLocalStorage,s=i(8),a=["s.tradingview.com","betacdn.tradingview.com"],l=window.TVSettings=function(){function t(e){return M+"."+e}function i(e,t){var i;return i=V[e],window.is_authenticated&&!W||null!=i||(i=V[e]),null==i?t:i}function c(e,t){var n=i(e,void 0);if(null==n)return t;try{return JSON.parse(n)}catch(i){return f(e),t}}function h(e,t){var n=i(e);return null==n?t:!(!n||"false"===n||0==+n)}function u(e,t,n){var o,r=i(e,void 0,n);if(null==r)return t;if(o=parseFloat(r),!isFinite(o))throw new TypeError('"'+r+'" is not float (key: "'+e+'")');return o}function d(e,t,n){var o,r=i(e,void 0,n);if(null==r)return t;if(o=parseInt(r,10),!isFinite(o))throw new TypeError('"'+r+'" is not int (key: "'+e+'")');return o}function p(e,t,i){i=i||{};var n=""+t;return V[e]!==n&&(V[e]=n,y(e)),i.forceFlush&&!R&&(R=setTimeout(function(){R=void 0,g()},E)),l}function _(e,t,i){return p(e,JSON.stringify(t),i),l}function f(e,t){return t=t||{},null!=V[e]&&(delete V[e],y(e)),t.forceFlush&&g(),l}function m(){O=void 0,D.length&&g()}function y(e){if(H)null==V[e]?H.removeValue(e):H.setValue(e,V[e]);else if(!window.is_authenticated||W)try{null==V[e]?r.removeItem(t(e)):r.setItem(t(e),V[e])
}catch(e){}else D.push(e),O||(O=setTimeout(m,k));o.emit("settings",JSON.stringify({key:e,value:V[e]}))}function g(t){var i,n,o,r,s;if(!e.enabled("widget")&&window.is_authenticated&&!W&&0!==D.length){for(i=D,D=[],n={},o=i.length;o--;)r=i[o],s=V[r],void 0===s&&(s=null),n[r]=s;$.ajax({url:"/savesettings/",type:"POST",data:{delta:JSON.stringify(n)},async:!t})}}function v(){return Object.keys(V)}function S(e,t){var i,o=v(t),r=[];for(e=RegExp("^"+n(e).replace(/\\\*\\\*/gi,".+").replace(/\\\*/gi,"[^.]+")+"$","gi"),i=o.length-1;i>=0;i--)e.test(o[i])&&r.push(o[i]),e.lastIndex=0;return r}function b(e){for(var t=0;t<B.length;++t)if(B[t].exec(e))return!0;return!1}function w(){var t,i,n,o,s;for(V={},t=M+".",i=!e.enabled("save_chart_properties_to_local_storage"),n=r.length;n--;)(o=r.key(n))&&o.substring(0,t.length)===t&&(s=o.substring(t.length),i&&!b(s)||(V[s]=r.getItem(o)))}function P(e){var t,i,n,o,s;for(V={},t=0===Object.keys(e).length,i=M+".",n=r.length;n--;)(o=r.key(n))&&o.substring(0,i.length)===i&&(t&&(s=o.substring(i.length),p(s,r.getItem(o))),r.removeItem(o));Object.keys(e).forEach(function(t){V[t]=e[t]+""})}function T(){var e,t,i,n;if(TradingView.onWidget()&&a.includes(window.location.host))for(e="tradingview.",t=r.length;t--;)i=r.key(t),0===i.indexOf(e)&&(n=i.replace(e,M+"."),r.setItem(n,r.getItem(i)),r.removeItem(i))}function x(e){H?P(H.initialSettings||{}):window.is_authenticated&&!W?P(e||{}):(T(),w()),N.fire()}function C(e){H=e}var L,I,A,k,E,M,V,D,O,R,B,N,F=!1,W=e.enabled("cqg_terminal"),H=null;try{F=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(e){}return F?(L={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},I=function(e,t,i){var n=L[e];return null==n?t:n},A=function(){},{loaded:!1,loadedModel:!1,getValue:I,getJSON:I,getBool:I,getFloat:I,getInt:I,setValue:A,setJSON:A,remove:A,keys:function(){return Object.keys(L)},keysMask:function(){return[]},sync:A,onSync:{subscribe:function(){}}}):(k=12e4,E=10,"local"===window.environment&&(k=5e3),M=TradingView.onWidget()?"tradingview-widget":"tradingview",V={},D=[],B=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^domepanel.visible$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/],o.on("settings",function(e){var t=JSON.parse(e);null==t.value?delete V[t.key]:V[t.key]=t.value}),N=new s,document.addEventListener("visibilitychange",function(){"hidden"!==document.visibiltyState&&!0!==document.hidden||g()}),window.addEventListener("unload",function(){g(!0)}),{loaded:!1,loadedModel:!1,getValue:i,getJSON:c,getBool:h,getFloat:u,getInt:d,setValue:p,setJSON:_,remove:f,keys:v,keysMask:S,sync:x,onSync:N,setSettingsAdapter:C})}(),void 0!==t&&t&&t.exports&&(t.exports=l)}).call(t,i(5),i(51)(e))},function(e,t,i){"use strict";function n(e,t){return e<=t}function o(e,t){
}catch(e){}else D.push(e),O||(O=setTimeout(m,k));o.emit("settings",JSON.stringify({key:e,value:V[e]}))}function g(t){var i,n,o,r,s;if(!e.enabled("widget")&&window.is_authenticated&&!W&&0!==D.length){for(i=D,D=[],n={},o=i.length;o--;)r=i[o],s=V[r],void 0===s&&(s=null),n[r]=s;$.ajax({url:"/savesettings/",type:"POST",data:{delta:JSON.stringify(n)},async:!t})}}function v(){return Object.keys(V)}function S(e,t){var i,o=v(t),r=[];for(e=RegExp("^"+n(e).replace(/\\\*\\\*/gi,".+").replace(/\\\*/gi,"[^.]+")+"$","gi"),i=o.length-1;i>=0;i--)e.test(o[i])&&r.push(o[i]),e.lastIndex=0;return r}function b(e){for(var t=0;t<B.length;++t)if(B[t].exec(e))return!0;return!1}function w(){var t,i,n,o,s;for(V={},t=M+".",i=!e.enabled("save_chart_properties_to_local_storage"),n=r.length;n--;)(o=r.key(n))&&o.substring(0,t.length)===t&&(s=o.substring(t.length),i&&!b(s)||(V[s]=r.getItem(o)))}function P(e){var t,i,n,o,s;for(V={},t=0===Object.keys(e).length,i=M+".",n=r.length;n--;)(o=r.key(n))&&o.substring(0,i.length)===i&&(t&&(s=o.substring(i.length),p(s,r.getItem(o))),r.removeItem(o));Object.keys(e).forEach(function(t){V[t]=e[t]+""})}function T(){var e,t,i,n;if(TradingView.onWidget()&&a.includes(window.location.host))for(e="tradingview.",t=r.length;t--;)i=r.key(t),0===i.indexOf(e)&&(n=i.replace(e,M+"."),r.setItem(n,r.getItem(i)),r.removeItem(i))}function x(e){H?P(H.initialSettings||{}):window.is_authenticated&&!W?P(e||{}):(T(),w()),F.fire()}function C(e){H=e}var L,I,A,k,E,M,V,D,O,R,B,F,N=!1,W=e.enabled("cqg_terminal"),H=null;try{N=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(e){}return N?(L={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},I=function(e,t,i){var n=L[e];return null==n?t:n},A=function(){},{loaded:!1,loadedModel:!1,getValue:I,getJSON:I,getBool:I,getFloat:I,getInt:I,setValue:A,setJSON:A,remove:A,keys:function(){return Object.keys(L)},keysMask:function(){return[]},sync:A,onSync:{subscribe:function(){}}}):(k=12e4,E=10,"local"===window.environment&&(k=5e3),M=TradingView.onWidget()?"tradingview-widget":"tradingview",V={},D=[],B=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^domepanel.visible$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/],o.on("settings",function(e){var t=JSON.parse(e);null==t.value?delete V[t.key]:V[t.key]=t.value}),F=new s,document.addEventListener("visibilitychange",function(){"hidden"!==document.visibiltyState&&!0!==document.hidden||g()}),window.addEventListener("unload",function(){g(!0)}),{loaded:!1,loadedModel:!1,getValue:i,getJSON:c,getBool:h,getFloat:u,getInt:d,setValue:p,setJSON:_,remove:f,keys:v,keysMask:S,sync:x,onSync:F,setSettingsAdapter:C})}(),void 0!==t&&t&&t.exports&&(t.exports=l)}).call(t,i(5),i(51)(e))},function(e,t,i){"use strict";function n(e,t){return e<=t}function o(e,t){
return e>=t}function r(e,t,i){return Math.min(Math.max(e,t),i)}function s(e){return e<0?-1:e>0?1:0}function a(e){if(e<0)return f.logDebug("MathEx.isBaseDecimal: argument less zero"),!1;for(var t=e;t>1;t/=10)if(t%10!=0)return!1;return!0}function l(e,t,i){return t-e<=i}function c(e,t,i){return Math.abs(e-t)<i}function h(e){return e<=0?(f.logDebug("MathEx.log10: argument less or equal zero"),NaN):Math.log(e)/Math.log(10)}function u(e,t){return e<t?-1:e>t?1:0}function d(e,t){var i,n;if(void 0===t&&(t=u),e.length<1)throw Error("array is empty");for(i=e[0],n=0;n<e.length;++n)t(e[n],i)<0&&(i=e[n]);return i}function p(e,t){var i,n;if(void 0===t&&(t=u),e.length<1)throw Error("array is empty");for(i=e[0],n=0;n<e.length;++n)t(e[n],i)>0&&(i=e[n]);return i}var _,f;Object.defineProperty(t,"__esModule",{value:!0}),t.lessThan=n,t.greaterThan=o,t.clamp=r,t.sign=s,t.isBaseDecimal=a,t.greaterOrEqual=l,t.equal=c,t.log10=h,t.defComparator=u,t.min=d,t.max=p,_=i(4),f=Object(_.getLogger)("Common.MathEx")},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},,,,,,,function(e,t,i){"use strict";var n,o=i(24),r=i(1),s=i(29),a=i(38),l=function(){function e(e){this.setData(e)}return e.prototype.setData=function(e){this._data=r.a({},e)},e.prototype.draw=function(e,t){var i,n,o,r,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P;this._data.visible&&(i=t.fontSize,e.font=t.font,n=t.tickLength,o=t.borderSize,r=t.paddingTop,l=t.paddingBottom,c=t.paddingInner,h=t.paddingOuter,u=Math.ceil(t.widthCache.measureText(e,this._data.text)),d=t.baselineOffset,p=t.fontSize+r+l,_=o+u+c+h+n,f=this._data.coordinate,this._data.fixedCoordinate&&(f=this._data.fixedCoordinate),m=f-Math.floor(i/2)-r-.5,y=m+p,g=t.isLeft?t.width-o-.5:.5,v=g,e.fillStyle=Object(s.resetTransparency)(this._data.background),e.lineWidth=1,this._data.text&&(t.isLeft?(v=g-_,S=g-n,b=v+h):(v=g+_,S=g+n,b=g+o+n+c),e.beginPath(),e.moveTo(g,m),e.lineTo(v,m),e.lineTo(v,y),e.lineTo(g,y),e.fill(),e.beginPath(),e.strokeStyle=this._data.color,e.moveTo(g,f),e.lineTo(S,f),e.stroke(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(Object(a.startWithLTR)(this._data.text),b,y-l-d)),this._data.secondLine&&(w=Math.ceil(t.widthCache.measureText(e,this._data.secondLine)),P=w+c+h,e.fillStyle=Object(s.resetTransparency)(this._data.background),this._data.text&&(m+=p+1,y+=p+1),t.isLeft?(v=Math.min(v,t.width-n),g=v+P,b=v+h):(g=Math.max(v-P,o),v=g+P,b=g+c),e.beginPath(),e.moveTo(g,m),e.lineTo(v,m),e.lineTo(v,y),e.lineTo(g,y),e.fill(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(Object(a.startWithLTR)(this._data.secondLine),b,y-l-d)))},e.prototype.height=function(e,t){var i=e.fontSize+e.paddingTop+e.paddingBottom;return this._data.secondLine&&t?2*i+1:i},e}();i.d(t,"a",function(){return n}),n=function(){function e(){this._rendererData={text:"",coordinate:0,
fixedCoordinate:0,color:"#FFF",background:"#000",visible:!1},this._renderer=new l(this._rendererData),this._invalidated=!0}return e.prototype.text=function(){return this._rendererData.text},e.prototype.background=function(){return this._rendererData.background},e.prototype.color=function(){return this.generateTextColor(this.background())},e.prototype.generateTextColor=function(e){return"black"===Object(o.rgbToBlackWhiteString)(Object(o.parseRgb)(e),160)?"white":"black"},e.prototype.coordinate=function(){return this._updateRendererDataIfNeeded(),this._rendererData.coordinate},e.prototype.floatCoordinate=function(){return this._updateRendererDataIfNeeded(),this._rendererData.floatCoordinate||this._rendererData.coordinate},e.prototype.update=function(){this._invalidated=!0},e.prototype.height=function(e,t){return void 0===t&&(t=!1),this._renderer.height(e,t)},e.prototype.getFixedCoordinate=function(){return this._rendererData.fixedCoordinate||0},e.prototype.setFixedCoordinate=function(e){this._rendererData.fixedCoordinate=e},e.prototype.isVisible=function(){return this._rendererData.visible},e.prototype.renderer=function(){return this._updateRendererDataIfNeeded(),this._renderer.setData(this._rendererData),this._renderer},e.prototype._updateRendererDataIfNeeded=function(){this._invalidated&&(this._updateRendererData(this._rendererData),this._invalidated=!1)},e}()},,function(e,t,i){"use strict";function n(e,t){var i=t.edge;return i.A*e.x+i.B*e.y+i.C>0===t.isPositive}function o(e,t,i,n){var o=t.add(i).scaled(.5),r=o.add(n).scaled(.5),s=l.intersectLineSegments(t,i,r,e);return null===s&&(null===(s=l.intersectLineSegments(i,n,r,e))&&null===(s=l.intersectLineSegments(n,t,r,e)))}function r(e,t,i){return e.x>=t.x&&e.x<=i.x&&e.y>=t.y&&e.y<=i.y}function s(e,t){var i,n,o,r=t.length-1,s=!1,a=e.x,l=e.y;for(i=0;i<t.length;i++)n=t[i],o=t[r],(n.y<l&&o.y>=l||o.y<l&&n.y>=l)&&n.x+(l-n.y)/(o.y-n.y)*(o.x-n.x)<a&&(s=!s),r=i;return s}function a(e,t,i){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)<=i*i}Object.defineProperty(t,"__esModule",{value:!0});var l=i(129);t.pointInHalfplane=n,t.pointInTriangle=o,t.pointInRectangle=r,t.pointInPolygon=s,t.pointInCircle=a},function(e,t,i){"use strict";function n(e){return C.Interval.parse(e).value()}function o(e){var t,i,o,r;return!!C.Interval.isRange(e)||(e=n(e),t=A.linking.supportedResolutions.value(),i=!1,void 0!==t?(o=t.map(n),i=-1!==o.indexOf(e)):i=!0,r=A.linking.intraday.value(),r?i:C.Interval.isDWM(e)&&i)}function r(e){C.Interval.isValid(e)&&(C.Interval.isRange(e)?I.setValue("chart.lastUsedRangeResolution",e):I.setValue("chart.lastUsedTimeBasedResolution",e))}function s(e){var t,i=I.getValue("chart.lastUsedRangeResolution");return void 0!==i&&C.Interval.isRange(i)?i:(t=e.filter(function(e){return C.Interval.isRange(e)}),t.includes("100R")?"100R":t.length>0?t[0]:"100R")}function a(e){var t,i=I.getValue("chart.lastUsedTimeBasedResolution");return void 0!==i&&C.Interval.isTimeBased(i)?i:(t=e.filter(function(e){return C.Interval.isTimeBased(e)}),t.includes("1D")?"1D":t.length>0?t[0]:"1D")}
function l(e){return e?"100R":"1D"}function c(e,t,i){var n=L.isRangeStyle(e),o=C.Interval.isRange(t);return!n&&o?a(i):n&&!o?s(i):t}function h(e){return C.Interval.isRange(e)?"1":e}function u(e){var t=C.Interval.parse(e),i=d(t.kind()),n=t.multiplier();return void 0!==n&&n<=i}function d(e){var t=D[e];return Number.isNaN(t)?1:t}function p(e){return d(C.Interval.kind(e))}function _(e){var t=f(I.getJSON(e,[]));return E()(t.filter(u).map(n))}function f(e){return Array.isArray(e)?e:Object.keys(e)}function m(){var e,t,i,o=[];for(e=0;e<arguments.length;e++)o[e]=arguments[e];return i=(t=[]).concat.apply(t,o),i=E()(i.filter(u).map(n)),y(i)}function y(e){return e.sort(v)}function g(e){var t=new C.Interval(e),i=t.multiplier()||1;return t.kind()===C.ResolutionKind.Minutes&&T(i)?[C.ResolutionKind.Hours,Math.floor(i/60)]:[t.kind(),i]}function v(e,t){var i=g(e),n=i[0],o=i[1],r=g(t),s=r[0],a=r[1];return n!==s?O[n]-O[s]:o-a}function S(){var e=[];return e}function b(e){var t=w(e);return""+t.multiplier+t.shortKind}function w(e){var t=C.Interval.parse(e),i=t.multiplier(),n=t.kind();if(!t.isValid()||void 0===i)throw new TypeError("Can't translate invalid interval");return t.kind()===C.ResolutionKind.Minutes&&T(i)&&(i=Math.floor(i/60),n=C.ResolutionKind.Hours),{multiplier:""+i,shortKind:P(n),hint:i+" "+P(n,i),mayOmitMultiplier:t.isDWM()&&1===i}}function P(e,t){if(t)switch(e){case C.ResolutionKind.Days:return window.t("day",{plural:"days",count:t});case C.ResolutionKind.Weeks:return window.t("week",{plural:"weeks",count:t});case C.ResolutionKind.Months:return window.t("month",{plural:"months",count:t});case C.ResolutionKind.Seconds:return window.t("second",{plural:"seconds",count:t});case C.ResolutionKind.Minutes:return window.t("minute",{plural:"minutes",count:t});case C.ResolutionKind.Hours:return window.t("hour",{plural:"hours",count:t});case C.ResolutionKind.Range:return window.t("range",{plural:"ranges",count:t});default:return e}else switch(e){case C.ResolutionKind.Minutes:return window.t("m",{context:"interval_short"});case C.ResolutionKind.Hours:return window.t("h",{context:"interval_short"});case C.ResolutionKind.Days:return window.t("D",{context:"interval_short"});case C.ResolutionKind.Weeks:return window.t("W",{context:"interval_short"});case C.ResolutionKind.Months:return window.t("Mo",{context:"interval_short"});case C.ResolutionKind.Range:return window.t("R",{context:"interval_short"});default:return""}}function T(e){return e>=60&&!(e%60)}var x,C,L,I,A,k,E,M,V,D,O;Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeIntervalString=n,t.isAvailable=o,t.setLastUsedResolution=r,t.getRangeResolution=s,t.getTimeBasedResolution=a,t.getDefaultResolution=l,t.getResolutionByChartStyle=c,t.getServerInterval=h,t.isResolutionMultiplierValid=u,t.getMaxResolutionValue=p,t.getResolutionsFromSettings=_,t.convertResolutionsFromSettings=f,t.mergeResolutions=m,t.sortResolutions=y,t.getCustomResolutions=S,t.getTranslatedResolution=b,t.getTranslatedResolutionModel=w,t.isHour=T,x=i(248),i.n(x),i(11),C=i(15),L=i(42),I=i(49),i.n(I),A=i(62),
k=i(204),E=i.n(k),M={},M[C.ResolutionKind.Seconds]=60,M[C.ResolutionKind.Minutes]=1440,M[C.ResolutionKind.Hours]=24,M[C.ResolutionKind.Days]=365,M[C.ResolutionKind.Weeks]=52,M[C.ResolutionKind.Months]=12,M[C.ResolutionKind.Range]=1e3,M[C.ResolutionKind.Invalid]=NaN,D=M,V={},V[C.ResolutionKind.Seconds]=1,V[C.ResolutionKind.Minutes]=2,V[C.ResolutionKind.Hours]=3,V[C.ResolutionKind.Days]=4,V[C.ResolutionKind.Weeks]=5,V[C.ResolutionKind.Months]=6,V[C.ResolutionKind.Range]=7,V[C.ResolutionKind.Invalid]=8,O=V},function(e,t,i){"use strict";var n,o,r,s,a,l;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"Linking",function(){return a}),i.d(t,"linking",function(){return l}),n=i(16),o=i.n(n),r=i(5),i.n(r),function(e){e[e.NotBound=0]="NotBound",e[e.BoundToWidget=1]="BoundToWidget",e[e.BoundToModel=2]="BoundToModel"}(s||(s={})),a=function(){function e(){this._watchedSymbol=new o.a,this._seriesShortSymbol=new o.a,this._proSymbol=new o.a,this._watchedInterval=new o.a,this._watchedIntraday=new o.a,this._watchedSupportedResolutions=new o.a,this._symbolNamesList=new o.a,this._chartWidgetBindingState=s.NotBound,this._activeChartWidget=null,this._watchedSymbolListenerBound=this._watchedSymbolListener.bind(this),this._watchedIntervalListenerBound=this._watchedIntervalListener.bind(this),this._onSymbolLinkBound=this._onSymbolLink.bind(this),this._searchCharts=null,this._selfEmit=!1,this._preventFeedBySymbol=!1}return Object.defineProperty(e.prototype,"symbol",{get:function(){return this._watchedSymbol},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"proSymbol",{get:function(){return this._proSymbol},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"symbolNamesList",{get:function(){return this._symbolNamesList},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"seriesShortSymbol",{get:function(){return this._seriesShortSymbol.readonly()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interval",{get:function(){return this._watchedInterval},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"intraday",{get:function(){return this._watchedIntraday.readonly()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"supportedResolutions",{get:function(){return this._watchedSupportedResolutions.readonly()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preventFeedBySymbol",{get:function(){return this._preventFeedBySymbol},enumerable:!0,configurable:!0}),e.prototype.bindToChartWidget=function(e){var t,i;if(this.unbindFromChartWidget(),this._activeChartWidget=e,t=e.model())return void this._onChartModelCreated(t);e.modelCreated().subscribe(this,this._onChartModelCreated),this._chartWidgetBindingState=s.BoundToWidget,i=e.properties().mainSeriesProperties,this._watchedSymbol.setValue(i.symbol.value()),this._watchedInterval.setValue(i.interval.value())},e.prototype.unbindFromChartWidget=function(){switch(this._chartWidgetBindingState){case s.BoundToWidget:if(!this._activeChartWidget)throw Error("ChartWidget is undefined")
;this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);break;case s.BoundToModel:this._symbolProperty().unsubscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.unsubscribe(this._watchedSymbolListenerBound),this._mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._updateSeriesSymbolInfo),this._mainSeries().dataEvents().symbolError().unsubscribe(this,this._updateSeriesSymbolInfo),this._intervalProperty().unsubscribe(this,this._onIntervalPropertyChange),this._watchedInterval.unsubscribe(this._watchedIntervalListenerBound),delete this._watchedSymbol.hook,delete this._watchedSymbol.writeLock}this._activeChartWidget=null,this._chartWidgetBindingState=s.NotBound},e.prototype.getChartWidget=function(){return this._activeChartWidget},e.prototype.bindToChartWidgetCollection=function(e){var t=this;this._chartWidgetCollection=e,this.unbindFromChartWidget(),e.activeChartWidget.subscribe(function(e){t.unbindFromChartWidget(),t.bindToChartWidget(e)},{callWithLast:!0})},e.prototype.bindToSearchCharts=function(e){this.unbindFromSearchCharts(),this._searchCharts=e,e.onSearchBySymbol.subscribe(this,this._onSearchBySymbol),this._watchedSymbol.subscribe(this._onSymbolLinkBound)},e.prototype.unbindFromSearchCharts=function(){this._searchCharts&&(this._searchCharts.onSearchBySymbol.unsubscribe(this,this._onSearchBySymbol),this._watchedSymbol.unsubscribe(this._onSymbolLinkBound),this._searchCharts=null)},e.prototype.setPreventFeedBySymbol=function(e){this._preventFeedBySymbol=e},e.prototype._onSearchBySymbol=function(e){if(!e.resolved_symbol)throw Error("no resolved_symbol");this._selfEmit=!0,this._watchedSymbol.setValue(e.resolved_symbol),this._selfEmit=!1},e.prototype._onSymbolLink=function(e){if(!this._selfEmit){if(!this._searchCharts)throw Error("No search charts defined");this._preventFeedBySymbol||this._searchCharts.feedBySymbol(e)}},e.prototype._mainSeries=function(){if(!this._activeChartWidget)throw Error("ChartWidget is undefined");return this._activeChartWidget.model().mainSeries()},e.prototype._properties=function(){return this._mainSeries().properties()},e.prototype._symbolProperty=function(){return this._properties().symbol},e.prototype._intervalProperty=function(){return this._properties().interval},e.prototype._watchedSymbolListener=function(e){(r.enabled("same_data_requery")||this._symbolProperty().value()!==e)&&this._chartWidgetCollection.setSymbol(e)},e.prototype._onSymbolPropertyChange=function(){this._watchedSymbol.setValue(this._symbolProperty().value())},e.prototype._onSymbolResolved=function(e){var t=this._mainSeries().symbolInfo();t&&this._applyValuesFromSymbolInfo(t)},e.prototype._applyValuesFromSymbolInfo=function(e){var t=e.pro_name||r.enabled("trading_terminal")&&(e.full_name||e.name)||"";this._proSymbol.setValue(t),e.aliases&&this._symbolNamesList.setValue(e.aliases)},e.prototype._updateSeriesSymbolInfo=function(){this._seriesShortSymbol.setValue(this._properties().shortName.value());var e=this._mainSeries().symbolInfo();e?(this._applyValuesFromSymbolInfo(e),
e.hasOwnProperty("supported_resolutions")?this._watchedSupportedResolutions.setValue(e.supported_resolutions):this._watchedSupportedResolutions.setValue(void 0),this._watchedIntraday.setValue(!!e.has_intraday)):(this._watchedIntraday.deleteValue(),this._proSymbol.deleteValue())},e.prototype._watchedIntervalListener=function(e){(r.enabled("same_data_requery")||this._intervalProperty().value()!==e)&&this._chartWidgetCollection.setResolution(e)},e.prototype._onIntervalPropertyChange=function(){this._watchedInterval.setValue(this._intervalProperty().value())},e.prototype._onChartModelCreated=function(e){var t,i,n;if(!this._activeChartWidget)throw Error("ChartWidget is undefined");this._chartWidgetBindingState=s.BoundToModel,this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated),t=this._symbolProperty(),t.subscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.setValue(t.value()),this._watchedSymbol.subscribe(this._watchedSymbolListenerBound),i=this._mainSeries(),i.dataEvents().symbolResolved().subscribe(this,this._onSymbolResolved),this._watchedSymbol.hook=function(e){return i.symbolSameAsCurrent(e)&&(e=i.symbol()),e},i.dataEvents().symbolResolved().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolError().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolGroupNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().extendedHoursNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),this._updateSeriesSymbolInfo(),n=this._intervalProperty(),n.subscribe(this,this._onIntervalPropertyChange),this._watchedInterval.setValue(n.value()),this._watchedInterval.subscribe(this._watchedIntervalListenerBound),this._activeChartWidget.readOnly()&&(this._watchedSymbol.writeLock=!0)},e}(),window.TradingView=window.TradingView||{},l=new a,window.TradingView.Linking=l},function(e,t,i){"use strict";(function(e,n,o,r){function s(){return{count:TradingView.DEFAULT_BAR_COUNT}}function a(t,o,r){var l,_=i(120);L.call(this,t),this._dataEvents=new oe,this._boxSizeChanged=new e,this._tagsChanged=new e,this._symbolIntervalChanged=new e,this._intervalChanged=new e,this._extendedHoursChanged=new e,this.chartWidgetInitialized=new e,this._onStyleChanged=new e,this._onStatusChanged=new e,this._onRestarted=new e,this._onSessionsStudyCreated=new e,this.requestingIntradayWhenNotSupported=new e,this.requestingResolutionWhenNotSupported=new e,this._priceScaleChanged=new e,this._onInReplayStateChanged=new e,this._requestOptions=r||s(),this.m_model=t,this._chartApi=t._chartApi,this.m_data=new A,this.setProperties(o),this._prevChartStyle=o.style.value(),this.createPaneView(),this._dataWindowView=new d(this,t),this._legendView=new p(this,t),this._statusView=new c(this,t.properties()),this._priceAxisViews=[new u(this,{model:t}),new h(this,{model:t})],this._symbolInfo=null,this._status=a.STATUS_OFFLINE,this._syncModel=null,this._replaySubscriber=null,l=this,this._turnaroundCounter=1,
this._turnaround="s"+this._turnaroundCounter,this._handler=function(e){l.onData(e)},this._haStyle={studyId:Z.chartStyleStudyId(a.STYLE_HEIKEN_ASHI,!0)},this._renkoStyle={studyId:Z.chartStyleStudyId(a.STYLE_RENKO,!0)},this._pbStyle={studyId:Z.chartStyleStudyId(a.STYLE_PB,!0)},this._kagiStyle={studyId:Z.chartStyleStudyId(a.STYLE_KAGI,!0)},this._pnfStyle={studyId:Z.chartStyleStudyId(a.STYLE_PNF,!0)},this._rangeStyle={studyId:Z.chartStyleStudyId(a.STYLE_RANGE,!0)},this._properties.addExclusion&&this._properties.addExclusion("visible"),this._base=100,this._formatter=new D(this._base),this._predictBars=0,this._futureBarsPaneView=null,this._properties.showInDataWindow.listeners().subscribe(t,_.prototype.fullUpdate),this.marketStatus=new n,this._seriesLoaded=!1,this.properties().minTick.listeners().subscribe(this,a.prototype._recreateFormatter),l=this,this.properties().minTick.listeners().subscribe(null,function(){l.m_model.invalidate(new M(M.FULL_UPDATE))}),this._priceLineView=new ne(this),this._baseHorizontalLineView=new ie(this),this._gotoDateResultCleared=!1,this._gotoDateView=null,this.bindStyleChange(),this.bindJapChartsInputs(),this._createIsPrevClosePriceAvailableProperty(),this.createExtendedHoursProperty(),this.extendedHours.listeners().subscribe(this,function(e){this._extendedHoursChanged.fire(e),this.restart()}),this._dataEvents.extendedHoursNotPermitted().subscribe(this,function(){this._properties.extendedHours.setValue(!1)}),this._extendedHoursChanged.subscribe(this,function(){this._status!==a.STATUS_SNAPSHOT&&this.restart()}),this._symbolIntervalChanged.subscribe(this,this.checkInterval),this.properties().showCountdown.listeners().subscribe(this,a.prototype._onChangeShowCountdown),this._onChangeShowCountdown(this.properties().showCountdown),this._recreateFormatter(),this._isDWMCached=null,this.properties().lineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().areaStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().baselineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this._updateBarFunction()}var l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,N,F,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se;TradingView.DEFAULT_BAR_COUNT=300,TradingView.TIME_PLOT=0,TradingView.OPEN_PLOT=1,TradingView.HIGH_PLOT=2,TradingView.LOW_PLOT=3,TradingView.CLOSE_PLOT=4,TradingView.ADT_PLOT=6,TradingView.STYLE_PLOT=7,l=i(7).ensureNotNull,c=i(604),h=i(606).ProjectionSeriesPriceAxisView,u=i(279).SeriesPriceAxisView,d=i(280).SeriesDataWindowView,p=i(607).SeriesLegendView,_=i(282),f=_.SeriesAreaPaneView,m=_.SeriesLinePaneView,y=_.SeriesHollowCandlesPaneView,g=_.SeriesCandlesPaneView,v=_.SeriesBarsPaneView,S=_.SeriesHeikenAshiPaneView,b=_.SeriesBaselinePaneView,w=i(283).SeriesWaterlinePaneView,P=i(5),T=i(2).propertyPages,x=i(214).BarsRange,C=i(166).SeriesBarColorer,L=i(28).PriceDataSource,I=i(100),A=i(72).SeriesData,k=i(72).barFunction,E=i(72).seriesPlotFunctionMap,M=i(18),V=i(609),D=i(21).PriceFormatter,O=i(17),R=O.PlotList,
B=O.PlotRowSearchMode,N=O.mergeMinMax,F=i(26),W=i(259).unpackNonSeriesData,H=i(610).SyncModel,j=i(39).trackEvent,z=i(123).translatedIntervalString,U=i(33),q=i(4),Y=q.getLogger("Chart.Series"),G=q.getLogger("Chart.Series.Updates",{highRate:!0}),K=i(40),Z=i(42),J=i(61),X=J.getServerInterval,Q=J.getResolutionByChartStyle,ee=i(15).Interval,te=i(135),ie=i(611).SeriesHorizontalBaseLinePaneView,ne=i(612).SeriesPriceLinePaneView,oe=i(613).SeriesDataEvents,re=te.getQuoteSessionInstance,se=!P.enabled("hide_series_legend_item"),inherit(a,L),a.prototype.styleStudyInfos=function(){return{haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle}},a.prototype.styleStudyInfo=function(e){return this.styleStudyInfos()[e]},a.prototype.priceLineColor=function(e){return this.properties().priceLineColor.value()||e},a.prototype.endOfData=function(){return this._endOfData},a.prototype.serverTimeOffset=function(){return this._chartApi.serverTimeOffset()},a.prototype._onChangeShowCountdown=function(e){var t=this;e.value()?this._countdownUpdateTimer=this.m_model.setInterval(function(){t.isDWM()||(t._priceAxisViews[0].update(),t.m_model.invalidate(new M(M.LIGHT_UPDATE)))},500):(this.m_model.clearInterval(this._countdownUpdateTimer),delete this._countdownUpdateTimer)},a.prototype.lastValueData=function(e,t,i){var n,o,r,s,a,l,c,h,u,d,p={noData:!0};if(this.m_model.timeScale().isEmpty()||this.priceScale().isEmpty()||this.data().isEmpty())return p;if(null===(n=this.m_model.timeScale().visibleBars()))return p;if(t){if(null===(s=this.data().bars().last()))return p;o=s.value,r=s.index}else{if(null===(a=this.data().bars().search(n.lastBar(),B.NearestLeft)))return p;o=this.data().bars().valueAt(a.index),r=a.index}return l={noData:!1},c=void 0!==e?o[e]:this._barFunction(o),i&&(l.price=c),h=this.firstValue(),l.text=this.priceScale().formatPrice(c,h),u=this.barColorer(),d=u.barStyle(r,!1),l.color=d.barColor,l.floatCoordinate=this.priceScale().priceToCoordinate(c,h,!0),l.coordinate=Math.round(l.floatCoordinate),l.index=r,l},a.prototype.prevClose=function(){var e,t;return this.priceScale().isEmpty()||this.data().isEmpty()||!this.quoteData?null:null==(e=this.quoteData.prev_close_price)?null:(t=this.firstValue(),{coordinate:this.priceScale().priceToCoordinate(e,t),floatCoordinate:this.priceScale().priceToCoordinate(e,t,!0),text:this.priceScale().formatPrice(e,t)})},a.prototype._createIsPrevClosePriceAvailableProperty=function(){this._isPrevClosePriceAvailable=new o(!this.isDWM()),this._onRestarted.subscribe(this,function(){this._isPrevClosePriceAvailable.setValue(!this.isDWM())})},a.prototype.isPrevClosePriceAvailable=function(){return this._isPrevClosePriceAvailable},a.prototype._prepareChartApiParams=function(){
this._turnaround="s"+this._turnaroundCounter,this._handler=function(e){l.onData(e)},this._haStyle={studyId:Z.chartStyleStudyId(a.STYLE_HEIKEN_ASHI,!0)},this._renkoStyle={studyId:Z.chartStyleStudyId(a.STYLE_RENKO,!0)},this._pbStyle={studyId:Z.chartStyleStudyId(a.STYLE_PB,!0)},this._kagiStyle={studyId:Z.chartStyleStudyId(a.STYLE_KAGI,!0)},this._pnfStyle={studyId:Z.chartStyleStudyId(a.STYLE_PNF,!0)},this._rangeStyle={studyId:Z.chartStyleStudyId(a.STYLE_RANGE,!0)},this._properties.addExclusion&&this._properties.addExclusion("visible"),this._base=100,this._formatter=new D(this._base),this._predictBars=0,this._futureBarsPaneView=null,this._properties.showInDataWindow.listeners().subscribe(t,_.prototype.fullUpdate),this.marketStatus=new n,this._seriesLoaded=!1,this.properties().minTick.listeners().subscribe(this,a.prototype._recreateFormatter),l=this,this.properties().minTick.listeners().subscribe(null,function(){l.m_model.invalidate(new M(M.FULL_UPDATE))}),this._priceLineView=new ne(this),this._baseHorizontalLineView=new ie(this),this._gotoDateResultCleared=!1,this._gotoDateView=null,this.bindStyleChange(),this.bindJapChartsInputs(),this._createIsPrevClosePriceAvailableProperty(),this.createExtendedHoursProperty(),this.extendedHours.listeners().subscribe(this,function(e){this._extendedHoursChanged.fire(e),this.restart()}),this._dataEvents.extendedHoursNotPermitted().subscribe(this,function(){this._properties.extendedHours.setValue(!1)}),this._extendedHoursChanged.subscribe(this,function(){this._status!==a.STATUS_SNAPSHOT&&this.restart()}),this._symbolIntervalChanged.subscribe(this,this.checkInterval),this.properties().showCountdown.listeners().subscribe(this,a.prototype._onChangeShowCountdown),this._onChangeShowCountdown(this.properties().showCountdown),this._recreateFormatter(),this._isDWMCached=null,this.properties().lineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().areaStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().baselineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this._updateBarFunction()}var l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,F,N,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se;TradingView.DEFAULT_BAR_COUNT=300,TradingView.TIME_PLOT=0,TradingView.OPEN_PLOT=1,TradingView.HIGH_PLOT=2,TradingView.LOW_PLOT=3,TradingView.CLOSE_PLOT=4,TradingView.ADT_PLOT=6,TradingView.STYLE_PLOT=7,l=i(7).ensureNotNull,c=i(604),h=i(606).ProjectionSeriesPriceAxisView,u=i(279).SeriesPriceAxisView,d=i(280).SeriesDataWindowView,p=i(607).SeriesLegendView,_=i(282),f=_.SeriesAreaPaneView,m=_.SeriesLinePaneView,y=_.SeriesHollowCandlesPaneView,g=_.SeriesCandlesPaneView,v=_.SeriesBarsPaneView,S=_.SeriesHeikenAshiPaneView,b=_.SeriesBaselinePaneView,w=i(283).SeriesWaterlinePaneView,P=i(5),T=i(2).propertyPages,x=i(214).BarsRange,C=i(166).SeriesBarColorer,L=i(28).PriceDataSource,I=i(100),A=i(72).SeriesData,k=i(72).barFunction,E=i(72).seriesPlotFunctionMap,M=i(18),V=i(609),D=i(21).PriceFormatter,O=i(17),R=O.PlotList,
B=O.PlotRowSearchMode,F=O.mergeMinMax,N=i(26),W=i(259).unpackNonSeriesData,H=i(610).SyncModel,j=i(39).trackEvent,z=i(123).translatedIntervalString,U=i(33),q=i(4),Y=q.getLogger("Chart.Series"),G=q.getLogger("Chart.Series.Updates",{highRate:!0}),K=i(40),Z=i(42),J=i(61),X=J.getServerInterval,Q=J.getResolutionByChartStyle,ee=i(15).Interval,te=i(135),ie=i(611).SeriesHorizontalBaseLinePaneView,ne=i(612).SeriesPriceLinePaneView,oe=i(613).SeriesDataEvents,re=te.getQuoteSessionInstance,se=!P.enabled("hide_series_legend_item"),inherit(a,L),a.prototype.styleStudyInfos=function(){return{haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle}},a.prototype.styleStudyInfo=function(e){return this.styleStudyInfos()[e]},a.prototype.priceLineColor=function(e){return this.properties().priceLineColor.value()||e},a.prototype.endOfData=function(){return this._endOfData},a.prototype.serverTimeOffset=function(){return this._chartApi.serverTimeOffset()},a.prototype._onChangeShowCountdown=function(e){var t=this;e.value()?this._countdownUpdateTimer=this.m_model.setInterval(function(){t.isDWM()||(t._priceAxisViews[0].update(),t.m_model.invalidate(new M(M.LIGHT_UPDATE)))},500):(this.m_model.clearInterval(this._countdownUpdateTimer),delete this._countdownUpdateTimer)},a.prototype.lastValueData=function(e,t,i){var n,o,r,s,a,l,c,h,u,d,p={noData:!0};if(this.m_model.timeScale().isEmpty()||this.priceScale().isEmpty()||this.data().isEmpty())return p;if(null===(n=this.m_model.timeScale().visibleBars()))return p;if(t){if(null===(s=this.data().bars().last()))return p;o=s.value,r=s.index}else{if(null===(a=this.data().bars().search(n.lastBar(),B.NearestLeft)))return p;o=this.data().bars().valueAt(a.index),r=a.index}return l={noData:!1},c=void 0!==e?o[e]:this._barFunction(o),i&&(l.price=c),h=this.firstValue(),l.text=this.priceScale().formatPrice(c,h),u=this.barColorer(),d=u.barStyle(r,!1),l.color=d.barColor,l.floatCoordinate=this.priceScale().priceToCoordinate(c,h,!0),l.coordinate=Math.round(l.floatCoordinate),l.index=r,l},a.prototype.prevClose=function(){var e,t;return this.priceScale().isEmpty()||this.data().isEmpty()||!this.quoteData?null:null==(e=this.quoteData.prev_close_price)?null:(t=this.firstValue(),{coordinate:this.priceScale().priceToCoordinate(e,t),floatCoordinate:this.priceScale().priceToCoordinate(e,t,!0),text:this.priceScale().formatPrice(e,t)})},a.prototype._createIsPrevClosePriceAvailableProperty=function(){this._isPrevClosePriceAvailable=new o(!this.isDWM()),this._onRestarted.subscribe(this,function(){this._isPrevClosePriceAvailable.setValue(!this.isDWM())})},a.prototype.isPrevClosePriceAvailable=function(){return this._isPrevClosePriceAvailable},a.prototype._prepareChartApiParams=function(){
return this._requestOptions.startDate?!this._requestOptions.startDate||this._requestOptions.endDate||this._requestOptions.count?this._requestOptions.startDate&&this._requestOptions.endDate?["from_to",this._requestOptions.startDate,this._requestOptions.endDate]:["from_to",this._requestOptions.startDate,this._requestOptions.count]:["from_to",this._requestOptions.startDate]:this._requestOptions.count||TradingView.DEFAULT_BAR_COUNT},a.prototype._nextSymbolId=1,a.prototype._nextSeriesId=1,Object.assign(a,K),a.PERMISSION_DENIED="permission denied",a.PD_REASON_SYMBOL="symbol",a.PD_REASON_EXTENDED_HOURS="extended_hours",a.PD_REASON_GROUP_PERMISSION="group",a.STUDY_NOT_AUTH="study_not_auth",a.prototype.model=function(){return this.m_model},a.prototype.fixLastBar=function(e){},a.prototype.clearData=function(){this.data().clear()},a.prototype.data=function(){return this.m_data},a.prototype.symbolId=function(){return this._symbolId},a.prototype.seriesId=function(){return this._seriesId},a.prototype.isPulse=function(){return this._symbolInfo&&this._symbolInfo.resolutions.length>0},a.prototype.onTagsChanged=function(){return this._tagsChanged},a.prototype.onSymbolIntervalChanged=function(){return this._symbolIntervalChanged},a.prototype.onIntervalChanged=function(){return this._intervalChanged},a.prototype.onStatusChanged=function(){return this._onStatusChanged},a.prototype.onStyleChanged=function(){return this._onStyleChanged},a.prototype.onRestarted=function(){return this._onRestarted},a.prototype.onBoxSizeChanged=function(){return this._boxSizeChanged},a.prototype.status=function(){return this._status},a.prototype.isDWM=function(){var e,t;return null!==this._isDWMCached?this._isDWMCached:(e=new ee(this._properties.interval.value()),e.isDWM()?this._isDWMCached=!0:(t=e.isSeconds()?e.multiplier():60*e.multiplier(),this._isDWMCached=!(t<216e3)),this._isDWMCached)},a.prototype.lastPriceLabelFixedCoordinate=function(){return this._priceAxisViews[0]._fixedCoordinate},a.prototype.createPaneView=function(){this._paneView=null,this._projectionBarsPaneView=null,this._waterlineView=null,this._symbolLabelView=new I(this.m_model,this,void 0,"firstShortName","showSymbolLabels");var e=this._properties.style.value();switch(e){case a.STYLE_BARS:this._paneView=new v(this,this.m_model);break;case a.STYLE_CANDLES:this._paneView=new g(this,this.m_model);break;case a.STYLE_LINE:this._paneView=new m(this,this.m_model);break;case a.STYLE_AREA:this._paneView=new f(this,this.m_model);break;case a.STYLE_HEIKEN_ASHI:this._paneView=new S(this,this.m_model);break;case a.STYLE_HOLLOW_CANDLES:this._paneView=new y(this,this.m_model);break;case a.STYLE_BASELINE:this._paneView=new b(this,this.m_model),this._waterlineView=new w(this);break;default:throw Error("Unknown chart style assigned: "+e)}},a.prototype._clearStylePlot=function(e,t){var i,n;0!==e.size()&&(i=t||l(e.firstIndex()),n=l(e.lastIndex())+1,e.range(i,n).each(function(e,t){t[TradingView.STYLE_PLOT]=null}))},a.prototype.invalidateBarStylesCache=function(e){
Y.logDebug("Invalidate style cache starting from "+e),this._clearStylePlot(this.m_data.m_bars,e),this._clearStylePlot(this.m_data.m_nsBars)},a.prototype.invalidateBarColorerCache=function(){delete this._barColorerCache,this.invalidateBarStylesCache()},a.prototype.barColorer=function(){var e,t,i,n;if(this._barColorerCache)return this._barColorerCache;for(e=null,t=this.m_model.dataSources().length-1;t>=0;t--)i=this.m_model.dataSources()[t],i.metaInfo&&TradingView.isInherited(i.constructor,TradingView.Study)&&i.hasBarColorer()&&i.properties().visible.value()&&(n=i.barColorer(),null===e?e=n:e.pushBackBarColorer(n));return null===e?e=new C(this):e.pushBackBarColorer(new C(this)),this._barColorerCache=e,this._barColorerCache},a.prototype.properties=function(){return this._properties},a.prototype._barsState=function(e){var t=e.state();return t.data.forEach(function(e){e.value.splice(7,1)}),t},a.prototype.state=function(e,t){var i=this===this.m_model.mainSeries()?"MainSeries":TradingView.className(this.constructor),n={type:i,id:this.id(),state:this.properties().state(t),zorder:this.zorder(),haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle};return this._symbolInfo&&this._symbolInfo.ticker&&(n.state.symbol=this._symbolInfo.ticker),e&&(n.bars=this._barsState(this.m_data.m_bars),n.nsBars=this._barsState(this.m_data.m_nsBars),n.symbolInfo=this._symbolInfo,n.rtPrice=this.data().lastProjectionPrice),n.boxSize=this.data().boxSize,n.reversalAmount=this.data().reversalAmount,n},a.prototype.restoreData=function(e,t,i,n,o,r){this._status=a.STATUS_SNAPSHOT,this.m_data.m_bars.restoreState(e),this.m_data.m_nsBars.restoreState(t),this.updateSymbolInfo(i),this.m_data.lastProjectionPrice=n,this.m_data.boxSize=o,o||(this.properties().style.value()===a.STYLE_PNF?this.m_data.boxSize=this.properties().pnfStyle.inputs.boxSize.value():this.properties().style.value()===a.STYLE_RENKO&&(this.m_data.boxSize=this.properties().renkoStyle.inputs.boxSize.value())),this.m_data.reversalAmount=r,r||this.properties().style.value()===a.STYLE_KAGI&&(this.m_data.reversalAmount=this.properties().kagiStyle.inputs.reversalAmount.value())},a.prototype.setProperties=function(e){e.timeframe||e.merge({timeframe:""}),e.shortName||e.merge({shortName:""}),this._properties=e,this._properties.symbol.listeners().subscribe(this,a.prototype.changeSymbol),this._properties.interval.listeners().subscribe(this,a.prototype.changeInterval),this._properties.timeframe.listeners().subscribe(this,a.prototype.changeTimeFrame),this._properties.listeners().subscribe(this,a.prototype.changeProperties)},a.prototype.changeSymbol=function(){this.setSymbolIntervalDelayed(),this.m_model.checkLineToolSelection()},a.prototype.changeInterval=function(){this.setSymbolIntervalDelayed()},a.prototype.changeTimeFrame=function(){j("GUI","Change timeframe")},a.prototype.title=function(){return this.properties().symbol.value()+", "+z(this.properties().interval.value())},
a.prototype.changeProperties=function(e){e!==this._properties.symbol&&e!==this._properties.interval&&e!==this._properties.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews(),this.m_model.updateSource(this))},a.prototype._makeNextSymbolId=function(){return"symbol_"+this._nextSymbolId++},a.prototype._makeNextSeriesId=function(){return"s"+this._nextSeriesId++},a.prototype.onData=function(e){var t,i,n,o,r,s,c,h,u,d,p,_,f,m,y,g,v=this;switch(e.method){case"symbol_resolved":if(e.params[0]!==this._symbolId){Y.logNormal("command for old symbol. Expected:"+this._symbolId+", actual"+e.params[0]);break}this.updateSymbolInfo(e.params[1]),this.m_model.updateSource(this),this._dataEvents.fireSymbolResolved(this._symbolInfo),this.m_model.realignLineTools(),TradingView.onWidget()||j("Symbol",e.params[1].listed_exchange,e.params[1].name),t=this.symbolInfo().minmov/this.symbolInfo().pricescale,i=this.properties(),i.style.value()===a.STYLE_RENKO&&i.renkoStyle.inputs.boxSize.value()<t?i.renkoStyle.inputs.merge({boxSize:t}):i.style.value()===a.STYLE_PNF&&i.pnfStyle.inputs.boxSize.value()<t?i.pnfStyle.inputs.merge({boxSize:t}):i.style.value()===a.STYLE_KAGI&&i.kagiStyle.inputs.reversalAmount.value()<t&&i.kagiStyle.inputs.merge({reversalAmount:t});break;case"symbol_error":if(e.params[0]!==this._symbolId){Y.logNormal("command for old symbol. Expected:"+this._symbolId+", actual"+e.params[0]);break}if(this._setStatus(a.STATUS_INVALID_SYMBOL),this._properties.shortName.setValue(this._properties.symbol.value()),this.m_model.clearAllStudies(),this.updateAllViews(),this.m_model.updateSource(this),(n=e.params[1])===a.PERMISSION_DENIED)switch(e.params[2]){case a.PD_REASON_EXTENDED_HOURS:this._dataEvents.fireExtendedHoursNotPermitted();break;case a.PD_REASON_SYMBOL:this._dataEvents.fireSymbolNotPermitted(e.params[3]);break;case a.PD_REASON_GROUP_PERMISSION:this._dataEvents.fireSymbolGroupNotPermitted(e.params[3]);break;default:this._dataEvents.fireSymbolNotPermitted(e.params[2])}else this.m_model.resetTimeScale(),this._dataEvents.fireSymbolError(e);this.m_model.realignLineTools();break;case"series_timeframe":if(e.params[1]!==this._turnaround)break;o=e.params[2],r=e.params[3],s=e.params[4],c=void 0!==s&&s?r:r+10,this.m_model.setTimeViewport(o,c);break;case"series_error":n=e.params[2],delete this._loadingStartTime,P.enabled("charting_library_debug_mode")&&Y.logNormal("Error reason: "+n),this._setStatus(P.enabled("no_bars_status")&&this._symbolInfo?a.STATUS_NO_BARS:a.STATUS_INVALID_SYMBOL),"string"==typeof n&&(n.startsWith("study_not_auth:")?(h=n.split(":",2)[1].split("@",2)[0],h in{BarSetRenko:!0,BarSetPriceBreak:!0,BarSetKagi:!0,BarSetPnF:!0}?this._dataEvents.fireChartTypeNotPermitted(h):"BarSetSpread"===h?this._dataEvents.fireIntradaySpreadNotPermitted():"BarSetRange"===h&&this._dataEvents.fireCustomIntervalNotPermitted()):"resolution_not_entitled"===n?this._dataEvents.fireIntradayExchangeNotPermitted():"custom_resolution"===n&&this._dataEvents.fireCustomIntervalNotPermitted()),this._seriesLoaded=!0,
this._dataEvents.fireSeriesError(e);break;case"series_loading":if(e.params[1]!==this._turnaround)break;if(e.params[0]!==this._seriesId){Y.logNormal("command for old series. Expected:"+this._seriesId+", actual"+e.params.customId);break}this._setStatus(a.STATUS_LOADING),v._loadingStartTime=(new Date).getTime();break;case"series_completed":if(e.params[2]!==this._turnaround)break;if(e.params[0]!==this._seriesId){Y.logNormal("command for old series. Expected:"+this._seriesId+", actual"+e.params.customId);break}switch(u="chartSession:"+v._chartApi._sessionid,d=(new Date).getTime()-this._loadingStartTime,Y.logDebug(u+", Series loading took "+d+" ms, eod:"+this._endOfData),delete this._loadingStartTime,p=e.params[1],"pulsed"===p&&(p="delayed"),p){case"streaming":this._setStatus(a.STATUS_READY);break;case"endofday":this._setStatus(a.STATUS_EOD);break;case"delayed":this._setStatus(a.STATUS_DELAYED);break;case"pulsed":this._setStatus(a.STATUS_PULSE);break;case"replay":this._setStatus(a.STATUS_REPLAY)}p.match(/delayed_streaming/)&&this._setStatus(a.STATUS_DELAYED_STREAMING),_=this.m_model.paneForSource(this),_.recalculatePriceScale(this.priceScale()),this.m_model.invalidate(new M(M.FULL_UPDATE)),this.m_data.size()&&this._dataEvents.fireTickMarksRangeChanged({start:l(this.data().first()).value[TradingView.TIME_PLOT],end:l(this.data().last()).value[TradingView.TIME_PLOT]}),this.model().recalcVisibleRangeStudy(this.model().dataSources(),!0),this.model().recalcStudyBasedLineTools(),!this.m_priceScale.isLockScale()||this.model().timeScale().isEmpty()||this._seriesLoaded||(this.model().timeScale()._correctOffset(),this.model().timeScale().correctBarSpacing(),this.model().resetPriceScale(_,this.priceScale())),this._seriesLoaded=!0,this._dataEvents.fireCompleted(),this.requestMoreData();break;case"series_deleted":break;case"data_update":if(e.params.customId!==this._seriesId){Y.logNormal("command for old series. Expected:"+this._seriesId+", actual"+e.params.customId);break}if(e.params.turnaround!==this._turnaround){Y.logNormal("command for old series turnaround. Expected:"+this._turnaround+", actual"+e.params.turnaround);break}if(this._setSymbolIntervalDelay){if(this._willSymbolIntervalChanged())return void Y.logNormal("command comes during symbol/interval changing");Y.logNormal("data_update comes when symbol interval delay present but symbol/interval should not be changed")}if(this.status()===a.STATUS_INVALID_SYMBOL)break;e.params.plots.length?(f=this.m_data.bars().size(),m=this.m_data.bars().firstIndex(),y=this.m_data.bars().merge(e.params.plots),(null===m||y.index<m)&&(this._endOfData=!1),g="Merge bars. earliestRow:"+y.index+"} ",g+="bars state:{firstBar:"+l(this.m_data.bars().firstIndex())+",lastBar:"+l(this.m_data.bars().lastIndex())+",size:"+this.m_data.bars().size()+"}",G.logDebug(g),f!==this.bars().size()&&(this._dataEvents.fireBarReceived(y),this.model().recalcVisibleRangeStudy(this.model().dataSources(),!0))):this.m_data.clear(),new Promise(function(t){var i=v.properties().style.value()
;e.params.nonseries&&Z.isRangeBasedStyle(i)?v.parseJapProjBars(e.params.nonseries).then(function(e){v.m_data.m_nsBars=e.nsBars,v.m_data.lastProjectionPrice=e.lastPrice;var i=v.m_data.boxSize!==e.boxSize;v.m_data.boxSize=e.boxSize,v.m_data.reversalAmount=e.reversalAmount,i&&v._boxSizeChanged.fire(v.m_data.boxSize),t()}):(e.params.nonseries||(v.m_data.m_nsBars.clear(),v.m_data.lastProjectionPrice=void 0),t(),t())}).then(function(){v._statusView.invalidate();var e=v.m_model.paneForSource(v);v.m_model.updateAllVolumeStudies(),v.m_model.recalculatePane(e),v.m_model.updateSource(v),v.m_model.updateLineTools(),v.m_model.updateCrossHair()})}this._dataEvents.fireMessageReceived(e)},a.prototype.parseJapProjBars=function(e){var t,i,n,o=new R(E()),r=this.model().timeScale(),s=this.properties().style.value();return new Promise(function(l){e.d&&""!==e.d?W(e.d).then(function(c){var h,u,d,p,_=c.data;for(t=_.price,i=_.boxSize,n=_.reversalAmount,h=_.bars,u=0;h&&u<h.length;u++)d=[],p=e.indexes[h[u].time],d.push(r.points().valueAt(p)),d.push(h[u].open),d.push(h[u].high),d.push(h[u].low),d.push(h[u].close),d.push(h[u].volume),s===a.STYLE_KAGI?d.push(h[u].additionalPrice):s===a.STYLE_PNF&&d.push(h[u].factor),o.add(p,d);l({nsBars:o,lastPrice:t,boxSize:i,reversalAmount:n})}):l({nsBars:o,lastPrice:t,boxSize:i,reversalAmount:n})})},a.prototype.disconnect=function(){this._seriesId&&this._chartApi.removeSeries(this._seriesId),this._symbolId=null,this._seriesId=null,this._predictBars=0,this._status=a.STATUS_OFFLINE},a.prototype.isStarted=function(){return!!this._symbolId},a.prototype.restart=function(){var e,t=i(120);this._onRestarted.fire(),this._setStatus(a.STATUS_RESOLVING),this.m_data=new A,this.updateSymbolInfo(null),this._prevSymbolId=this._symbolId,this._symbolId=this._makeNextSymbolId(),e=this._properties.interval.value(),this._pendingTimeRange&&(e=this._generateTimeframe(e,this._pendingTimeRange),delete this._pendingTimeRange),this._onBeforeModifySeries(this.getSymbolString(),e),e=X(e),this._chartApi.resolveSymbol(this._symbolId,this._getResolvingSymbolString(),this._handler),this._seriesId?(this._turnaround="s"+ ++this._turnaroundCounter,this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,e,this._handler,this._prevSymbolId)):(this._seriesId=this._makeNextSeriesId(),!1===this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,e,this._prepareChartApiParams(),this._handler)&&(this._seriesId=void 0)),this._properties.showInDataWindow.listeners().subscribe(this.m_model,t.prototype.fullUpdate),this.m_symbol=this._properties.symbol.value(),this.m_interval=this._properties.interval.value()},a.prototype._generateTimeframe=function(e,t){var i,n=t.slice(-1),o=e;return"ytd"===t?o+=",YTD":"d"===n?(i=t.slice(0,-1),o+=","+i,P.enabled("daily_timeframe_suffix")&&(o+="D")):"m"===n?(i=t.slice(0,-1),o+=","+i+"M"):"all"===t&&(o+=",ALL"),o},a.prototype.hasDelayedSymbolIntervalChange=function(){return!!this._setSymbolIntervalDelay},a.prototype.setSymbolIntervalDelayed=function(){this._isDWMCached=null,
this._willSymbolIntervalChanged()&&(this._setSymbolIntervalDelay&&(Y.logNormal("Clear timeout to change symbol/interval #"+this._setSymbolIntervalDelay),clearTimeout(this._setSymbolIntervalDelay)),this._setSymbolIntervalDelay=setTimeout(function(){Y.logNormal("Timeout #"+this._setSymbolIntervalDelay+' fired, new symbol will be "'+this._properties.symbol.value()+'"'),delete this._setSymbolIntervalDelay,this._setSymbolInterval(this._properties.symbol.value(),this._properties.interval.value())}.bind(this),30),Y.logNormal("Started timeout #"+this._setSymbolIntervalDelay+' to change symbol/interval from "'+this.m_symbol+'" to "'+this._properties.symbol.value()+'"'))},a.prototype._willSymbolIntervalChanged=function(){var e=this._checkIntervalWillChanged(this._parseInterval(this._properties.interval.value()).interval);return this._checkSymbolWillChanged(this._properties.symbol.value())||e},a.prototype._checkSymbolWillChanged=function(e){return!this.symbolSameAsCurrent(e)||P.enabled("same_data_requery")},a.prototype._checkIntervalWillChanged=function(e){return this.m_interval!==e||P.enabled("same_data_requery")},a.prototype._parseInterval=function(e){var t=(e+"").split(",");return{interval:2===t.length?t[0]:e,timeframe:2===t.length?t[1]:0}},a.prototype.rerequestData=function(){this._setSymbolInterval(this.m_symbol,this.m_interval,!0)},a.prototype._setSymbolInterval=function(e,t,i){var n,o,r,s,l,c,h;this.clearGotoDateResult(),n=ee.isRange(t),n&&this._properties.rangeStyle.inputs.range.setValue(ee.parse(t).multiplier()),o=this._parseInterval(t),r=o.interval,s=o.timeframe,l=this._checkSymbolWillChanged(e),c=this._checkIntervalWillChanged(r),(l||c||i)&&((n||ee.isRange(this.m_interval))&&(this._symbolId=null),this._syncModel=null,this.m_symbol=e,this.m_interval=r,this.m_timeframe=s,this._symbolId&&!l||this.updateSymbolInfo(null),this.m_model.realignLineTools(),this._status!==a.STATUS_SNAPSHOT&&(this._setStatus(a.STATUS_RESOLVING),this._symbolIntervalChanged.fire(),c&&(h={timeframe:this._pendingTimeRange},this._intervalChanged.fire(this.m_interval,h),this._pendingTimeRange=h.timeframe&&h.timeframe.toLowerCase()),this._onRestarted.fire(),this._seriesLoaded=!1,this._chartApi&&this._chartApi.connected()&&(this._symbolId&&!l||(this._prevSymbolId=this._symbolId,this._symbolId=this._makeNextSymbolId(),this._chartApi.resolveSymbol(this._symbolId,this._getResolvingSymbolString(),this._handler)),this._seriesId?(this._turnaround="s"+ ++this._turnaroundCounter,this._pendingTimeRange&&(t=this._generateTimeframe(t,this._pendingTimeRange),delete this._pendingTimeRange),this._onBeforeModifySeries(this.getSymbolString(),t),this._predictBars=0,t=X(t),this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,t,this._handler,this._prevSymbolId)):(this._onBeforeModifySeries(this.getSymbolString(),t),this._seriesId=this._makeNextSeriesId(),t=X(t),this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,t,this._prepareChartApiParams(),this._handler)))))},a.prototype.setDefaultTimeframe=function(e){
this._pendingTimeRange=e},a.prototype.actualSymbol=function(){return this.symbolInfo()?this.symbolInfo().full_name:this.symbol()},a.prototype.proSymbol=function(){return this.symbolInfo()?this.symbolInfo().pro_name:this.symbol()},a.prototype.symbol=function(){return this.properties().symbol.value()},a.prototype.interval=function(){return this.properties().interval.value()},a.prototype.isIntradayInterval=function(){var e=X(this.interval());return!!/^\d*$/.test(e)&&e<=1440},a.prototype.bars=function(){return this.m_data.m_bars},a.prototype.nsBars=function(){return this.m_data.m_nsBars},a.prototype.open=function(e){return this.m_data.valueAt(e)[TradingView.OPEN_PLOT]},a.prototype.high=function(e){return this.m_data.valueAt(e)[TradingView.HIGH_PLOT]},a.prototype.low=function(e){return this.m_data.valueAt(e)[TradingView.LOW_PLOT]},a.prototype.close=function(e){return this.m_data.valueAt(e)[TradingView.CLOSE_PLOT]},a.prototype.hl2=function(e){return(this.high(e)+this.low(e))/2},a.prototype.hlc3=function(e){return(this.high(e)+this.low(e)+this.close(e))/3},a.prototype.ohlc4=function(e){return(this.open(e)+this.high(e)+this.low(e)+this.close(e))/4},a.prototype.priceRange=function(e,t){var i,n,o,s,a,l,c,h;return TradingView.isInteger(e)?TradingView.isInteger(t)?this.data().isEmpty()?null:this.m_priceScale.isLockScale()&&null!==(i=this._model.mainSeriesScaleRatio())?(n=this.priceScale().internalHeight()/(this.model().timeScale().barSpacing()/i),o=this.data().search(t,B.NearestLeft),s=(o.value[TradingView.HIGH_PLOT]+o.value[TradingView.LOW_PLOT])/2,new r(s-.5*n,s+.5*n)):(a=this.priceSource(),null!==a?(l=this.data().bars().minMaxOnRangeCached(e,t,[{name:a,offset:0}]),c=this.data().nsBars().minMaxOnRangeCached(e,t,[{name:a,offset:0}])):(l=this.data().bars().minMaxOnRangeCached(e,t,[{name:"low",offset:0},{name:"high",offset:0}]),c=this.data().nsBars().minMaxOnRange(e,t,[{name:"low",offset:0},{name:"high",offset:0}])),l=N(l,c),h=null!==l?l.min===l.max?new r(l.min-.5,l.max+.5):new r(l.min,l.max):new r(-.5,.5),this.priceScale().isLog()?new r(this.priceScale().priceToLogical(h.minValue()),this.priceScale().priceToLogical(h.maxValue())):h):(Y.logDebug("Series.priceRange: incorrect endBar"),null):(Y.logDebug("Series.priceRange: incorrect startBar"),null)},a.prototype.nearestData=function(e,t){if(!TradingView.isInteger(e))return void Y.logDebug("Series.nearestData: incorrect logicalPoint");var i=this.data().search(e,t);return null!==i?i:void 0},a.prototype.nearestIndex=function(e,t){var i=this.nearestData(e,t);return i?i.index:void 0},a.prototype.paneViews=function(e){if(!this.properties().visible.value())return null;var t=[this._baseHorizontalLineView,this._paneView];return this._futureBarsPaneView&&t.push(this._futureBarsPaneView),this._projectionBarsPaneView&&t.push(this._projectionBarsPaneView),null!==this._waterlineView&&t.push(this._waterlineView),t.push(this._priceLineView),t.push(this._symbolLabelView),null!==this._gotoDateView&&t.push(this._gotoDateView),t},a.prototype.dataWindowView=function(){return this._dataWindowView},
this._pendingTimeRange=e},a.prototype.actualSymbol=function(){return this.symbolInfo()?this.symbolInfo().full_name:this.symbol()},a.prototype.proSymbol=function(){return this.symbolInfo()?this.symbolInfo().pro_name:this.symbol()},a.prototype.symbol=function(){return this.properties().symbol.value()},a.prototype.interval=function(){return this.properties().interval.value()},a.prototype.isIntradayInterval=function(){var e=X(this.interval());return!!/^\d*$/.test(e)&&e<=1440},a.prototype.bars=function(){return this.m_data.m_bars},a.prototype.nsBars=function(){return this.m_data.m_nsBars},a.prototype.open=function(e){return this.m_data.valueAt(e)[TradingView.OPEN_PLOT]},a.prototype.high=function(e){return this.m_data.valueAt(e)[TradingView.HIGH_PLOT]},a.prototype.low=function(e){return this.m_data.valueAt(e)[TradingView.LOW_PLOT]},a.prototype.close=function(e){return this.m_data.valueAt(e)[TradingView.CLOSE_PLOT]},a.prototype.hl2=function(e){return(this.high(e)+this.low(e))/2},a.prototype.hlc3=function(e){return(this.high(e)+this.low(e)+this.close(e))/3},a.prototype.ohlc4=function(e){return(this.open(e)+this.high(e)+this.low(e)+this.close(e))/4},a.prototype.priceRange=function(e,t){var i,n,o,s,a,l,c,h;return TradingView.isInteger(e)?TradingView.isInteger(t)?this.data().isEmpty()?null:this.m_priceScale.isLockScale()&&null!==(i=this._model.mainSeriesScaleRatio())?(n=this.priceScale().internalHeight()/(this.model().timeScale().barSpacing()/i),o=this.data().search(t,B.NearestLeft),s=(o.value[TradingView.HIGH_PLOT]+o.value[TradingView.LOW_PLOT])/2,new r(s-.5*n,s+.5*n)):(a=this.priceSource(),null!==a?(l=this.data().bars().minMaxOnRangeCached(e,t,[{name:a,offset:0}]),c=this.data().nsBars().minMaxOnRangeCached(e,t,[{name:a,offset:0}])):(l=this.data().bars().minMaxOnRangeCached(e,t,[{name:"low",offset:0},{name:"high",offset:0}]),c=this.data().nsBars().minMaxOnRange(e,t,[{name:"low",offset:0},{name:"high",offset:0}])),l=F(l,c),h=null!==l?l.min===l.max?new r(l.min-.5,l.max+.5):new r(l.min,l.max):new r(-.5,.5),this.priceScale().isLog()?new r(this.priceScale().priceToLogical(h.minValue()),this.priceScale().priceToLogical(h.maxValue())):h):(Y.logDebug("Series.priceRange: incorrect endBar"),null):(Y.logDebug("Series.priceRange: incorrect startBar"),null)},a.prototype.nearestData=function(e,t){if(!TradingView.isInteger(e))return void Y.logDebug("Series.nearestData: incorrect logicalPoint");var i=this.data().search(e,t);return null!==i?i:void 0},a.prototype.nearestIndex=function(e,t){var i=this.nearestData(e,t);return i?i.index:void 0},a.prototype.paneViews=function(e){if(!this.properties().visible.value())return null;var t=[this._baseHorizontalLineView,this._paneView];return this._futureBarsPaneView&&t.push(this._futureBarsPaneView),this._projectionBarsPaneView&&t.push(this._projectionBarsPaneView),null!==this._waterlineView&&t.push(this._waterlineView),t.push(this._priceLineView),t.push(this._symbolLabelView),null!==this._gotoDateView&&t.push(this._gotoDateView),t},a.prototype.dataWindowView=function(){return this._dataWindowView},
a.prototype.legendView=function(){return this._legendView},a.prototype.statusView=function(){return se?this._statusView:null},a.prototype.priceAxisViews=function(e,t){return this.m_model.paneForSource(this)===e&&t===this.priceScale()&&(this.m_model.properties().scalesProperties.showSeriesLastValue.value()||this.properties().showCountdown.value())?this._priceAxisViews:null},a.prototype.base=function(){return this._base},a.prototype.formatter=function(){return this._formatter},a.prototype.purgeSymbolInfo=function(){this._symbolInfo=null,this._isDWMCached=null},a.prototype.symbolInfo=function(){return this._symbolInfo},a.prototype._recreateFormatter=function(){var e,t,i,n;"default"===this.properties().minTick.value()?this._formatter=new D(this._symbolInfo?this._symbolInfo.pricescale:100,this._symbolInfo?this._symbolInfo.minmov:1,!!this._symbolInfo&&this._symbolInfo.fractional,this._symbolInfo?this._symbolInfo.minmove2:void 0):(e=this.properties().minTick.value().split(","),t=parseInt(e[0]),i=parseInt(e[1]),n="true"===e[2],this._formatter=new D(t,i,n)),this.priceScale()&&this.priceScale().updateFormatter()},a.prototype.updateSymbolInfo=function(e){var t,i,n=this,o=e&&(e.pro_name||e.full_name||e.name);P.enabled("charting_library_single_symbol_request")&&this.m_symbol?o=this.m_symbol:P.enabled("use_ticker_on_symbol_info_update")&&e&&e.ticker&&(o=e.ticker),this._symbolInfo=e,e&&(this._properties.shortName.setValue(e.name),t=this._properties.symbol.value(),i=o,P.enabled("uppercase_instrument_names")&&(t=t.toUpperCase(),i=i.toUpperCase()),o&&t!==i&&this._properties.symbol.setValue(o)),this._base=e?e.pricescale/e.minmov:100,this._recreateFormatter(),this._statusView.update(),this.priceScale().updateFormatter(),this._quoteSessionSymbol!==o&&(this._quoteSessionClientId||(this._quoteSessionClientId="series-"+U.guid()),this._unsubscribeQuoteSession(),o&&(this._quoteSessionSymbol=o,re("full").subscribe(this._quoteSessionClientId,this._quoteSessionSymbol,function(e,t){n.quoteData=e&&e.values||null,t&&t.values&&t.values.current_session&&n.marketStatus.setValue(t.values.current_session)}))),this.checkInterval()},a.prototype.dataPoweredBy=function(){return null},a.prototype._unsubscribeQuoteSession=function(){this._quoteSessionSymbol&&(re("full").unsubscribe(this._quoteSessionClientId,this._quoteSessionSymbol),this._quoteSessionSymbol=void 0)},a.prototype.symbolSameAsCurrent=function(e){if(this.m_symbol===e)return!0;var t=this._symbolInfo;if(t){if(t.full_name===e||t.pro_name===e)return!0;if(t.ticker===e)return!0;if(t.aliases&&-1!==t.aliases.indexOf(e))return!0;if(t.alternatives&&-1!==t.alternatives.indexOf(e))return!0;if(0===e.indexOf("FRA:")&&t.pro_name===e.replace("FRA:","FWB:"))return!0}return!1},a.prototype.updateAllViews=function(){var e,t;for(this._paneView.update(),this._dataWindowView.update(),this._legendView.update(),this._statusView.update(),e=this._priceAxisViews.length,t=0;t<e;t++)this._priceAxisViews[t].update();this._futureBarsPaneView&&this._futureBarsPaneView.update(),
this._projectionBarsPaneView&&this._projectionBarsPaneView.update(),null!==this._waterlineView&&this._waterlineView.update(),this._priceLineView.update(),null!==this._gotoDateView&&this._gotoDateView.update(),this._symbolInfo&&this._symbolLabelView.update(),this._baseHorizontalLineView.update()},a.prototype._setStatus=function(e){this._status=e,this._statusView.update(),this.m_model.updateSource(this),this._onStatusChanged.fire()},a.prototype.requestMoreData=function(e){var t,i,n,o;this._status!==a.STATUS_READY&&this._status!==a.STATUS_PULSE&&this._status!==a.STATUS_DELAYED&&this._status!==a.STATUS_DELAYED_STREAMING&&this._status!==a.STATUS_EOD&&this._status!==a.STATUS_REPLAY||this.m_model.timeScale().isEmpty()||null!==(t=this.m_model.timeScale().visibleBars())&&0!==this.bars().size()&&(i=e||t.lastBar()-l(this.data().last()).index,this._predictBars<i&&(this._predictBars=i,this._chartApi&&this._chartApi.connected()&&this._chartApi.requestMoreTickmarks(this._seriesId,i,this._handler)),this._endOfData||(n=l(this.bars().firstIndex()),(o=e||n-t.firstBar())<=0||(this._endOfData=!0,this._chartApi&&this._chartApi.connected()&&(this._chartApi.requestMoreData(this._seriesId,o,this._handler),P.enabled("charting_library_base")&&(this._predictBars=0)),this._setStatus(a.STATUS_LOADING))))},a.prototype.bindStyleChange=function(){var e=this;Object.keys(a.STYLE_SHORT_NAMES).map(function(e){return a.STYLE_SHORT_NAMES[e]+"Style"}).forEach(function(t){e._properties[t].listeners().subscribe(e,a.prototype.invalidateBarStylesCache)})},a.prototype.bindJapChartsInputs=function(){this._properties.style.listeners().subscribe(this,this.onChartStyleChanged),this._properties.renkoStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged),this._properties.renkoStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this._properties.renkoStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged),this._properties.renkoStyle.inputs.wicks.listeners().subscribe(this,this.onInputChanged),this._properties.pbStyle.inputs.lb.listeners().subscribe(this,this.onInputChanged),this._properties.kagiStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged),this._properties.kagiStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this._properties.kagiStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.sources.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged),this._properties.rangeStyle.inputs.phantomBars.listeners().subscribe(this,this.onInputChanged)},a.prototype.createExtendedHoursProperty=function(){function e(){
var e="undefined"!=typeof ProductFeatures&&isProductFeatureEnabled(ProductFeatures.EXTENDED_SESSION),i=t.model().readOnly(),n=t._properties.extendedHours.value(),o=P.enabled("widget");!n||o||i||e||(t._dataEvents.fireExtendedHoursNotPermitted(),n=!1),n&&!t.isIntradayInterval()&&(n=!1),t.extendedHours.setValue(n)}var t=this;t.extendedHours=new o,t._properties.extendedHours.listeners().subscribe(null,e),t._properties.interval.listeners().subscribe(null,e),t.chartWidgetInitialized.subscribe(null,e),e()},a.prototype.setChartStyleWithIntervalIfNeeded=function(e,t){var i,n=t;void 0===t&&(n=Q(e,this._properties.interval.value(),this._model.defaultResolutions())),i=ee.isEqual(n,this._properties.interval.value()),i||this._properties.interval.setValue(n),this._properties.style.setValue(e)},a.prototype.isNeedRestart=function(e){return void 0===e&&(e=this.properties().style.value()),!Z.isRangeStyle(this._prevChartStyle)&&!Z.isRangeStyle(e)&&!(this._prevChartStyle===e||!Z.isRequiringRestartSeriesStyles(this._prevChartStyle)&&!Z.isRequiringRestartSeriesStyles(e))},a.prototype.onChartStyleChanged=function(){this._updateBarFunction(),this.isNeedRestart()&&(this.data().clear(),this.model().timeScale().scrollToRealtime(!1),this.restart()),this._prevChartStyle=this.properties().style.value(),this._onStyleChanged.fire(this.properties().style.value()),this.invalidateBarStylesCache()},a.prototype.applyPreferences=function(e){var t=$.extend(!0,{},e);this.m_priceScale.setMode({autoScale:t.priceAxisProperties.autoScale,percentage:t.priceAxisProperties.percentage,log:t.priceAxisProperties.log,lockScale:t.priceAxisProperties.lockScale}),this.setChartStyleWithIntervalIfNeeded(t.style),delete t.style,delete t.interval,this._properties.mergeAndFire(t),this._properties.saveDefaults(),this.createPaneView(),this.invalidateBarStylesCache()},a.prototype.barFunction=function(){return this._barFunction},a.prototype.priceSource=function(){var e=null;switch(this._properties.style.value()){case a.STYLE_LINE:e=this._properties.lineStyle.priceSource.value();break;case a.STYLE_AREA:e=this._properties.areaStyle.priceSource.value();break;case a.STYLE_BASELINE:e=this._properties.baselineStyle.priceSource.value()}return e},a.prototype._updateBarFunction=function(){var e=this.priceSource()||"close";this._barFunction=k(e)},a.prototype.style=function(){return this.properties().style.value()},a.prototype.isRangeBasedStyle=function(){return Z.isRangeBasedStyle(this.style())},a.prototype.onInputChanged=function(){this.restart()},a.prototype.onExtendedHoursChanged=function(){return this._extendedHoursChanged},a.prototype.getSymbolString=function(){var e,t,i;return e=P.enabled("pay_attention_to_ticker_not_symbol")&&this._symbolInfo?this._symbolInfo.ticker:this.actualSymbol(),this.extendedHours.value()&&(e={symbol:e,session:"extended"}),a.SYMBOL_STRING_DATA.hasOwnProperty(this._properties.style.value())&&(t=this.styleStudyInfo(this.getStyleShortName()+"Style").studyId,i=this.getInputsProperties(),e={symbol:e,type:t+"!",inputs:i.state()}),
"string"!=typeof e&&(e="="+JSON.stringify(e)),e},a.prototype._getResolvingSymbolString=function(){return this.getSymbolString()},a.prototype.getStyleShortName=function(){var e=this._properties.style.value();if(a.STYLE_SHORT_NAMES.hasOwnProperty(e))return a.STYLE_SHORT_NAMES[e];throw Error("Missed short name for style "+e)},a.prototype.getStyleProperties=function(){return this._properties[this.getStyleShortName()+"Style"]},a.prototype.getInputsProperties=function(){return this.getStyleProperties().inputs||new o},a.prototype.getRealVisibleRange=function(){var e,t,i=this.model().timeScale().visibleBars();return null===i?null:(e=this.data().search(i.firstBar(),B.NearestRight),t=this.data().search(i.lastBar(),B.NearestLeft),null===e||null===t?null:new x(e.index,t.index))},a.prototype.firstValue=function(){var e=this.firstBar();return null===e?null:this._barFunction(e)},a.prototype.firstBar=function(){var e,t,i=this.model().timeScale().visibleBars();return null===i?null:(e=i.firstBar(),t=this.data().search(e,B.NearestRight),null!==t?t.value:null)},a.prototype.sessionsStudy=function(){var e,t,i,n;if(this._sessionsStudy)return this._sessionsStudy;for(e=this.model().paneForSource(this),t=e.dataSources(),i=0;i<t.length;i++)if((n=t[i])instanceof TradingView.Study&&"Sessions"===n.metaInfo().shortId)return this._sessionsStudy=n,this._sessionsStudy;return!1},a.prototype.clearSessionStudy=function(){this._sessionsStudy=null},a.prototype.createSessStudy=function(){if(!this.sessionsStudy()){var e=F.findStudyMetaInfo(this.model().studiesMetaData(),"Sessions@tv-basicstudies");this.model().insertStudy(e,!1,!0),this._onSessionsStudyCreated.fire()}},a.prototype.checkSessStudy=function(){P.enabled("charting_library_base")||(this.sessionsStudy()||this.createSessStudy(),this.sessionsStudy().start())},a.prototype.isSpread=function(){return"spread"===this._symbolInfo.type},a.prototype.firstSymbol=function(){return this._symbolInfo?this._symbolInfo.legs[0]:""},a.prototype.firstShortName=function(){return V.ticker(this.firstSymbol())},a.prototype.onSessionsStudyCreated=function(){return this._onSessionsStudyCreated},a.prototype.loadDataTo=function(e){this._turnaround="s"+ ++this._turnaroundCounter;var t=this._properties.interval.value();t=this._generateTimeframe(t,e),this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,t,this._handler)},a.prototype.checkInterval=function(){if(this._symbolInfo&&(ee.isMinutes(this.interval())&&!this._symbolInfo.has_intraday&&this.requestingIntradayWhenNotSupported.fire(),this._symbolInfo.hasOwnProperty("supported_resolutions"))){var e=ee.normalize(this._properties.interval.value());-1===this._symbolInfo.supported_resolutions.indexOf(e)&&this.requestingResolutionWhenNotSupported.fire(this._symbolInfo.supported_resolutions[0])}},a.prototype.priceScale=function(){return this.m_priceScale},a.prototype.setPriceScale=function(e){this.m_priceScale!==e&&(this.m_priceScale=e,this._priceScaleChanged.fire(e),this._properties.removeProperty("priceAxisProperties"),
"string"!=typeof e&&(e="="+JSON.stringify(e)),e},a.prototype._getResolvingSymbolString=function(){return this.getSymbolString()},a.prototype.getStyleShortName=function(){var e=this._properties.style.value();if(a.STYLE_SHORT_NAMES.hasOwnProperty(e))return a.STYLE_SHORT_NAMES[e];throw Error("Missed short name for style "+e)},a.prototype.getStyleProperties=function(){return this._properties[this.getStyleShortName()+"Style"]},a.prototype.getInputsProperties=function(){return this.getStyleProperties().inputs||new o},a.prototype.getRealVisibleRange=function(){var e,t,i=this.model().timeScale().visibleBars();return null===i?null:(e=this.data().search(i.firstBar(),B.NearestRight),t=this.data().search(i.lastBar(),B.NearestLeft),null===e||null===t?null:new x(e.index,t.index))},a.prototype.firstValue=function(){var e=this.firstBar();return null===e?null:this._barFunction(e)},a.prototype.firstBar=function(){var e,t,i=this.model().timeScale().visibleBars();return null===i?null:(e=i.firstBar(),t=this.data().search(e,B.NearestRight),null!==t?t.value:null)},a.prototype.sessionsStudy=function(){var e,t,i,n;if(this._sessionsStudy)return this._sessionsStudy;for(e=this.model().paneForSource(this),t=e.dataSources(),i=0;i<t.length;i++)if((n=t[i])instanceof TradingView.Study&&"Sessions"===n.metaInfo().shortId)return this._sessionsStudy=n,this._sessionsStudy;return!1},a.prototype.clearSessionStudy=function(){this._sessionsStudy=null},a.prototype.createSessStudy=function(){if(!this.sessionsStudy()){var e=N.findStudyMetaInfo(this.model().studiesMetaData(),"Sessions@tv-basicstudies");this.model().insertStudy(e,!1,!0),this._onSessionsStudyCreated.fire()}},a.prototype.checkSessStudy=function(){P.enabled("charting_library_base")||(this.sessionsStudy()||this.createSessStudy(),this.sessionsStudy().start())},a.prototype.isSpread=function(){return"spread"===this._symbolInfo.type},a.prototype.firstSymbol=function(){return this._symbolInfo?this._symbolInfo.legs[0]:""},a.prototype.firstShortName=function(){return V.ticker(this.firstSymbol())},a.prototype.onSessionsStudyCreated=function(){return this._onSessionsStudyCreated},a.prototype.loadDataTo=function(e){this._turnaround="s"+ ++this._turnaroundCounter;var t=this._properties.interval.value();t=this._generateTimeframe(t,e),this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,t,this._handler)},a.prototype.checkInterval=function(){if(this._symbolInfo&&(ee.isMinutes(this.interval())&&!this._symbolInfo.has_intraday&&this.requestingIntradayWhenNotSupported.fire(),this._symbolInfo.hasOwnProperty("supported_resolutions"))){var e=ee.normalize(this._properties.interval.value());-1===this._symbolInfo.supported_resolutions.indexOf(e)&&this.requestingResolutionWhenNotSupported.fire(this._symbolInfo.supported_resolutions[0])}},a.prototype.priceScale=function(){return this.m_priceScale},a.prototype.setPriceScale=function(e){this.m_priceScale!==e&&(this.m_priceScale=e,this._priceScaleChanged.fire(e),this._properties.removeProperty("priceAxisProperties"),
this._properties.addChild("priceAxisProperties",e.properties()),this._properties.priceAxisProperties.childChanged())},a.prototype.priceScaleChanged=function(){return this._priceScaleChanged},a.prototype.setGotoDateResult=function(e){this._gotoDateResultCleared=!1,i.e(25).then(function(t){if(!this._gotoDateResultCleared){var n=i(810).GotoDateView;this._gotoDateView=new n(this,e),this.m_model.updateSource(this)}}.bind(this).bind(null,i)).catch(i.oe)},a.prototype.clearGotoDateResult=function(e){this._gotoDateView=null,this._gotoDateResultCleared=!0};a.prototype.syncModel=function(){var e,t;if(!this._syncModel){if(e=this.symbolInfo(),t=this.interval(),!e||!t)return null;this._syncModel=new H(e,t)}return this._syncModel},a.prototype.turnaround=function(){return this._turnaround},a.prototype.getStylesPropertyPage=function(){return P.enabled("show_chart_property_page")?T.ChartStylesPropertyPage:null},a.prototype.getSourceIcon=function(){return{type:"loadSvg",svgId:"series."+this.properties().style.value()}},a.prototype.isStyleSupported=function(e){return!0},a.prototype.isStyleSupportedForReplay=function(e){return Z.isTimeBasedStyle(e)},a.prototype.isInReplay=function(){return null!==this._replaySubscriber},a.prototype._onBeforeModifySeries=function(e,t){},a.prototype._isExtendedHoursAllowed=function(){return this._symbolInfo&&-1!==["stock","index","futures"].indexOf(this._symbolInfo.type)},a.prototype._getTelemetryAdditionalData=function(e,t){t=void 0===t||t;var i={symbol:this.actualSymbol()};return t&&(i.resolution=this.interval()),void 0!==e&&(i.reason=e),i},a.prototype._sendTelemetryReport=function(e,t,i){void 0===i&&(i=this._getTelemetryAdditionalData());var n=Object.assign(t,{additional:i});telemetry.sendChartReport(e,n)},a.prototype._sendTelemetryCounter=function(e,t){this._sendTelemetryReport(e,{count:1},t)},a.prototype._sendTelemetryTiming=function(e,t,i){this._sendTelemetryReport(e,{value:t},i)},a.prototype.destroy=function(){this._unsubscribeQuoteSession(),this.clearGotoDateResult(),this._legendView.destroy()},a.prototype.dataEvents=function(){return this._dataEvents},TradingView.Series=a,t.Series=a}).call(t,i(8),i(16),i(13),i(48).PriceRange)},,,,function(e,t,i){"use strict";e.exports=i(252)},function(e,t,i){"use strict";function n(){this._registeredSources={},this._sourcesToRow={},this._rowsToSources={},this._currentSymbol="",this._actualCapacity=0,this._actualWidth=1,this._numericFormatter=new r,this._percentageFormatter=new o}var o=i(70).PercentageFormatter,r=i(106).NumericFormatter;n.prototype.levelsCount=function(){return 0},n.prototype.topByRow=function(e){return e*n.ROW_HEIGHT},n.prototype.rowHeight=function(e){return n.ROW_HEIGHT},n.prototype.canvas=function(){if(!this._canvas){this._canvas=$("<canvas>"),this._cache=this._canvas.get(0).getContext("2d"),this._canvas.prop("width",100).css("position","absolute").css("top",0).css("z-index",1e3).css("left",0);this._canvas.get(0).getContext("2d").font="12px Verdana"}return this._canvas},n.ROW_HEIGHT=14,n.prototype.points=function(e){
return[e.points()[0],e.points()[1]]},n.prototype.startPoint=function(e,t){return t?e.points()[0]:e.points()[1]},n.prototype.priceRange=function(e,t){var i=this.points(e),n=i[0],o=i[1];return t?o.price-n.price:n.price-o.price},n.prototype.sourceIsReady=function(e){return e.points().length>=2},n.prototype._calculateWidth=function(e){var t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P;if(!this.sourceIsReady(e))return null;if(t=this.canvas().get(0).getContext("2d"),t.font="12px Verdana",i=!!e.properties().showPrices&&e.properties().showPrices.value(),n=!!e.properties().coeffsAsPercents&&e.properties().coeffsAsPercents.value(),o=e.properties().showCoeffs.value(),r=e.priceScale(),s=this.points(e),a=s[0],l=s[1],!a||!l)return null;if(c=!1,h=e.properties(),h.reverse&&h.reverse.value()&&(c=h.reverse.value()),u=this.priceRange(e,c),d=this.startPoint(e,c).price,null===(p=e.ownerSource().firstValue()))return 0;for(_=0,f=[],m=1;m<=this.levelsCount();m++)y="level"+m,g=h[y],v=g.coeff.value(),S=d+v*u,b="",o&&(b+=n?this._percentageFormatter.format(Math.round(1e4*v)/100):this._numericFormatter.format(v)),i&&(b+="("+r.formatPrice(S,p)+")"),w=t.measureText(b).width,P={text:b,left:_,width:w+4},f.push(P),_+=P.width;return{totalWidth:_,cells:f}},n.prototype._effectiveState=function(e){var t,i,n,o,r,s,a={},l=e.properties();for(l.showPrices&&(a.showPrices=l.showPrices.value()),l.coeffsAsPercents&&(a.coeffsAsPercents=l.coeffsAsPercents.value()),a.showCoeffs=l.showCoeffs.value(),e.priceScale()&&e.priceScale().formatter().state&&(a.formatter=e.priceScale().formatter().state()),l.reverse&&(a.reverse=l.reverse.value()),a.p1=e.points()[0],a.p2=e.points()[1],3===e.points().length&&(a.p3=e.points()[2]),a.items=[],t=1;t<=this.levelsCount();t++)i="level"+t,n=l[i],o=n.coeff.value(),r=n.color.value(),s={coeff:o,color:r},a.items.push(s);return a},n.prototype._findEmptyRow=function(e){for(var t,i=0;this._rowsToSources[i];)i++;return this._rowsToSources[i]=e,i>=this._actualCapacity&&(this._actualCapacity++,t=this.canvas(),TradingView.resizeCanvas(t,this._actualWidth,n.ROW_HEIGHT*this._actualCapacity)),i},n.prototype._repaintSource=function(e,t,i){var o,r,s=n.ROW_HEIGHT*i.row,a=this.canvas().get(0).getContext("2d");for(a.clearRect(0,s,this._actualWidth,n.ROW_HEIGHT),a.textBaseline="bottom",a.font="12px Verdana",s+=n.ROW_HEIGHT,o=0;o<e.cells.length;o++)r=e.cells[o],a.fillStyle=t.items[o].color,a.fillText(r.text,r.left,s)},n.prototype.removeSource=function(e){var t,i;this._sourcesToRow[e]&&(t=this._sourcesToRow[e].row,i=this.canvas().get(0).getContext("2d"),i.save(),i.clearRect(0,this.topByRow(t),this._actualWidth,n.ROW_HEIGHT),i.restore(),delete this._sourcesToRow[e],delete this._rowsToSources[t])},n.prototype._effectiveStatesEquals=function(e,t){var i,n=function(e,t){return!(!e&&!t)&&(!(!e||t)||(!(e||!t)||(e.minMove!==t.minMove||(e.minMove2!==t.minMove2||(e.fractional!==t.fractional||e.fractionalLength!==t.fractionalLength)))))},o=function(e,t){return!(!e&&!t)&&(!(!e||t)||(!(e||!t)||(e.index!==t.index||e.price!==t.price)))},r=function(e,t){
return e.coeff!==t.coeff||e.color!==t.color};if(e&&!t)return!1;if(!e&&t)return!1;if(e.showPrices!==t.showPrices)return!1;if(e.coeffsAsPercents!==t.coeffsAsPercents)return!1;if(e.showCoeffs!==t.showCoeffs)return!1;if(e.reverse!==t.reverse)return!1;if(n(e.formatter,t.formatter))return!1;if(o(e.p1,t.p1))return!1;if(o(e.p2,t.p2))return!1;if(o(e.p3,t.p3))return!1;if(e.items.length!==t.items.length)return!1;for(i=0;i<e.items.length;i++)if(r(e.items[i],t.items[i]))return!1;return!0},n.prototype.updateSource=function(e){var t,i,o,r,s=e.properties().symbol.value();return this._currentSymbol!==s&&(this._currentSymbol=s,this._sourcesToRow={},this._rowsToSources={}),this._sourcesToRow[e.id()]||(t=this._findEmptyRow(e.id()),this._sourcesToRow[e.id()]={effectiveState:null,row:t}),i=this._sourcesToRow[e.id()].effectiveState,o=this._effectiveState(e),this._effectiveStatesEquals(i,o)||(r=this._calculateWidth(e),r?(this._sourcesToRow[e.id()].effectiveState=o,r.totalWidth>this._actualWidth&&(TradingView.resizeCanvas(this.canvas(),r.totalWidth,n.ROW_HEIGHT*this._actualCapacity),this._actualWidth=r.totalWidth),t=this._sourcesToRow[e.id()],this._repaintSource(r,o,t),this._sourcesToRow[e.id()].effectiveState=o,this._sourcesToRow[e.id()].preparedCells=r):this._sourcesToRow[e.id()].effectiveState=null),this._sourcesToRow[e.id()]},e.exports=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"CompositeRenderer",function(){return n});var n=function(){function e(){this._renderers=[],this._globalAlpha=1}return e.prototype.setGlobalAlpha=function(e){this._globalAlpha=e},e.prototype.append=function(e){this._renderers.push(e)},e.prototype.insert=function(e,t){this._renderers.splice(t,0,e)},e.prototype.draw=function(e){for(var t=0;t<this._renderers.length;t++)e.save(),e.globalAlpha=this._globalAlpha,this._renderers[t].draw(e),e.restore()},e.prototype.drawBackground=function(e){var t,i;for(e.save(),e.globalAlpha=this._globalAlpha,t=0;t<this._renderers.length;t++)i=this._renderers[t],i.drawBackground&&i.drawBackground(e);e.restore()},e.prototype.hitTest=function(e){var t,i,n=null;for(t=this._renderers.length-1;t>=0;t--)null!==(i=this._renderers[t].hitTest(e))&&(null===n||i.result()>n.result())&&(n=i);return n},e}()},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"PercentageFormatter",function(){return r}),n=i(1),o=i(21),r=function(e){function t(t){void 0===t&&(t=100);var i=e.call(this,t)||this;return i.type="percentage",i}return n.c(t,e),t.prototype.state=function(){var e=o.PriceFormatter.prototype.state.call(this);return e.percent=!0,e},t.prototype.format=function(t,i,n,o){return e.prototype.format.call(this,t,i,n,o)+"%"},t.serialize=function(e){return e.state()},t.deserialize=function(e){return new t(e.priceScale)},t}(o.PriceFormatter)},function(e,t,i){"use strict";(function(t){function i(){return/on-features-page=1/i.test(window.location.search)}var n=window.TradingView=window.TradingView||{};n.className=function(e){for(var t in this)if(n[t]===e)return t;return null},
@@ -102,9 +102,9 @@ void 0===t&&(t=(new Date).valueOf()),t!==TVLocalStorage.getItem(r+e)&&TVLocalSto
c&&!Modernizr.touch||(this._processEvent(e,this._handler.mouseMoveEvent),this._preventDefaultIfNeeded(e))},e.prototype._mouseMoveWithDownHandler=function(e){var t,i,n,o,r,s,c;void 0===e.button&&(e.button=0),t=!1,this._fixMouseTouchEvent(e,e.originalEvent),i=Modernizr.touch||e.originalEvent.touches,i&&(this._verticalTouchScroll&&(n=Math.abs(.5*(e.pageX-this._lastTouchPosition.x)),o=Math.abs(e.pageY-this._lastTouchPosition.y),n<=o?(t=!0,this._preventDefault=!1):this._preventDefault=this._originalPreventDefault),this._lastTouchPosition.x=e.pageX,this._lastTouchPosition.y=e.pageY),r=Object(a.ensure)(this._mouseMoveStartPosition),s=Math.abs(r.x-e.pageX),c=Math.abs(r.y-e.pageY),this._moveExceededManhattanDistance=this._moveExceededManhattanDistance||s+c>5,this._moveExceededManhattanDistance?(this._cancelClick=!0,i&&this._clearContextMenuTimeout()):i&&(t=!0),e.button===l||t||this._processEvent(e,this._handler.pressedMouseMoveEvent),this._preventDefaultIfNeeded(e)},e.prototype._mouseUpHandler=function(e){void 0===e.button&&(e.button=0),this._fixMouseTouchEvent(e,e.originalEvent),Modernizr.touch&&this._clearContextMenuTimeout(),this._mouseMoveStartPosition=null,c=!1;var t=e.target.ownerDocument.documentElement;$(t).off("mousemove.chartgui"),$(t).off("mouseup.chartgui"),Modernizr.touch||e.originalEvent.touches?($(t).off("touchmove.chartgui"),$(t).off("touchend.chartgui"),this._mouseLeaveHandler(e)):($(t).off("mousemove.chartgui touchmove.chartgui"),$(t).off("mouseup.chartgui touchend.chartgui")),e.button!==l&&(this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1?(this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()):this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent)),this._preventDefaultIfNeeded(e),Modernizr.touch&&this._mouseLeaveHandler(e)},e.prototype._clearContextMenuTimeout=function(){null!==this._touchContextMenuTimeout&&(clearTimeout(this._touchContextMenuTimeout),this._touchContextMenuTimeout=null)},e.prototype._mouseDownHandler=function(e){void 0===e.button&&(e.button=0),this._cancelClick=!1,this._moveExceededManhattanDistance=!1,this._fixMouseTouchEvent(e,e.originalEvent),Modernizr.touch&&(this._lastTouchPosition.x=e.pageX,this._lastTouchPosition.y=e.pageY,this._mouseEnterHandler(e)),this._mouseMoveStartPosition={x:e.pageX,y:e.pageY};var t=e.target.ownerDocument.documentElement;if(Modernizr.touch?($(t).off("touchmove.chartgui"),$(t).off("touchend.chartgui"),$(t).on("touchmove.chartgui",this._mouseMoveWithDownHandler.bind(this)),$(t).on("touchend.chartgui",this._mouseUpHandler.bind(this)),this._clearContextMenuTimeout(),this._touchContextMenuTimeout=setTimeout(this._contextMenuHandler.bind(this,e),500)):($(t).off("mousemove.chartgui touchmove.chartgui"),$(t).off("mouseup.chartgui touchend.chartgui"),$(t).on("mousemove.chartgui touchmove.chartgui",this._mouseMoveWithDownHandler.bind(this)),$(t).on("mouseup.chartgui touchend.chartgui",this._mouseUpHandler.bind(this))),c=!0,
e.button!==l&&(this._processEvent(e,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500))),this._preventDefaultIfNeeded(e),this._preventDefault)try{window.focus()}catch(e){}},e.prototype._init=function(){var e=this;this._$target.mouseenter(this._mouseEnterHandler.bind(this)),this._$target.on("touchcancel",this._clearContextMenuTimeout.bind(this)),this._$target.on("touchstartoutside mousedownoutside",function(t){e._handler.mouseDownOutsideEvent&&e._handler.mouseDownOutsideEvent(t,e._$target)}),this._$target.mouseleave(this._mouseLeaveHandler.bind(this)),this._$target.contextMenu&&this._$target.contextMenu(this._contextMenuHandler.bind(this)),Modernizr.touch?(this._$target.on("touchstart.chartgui",this._mouseDownHandler.bind(this)),this._initGestureEvents()):this._$target.on("mousedown.chartgui touchstart.chartgui",this._mouseDownHandler.bind(this))},e.prototype._mouseLeaveHandler=function(e){this._$target.off("mousemove.chartgui touchmove.chartgui"),this._processEvent(e,this._handler.mouseLeaveEvent),this._preventDefaultIfNeeded(e)},e.prototype._contextMenuHandler=function(e){this._processEvent(e,this._handler.contextMenuEvent),this._preventDefaultIfNeeded(e),this._cancelClick=!0},e.prototype._processEvent=function(e,t){t&&(n(this._$target,e),t.call(this._handler,e,this._$target))},e.prototype._preventDefaultIfNeeded=function(e){this._preventDefault&&e.preventDefault()},e.prototype._initGestureEvents=function(){var e,t=this;[this._handler.gestureStartEvent,this._handler.gestureChangeEvent,this._handler.gestureEndEvent].some(Boolean)&&(e=new s.a,e.load().then(function(e){t._isDestroyed||(t._hammerManager=new e(t._$target.get(0)),t._hammerManager.get("pinch").set({enable:!0}),t._hammerManager.on("pinchstart",function(e){t._handler.gestureStartEvent&&t._handler.gestureStartEvent(e,t._$target),t._clearContextMenuTimeout()}),t._hammerManager.on("pinchmove",function(e){t._handler.gestureChangeEvent&&t._handler.gestureChangeEvent(e,t._$target)}),t._hammerManager.on("pinchend pinchcancel",function(e){t._handler.gestureEndEvent&&t._handler.gestureEndEvent(e,t._$target)}))}))},e.prototype._fixMouseTouchEvent=function(e,t){var i;if(t.touches&&0!==t.touches.length)i=t.touches[0];else{if(!t.changedTouches||0===t.changedTouches.length)return;i=t.changedTouches[0]}e.pageX=i.pageX,e.pageY=i.pageY,e.localX=i.pageX,e.localY=i.pageY,e.clientX=i.clientX,e.clientY=i.clientY},e}()},,,,function(e,t,i){"use strict";var n,o;i.d(t,"a",function(){return o}),n=3e3,o=function(){function e(){var e=this;this._cache=null,this._tryLoad=function(t){e._startLoading().then(t,function(){return setTimeout(function(){return e._tryLoad(t)},n)})}}return e.prototype.load=function(){return this._cache||(this._cache=new Promise(this._tryLoad)),this._cache},e}()},function(e,t,i){"use strict";function n(e){this._maxSize=e||50,this.reset()}var o=/[2-9]/g;n.prototype.measureText=function(e,t,i){var n,r,s=i||o,a=(t+"").replace(s,"0")
;return this._cache[a]?this._cache[a].width:(this._actualSize===this._maxSize&&(n=this._tick2Labels[this._oldestTick],delete this._tick2Labels[this._oldestTick],delete this._cache[n],this._oldestTick++,this._actualSize--),0===(r=e.measureText(a).width)&&t.length?0:(this._cache[a]={width:r,tick:this._usageTick},this._tick2Labels[this._usageTick]=a,this._actualSize++,this._usageTick++,r))},n.prototype.reset=function(){this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}},e.exports=n},function(e,t,i){"use strict";var n,o,r,s,a,l,c,h,u,d;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyDataWindowView",function(){return d}),n=i(1),o=i(84),i.n(o),r=i(118),s=i(5),i.n(s),a=i(17),l=i(87),c=window.t("n/a"),h=s.enabled("hide_last_na_study_output"),u=function(e){function t(t,i,n,o){var r=e.call(this,t,i)||this;return r.plotId=n,r.plotIndex=o,r}return n.c(t,e),t}(r.DataWindowItem),d=function(e){function t(t,i){var n,o,r,s,a=e.call(this)||this;if(a._invalidated=!0,a._study=t,a._model=i,!(n=t.metaInfo().plots))return a;for(o=0;o<n.length;++o)a._study.isSelfColorerPlot(o)||a._study.isBarColorerPlot(o)||a._study.isBgColorerPlot(o)||a._study.isDataOffsetPlot(o)||a._study.isOHLCColorerPlot(o)||(r=n[o].id,s=new u(a._study.guiPlotName(r),"",r,o),a._items.push(s));return a.update(),a}return n.c(t,e),t.prototype.update=function(){this._invalidated=!0},t.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},t.prototype._updateImpl=function(){var e,t,i,n,r,s,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O;for(this._header=this._study.title(!0),this._title=this._study.title(),e=this._study.isVisible()?c:"",t=0,i=this._items;t<i.length;t++)n=i[t],n.setValue(e);if(h&&this._items.length&&this._items[this._items.length-1].setValue(""),!this._model.timeScale().isEmpty()){if(r=this._study.metaInfo().plots,s={},u=this._study.metaInfo().palettes,r&&void 0!==u)for(d=0;d<r.length;d++)p=r[d],(Object(l.isColorerPlot)(p)||Object(l.isOhlcColorerPlot)(p))&&(_=p.target,s[_]={index:d,palette:u[p.palette],paletterProps:this._study.properties().palettes[p.palette]});for(f=this._study.data().size()-1,m=this._model.crossHairSource().appliedIndex(),y=this._study.formatter(),g={},v=0,S=this._items;v<S.length;v++)b=S[v],n=b,w=n.plotId,P=n.plotIndex,T=this._study.offset(w),void 0!==(x=Object(o.isNumber)(m)?this._study.nearestIndex(m-T,a.PlotRowSearchMode.NearestLeft):f)&&(C=g[w],void 0===C&&(C=this._study.getMinFirstBarIndexForPlot(w),Number.isFinite(C)&&(g[w]=C)),C>x||(L=this._study.data().last(),null!==(I=this._study.data().valueAt(x)||(null!==L?L.value:null))&&(A=I[P+1],Object(o.isNumber)(A)&&(n.setValue(y.format(A)),k=this._study.properties().styles[w].color.value(),p=r[P],Object(l.isOhlcPlot)(p)&&(w=p.target||w,k=this._study.properties().ohlcPlots[w].color.value()),E=k,s[w]&&I.length>s[w].index+1&&(M=I[s[w].index+1],V=s[w].palette,void 0!==M&&null!==M&&void 0!==V&&(D=s[w].paletterProps,O=V.valToIndex?V.valToIndex[M]:M,
E=D.colors[void 0!==O?O:M].color.value())),n.setColor(E)))))}},t}(r.DataWindowView)},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DataWindowItem",function(){return n}),i.d(t,"DataWindowView",function(){return o}),n=function(){function e(e,t){this._visible=!0,this._title=e,this._value=t}return e.prototype.title=function(){return this._title},e.prototype.setTitle=function(e){this._title=e},e.prototype.text=function(){return this._value},e.prototype.value=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.prototype.visible=function(){return this._visible},e.prototype.setVisible=function(e){this._visible=e},e.prototype.color=function(){return this._color},e.prototype.setColor=function(e){this._color=e},e}(),o=function(){function e(){this._items=[],this._header="",this._title=""}return e.prototype.header=function(){return this._header},e.prototype.title=function(){return this._title},e.prototype.items=function(){return this._items},e.prototype.update=function(){},e}()},function(e,t,i){"use strict";function n(e,t){o.call(this,t),this._study=e,this._inputValueReplacements={NONE:"Default"}}var o=i(267);inherit(n,o),n.prototype.color=function(){return this._study.isFailed()||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":o.prototype.color.call(this)},n.prototype.update=function(){this._study.isFailed()?this._text=this._study.title(!0,this._inputValueReplacements)+": "+this._study.status():this._text=this._study.title(!0,this._inputValueReplacements)+" "+this._study.status()},e.exports=n},function(e,t,i){"use strict";var n,o=i(7).assert,r=i(24),s=r.rgba,a=r.rgbaToString,l=r.parseRgb,c=i(533),h=i(177).PriceScale,u=i(124),d=i(73),p=d.createLineTool,_=d.isLineToolName,f=d.isStudyLineToolName,m=i(0).LineDataSource,y=i(45).LineToolBarsPattern,g=i(45).LineToolCallout,v=i(635),S=i(34),b=S.Study,w=S.prepareStudyPropsStateForLoadChart,P=S.prepareStudyPropertiesForLoadChart,T=i(285).createStudy,x=i(63).Series,C=i(40),L=i(42),I=i(3).DefaultProperty,A=i(26),k=i(5),E=i(4).getLogger("Chart.Serialization"),M=i(45).LineToolParallelChannel,V=i(45).LineToolTrendAngle,D=i(45).LineToolGhostFeed,O=i(45).LineToolElliott,R=i(28).PriceDataSource,B=i(176).Pane,N=i(18),F=i(29);E=i(4).getLogger("Chart.Serialization"),c.version=2,c.prototype.state=function(e,t){var i,n,o,r={};for(r.panes=[],i=0;i<this.panes().length;i++)r.panes.push(this.panes()[i].state(!0,e,!1,t));return r.timeScale=this.m_timeScale.state(e),n=null,o=this.properties(),r.chartProperties={paneProperties:o.paneProperties.state(),scalesProperties:o.scalesProperties.state(),publishedChartsTimelineProperties:n?n.state(e):void 0,chartEventsSourceProperties:o.chartEventsSourceProperties.state()},o.chartEventsSourceProperties&&(r.chartProperties.chartEventsSourceProperties=o.chartEventsSourceProperties.state()),r.version=c.version,r.timezone=this.timezone(),r},c.prototype.chartPropertiesTransparencyMigrate=function(e){var t,i,n
;e.chartProperties.paneProperties.crossHairProperties&&(n=e.chartProperties.paneProperties.crossHairProperties,F.isHexColor(n.color)&&(i=n.transparency/100,t=l(n.color),n.color=a(s(t,i)))),e.chartProperties.paneProperties.dataWindowProperties&&(n=e.chartProperties.paneProperties.dataWindowProperties,F.isHexColor(n.color)&&(i=n.transparency/100,t=l(n.color),n.color=a(s(t,i))))},c.prototype.resetDeferredStudies=function(){new n(this).reset()},c.prototype._getExceedingChildStudies=function(e){var t,i,n,o,r,s,a,l,c=[];for(t=0;t<e.length;++t)c=c.concat(e[t].sources||[]);for(i=0,n=1,o=[],r={},s=0,a=1e6;c.length&&--a;)l=c[s],(l.ownerSource&&r[l.ownerSource]||!l.ownerSource)&&(r[l.id]=l,c.splice(c.indexOf(l),1),l.ownerSource&&"Study"===l.type&&l.state&&l.state.isChildStudy&&++i>n&&o.push(l)),s=(s+1)%c.length;return o},c.prototype.restoreState=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_;if(new n(this).reset(),i={},!e.panes)return void E.logDebug("ChartModel.restoreState: invalid state");if(!Array.isArray(e.panes))return void E.logDebug("ChartModel.restoreState: invalid state");if(e.panes.length<1)return void E.logDebug("ChartModel.restoreState: invalid state");if(e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties&&(o=TradingView.factoryDefaults("chartproperties").scalesProperties,TradingView.merge(o,e.chartProperties.scalesProperties),!("showLastValue"in o)||"showSeriesLastValue"in o||"showStudyLastValue"in o||(o.showSeriesLastValueProperty=o.showLastValue,o.showStudyLastValueProperty=o.showLastValue),"showSeriesLastValue"in o&&(i.showSeriesLastValueProperty=!0),"showStudyLastValue"in o&&(i.showStudyLastValueProperty=!0),e.chartProperties.paneProperties.vertGridProperties=e.chartProperties.paneProperties.vertGridProperties||TradingView.clone(e.chartProperties.paneProperties.gridProperties),e.chartProperties.paneProperties.horzGridProperties=e.chartProperties.paneProperties.horzGridProperties||TradingView.clone(e.chartProperties.paneProperties.gridProperties),this._properties.paneProperties.merge(e.chartProperties.paneProperties),this._properties.scalesProperties.merge(o),e.chartProperties.timezone&&this._properties.timezone.setValue(e.chartProperties.timezone),e.chartProperties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties.merge(e.chartProperties.chartEventsSourceProperties),this.m_timeScale.restoreState(e.timeScale,t)),e.timeScale&&this.m_timeScale.restoreState(e.timeScale,t),!this.readOnly()&&(r=this._getExceedingChildStudies(e.panes),r.length))for(s=e.panes.length-1;s>=0;--s){for(a=e.panes[s],l=a.sources.length-1;l>=0;--l)c=a.sources[l],~r.indexOf(c)&&a.sources.splice(l,1);a.sources.length||e.panes.splice(s,1)}for(h=e.panes,this.panes()[0].restoreState(h[0],t,e.version,i),s=1;s<e.panes.length;s++)a=this.panes()[s]||this.createPane(),a.restoreState(e.panes[s],t,e.version,i);for(this._invalidateBarColorerCaches(),u=this.dataSources(),d=0,s=0;s<u.length;s++)p=u[s],
TradingView.isInherited(p.constructor,m)&&(d++,p.calcIsActualSymbol());return this._version=e.version,this.updateTimeScaleBaseIndex(),this.recalculateAllPanes(),this.invalidate(new N(N.FULL_UPDATE)),_=TVLocalStorage.getItem("linetools_limit")||1e3,window.is_authenticated&&window.user&&window.user.settings&&(_=window.user.settings.linetools_limit||_),d>_&&d%100==0?{lines_limit_exceeded:!0,line_tools_count:d}:{}},B.prototype.state=function(e,t,i,n){function o(e){return i&&!e.isSavedInStudyTemplates()||!e.state||!e.state()||!e.isSavedInChart(t)||n&&e.isActualSymbol&&!e.isActualSymbol()}var r,s,a={};if(e)for(a.sources=[],r=0;r<this.m_dataSources.length;r++)o(this.m_dataSources[r])||a.sources.push(this.m_dataSources[r].state(t));for(a.leftAxisState=this.m_leftPriceScale.state(),a.leftAxisState.m_isLockScale&&null!==this._lastLeftPriceScaleRatio&&(a.leftPriceScaleRatio=this._lastLeftPriceScaleRatio),a.leftAxisSources=[],r=0;r<this.m_leftPriceScale.dataSources().length;r++)o(this.m_leftPriceScale.dataSources()[r])||a.leftAxisSources.push(this.m_leftPriceScale.dataSources()[r].id());for(a.rightAxisState=this.m_rightPriceScale.state(),a.rightAxisState.m_isLockScale&&null!==this._lastRightPriceScaleRatio&&(a.rightPriceScaleRatio=this._lastRightPriceScaleRatio),a.rightAxisSources=[],r=0;r<this.m_rightPriceScale.dataSources().length;r++)o(this.m_rightPriceScale.dataSources()[r])||a.rightAxisSources.push(this.m_rightPriceScale.dataSources()[r].id());for(a.overlayPriceScales={},r=0;r<this.m_dataSources.length;r++)s=this.m_dataSources[r],this.isOverlay(s)&&s.isSavedInChart(t)&&(a.overlayPriceScales[s.id()]=s.priceScale().state());return a.stretchFactor=this._stretchFactor,this.m_mainDataSource&&(a.mainSourceId=this.m_mainDataSource.id()),a},B.prototype.sourceById=function(e){for(var t=0;t<this.m_dataSources.length;t++)if(this.m_dataSources[t].id()===e)return this.m_dataSources[t];return null},B.prototype.isESDStudy=function(e){return"Script$TV_EARNINGS@tv-scripting"===e.id||"Script$TV_DIVIDENDS@tv-scripting"===e.id||"Script$TV_SPLITS@tv-scripting"===e.id||"ESD$TV_EARNINGS@tv-scripting"===e.id||"ESD$TV_DIVIDENDS@tv-scripting"===e.id||"ESD$TV_SPLITS@tv-scripting"===e.id},B.prototype.isStudyToSkip=function(e){return!!this.isESDStudy(e)},B.prototype.restoreState=function(e,t,i,n){var o,r,s,a,l,c,u,d,p,_,f,y,g,v,S;if(n=n||{},!e.leftAxisState||!e.rightAxisState)throw Error("invalid state");if(!e.leftAxisSources||!e.rightAxisSources)throw Error("invalid state");if(e.stretchFactor&&(this._stretchFactor=e.stretchFactor),o={},e.sources)for(r=-1!==this.m_dataSources.indexOf(this._model.mainSeries()),this.clearSeries(),this.m_mainDataSource=null,r&&this.m_dataSources.push(this._model.mainSeries()),s=this.getZOrderMinMax(),a=s.minZOrder,l=s.maxZOrder,function(){var t,i,n,o,r,s=e.sources.find(function(t){return t.id===e.mainSourceId});if(void 0===s)return void E.logWarn("There is no main source with id "+e.mainSourceId+", total sources="+e.sources.length)
E=D.colors[void 0!==O?O:M].color.value())),n.setColor(E)))))}},t}(r.DataWindowView)},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DataWindowItem",function(){return n}),i.d(t,"DataWindowView",function(){return o}),n=function(){function e(e,t){this._visible=!0,this._title=e,this._value=t}return e.prototype.title=function(){return this._title},e.prototype.setTitle=function(e){this._title=e},e.prototype.text=function(){return this._value},e.prototype.value=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.prototype.visible=function(){return this._visible},e.prototype.setVisible=function(e){this._visible=e},e.prototype.color=function(){return this._color},e.prototype.setColor=function(e){this._color=e},e}(),o=function(){function e(){this._items=[],this._header="",this._title=""}return e.prototype.header=function(){return this._header},e.prototype.title=function(){return this._title},e.prototype.items=function(){return this._items},e.prototype.update=function(){},e}()},function(e,t,i){"use strict";function n(e,t){o.call(this,t),this._study=e,this._inputValueReplacements={NONE:"Default"}}var o=i(267);inherit(n,o),n.prototype.color=function(){return this._study.isFailed()||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":o.prototype.color.call(this)},n.prototype.update=function(){this._study.isFailed()?this._text=this._study.title(!0,this._inputValueReplacements)+": "+this._study.status():this._text=this._study.title(!0,this._inputValueReplacements)+" "+this._study.status()},e.exports=n},function(e,t,i){"use strict";var n,o=i(7).assert,r=i(24),s=r.rgba,a=r.rgbaToString,l=r.parseRgb,c=i(533),h=i(177).PriceScale,u=i(124),d=i(73),p=d.createLineTool,_=d.isLineToolName,f=d.isStudyLineToolName,m=i(0).LineDataSource,y=i(45).LineToolBarsPattern,g=i(45).LineToolCallout,v=i(635),S=i(34),b=S.Study,w=S.prepareStudyPropsStateForLoadChart,P=S.prepareStudyPropertiesForLoadChart,T=i(285).createStudy,x=i(63).Series,C=i(40),L=i(42),I=i(3).DefaultProperty,A=i(26),k=i(5),E=i(4).getLogger("Chart.Serialization"),M=i(45).LineToolParallelChannel,V=i(45).LineToolTrendAngle,D=i(45).LineToolGhostFeed,O=i(45).LineToolElliott,R=i(28).PriceDataSource,B=i(176).Pane,F=i(18),N=i(29);E=i(4).getLogger("Chart.Serialization"),c.version=2,c.prototype.state=function(e,t){var i,n,o,r={};for(r.panes=[],i=0;i<this.panes().length;i++)r.panes.push(this.panes()[i].state(!0,e,!1,t));return r.timeScale=this.m_timeScale.state(e),n=null,o=this.properties(),r.chartProperties={paneProperties:o.paneProperties.state(),scalesProperties:o.scalesProperties.state(),publishedChartsTimelineProperties:n?n.state(e):void 0,chartEventsSourceProperties:o.chartEventsSourceProperties.state()},o.chartEventsSourceProperties&&(r.chartProperties.chartEventsSourceProperties=o.chartEventsSourceProperties.state()),r.version=c.version,r.timezone=this.timezone(),r},c.prototype.chartPropertiesTransparencyMigrate=function(e){var t,i,n
;e.chartProperties.paneProperties.crossHairProperties&&(n=e.chartProperties.paneProperties.crossHairProperties,N.isHexColor(n.color)&&(i=n.transparency/100,t=l(n.color),n.color=a(s(t,i)))),e.chartProperties.paneProperties.dataWindowProperties&&(n=e.chartProperties.paneProperties.dataWindowProperties,N.isHexColor(n.color)&&(i=n.transparency/100,t=l(n.color),n.color=a(s(t,i))))},c.prototype.resetDeferredStudies=function(){new n(this).reset()},c.prototype._getExceedingChildStudies=function(e){var t,i,n,o,r,s,a,l,c=[];for(t=0;t<e.length;++t)c=c.concat(e[t].sources||[]);for(i=0,n=1,o=[],r={},s=0,a=1e6;c.length&&--a;)l=c[s],(l.ownerSource&&r[l.ownerSource]||!l.ownerSource)&&(r[l.id]=l,c.splice(c.indexOf(l),1),l.ownerSource&&"Study"===l.type&&l.state&&l.state.isChildStudy&&++i>n&&o.push(l)),s=(s+1)%c.length;return o},c.prototype.restoreState=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_;if(new n(this).reset(),i={},!e.panes)return void E.logDebug("ChartModel.restoreState: invalid state");if(!Array.isArray(e.panes))return void E.logDebug("ChartModel.restoreState: invalid state");if(e.panes.length<1)return void E.logDebug("ChartModel.restoreState: invalid state");if(e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties&&(o=TradingView.factoryDefaults("chartproperties").scalesProperties,TradingView.merge(o,e.chartProperties.scalesProperties),!("showLastValue"in o)||"showSeriesLastValue"in o||"showStudyLastValue"in o||(o.showSeriesLastValueProperty=o.showLastValue,o.showStudyLastValueProperty=o.showLastValue),"showSeriesLastValue"in o&&(i.showSeriesLastValueProperty=!0),"showStudyLastValue"in o&&(i.showStudyLastValueProperty=!0),e.chartProperties.paneProperties.vertGridProperties=e.chartProperties.paneProperties.vertGridProperties||TradingView.clone(e.chartProperties.paneProperties.gridProperties),e.chartProperties.paneProperties.horzGridProperties=e.chartProperties.paneProperties.horzGridProperties||TradingView.clone(e.chartProperties.paneProperties.gridProperties),this._properties.paneProperties.merge(e.chartProperties.paneProperties),this._properties.scalesProperties.merge(o),e.chartProperties.timezone&&this._properties.timezone.setValue(e.chartProperties.timezone),e.chartProperties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties.merge(e.chartProperties.chartEventsSourceProperties),this.m_timeScale.restoreState(e.timeScale,t)),e.timeScale&&this.m_timeScale.restoreState(e.timeScale,t),!this.readOnly()&&(r=this._getExceedingChildStudies(e.panes),r.length))for(s=e.panes.length-1;s>=0;--s){for(a=e.panes[s],l=a.sources.length-1;l>=0;--l)c=a.sources[l],~r.indexOf(c)&&a.sources.splice(l,1);a.sources.length||e.panes.splice(s,1)}for(h=e.panes,this.panes()[0].restoreState(h[0],t,e.version,i),s=1;s<e.panes.length;s++)a=this.panes()[s]||this.createPane(),a.restoreState(e.panes[s],t,e.version,i);for(this._invalidateBarColorerCaches(),u=this.dataSources(),d=0,s=0;s<u.length;s++)p=u[s],
TradingView.isInherited(p.constructor,m)&&(d++,p.calcIsActualSymbol());return this._version=e.version,this.updateTimeScaleBaseIndex(),this.recalculateAllPanes(),this.invalidate(new F(F.FULL_UPDATE)),_=TVLocalStorage.getItem("linetools_limit")||1e3,window.is_authenticated&&window.user&&window.user.settings&&(_=window.user.settings.linetools_limit||_),d>_&&d%100==0?{lines_limit_exceeded:!0,line_tools_count:d}:{}},B.prototype.state=function(e,t,i,n){function o(e){return i&&!e.isSavedInStudyTemplates()||!e.state||!e.state()||!e.isSavedInChart(t)||n&&e.isActualSymbol&&!e.isActualSymbol()}var r,s,a={};if(e)for(a.sources=[],r=0;r<this.m_dataSources.length;r++)o(this.m_dataSources[r])||a.sources.push(this.m_dataSources[r].state(t));for(a.leftAxisState=this.m_leftPriceScale.state(),a.leftAxisState.m_isLockScale&&null!==this._lastLeftPriceScaleRatio&&(a.leftPriceScaleRatio=this._lastLeftPriceScaleRatio),a.leftAxisSources=[],r=0;r<this.m_leftPriceScale.dataSources().length;r++)o(this.m_leftPriceScale.dataSources()[r])||a.leftAxisSources.push(this.m_leftPriceScale.dataSources()[r].id());for(a.rightAxisState=this.m_rightPriceScale.state(),a.rightAxisState.m_isLockScale&&null!==this._lastRightPriceScaleRatio&&(a.rightPriceScaleRatio=this._lastRightPriceScaleRatio),a.rightAxisSources=[],r=0;r<this.m_rightPriceScale.dataSources().length;r++)o(this.m_rightPriceScale.dataSources()[r])||a.rightAxisSources.push(this.m_rightPriceScale.dataSources()[r].id());for(a.overlayPriceScales={},r=0;r<this.m_dataSources.length;r++)s=this.m_dataSources[r],this.isOverlay(s)&&s.isSavedInChart(t)&&(a.overlayPriceScales[s.id()]=s.priceScale().state());return a.stretchFactor=this._stretchFactor,this.m_mainDataSource&&(a.mainSourceId=this.m_mainDataSource.id()),a},B.prototype.sourceById=function(e){for(var t=0;t<this.m_dataSources.length;t++)if(this.m_dataSources[t].id()===e)return this.m_dataSources[t];return null},B.prototype.isESDStudy=function(e){return"Script$TV_EARNINGS@tv-scripting"===e.id||"Script$TV_DIVIDENDS@tv-scripting"===e.id||"Script$TV_SPLITS@tv-scripting"===e.id||"ESD$TV_EARNINGS@tv-scripting"===e.id||"ESD$TV_DIVIDENDS@tv-scripting"===e.id||"ESD$TV_SPLITS@tv-scripting"===e.id},B.prototype.isStudyToSkip=function(e){return!!this.isESDStudy(e)},B.prototype.restoreState=function(e,t,i,n){var o,r,s,a,l,c,u,d,p,_,f,y,g,v,S;if(n=n||{},!e.leftAxisState||!e.rightAxisState)throw Error("invalid state");if(!e.leftAxisSources||!e.rightAxisSources)throw Error("invalid state");if(e.stretchFactor&&(this._stretchFactor=e.stretchFactor),o={},e.sources)for(r=-1!==this.m_dataSources.indexOf(this._model.mainSeries()),this.clearSeries(),this.m_mainDataSource=null,r&&this.m_dataSources.push(this._model.mainSeries()),s=this.getZOrderMinMax(),a=s.minZOrder,l=s.maxZOrder,function(){var t,i,n,o,r,s=e.sources.find(function(t){return t.id===e.mainSourceId});if(void 0===s)return void E.logWarn("There is no main source with id "+e.mainSourceId+", total sources="+e.sources.length)
;if(!TradingView.isInherited(TradingView[s.type],m))return void E.logNormal("The type of main source is not line tool - fix is unnecessary");for(t=null,i=0;i<e.sources.length;i++)if(n=e.sources[i],!TradingView.isInherited(TradingView[n.type],m)){if(null!==t)return void E.logWarn("Pane contains more than 1 possibly main sources - auto fix cannot be applied");t=n}if(null===t)return void E.logWarn("Pane contains only line tools - possible we need to remove this pane?");o=e.mainSourceId,r=0,e.mainSourceId=t.id,e.sources.forEach(function(e){e.ownerSource===o&&(e.ownerSource=t.id,r+=1)}),E.logNormal("Auto fix broken pane is applied, changed line tools="+r+", changed from="+o+" to="+t.id)}(),c=0;c<e.sources.length;c++)u=e.sources[c],d=u.type,Math.abs(u.zorder)>1e200?(p=a-1,E.logWarn("Datasource zorder has bad value: "+u.zorder+" Resetting it to "+p),u.zorder=p):this.isZOrderAvailable(u.zorder)||r&&"MainSeries"===d&&this._model.mainSeries().zorder()===u.zorder||(u.zorder=l+1),_=u.id,o[_]=u.ownerSource,d&&("MainSeries"===d?this._restoreMainSeries(u,t,r,n):d.toLowerCase().startsWith("study")?this._restoreStudy(u,t,n):TradingView.isInherited(TradingView[d],m)?this._restoreLineTool(u,t):TradingView[d]&&TradingView[d].createFromState&&this._restoreSpecialSource(u,t)),a=Math.min(a,u.zorder),l=Math.max(l,u.zorder);for(this.m_leftPriceScale.dataSources().splice(0,1/0),this.m_leftPriceScale._hasSeries=!1,f=defaults("chartproperties").paneProperties.leftAxisProperties,TradingView.merge(f,e.leftAxisState),this.m_leftPriceScale.restoreState(f),void 0!==e.leftPriceScaleRatio&&(this._lastLeftPriceScaleRatio=e.leftPriceScaleRatio),c=0;c<e.leftAxisSources.length;c++)(y=this.dataSourceForId(e.leftAxisSources[c]))&&(void 0!==f.m_showSymbolLabels&&y instanceof x&&this.model().properties().scalesProperties.showSymbolLabels.setValue(f.m_showSymbolLabels),y.setPriceScale(this.m_leftPriceScale),this.m_leftPriceScale.addDataSource(y));for(this.m_rightPriceScale.dataSources().splice(0,1/0),this.m_rightPriceScale._hasSeries=!1,f=defaults("chartproperties").paneProperties.rightAxisProperties,TradingView.merge(f,e.rightAxisState),this.m_rightPriceScale.restoreState(f),void 0!==e.rightPriceScaleRatio&&(this._lastRightPriceScaleRatio=e.rightPriceScaleRatio),c=0;c<e.rightAxisSources.length;c++)(y=this.dataSourceForId(e.rightAxisSources[c]))&&(void 0!==f.m_showSymbolLabels&&y instanceof x&&this.model().properties().scalesProperties.showSymbolLabels.setValue(f.m_showSymbolLabels),y.setPriceScale(this.m_rightPriceScale),this.m_rightPriceScale.addDataSource(y));for(c=0;c<this.m_dataSources.length;c++)y=this.m_dataSources[c],-1===this.m_rightPriceScale.dataSources().indexOf(y)&&-1===this.m_leftPriceScale.dataSources().indexOf(y)?(y._isOverlay=!0,g=new h(this._model.properties().scalesProperties),g.setHeight(this.m_height),g.setTopMargin(this.m_rightPriceScale.topMargin()),g.setBottomMargin(this.m_rightPriceScale.bottomMargin()),g.addDataSource(y),e.overlayPriceScales&&e.overlayPriceScales[y.id()]&&(f=e.overlayPriceScales[y.id()],f.m_isAutoScale=!0,
f.m_isLog=!1,f.m_isPercentage=!1,f.m_isLockScale=!1,g.restoreState(f)),y.setPriceScale(g)):y._isOverlay=!1;for(_ in o)(v=o[_])&&(y=this.sourceById(_))&&this.sourceById(_).setOwnerSource(this.sourceById(v));if(e.mainSourceId&&!this.m_mainDataSource&&(this.m_mainDataSource=this.dataSourceForId(e.mainSourceId)),!this.m_mainDataSource)for(c=0;c<this.m_dataSources.length;c++)if(y=this.m_dataSources[c],TradingView.isInherited(y.constructor,R)){this.m_mainDataSource=y;break}for(c=0;c<this.m_dataSources.length;c++)y=this.m_dataSources[c],TradingView.isInherited(y.constructor,m)?(y.ownerSource()||y.setOwnerSource(this.mainDataSource()),y.isFixed()&&y.restoreFixedPoints(),y.fixAfterRestorePriceAxis&&y.fixAfterRestorePriceAxis()):TradingView.isInherited(y.constructor,b)&&(S=y.properties(),S.linkedToSeries&&S.linkedToSeries.value()&&(y.ownerSource()||y.setOwnerSource(this.model().mainSeries())));this._updateMargins(),this._model.onMainSeriesPriceScaleNameChanged(),this._cachedOrderedSoruces=null,this._cachedHitTestSources=null},B.prototype._restoreMainSeries=function(e,t,i,n){var o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v=e.id,S=e.state,b=e.zorder;if(S&&["candleStyle","hollowCandleStyle","haStyle"].forEach(function(e){S[e]&&(S[e].wickUpColor=S[e].wickUpColor||S[e].wickColor,S[e].wickDownColor=S[e].wickDownColor||S[e].wickColor)}),i||(o=this._model.paneForSource(this._model.mainSeries()),o.removeDataSource(this._model.mainSeries()),this.m_dataSources.push(this._model.mainSeries())),this.m_mainDataSource=this._model.mainSeries(),r=S&&S.style?S.style:void 0,r===x.STYLE_PNF&&"ATR"===this._model.mainSeries().properties().pnfStyle.inputs.style.value()?this._model.mainSeries().properties().pnfStyle.inputs.style._value="Traditional":r===x.STYLE_RENKO&&"ATR"===this._model.mainSeries().properties().renkoStyle.inputs.style.value()&&(this._model.mainSeries().properties().renkoStyle.inputs.style._value="Traditional"),S&&!S.hasOwnProperty("showSessions")&&(S.showSessions=!1),S&&!S.extendedHours&&(S.extendedHours=!1),S&&t&&(S.showCountdown=!1),S&&(t&&!("showSeriesLastValueProperty"in n)&&"showLastValue"in S&&this._model.properties().scalesProperties.showSeriesLastValue.setValue(S.showLastValue),delete S.showLastValue),S)for(s={haStyle:L.chartStyleStudyId(x.STYLE_HEIKEN_ASHI,!0),renkoStyle:L.chartStyleStudyId(x.STYLE_RENKO,!0),pbStyle:L.chartStyleStudyId(x.STYLE_PB,!0),kagiStyle:L.chartStyleStudyId(x.STYLE_KAGI,!0),pnfStyle:L.chartStyleStudyId(x.STYLE_PNF,!0),rangeStyle:L.chartStyleStudyId(x.STYLE_RANGE,!0)},a=this._model.studyVersioning(),l=this._model.mainSeries().styleStudyInfos(),c=Object.keys(C.SYMBOL_STRING_DATA),h=0;h<c.length;h++)r=c[h],u=C.STYLE_SHORT_NAMES[r]+"Style",d=u in e?e[u].studyId:s[u],null!=(r=S[u])&&(p=r.inputs,_=A.parseIdString(d),f=l[u].studyId,m=A.parseIdString(f),y=a.updateStudyInputs(_.id,_.version,m.version,p,null),r.inputs=y);this._model.mainSeries().clearSessionStudy(),this._model.mainSeries().properties().merge(S),this._model.mainSeries()._prevChartStyle=this._model.mainSeries().properties().style.value(),
this._model.mainSeries().createPaneView(),this._model.mainSeries().setId(v),t&&this._model.mainSeries().restoreData(e.bars,e.nsBars,e.symbolInfo,e.rtPrice,e.boxSize,e.reversalAmount),void 0!==b&&this._model.mainSeries().setZorder(b),this._model.mainSeries().properties().extendedHours.listeners().fire(this._model.mainSeries().properties().extendedHours),(g=this._model.mainSeries().symbolInfo())&&this._model.mainSeries().dataEvents().fireSymbolResolved(this._model.mainSeries().symbolInfo())},B.prototype._restoreStudy=function(e,t,i){var o,r,s,a,l,c,h,d,p,_;return t&&void 0===e.data&&void 0===e.nonSeriesData&&void 0===e.indexes?void E.logError("Cannot restore (skipping) study without data "+e.id+", "+e.metaInfo.id):(o=e.id,r=e.state,s=e.zorder,a=e.ownerSource,l=TradingView.clone(e.metaInfo),$.extend(l,A.parseIdString(l.id)),this.isStudyToSkip(l)&&!t?void E.logNormal("Skipping study "+l.id):(c=r,h=this._model.studyVersioning(),d=h.patchPropsStateAndMetaInfo(c,l,{oldShowStudyLastValueProperty:t&&!i.showStudyLastValueProperty}),c=d.propsState,l=d.metaInfo,p=new u(this._model,e,l.shortDescription),p.setId(o),_=this,h.updateMetaInfoAsync(l,t).done(function(i){function r(n){var r,a=P(l,i,c,null,h,n),d=T(_._model,a,n||_._model.mainSeries(),s);d.setId(o),t&&(r=h.patchStudyData(l,e.data,e.nonSeriesData,e.indexes),d.restoreData(r.data,r.nsData,r.indexes)),_._model.replaceStudyStub(p,d)||(p=d),u.add(o,d)}var s,u,d;p.setStatus(""),s=i||new A(l),u=new n(_._model),d=a&&e.state.isChildStudy,d?u.get(a).done(r):r()}).fail(function(e){p.setStatus("error: "+e),p.setFailed(!0)}),p&&this.m_dataSources.push(p),delete this._cachedOrderedSoruces,delete this._cachedHitTestSources,p&&void 0!==s&&p.setZorder(s),p))},B.prototype._restoreLineTool=function(e,t,i){var n,r,s,a,l,c,h,d,m,S,b,P,T,x,C,L,E,R,B;if(i=void 0===i||i,O.migrateState(e),v.migrateState(e),n=e.type,r=e.id,s=e.state,a=i?e.zorder:this._newZOrderForLineTool(),o(_(n),"invalid data source type:"+n+" (expected to be a Line Tool)"),l=null,c=TradingView.factoryDefaults("linetool"),f(n)){if(l=this._model.studyVersioning(),e=l.patchPointsBasedStudyState(e),TradingView.merge(c,s),m=e.metaInfo,$.extend(m,A.parseIdString(m.fullId)),!t&&(S=m.productId,!pro.hasPackage(S)))return b=new u(this._model,e,m.shortDescription),b.setId(r),this.m_dataSources.push(b),void 0!==a&&b.setZorder(a),b.setStatus($.t("not authorized")),void b.setFailed(!0);P=l.updateMetaInfo(m),T=P||m,c=w(T,m,c,null,l),t?TradingView.merge(c,{fixedSize:!1}):TradingView.merge(c,{fixedSize:!0}),d=new I("study_"+T.id,c,!0),h=p(n,this._model,d,T,this.mainDataSource())}else x=n.toLowerCase(),TradingView.merge(c,TradingView.factoryDefaults(x)),d=TradingView[n].prototype.createPropertiesObject(x,c),d.merge(s),t?d.merge({fixedSize:!1}):d.merge({fixedSize:!0}),h=new TradingView[n](this._model,d,!0);return h.setId(r),h.linkKey=e.linkKey,C=e.alertId,C&&"function"==typeof h.setAlert&&k.enabled("alerts")&&!this._model.readOnly()&&!this._model.isJustClonedChart()&&h.setAlert(C,{noChartSave:!0}),L=e.indexes?e.indexes:[],
@@ -119,8 +119,8 @@ n.prototype.paint=function(e){this._isVisible&&e&&(e===d.UPDATE_CURSOR_ONLY?(thi
f=n(a,l,u,d,p,_)):(c=r,h=s,y=n(c,h,u,d,p,_))}return g?m.equalPoints(m.point(a,l),m.point(c,h))?m.point(a,l):m.lineSegment(m.point(a,l),m.point(c,h)):null}function o(e,t){var i,n,o=e.A,r=t.A,s=e.B,a=t.B,l=e.C,c=t.C,h=o*a-r*s;return Math.abs(h)<1e-6?null:(i=(s*c-a*l)/h,n=(r*l-o*c)/h,new m.Point(i,n))}function r(e,t,i,n){var o,r=t.subtract(e),s=n.subtract(i),a=r.x*s.y-r.y*s.x;return Math.abs(a)<1e-6?null:(o=e.subtract(i),(o.y*s.x-o.x*s.y)/a)}function s(e,t,i,n){var o,s,a,l=r(e,t,i,n);return null===l?null:(o=t.subtract(e),s=o.scaled(l).add(e),a=y.distanceToSegment(i,n,s),Math.abs(a.distance)<1e-6?l:null)}function a(e,t){return-(e.C+e.B*t)/e.A}function l(e,t){return-(e.C+e.A*t)/e.B}function c(e,t){var i,n,o;for(i=0,n=e;i<n.length;i++)if(o=n[i],m.equalPoints(o,t))return!1;return e.push(t),!0}function h(e,t,i){var n,o,r,s,h,u=t.x,d=t.y,p=i.x,_=i.y;if(0===e.A)return n=-e.C/e.B,d<=n&&n<=_?m.lineSegment(m.point(u,n),m.point(p,n)):null;if(0===e.B)return o=-e.C/e.A,u<=o&&o<=p?m.lineSegment(m.point(o,d),m.point(o,_)):null;switch(r=[],s=function(t){var i=l(e,t);d<=i&&i<=_&&c(r,new m.Point(t,i))},h=function(t){var i=a(e,t);u<=i&&i<=p&&c(r,new m.Point(i,t))},s(u),h(d),s(p),h(_),r.length){case 0:return null;case 1:return r[0];case 2:return m.equalPoints(r[0],r[1])?r[0]:m.lineSegment(r[0],r[1])}return f.assert(!1,"We should have at most two intersection points"),null}function u(e,t,i,n){var o,r=s(e,t,i,new m.Point(n.x,i.y)),a=s(e,t,new m.Point(n.x,i.y),n),l=s(e,t,n,new m.Point(i.x,n.y)),c=s(e,t,new m.Point(i.x,n.y),i),h=[];return null!==r&&r>=0&&h.push(r),null!==a&&a>=0&&h.push(a),null!==l&&l>=0&&h.push(l),null!==c&&c>=0&&h.push(c),0===h.length?null:(h.sort(function(e,t){return e-t}),o=g.pointInRectangle(e,i,n)?h[0]:h[h.length-1],e.addScaled(t.subtract(e),o))}function d(e,t){return!(e.length>0&&m.equalPoints(e[e.length-1],t))&&(e.push(t),!0)}function p(e,t){var i,n,r,s,a,l=[];for(i=0;i<e.length;++i)n=e[i],r=e[(i+1)%e.length],s=m.lineThroughPoints(n,r),g.pointInHalfplane(n,t)?(d(l,n),g.pointInHalfplane(r,t)||null!==(a=o(s,t.edge))&&d(l,a)):g.pointInHalfplane(r,t)&&null!==(a=o(s,t.edge))&&d(l,a);return l.length>=3?l:null}function _(e,t){var i,n,o,r,s,a=e;for(i=0;i<t.length&&null!==a;++i)n=t[i],o=t[(i+1)%t.length],r=t[(i+2)%t.length],s=m.lineThroughPoints(n,o),a=p(a,m.halfplaneThroughPoint(s,r));return a}var f,m,y,g;Object.defineProperty(t,"__esModule",{value:!0}),f=i(7),m=i(6),y=i(30),g=i(60),t.intersectLineSegmentAndRectangle=n,t.intersectLines=o,t.intersectLineSegments=s,t.intersectLineAndRectangle=h,t.intersectRayAndRectangle=u,t.intersectPolygonAndHalfplane=p,t.intersectPolygons=_},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"TimeFormatter",function(){return o}),n=i(21),o=function(){function e(e){this._formatStr=e||"%h:%m:%s"}return e.prototype.format=function(e){
return n.customFormatters.timeFormatter?n.customFormatters.timeFormatter.format(e):this._formatStr.replace("%h",Object(n.numberToStringWithLeadingZero)(e.getUTCHours(),2)).replace("%m",Object(n.numberToStringWithLeadingZero)(e.getUTCMinutes(),2)).replace("%s",Object(n.numberToStringWithLeadingZero)(e.getUTCSeconds(),2))},e.prototype.formatLocal=function(e){return n.customFormatters.timeFormatter?n.customFormatters.timeFormatter.formatLocal?n.customFormatters.timeFormatter.formatLocal(e):n.customFormatters.timeFormatter.format(e):this._formatStr.replace("%h",Object(n.numberToStringWithLeadingZero)(e.getHours(),2)).replace("%m",Object(n.numberToStringWithLeadingZero)(e.getMinutes(),2)).replace("%s",Object(n.numberToStringWithLeadingZero)(e.getSeconds(),2))},e}()},function(e,t,i){"use strict";var n=i(18),o=i(79).makeFont,r=i(79).parseFont,s={_fontHeightCache:{},_parsedColorCache:{}};s._parseColor=function(e){var t,i,n;return this._parsedColorCache[e]?this._parsedColorCache[e]:(t=document.createElement("div"),t.style.color=e,i=t.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||t.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\,\s*(\d*\.?\d+)\s*\)$/i),n={r:i[1],g:i[2],b:i[3],a:i[4]||"1"},this._parsedColorCache[e]=n,n)},s.getColorFromProperties=function(e,t){var i=1-t.value()/100,n=this._parseColor(e.value());return"rgba("+n.r+","+n.g+","+n.b+","+i+")"},s.setColorToProperties=function(e,t,i){var n,o=this._parseColor(e);t.setValue("rgb("+o.r+","+o.g+","+o.b+")"),n=100*(1-o.a),i.setValue(Math.max(0,Math.min(n,100)))},s.getFontFromProperties=function(e,t,i,n){return o(t.value(),e.value(),n.value()?"italic":"",i.value()?"bold":"")},s.setFontToProperties=function(e,t,i,n,o){var s=r(e);null!==s&&(s.family.length>0&&t.setValue(s.family),s.size.length>0&&i.setValue(s.size),n.setValue(s.bold),o.setValue(s.italic))},s.fontHeight=function(e){var t,i;return this._fontHeightCache[e]||(t=document.createElement("span"),t.appendChild(document.createTextNode("height")),document.body.appendChild(t),t.style.cssText="font: "+e+"; white-space: nowrap; display: inline;",i=t.offsetHeight,document.body.removeChild(t),this._fontHeightCache[e]=Math.ceil(i)),this._fontHeightCache[e]},s.drawPolyHoverOrPress=function(e,t,i,n){n?(e.save(),e.fillStyle="rgba(0, 0, 0, 0.15)",CanvasEx.drawPoly(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",CanvasEx.drawPoly(e,t,!0),e.restore())},s.repaint=function(e){var t=new n(n.LIGHT_UPDATE);t.force=!0,e.invalidate(t)},s.roundToMinTick=function(e,t){var i=e.mainSource().base(),n=1/i;return n*Math.round(t/n)},e.exports=s},function(e,t,i){"use strict";function n(){clearTimeout(W),clearTimeout(H),clearTimeout(j)}function o(e,t){j=setTimeout(e,t)}function r(e,t){H=setTimeout(e,t)}function s(e,t){W=setTimeout(e,t)}function a(){var e=document.getElementById(z);if(e)return void(U=e);U=document.createElement("div"),U.id=z,document.body.appendChild(U)}function l(){U.innerHTML=""}function c(e){return q.then(function(){l(),U.appendChild(e)})}function h(e,t){
var i,n=G.includes(t)?Y[t]:"";(i=e.classList).remove.apply(i,G.map(function(e){return Y[e]}).filter(function(e){return!!e})),n&&!e.classList.contains(n)&&e.classList.add(n)}function u(e,t){var i=K.get(e);return i&&i[t]}function d(e,t,i){var n=K.get(e)||{};n[t]=i,K.set(e,n)}function p(e){var t=e.getAttribute("title");return t&&(d(e,"text",t),e.removeAttribute("title")),u(e,"text")||""}function _(e){var t=p(e),i=e.getBoundingClientRect(),n={h:i.height,w:i.width,x:i.left,y:i.top},o=e.getAttribute("data-color-theme")||"",r=e.classList.contains("common-tooltip-html"),s=parseInt(e.getAttribute("data-tooltip-delay")||""),a={type:"none"};return t&&(a={type:r?"html":"text",data:t}),{above:e.classList.contains("common-tooltip-above"),below:e.classList.contains("common-tooltip-below"),otl:e.classList.contains("common-tooltip-otl"),otr:e.classList.contains("common-tooltip-otr"),vertical:e.classList.contains("common-tooltip-vertical"),hotkey:e.getAttribute("data-tooltip-hotkey"),narrow:e.classList.contains("common-tooltip-narrow"),colorTheme:o,tooltipDelay:s,rect:n,content:a}}function f(e){var t,i,n,o,r,s,a=b(),l=x(a),c=e.content;switch(c.type){case"element":l.innerHTML="",l.appendChild(c.data);break;case"html":l.innerHTML=c.data;break;case"text":e.hotkey?(i=P(),i.innerText=c.data,l.appendChild(i)):l.innerText=c.data}return e.hotkey&&(n="none"!==c.type,o=w(),r=Object(Z.a)(e.hotkey),s=S(r.keys),o.innerHTML=(t=r.text).format.apply(t,s).replace(/\s\+\s/g,'<span class="'+Q["common-tooltip__plus-sign"]+'">+</span>'),l.classList.add(Q["common-tooltip__body--with-hotkey"]),n&&o.classList.add(Q["common-tooltip__hotkey-block--divider"]),l.appendChild(o)),a}function m(e,t){var i,n,o,r,s,a,l,c,u,d,p,_,f,m,y,g,S=t.rect;S&&(h(e,t.colorTheme||"default"),t.addClass&&e.classList.add(t.addClass),i=x(e),i.classList.toggle(Q["common-tooltip__body--width_wide"],!!t.wide),i.classList.toggle(Q["common-tooltip__body--width_narrow"],!!t.narrow),i.classList.toggle(Q["common-tooltip__body--no-buttons"],!0),e.classList.toggle(Q["common-tooltip--no-pointer-events"],!Modernizr.pointerevents),i.style.left=v(0),i.style.width=v(i.clientWidth+2),n=document.body.clientWidth,o=document.body.clientHeight,r=t.vertical,s=r&&S.w<20||!r&&S.h<20,e.classList.toggle(Q["common-tooltip--farther"],s),e.classList.toggle(Q["common-tooltip--vertical"],r),e.classList.toggle(Q["common-tooltip--horizontal"],!r),a=T(e),l="",r?(e.style.left=v(S.x+S.w),e.style.top=v(S.y-(e.offsetHeight-S.h)/2),c=(e.querySelector(":last-child")||i).getBoundingClientRect().right,u=c+ee>n,e.classList.toggle(Q["common-tooltip--direction_reversed"],u),e.classList.toggle(Q["common-tooltip--direction_normal"],!u),l=u?"after":"before",X.IS_RTL?(l=t.otr?"after":l,l=t.otl?"before":l):(l=t.otr?"before":l,l=t.otl?"after":l),a.classList.toggle(Q["common-tooltip__ear-holder--before"],"before"===l),a.classList.toggle(Q["common-tooltip__ear-holder--after"],"after"===l),"after"===l&&(e.style.left="auto",e.style.right=v(n-S.x))):(d=S.x-(i.offsetWidth-S.w)/2,p=n-ee-e.offsetWidth,_=Math.max(ee,Math.min(d,p)),
e.style.bottom=v(o-S.y),e.style.left=v(_),u=p<d,e.classList.toggle(Q["common-tooltip--direction_reversed"],u),e.classList.toggle(Q["common-tooltip--direction_normal"],!u),f=i.getBoundingClientRect().top,l=f<ee?"below":"above",l=t.above?"above":l,l=t.below?"below":l,a.classList.toggle(Q["common-tooltip__ear-holder--above"],"above"===l),a.classList.toggle(Q["common-tooltip__ear-holder--below"],"below"===l),"below"===l&&(e.style.bottom="auto",e.style.top=v(S.y+S.h)),m=C(e),y=i.getBoundingClientRect().left,g=Math.round(S.x+S.w/2-(y+i.clientWidth/2)),e.style.left=v(_+g),e.style.width=v(i.clientWidth+m.clientWidth),g=u?Math.max(0,g):Math.min(0,g),m.style.left=v(-g),i.style.left=v(-g)))}function y(e){e.classList.toggle(Q["common-tooltip--hidden"],!1)}function g(e){e.classList.toggle(Q["common-tooltip--hidden"],!0)}function v(e){return Math.floor(e)+"px"}function S(e){return e.map(function(e){return'<span class="'+Q["common-tooltip__hotkey-button"]+'">'+e+"</span>"})}function b(){return re.cloneNode(!0)}function w(){return se.cloneNode(!0)}function P(){return ae.cloneNode(!0)}function T(e){return e.querySelector("."+Q["common-tooltip__ear-holder"])}function x(e){return e.querySelector("."+Q["common-tooltip__body"])}function C(e){return e.querySelector("."+Q["common-tooltip__button-container"])}function L(e,t){var i,n,o,r,s;return void 0===t&&(t={}),i=B(t),n=i.content,o=N.e(i,["content"]),r=_(e),s=Object.assign(r,o),"none"!==n.type&&(s.content=n),!("none"===s.content.type&&!s.hotkey)&&(I(s),!0)}function I(e){var t=B(e),i=f(t);he={options:t,element:i},c(i).then(function(){n(),ce?V(i):(g(i),s(function(){return V(i)},E(t)))})}function A(e){return p(e)}function k(e){var t,i,n,o=e.target,r=e.currentTarget,s=O(o,r,"apply-common-tooltip"),a=function(t){var i,n,o;if("buttons"in e){if(1&e.buttons)return"continue"}else if(1===e.which)return"continue";if((i=function(){return L(t)})())return n=function(){t.removeEventListener("common-tooltip-update",i),t.removeEventListener("mouseleave",n),t.removeEventListener("mousedown",n),document.removeEventListener("scroll",n),M()},o=function(e){27===e.keyCode&&(document.removeEventListener("keydown",o),n())},t.addEventListener("common-tooltip-update",i),t.addEventListener("mouseleave",n),t.addEventListener("mousedown",n),document.addEventListener("scroll",n),document.addEventListener("keydown",o),"break"};for(t=0,i=s;t<i.length&&(n=i[t],"break"!==a(n));t++);}function E(e){return"number"!=typeof e.tooltipDelay||isNaN(e.tooltipDelay)?le:e.tooltipDelay}function M(){var e,t,i;n(),ce&&he&&(e=he.element,t=he.options,i=function(){e.removeEventListener("mouseleave",i),g(e),o(function(){l(),ce=!1,he=null},le/2)},t.tooltipHideDelay?r(function(){e.querySelector(":hover")?e.addEventListener("mouseleave",i):i()},t.tooltipHideDelay):i())}function V(e){var t,i=Object($.ensureNotNull)(he).options;m(e,i),y(e),ce=!0,i.forceHideOnMove&&(t=function(){document.removeEventListener("mousemove",t),M()},document.addEventListener("mousemove",t))}function D(e){return e&&(e.nodeType===Node.ELEMENT_NODE?e:null)}
function O(e,t,i){for(var n=[];e&&e!==t;)e.classList&&e.classList.contains(i)&&n.push(e),e=e.parentElement||D(e.parentNode);return n}function R(e){return"content"in e}function B(e){var t,i,n,o,r;return R(e)?e:(t=e.inner,i=e.html,n=e.text,o=N.e(e,["inner","html","text"]),r={type:"none"},t&&(r={type:"element",data:t}),n&&(r={type:i?"html":"text",data:n}),N.a({content:r},o))}var N,F,W,H,j,z,U,q,$,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se,ae,le,ce,he;Object.defineProperty(t,"__esModule",{value:!0}),N=i(1),F=i(127),W=0,H=0,j=0,z="tooltip-root-element",q=new Promise(function(e){"interactive"===document.readyState?(a(),e()):document.addEventListener("DOMContentLoaded",function(){a(),e()})}),$=i(7),Y={default:"",white:"theme-white","round-shadow":"theme-round-shadow"},G=Object.keys(Y),K=new WeakMap,Z=i(306),J=i(202),X=i(38),i(86),Q=i(473),ee=10,te="common-tooltip-wrapper",ie='\n\t<div id="'+te+'" class="'+Q["common-tooltip"]+'">\n\t\t<div class="'+Q["common-tooltip__ear-holder"]+'" >\n\t\t\t<div class="'+Q["common-tooltip__body"]+' js-tooltip-body"></div>\n\t\t</div>\n\t\t<div class="'+Q["common-tooltip__button-container"]+'"></div>\n\t</div>\n',ne='\n\t<div class="'+Q["common-tooltip__hotkey-block"]+'"></div>\n',oe='\n\t<div class="'+Q["common-tooltip__hotkey-text"]+'"></div>\n',re=Object(J.b)(ie),se=Object(J.b)(ne),ae=Object(J.b)(oe),t.showOnElement=L,t.show=I,t.updateTooltipText=A,t.hide=M,le=500,ce=!1,he=null,Modernizr.touch||document.addEventListener("mouseover",k,!0)},function(e,t,i){"use strict";function n(e,t,i,n,o){function r(e){return t&&t[e]?t[e]:e}function s(e,t,i,n){var o=r(t[0]);return!!e.hasOwnProperty(o)&&(t.length>1?s(e[o],t.slice(1),i):(e[o]&&e[o].setValue?e[o].setValue(i):e[o]=i,!0))}function a(e){i||y.logWarn("Path `"+e+"` does not exist.")}var l,c,h,u;if(n)for(l in n)c=l.split("."),h=r(c[0]),u=void 0!==o&&o===c[0],0!==c.length&&u&&(c=c.slice(1),h=r(c[0])),0!==c.length&&e.hasOwnProperty(h)?s(e,c,n[l])||a(l):u&&a(l)}function o(e,t,i,o){window.__defaultsOverrides&&n(e,t,i,window.__defaultsOverrides,o)}function r(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach(function(t){e.test(t)&&o(TradingView.defaultProperties[t],null,!1,t)})}function s(e,t){return t?c(e,t):a(e)}function a(e){var t,i=g(e);return window._UNIT_TESTS||(t=TradingView.clone(TVSettings.getJSON(e,null)))&&TradingView.merge(i,t),i}function l(e){var t,i;return!!e&&(e=""+e,t=RegExp("\\d+"),i=t.exec(e),null!==i&&i[0]===e)}function c(e,t){var i,n,o,r,s=g(e);return window._UNIT_TESTS||(i=TradingView.clone(TVSettings.getJSON(e,null)),e.startsWith("study_")&&i&&l(i.version)&&(n=i.inputs,o=t.updateStudyInputs(i.id,i.version,"last",n,null),i.inputs=o,r=t.updateStudyState(i,i),i=r),TradingView.merge(s,i)),s}var h=i(40),u=i(247).LineToolPitchforkStyle,d=i(203).LineToolBarsPatternMode,p=i(87).PlotType,_=i(161),f=i(104).LineEnd,m=i(323).StatsPosition,y=i(4).getLogger("Chart.Defaults"),g=function(e){var t,i,n,s,a,l,c,y,g={a:function(e,t){return{color:e,visible:t}},b:function(e,t,i){return{coeff:e,color:t,visible:i}},c:function(e,t,i,n,o){
e.style.bottom=v(o-S.y),e.style.left=v(_),u=p<d,e.classList.toggle(Q["common-tooltip--direction_reversed"],u),e.classList.toggle(Q["common-tooltip--direction_normal"],!u),f=i.getBoundingClientRect().top,l=f<ee?"below":"above",l=t.above?"above":l,l=t.below?"below":l,a.classList.toggle(Q["common-tooltip__ear-holder--above"],"above"===l),a.classList.toggle(Q["common-tooltip__ear-holder--below"],"below"===l),"below"===l&&(e.style.bottom="auto",e.style.top=v(S.y+S.h)),m=C(e),y=i.getBoundingClientRect().left,g=Math.round(S.x+S.w/2-(y+i.clientWidth/2)),e.style.left=v(_+g),e.style.width=v(i.clientWidth+m.clientWidth),g=u?Math.max(0,g):Math.min(0,g),m.style.left=v(-g),i.style.left=v(-g)))}function y(e){e.classList.toggle(Q["common-tooltip--hidden"],!1)}function g(e){e.classList.toggle(Q["common-tooltip--hidden"],!0)}function v(e){return Math.floor(e)+"px"}function S(e){return e.map(function(e){return'<span class="'+Q["common-tooltip__hotkey-button"]+'">'+e+"</span>"})}function b(){return re.cloneNode(!0)}function w(){return se.cloneNode(!0)}function P(){return ae.cloneNode(!0)}function T(e){return e.querySelector("."+Q["common-tooltip__ear-holder"])}function x(e){return e.querySelector("."+Q["common-tooltip__body"])}function C(e){return e.querySelector("."+Q["common-tooltip__button-container"])}function L(e,t){var i,n,o,r,s;return void 0===t&&(t={}),i=B(t),n=i.content,o=F.e(i,["content"]),r=_(e),s=Object.assign(r,o),"none"!==n.type&&(s.content=n),!("none"===s.content.type&&!s.hotkey)&&(I(s),!0)}function I(e){var t=B(e),i=f(t);he={options:t,element:i},c(i).then(function(){n(),ce?V(i):(g(i),s(function(){return V(i)},E(t)))})}function A(e){return p(e)}function k(e){var t,i,n,o=e.target,r=e.currentTarget,s=O(o,r,"apply-common-tooltip"),a=function(t){var i,n,o;if("buttons"in e){if(1&e.buttons)return"continue"}else if(1===e.which)return"continue";if((i=function(){return L(t)})())return n=function(){t.removeEventListener("common-tooltip-update",i),t.removeEventListener("mouseleave",n),t.removeEventListener("mousedown",n),document.removeEventListener("scroll",n),M()},o=function(e){27===e.keyCode&&(document.removeEventListener("keydown",o),n())},t.addEventListener("common-tooltip-update",i),t.addEventListener("mouseleave",n),t.addEventListener("mousedown",n),document.addEventListener("scroll",n),document.addEventListener("keydown",o),"break"};for(t=0,i=s;t<i.length&&(n=i[t],"break"!==a(n));t++);}function E(e){return"number"!=typeof e.tooltipDelay||isNaN(e.tooltipDelay)?le:e.tooltipDelay}function M(){var e,t,i;n(),ce&&he&&(e=he.element,t=he.options,i=function(){e.removeEventListener("mouseleave",i),g(e),o(function(){l(),ce=!1,he=null},le/2)},t.tooltipHideDelay?r(function(){e.querySelector(":hover")?e.addEventListener("mouseleave",i):i()},t.tooltipHideDelay):i())}function V(e){var t,i=Object($.ensureNotNull)(he).options;m(e,i),y(e),ce=!0,i.forceHideOnMove&&(t=function(){document.removeEventListener("mousemove",t),M()},document.addEventListener("mousemove",t))}function D(e){return e&&(e.nodeType===Node.ELEMENT_NODE?e:null)}
function O(e,t,i){for(var n=[];e&&e!==t;)e.classList&&e.classList.contains(i)&&n.push(e),e=e.parentElement||D(e.parentNode);return n}function R(e){return"content"in e}function B(e){var t,i,n,o,r;return R(e)?e:(t=e.inner,i=e.html,n=e.text,o=F.e(e,["inner","html","text"]),r={type:"none"},t&&(r={type:"element",data:t}),n&&(r={type:i?"html":"text",data:n}),F.a({content:r},o))}var F,N,W,H,j,z,U,q,$,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se,ae,le,ce,he;Object.defineProperty(t,"__esModule",{value:!0}),F=i(1),N=i(127),W=0,H=0,j=0,z="tooltip-root-element",q=new Promise(function(e){"interactive"===document.readyState?(a(),e()):document.addEventListener("DOMContentLoaded",function(){a(),e()})}),$=i(7),Y={default:"",white:"theme-white","round-shadow":"theme-round-shadow"},G=Object.keys(Y),K=new WeakMap,Z=i(306),J=i(202),X=i(38),i(86),Q=i(473),ee=10,te="common-tooltip-wrapper",ie='\n\t<div id="'+te+'" class="'+Q["common-tooltip"]+'">\n\t\t<div class="'+Q["common-tooltip__ear-holder"]+'" >\n\t\t\t<div class="'+Q["common-tooltip__body"]+' js-tooltip-body"></div>\n\t\t</div>\n\t\t<div class="'+Q["common-tooltip__button-container"]+'"></div>\n\t</div>\n',ne='\n\t<div class="'+Q["common-tooltip__hotkey-block"]+'"></div>\n',oe='\n\t<div class="'+Q["common-tooltip__hotkey-text"]+'"></div>\n',re=Object(J.b)(ie),se=Object(J.b)(ne),ae=Object(J.b)(oe),t.showOnElement=L,t.show=I,t.updateTooltipText=A,t.hide=M,le=500,ce=!1,he=null,Modernizr.touch||document.addEventListener("mouseover",k,!0)},function(e,t,i){"use strict";function n(e,t,i,n,o){function r(e){return t&&t[e]?t[e]:e}function s(e,t,i,n){var o=r(t[0]);return!!e.hasOwnProperty(o)&&(t.length>1?s(e[o],t.slice(1),i):(e[o]&&e[o].setValue?e[o].setValue(i):e[o]=i,!0))}function a(e){i||y.logWarn("Path `"+e+"` does not exist.")}var l,c,h,u;if(n)for(l in n)c=l.split("."),h=r(c[0]),u=void 0!==o&&o===c[0],0!==c.length&&u&&(c=c.slice(1),h=r(c[0])),0!==c.length&&e.hasOwnProperty(h)?s(e,c,n[l])||a(l):u&&a(l)}function o(e,t,i,o){window.__defaultsOverrides&&n(e,t,i,window.__defaultsOverrides,o)}function r(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach(function(t){e.test(t)&&o(TradingView.defaultProperties[t],null,!1,t)})}function s(e,t){return t?c(e,t):a(e)}function a(e){var t,i=g(e);return window._UNIT_TESTS||(t=TradingView.clone(TVSettings.getJSON(e,null)))&&TradingView.merge(i,t),i}function l(e){var t,i;return!!e&&(e=""+e,t=RegExp("\\d+"),i=t.exec(e),null!==i&&i[0]===e)}function c(e,t){var i,n,o,r,s=g(e);return window._UNIT_TESTS||(i=TradingView.clone(TVSettings.getJSON(e,null)),e.startsWith("study_")&&i&&l(i.version)&&(n=i.inputs,o=t.updateStudyInputs(i.id,i.version,"last",n,null),i.inputs=o,r=t.updateStudyState(i,i),i=r),TradingView.merge(s,i)),s}var h=i(40),u=i(247).LineToolPitchforkStyle,d=i(203).LineToolBarsPatternMode,p=i(87).PlotType,_=i(161),f=i(104).LineEnd,m=i(323).StatsPosition,y=i(4).getLogger("Chart.Defaults"),g=function(e){var t,i,n,s,a,l,c,y,g={a:function(e,t){return{color:e,visible:t}},b:function(e,t,i){return{coeff:e,color:t,visible:i}},c:function(e,t,i,n,o){
return{coeff:e,color:t,visible:i,linestyle:void 0===n?CanvasEx.LINESTYLE_SOLID:n,linewidth:void 0===o?1:o}},d:function(e,t,i){return{color:e,width:i,visible:t}},e:function(e,t,i,n,o){return{color:e,visible:t,width:i,x:n,y:o}},f:function(e,t,i,n,o,r){return{coeff1:e,coeff2:t,color:i,visible:n,linestyle:void 0===o?CanvasEx.LINESTYLE_SOLID:o,linewidth:void 0===r?1:r}}};if(void 0===TradingView.defaultProperties){switch(window.locale){case"ar_AE":t="Asia/Dubai";break;case"au":t="Australia/Sydney";break;case"br":t="America/Sao_Paulo";break;case"ca":t="America/Toronto";break;case"de_DE":case"it":t="Europe/Berlin";break;case"es":t="Europe/Madrid";break;case"fa_IR":t="Asia/Tehran";break;case"fr":case"sv_SE":t="Europe/Paris";break;case"he_IL":case"tr":t="Europe/Athens";break;case"hu_HU":case"pl":t="Europe/Warsaw";break;case"id":case"th_TH":case"vi_VN":t="Asia/Bangkok";break;case"in":t="Asia/Kolkata";break;case"ja":case"kr":t="Asia/Tokyo";break;case"ms_MY":t="Asia/Singapore";break;case"ru":t="Europe/Moscow";break;case"uk":t="Europe/London";break;case"zh_CN":case"zh_TW":t="Asia/Shanghai";break;default:t="Etc/UTC"}TradingView.defaultProperties={chartproperties:{timezone:t,dataWindowProperties:{background:"rgba( 255, 254, 206, 0.2)",border:"rgba( 96, 96, 144, 1)",font:"Verdana",fontBold:!1,fontItalic:!1,fontSize:10,transparency:80,visible:!0},paneProperties:{background:"#ffffff",gridProperties:{color:"#e1ecf2",style:CanvasEx.LINESTYLE_SOLID},vertGridProperties:{color:"#e1ecf2",style:CanvasEx.LINESTYLE_SOLID},horzGridProperties:{color:"#e1ecf2",style:CanvasEx.LINESTYLE_SOLID},crossHairProperties:{color:"#758696",style:CanvasEx.LINESTYLE_DASHED,transparency:0,width:1},topMargin:5,bottomMargin:5,leftAxisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,alignLabels:!0},rightAxisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0,showBarChange:!0,showOnlyPriceSource:!0}},scalesProperties:{showLeftScale:!1,showRightScale:!0,backgroundColor:"#ffffff",lineColor:"#555",textColor:"#555",fontSize:11,scaleSeriesOnly:!1,showSeriesLastValue:!0,showSeriesPrevCloseValue:!1,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1,barSpacing:_.DEFAULT_BAR_SPACING},mainSeriesProperties:{style:h.STYLE_CANDLES,esdShowDividends:!0,esdShowSplits:!0,esdShowEarnings:!0,esdShowBreaks:!1,esdBreaksStyle:{color:"rgba( 235, 77, 92, 1)",style:CanvasEx.LINESTYLE_DASHED,width:1},esdFlagSize:2,showCountdown:!0,showInDataWindow:!0,visible:!0,showPriceLine:!0,priceLineWidth:1,priceLineColor:"",baseLineColor:"#B2B5BE",showPrevClosePriceLine:!1,prevClosePriceLineWidth:1,prevClosePriceLineColor:"rgba( 85, 85, 85, 1)",minTick:"default",extendedHours:!1,sessVis:!1,statusViewStyle:{fontSize:17,showExchange:!0,showInterval:!0,showSymbolAsDescription:!1},candleStyle:{
upColor:"#53b987",downColor:"#eb4d5c",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#53b987",borderDownColor:"#eb4d5c",wickColor:"#737375",wickUpColor:"#a9cdd3",wickDownColor:"#f5a6ae",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 83, 185, 135, 1)",borderDownColor:"rgba( 255, 77, 92, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 169, 220, 195, 1)",wickDownColor:"rgba( 245, 166, 174, 1)"},haStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 83, 185, 135, 1)",borderDownColor:"rgba( 255, 77, 92, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 83, 185, 135, 1)",wickDownColor:"rgba( 255, 77, 92, 1)",showRealLastPrice:!1,barColorsOnPrevClose:!1,inputs:{},inputInfo:{}},barStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",barColorsOnPrevClose:!1,dontDrawOpen:!1},lineStyle:{color:"rgba( 60, 120, 216, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",styleType:h.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:"rgba( 96, 96, 144, 0.5)",color2:"rgba( 1, 246, 245, 0.5)",linecolor:"rgba( 0, 148, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",transparency:50},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1},renkoStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",borderUpColor:"rgba( 83, 185, 135, 1)",borderDownColor:"rgba( 255, 77, 92, 1)",upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",borderUpColorProjection:"rgba( 169, 220, 195, 1)",borderDownColorProjection:"rgba( 245, 166, 174, 1)",wickUpColor:"rgba( 83, 185, 135, 1)",wickDownColor:"rgba( 255, 77, 92, 1)",inputs:{source:"close",boxSize:3,style:"ATR",atrLength:14,wicks:!0},inputInfo:{source:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR Length"},wicks:{name:"Wicks"}}},pbStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",borderUpColor:"rgba( 83, 185, 135, 1)",borderDownColor:"rgba( 255, 77, 92, 1)",upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",borderUpColorProjection:"rgba( 169, 220, 195, 1)",borderDownColorProjection:"rgba( 245, 166, 174, 1)",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",inputs:{source:"close",style:"ATR",atrLength:14,reversalAmount:1},inputInfo:{source:{name:"Source"},style:{name:"Style"},atrLength:{name:"ATR Length"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",
upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",inputs:{sources:"Close",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR Length"}}},baselineStyle:{baselineColor:"rgba( 117, 134, 150, 1)",topFillColor1:"rgba( 83, 185, 135, 0.1)",topFillColor2:"rgba( 83, 185, 135, 0.1)",bottomFillColor1:"rgba( 235, 77, 92, 0.1)",bottomFillColor2:"rgba( 235, 77, 92, 0.1)",topLineColor:"rgba( 83, 185, 135, 1)",bottomLineColor:"rgba( 235, 77, 92, 1)",topLineWidth:1,bottomLineWidth:1,priceSource:"close",transparency:50,baseLevelPercentage:50},rangeStyle:{upColor:"rgba( 83, 185, 135, 1)",downColor:"rgba( 255, 77, 92, 1)",upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",inputs:{range:10,phantomBars:!1},inputInfo:{range:{name:"Range"},phantomBars:{name:"Phantom Bars"}}}},symbolWatermarkProperties:{color:"rgba( 85, 85, 85, 0)",transparency:100},chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"rgba(85, 85, 85, 1)",visible:!1,style:CanvasEx.LINESTYLE_DASHED,width:1}},tradingProperties:{showPositions:!0,showOrders:!0,showExecutions:!0,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:CanvasEx.LINESTYLE_DASHED},alertsProperties:{labels:{visible:!0,color:"rgba( 215, 84, 66, 1)",highlightColor:"rgba( 255, 255, 51, 1)",hoverColor:"rgba( 245, 227, 135, 1)",line:{visible:!0,style:CanvasEx.LINESTYLE_DASHED,width:1}},fakeLabels:{visible:!0,color:"rgba( 119, 119, 119, 1)",line:{visible:!0,style:CanvasEx.LINESTYLE_DASHED,width:1}},drawingIcon:{color:"rgba( 170, 170, 170, 1)"}},editorFontsList:["Verdana","Courier New","Times New Roman","Arial"],volumePaneSize:"large"},drawings:{magnet:!1,stayInDrawingMode:!1,drawOnAllCharts:!0,crossHairColor:"#585858",crossHairStyle:CanvasEx.LINESTYLE_DASHED,crossHairWidth:1},linetoolorder:{singleChartOnly:!0,extendLeft:"inherit",lineLength:"inherit",lineColor:"rgba( 255, 0, 0, 1)",lineTransparency:0,lineStyle:"inherit",lineWidth:"inherit",bodyBorderColor:"rgba( 255, 0, 0, 0)",bodyBorderTransparency:0,bodyBackgroundColor:"rgba( 255, 255, 255, 0.75)",bodyBackgroundTransparency:25,bodyTextColor:"rgba( 255, 0, 0, 0)",bodyTextTransparency:0,bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderColor:"rgba( 255, 0, 0, 0)",quantityBorderTransparency:0,quantityBackgroundColor:"rgba( 255, 0, 0, 0.75)",quantityBackgroundTransparency:25,quantityTextColor:"rgba( 255, 255, 255, 1)",quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderColor:"rgba( 255, 0, 0, 1)",cancelButtonBorderTransparency:0,cancelButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",cancelButtonBackgroundTransparency:25,cancelButtonIconColor:"rgba( 255, 0, 0, 1)",cancelButtonIconTransparency:0,tooltip:""},linetoolposition:{singleChartOnly:!0,extendLeft:"inherit",lineLength:"inherit",
@@ -191,7 +191,7 @@ linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,colo
var e,t,i,o=this._input(0),r=this._context.new_var(n.Std.hl2(this._context)),s=n.Std.highest(r,o,this._context),a=this._context.new_var(n.Std.hl2(this._context)),l=n.Std.lowest(a,o,this._context),c=this._context.new_var(),h=this.f_0(.66*((n.Std.hl2(this._context)-l)/n.Std.max(s-l,.001)-.5)+.67*n.Std.nz(c.get(1)));return c.set(h[0]),e=this._context.new_var(),e.set(.5*n.Std.log((1+c.get(0))/n.Std.max(1-c.get(0),.001))+.5*n.Std.nz(e.get(1))),t=e.get(1),i=e.get(0),[i,t]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Historical Volatility",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Historical Volatility",shortDescription:"HV",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1e12}],id:"historical_volatility@tv-basicstudies-1",scriptIdPart:"",name:"Historical Volatility"},constructor:function(){this.f_0=function(){var e=this._input(0),t=n.Std.or(n.Std.isintraday(this._context),n.Std.and(n.Std.isdaily(this._context),n.Std.eq(n.Std.interval(this._context),1)))?1:7,i=this._context.new_var(n.Std.close(this._context)),o=this._context.new_var(n.Std.log(n.Std.close(this._context)/i.get(1)));return[100*n.Std.stdev(o,e,this._context)*n.Std.sqrt(365/t)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Hull MA",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Hull Moving Average",shortDescription:"HMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Hull MA@tv-basicstudies-1",scriptIdPart:"",name:"Hull MA"},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_,f;return this._context=e,this._input=t,i=n.Std.close(this._context),o=this._input(0),r=o/2,s=this._context.new_var(i),a=n.Std.wma(s,r,this._context),l=this._context.new_var(i),c=n.Std.wma(l,o,this._context),h=this.f_0(a,c),u=n.Std.sqrt(o),d=n.Std.round(u),p=this._context.new_var(h),_=n.Std.wma(p,d,this._context),f=_,[f]}}},{name:"Ichimoku Cloud",metainfo:{_metainfoVersion:42,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0496ff"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#991515"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#459915"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,
transparency:35,visible:!0,color:"#008000"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,palettes:{palette_0:{colors:{0:{color:"#008000",width:1,style:0},1:{color:"#FF0000",width:1,style:0}}}},filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:9,in_1:26,in_2:52,in_3:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"},{id:"plot_5",palette:"palette_0",target:"fill_0",type:"colorer"}],styles:{plot_0:{title:"Conversion Line",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"Base Line",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Lagging Span",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Lead 1",histogramBase:0,joinPoints:!1,isHidden:!1},plot_4:{title:"Lead 2",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ichimoku Cloud",shortDescription:"Ichimoku",is_price_study:!0,is_hidden_study:!1,id:"Ichimoku Cloud@tv-basicstudies-1",palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},filledAreas:[{id:"fill_0",objAId:"plot_3",objBId:"plot_4",type:"plot_plot",title:"Plots Background",isHidden:!1,palette:"palette_0"}],inputs:[{id:"in_0",name:"Conversion Line Periods",defval:9,type:"integer",min:1,max:1e12},{id:"in_1",name:"Base Line Periods",defval:26,type:"integer",min:1,max:1e12},{id:"in_2",name:"Lagging Span 2 Periods",defval:52,type:"integer",min:1,max:1e12},{id:"in_3",name:"Displacement",defval:26,type:"integer",min:1,max:1e12}],scriptIdPart:"",name:"Ichimoku Cloud"},constructor:function(){this.donchian=function(e){var t=this._context.new_var(n.Std.low(this._context)),i=this._context.new_var(n.Std.high(this._context));return n.Std.avg(n.Std.lowest(t,e,this._context),n.Std.highest(i,e,this._context))},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),o=this._input(3),r=this.donchian(e),s=this.donchian(t),a=n.Std.avg(r,s),l=this.donchian(i);return[r,s,n.Std.close(this._context),a,l,-o,o,o,n.Std.gt(a,l)?0:1]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_1();return[i[0],i[1],{value:i[2],offset:i[5]},{value:i[3],offset:i[6]},{value:i[4],offset:i[7]},i[8]]}}},{name:"Keltner Channels",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#0000FF",transparency:90,visible:!0}},inputs:{in_0:!0,in_1:20,in_2:1}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Middle",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",
histogramBase:0,joinPoints:!1}},description:"Keltner Channels",shortDescription:"KC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"useTrueRange",defval:!0,type:"bool"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"in_2",name:"mult",defval:1,type:"float",min:-1e12,max:1e12}],id:"Keltner Channels@tv-basicstudies-1",scriptIdPart:"",name:"Keltner Channels"},constructor:function(){this.f_0=function(e,t,i,n){return e?t:i-n},this.f_1=function(e,t,i){return e+t*i},this.f_2=function(e,t,i){return e-t*i},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_,f,m;return this._context=e,this._input=t,i=n.Std.close(this._context),o=this._input(0),r=this._input(1),s=this._input(2),a=this._context.new_var(i),l=n.Std.ema(a,r,this._context),c=this.f_0(o,n.Std.tr(this._context),n.Std.high(this._context),n.Std.low(this._context)),h=this._context.new_var(c),u=n.Std.ema(h,r,this._context),d=this.f_1(l,u,s),p=this.f_2(l,u,s),_=d,f=l,m=p,[_,f,m]}}},{name:"Klinger Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Klinger Oscillator",shortDescription:"Klinger Oscillator",is_price_study:!1,inputs:[],id:"Klinger Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Klinger Oscillator"},constructor:function(){this.f_0=function(e,t){return n.Std.ge(e,0)?t:-t},this.f_1=function(e,t){return e-t},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_,f;return this._context=e,this._input=t,i=n.Std.hlc3(this._context),o=this._context.new_var(i),r=n.Std.change(o),s=this.f_0(r,n.Std.volume(this._context)),a=this._context.new_var(s),l=n.Std.ema(a,34,this._context),c=this._context.new_var(s),h=n.Std.ema(c,55,this._context),u=this.f_1(l,h),d=this._context.new_var(u),p=n.Std.ema(d,13,this._context),_=u,f=p,[_,f]}}},{name:"Know Sure Thing",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:15,in_2:20,in_3:30,in_4:10,in_5:10,in_6:10,in_7:15,in_8:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"KST",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Know Sure Thing",shortDescription:"KST",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{
id:"in_0",name:"roclen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"roclen2",defval:15,type:"integer",min:1,max:2e3},{id:"in_2",name:"roclen3",defval:20,type:"integer",min:1,max:2e3},{id:"in_3",name:"roclen4",defval:30,type:"integer",min:1,max:2e3},{id:"in_4",name:"smalen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_5",name:"smalen2",defval:10,type:"integer",min:1,max:2e3},{id:"in_6",name:"smalen3",defval:10,type:"integer",min:1,max:2e3},{id:"in_7",name:"smalen4",defval:15,type:"integer",min:1,max:2e3},{id:"in_8",name:"siglen",defval:9,type:"integer",min:1,max:2e3}],id:"Know Sure Thing@tv-basicstudies-1",scriptIdPart:"",name:"Know Sure Thing"},constructor:function(){this.f_0=function(e,t,i,n){return e+2*t+3*i+4*n},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,N,F,W,H;return this._context=e,this._input=t,i=this._input(0),o=this._input(1),r=this._input(2),s=this._input(3),a=this._input(4),l=this._input(5),c=this._input(6),h=this._input(7),u=this._input(8),d=n.Std.close(this._context),p=i,_=this._context.new_var(d),f=n.Std.roc(_,p),m=a,y=this._context.new_var(f),g=n.Std.sma(y,m,this._context),v=o,S=this._context.new_var(d),b=n.Std.roc(S,v),w=l,P=this._context.new_var(b),T=n.Std.sma(P,w,this._context),x=r,C=this._context.new_var(d),L=n.Std.roc(C,x),I=c,A=this._context.new_var(L),k=n.Std.sma(A,I,this._context),E=s,M=this._context.new_var(d),V=n.Std.roc(M,E),D=h,O=this._context.new_var(V),R=n.Std.sma(O,D,this._context),B=this.f_0(g,T,k,R),N=this._context.new_var(B),F=n.Std.sma(N,u,this._context),W=B,H=F,[W,H]}}},{name:"Least Squares Moving Average",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:25,in_1:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Least Squares Moving Average",shortDescription:"LSMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:25,type:"integer",min:1,max:1e12},{id:"in_1",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Least Squares Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Least Squares Moving Average"},constructor:function(){this.main=function(e,t){var i,o,r,s,a,l;return this._context=e,this._input=t,i=this._input(0),o=this._input(1),r=n.Std.close(this._context),s=this._context.new_var(r),a=n.Std.linreg(s,i,o),l=a,[l]}}},{name:"Linear Regression Curve",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Linear Regression Curve",shortDescription:"LRC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3}],
id:"in_0",name:"roclen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"roclen2",defval:15,type:"integer",min:1,max:2e3},{id:"in_2",name:"roclen3",defval:20,type:"integer",min:1,max:2e3},{id:"in_3",name:"roclen4",defval:30,type:"integer",min:1,max:2e3},{id:"in_4",name:"smalen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_5",name:"smalen2",defval:10,type:"integer",min:1,max:2e3},{id:"in_6",name:"smalen3",defval:10,type:"integer",min:1,max:2e3},{id:"in_7",name:"smalen4",defval:15,type:"integer",min:1,max:2e3},{id:"in_8",name:"siglen",defval:9,type:"integer",min:1,max:2e3}],id:"Know Sure Thing@tv-basicstudies-1",scriptIdPart:"",name:"Know Sure Thing"},constructor:function(){this.f_0=function(e,t,i,n){return e+2*t+3*i+4*n},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,F,N,W,H;return this._context=e,this._input=t,i=this._input(0),o=this._input(1),r=this._input(2),s=this._input(3),a=this._input(4),l=this._input(5),c=this._input(6),h=this._input(7),u=this._input(8),d=n.Std.close(this._context),p=i,_=this._context.new_var(d),f=n.Std.roc(_,p),m=a,y=this._context.new_var(f),g=n.Std.sma(y,m,this._context),v=o,S=this._context.new_var(d),b=n.Std.roc(S,v),w=l,P=this._context.new_var(b),T=n.Std.sma(P,w,this._context),x=r,C=this._context.new_var(d),L=n.Std.roc(C,x),I=c,A=this._context.new_var(L),k=n.Std.sma(A,I,this._context),E=s,M=this._context.new_var(d),V=n.Std.roc(M,E),D=h,O=this._context.new_var(V),R=n.Std.sma(O,D,this._context),B=this.f_0(g,T,k,R),F=this._context.new_var(B),N=n.Std.sma(F,u,this._context),W=B,H=N,[W,H]}}},{name:"Least Squares Moving Average",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:25,in_1:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Least Squares Moving Average",shortDescription:"LSMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:25,type:"integer",min:1,max:1e12},{id:"in_1",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Least Squares Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Least Squares Moving Average"},constructor:function(){this.main=function(e,t){var i,o,r,s,a,l;return this._context=e,this._input=t,i=this._input(0),o=this._input(1),r=n.Std.close(this._context),s=this._context.new_var(r),a=n.Std.linreg(s,i,o),l=a,[l]}}},{name:"Linear Regression Curve",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Linear Regression Curve",shortDescription:"LRC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3}],
id:"Linear Regression Curve@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Curve"},constructor:function(){this.main=function(e,t){var i,o,r,s,a;return this._context=e,this._input=t,i=n.Std.close(this._context),o=this._input(0),r=this._context.new_var(i),s=n.Std.linreg(r,o,0),a=s,[a]}}},{name:"MA Cross",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA Cross",shortDescription:"MA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3}],id:"MA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA Cross"},constructor:function(){this.f_0=function(e,t){return e?t:n.Std.na()},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p;return this._context=e,this._input=t,i=this._input(0),o=this._input(1),r=n.Std.close(this._context),s=this._context.new_var(r),a=n.Std.sma(s,i,this._context),l=this._context.new_var(r),c=n.Std.sma(l,o,this._context),h=a,u=c,d=n.Std.cross(a,c,this._context),p=this.f_0(d,a),[h,u,p]}}},{name:"MA with EMA Cross",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:10,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"MA",histogramBase:0,joinPoints:!1},plot_1:{title:"EMA",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA with EMA Cross",shortDescription:"MA/EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Length MA",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"Length EMA",defval:10,type:"integer",min:1,max:2e3}],id:"MA with EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA with EMA Cross"},constructor:function(){this.f_0=function(e,t){return e?t:n.Std.na()},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p;return this._context=e,this._input=t,i=this._input(0),o=this._input(1),r=n.Std.close(this._context),s=this._context.new_var(r),a=n.Std.sma(s,i,this._context),l=this._context.new_var(r),c=n.Std.ema(l,o,this._context),h=a,u=c,
d=n.Std.cross(a,c,this._context),p=this.f_0(d,a),[h,u,p]}}},{name:"Mass Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Mass Index",shortDescription:"Mass Index",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Mass Index@tv-basicstudies-1",scriptIdPart:"",name:"Mass Index"},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d;return this._context=e,this._input=t,i=this._input(0),o=this.f_0(n.Std.high(this._context),n.Std.low(this._context)),r=this._context.new_var(o),s=n.Std.ema(r,9,this._context),a=this._context.new_var(s),l=n.Std.ema(a,9,this._context),c=this.f_1(s,l),h=this._context.new_var(c),u=n.Std.sum(h,i,this._context),d=u,[d]}}},{name:"McGinley Dynamic",metainfo:{_metainfoVersion:42,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"McGinley Dynamic",shortDescription:"McGinley Dynamic",is_price_study:!0,is_hidden_study:!1,id:"mcginley_dynamic@tv-basicstudies-1",inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],scriptIdPart:"",name:"McGinley Dynamic"},constructor:function(){this.f_0=function(){var e,t=this._input(0),i=n.Std.close(this._context),o=this._context.new_var(i),r=n.Std.ema(o,t,this._context),s=this._context.new_var(),a=s.get(1)+(i-s.get(1))/(t*n.Std.pow(i/s.get(1),4));return s.set(n.Std.na(s.get(1))?r:a),e=s.get(0),[e]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Momentum",metainfo:{_metainfoVersion:30,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,inputs:{in_0:10,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Mom",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Momentum",shortDescription:"Mom",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Momentum@tv-basicstudies-1",scriptIdPart:"",name:"Momentum"},constructor:function(){this.main=function(e,t){var i,o,r,s,a;return this._context=e,this._input=t,i=this._input(0),o=n.Std[this._input(1)](this._context),r=this._context.new_var(o),s=r.get(i),a=s?o-s:null,[a]}}},{name:"Money Flow",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{
linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#459915"}},precision:4,bands:[{color:"#c0c0c0",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#c0c0c0",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#9915ff",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Money Flow",shortDescription:"MFI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"Length",defval:14,type:"integer",min:1,max:2e3}],id:"Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Money Flow"},constructor:function(){this.f_0=function(e,t,i){return e*(n.Std.le(t,0)?0:i)},this.f_1=function(e,t,i){return e*(n.Std.ge(t,0)?0:i)},this.main=function(e,t){var i,o,r,s,a,l,c,h,u,d,p,_;return this._context=e,this._input=t,i=this._input(0),o=n.Std.hlc3(this._context),r=this._context.new_var(o),s=n.Std.change(r),a=this.f_0(n.Std.volume(this._context),s,o),l=this._context.new_var(a),c=n.Std.sum(l,i,this._context),h=this.f_1(n.Std.volume(this._context),s,o),u=this._context.new_var(h),d=n.Std.sum(u,i,this._context),p=n.Std.rsi(c,d),_=p,[_]}}},{name:"Moving Average",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average",shortDescription:"MA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average"},constructor:function(){this.main=function(e,t){var i,o,r,s,a,l;return this._context=e,this._input=t,i=n.Std[this._input(1)](this._context),o=this._input(0),r=this._input(2),s=this._context.new_var(i),a=n.Std.sma(s,o,this._context),l=a,[{value:l,offset:r}]}}},{name:"Moving Average Channel",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#CC0000"}},precision:4,filledAreasStyle:{fill_0:{color:"#A2C4C9",transparency:90,visible:!0}},inputs:{in_0:20,in_1:20,in_2:0,in_3:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_1",
@@ -220,8 +220,8 @@ for(var n=0;n<a.length;n++)a[n]||(t=t.toLowerCase()),e.addEventListener(a[n]+t,i
if(f=f.slice().sort(function(e,t){return e.color>t.color?-1:e.color<t.color?1:0}),e.translate(-.5,-.5),e.lineWidth=S,y)for(_=v,e.fillStyle=v,h=f.length;h--;)u=f[h],c=u.time,t=u.open,i=u.high,n=u.low,o=u.close,u.wickColor&&u.wickColor!==_&&(e.fillStyle=u.wickColor,_=u.wickColor),a=Math.min(t,o),l=Math.max(t,o),u.hollow?(e.fillRect(c,i,1,a-i),e.fillRect(c,l,1,n-l)):e.fillRect(c,i,1,n-i);if(g)for(h=f.length;h--;)u=f[h],f[h+1]&&u.borderColor===f[h+1].borderColor||(e.fillStyle=u.borderColor),u.hollow||(c=u.time,t=u.open,o=u.close,r=Math.round(c-b),s=Math.round(c+b),a=Math.min(t,o),l=Math.max(t,o),e.fillRect(r,a,s-r+1,l-a+1));for(h=f.length;h--;)u=f[h],c=u.time,t=u.open,i=u.high,n=u.low,o=u.close,r=Math.round(c-b),s=Math.round(c+b),a=Math.min(t,o),l=Math.max(t,o),f[h+1]&&u.color===f[h+1].color||(e.strokeStyle=u.color),e.fillStyle=u.color,Math.abs(a-l)<=1&&(e.fillStyle=u.borderColor),u.hollow?(e.translate(-.5,-.5),e.strokeRect(r+1,a+1,s-r,l-a),e.translate(.5,.5)):(g&&(r+=1,a+=1,s-=1,l-=1),e.fillRect(r,a,s-r+1,l-a+1))}},n.prototype.hitTest=function(e){var t,i,n,s,a=this.bars,l=.5*this._data.barSpacing;if(0===a.length)return null;if(e.x<a[0].time-l)return null;if(e.x>a[a.length-1].time+l)return null;for(t=null,i=0;i<a.length;++i)if(n=a[i],e.x<=n.time+l){t=n;break}return s=o.selectionTolerance(this._barBorderWidth),t&&t.high-s<=e.y&&e.y<=t.low+s?this._data.hittest||new r(r.REGULAR):null},t.PaneRendererCandles=TradingView.PaneRendererCandles=n},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"ScaleType",function(){return n}),i.d(t,"plotShapesData",function(){return o}),i(11),function(e){e[e.Right=0]="Right",e[e.Left=1]="Left",e[e.None=2]="None"}(n||(n={})),o={shape_arrow_down:{guiName:$.t("Arrow Down"),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown"},shape_arrow_up:{guiName:$.t("Arrow Up"),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup"},shape_circle:{guiName:$.t("Circle"),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle"},shape_cross:{guiName:$.t("Cross"),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross"},shape_diamond:{guiName:$.t("Diamond"),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond"},shape_flag:{guiName:$.t("Flag"),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag"},shape_label_down:{guiName:$.t("Label Down"),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown"},shape_label_up:{guiName:$.t("Label Up"),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup"},shape_square:{guiName:$.t("Square"),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square"},shape_triangle_down:{guiName:$.t("Triangle Down"),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown"},shape_triangle_up:{guiName:$.t("Triangle Up"),id:"shape_triangle_up",
paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup"},shape_xcross:{guiName:$.t("X Cross"),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross"}}},function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"MarkLocation",function(){return n}),i.d(t,"HAlign",function(){return o}),i.d(t,"VAlign",function(){return r}),i.d(t,"LineStyle",function(){return s}),function(e){e.AboveBar="AboveBar",e.BelowBar="BelowBar",e.Top="Top",e.Bottom="Bottom",e.Right="Right",e.Left="Left",e.Absolute="Absolute",e.AbsoluteUp="AbsoluteUp",e.AbsoluteDown="AbsoluteDown"}(n||(n={})),function(e){e.Left="left",e.Center="center",e.Right="right"}(o||(o={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(r||(r={})),function(e){e[e.Solid=0]="Solid",e[e.Dotted=1]="Dotted",e[e.Dashed=2]="Dashed"}(s||(s={}))},,function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"BarsRange",function(){return o}),n=i(7),i.n(n),o=function(){function e(e,t){Object(n.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}return e.prototype.firstBar=function(){return this._firstBar},e.prototype.lastBar=function(){return this._lastBar},e.prototype.count=function(){return this._lastBar-this._firstBar+1},e.prototype.contains=function(e){return this._firstBar<=e&&e<=this._lastBar},e.prototype.equals=function(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()},e}()},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";!function(e){if(document.createElement("canvas")&&document.createElement("canvas").getContext){var t=function(t){var i=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/i}(document.createElement("canvas").getContext("2d"));t<=1||(e.hidpiCanvasRatio=t,function(e){var i,n,o=function(e,t){for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},r={fillRect:"all",clearRect:"all",strokeRect:"all",moveTo:"all",lineTo:"all",arc:[0,1,2],arcTo:"all",bezierCurveTo:"all",isPointinPath:"all",isPointinStroke:"all",quadraticCurveTo:"all",rect:"all",translate:"all",createRadialGradient:"all",createLinearGradient:"all",drawImagePatchedSource:[1,2,3,4]};e.drawImagePatchedSource=e.drawImage,i=e.drawImage,e.drawImagePatchedSourceAndDest=function(e){var n,o=Array.prototype.slice.call(arguments);for(n=1;n<o.length;++n)o[n]&&(o[n]*=t);return o.length>5&&("width"in e&&(o[3]=Math.min(e.width,Math.max(1,o[3]))),"height"in e&&(o[4]=Math.min(e.height,Math.max(1,o[4])))),i.apply(this,o)},o(r,function(i,n){var o=e[n];e[n]=function(){var e,n;if("all"===i)for(n=[],e=arguments.length;0<e--;)n[e]=arguments[e]*t;else for(n=Array.prototype.slice.call(arguments),e=i.length;0<e--;)n[i[e]]&&(n[i[e]]=n[i[e]]*t);return o.apply(this,n)}}),e.drawImage=function(e){return function(){
return arguments[0]instanceof HTMLCanvasElement?e.drawImagePatchedSourceAndDest.apply(this,arguments):e.drawImagePatchedSource.apply(this,arguments)}}(e),n=/(\d+(?:\.\d+)?)(px|em|rem|pt)/g,e.fillText=function(e){return function(){var i=Array.prototype.slice.call(arguments);i[1]*=t,i[2]*=t,this.font=this.font.replace(n,function(e,i,n){return i*t+n}),e.apply(this,i),this.font=this.font.replace(n,function(e,i,n){return i/t+n})}}(e.fillText),e.strokeText=function(e){return function(){var i=Array.prototype.slice.call(arguments);i[1]*=t,i[2]*=t,this.font=this.font.replace(n,function(e,i,n){return i*t+n}),e.apply(this,i),this.font=this.font.replace(n,function(e,i,n){return i/t+n})}}(e.strokeText)}(CanvasRenderingContext2D.prototype),function(e){e.getContext=function(e){return function(i){var n=e.call(this,i);return"2d"===i&&this.width!==Math.floor(parseInt(this.style.width)*t)&&(this.style.height=this.height+"px",this.style.width=this.width+"px",this.width*=t,this.height*=t),n}}(e.getContext)}(HTMLCanvasElement.prototype))}}(window)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"LineToolPitchforkStyle",function(){return n});var n;!function(e){e[e.Original=0]="Original",e[e.Schiff=1]="Schiff",e[e.Inside=2]="Inside",e[e.Schiff2=3]="Schiff2"}(n||(n={}))},function(e,t){},function(e,t,i){"use strict";function n(e,t){i.e(21).then(i.bind(null,699)).then(function(i){new i.ChangeIntervalDialog(e).show(t)})}Object.defineProperty(t,"__esModule",{value:!0}),t.showChangeIntervalDialog=n},function(e,t,i){"use strict";function n(e,t){var i,n;return void 0===e&&(e=[]),void 0===t&&(t=[]),i=document.createElement("div"),n=document.createElement("div"),i.appendChild(n),i.classList.add(o.container),n.classList.add(o.inner),e.forEach(function(e){i.classList.add(o[e])}),t.forEach(function(e){i.classList.add(o[e])}),i}var o;t.a=n,o=i(478),i.n(o)},function(e,t,i){"use strict";function n(e){return Object(U.fetch)("/theme/?themeName="+encodeURIComponent(e),{credentials:"include",method:"GET"}).then(function(e){return e.json()}).then(function(e){var t={};return e.content&&(t.content=JSON.parse(e.content)),t})}function o(){return Y||Object(U.fetch)("/themes/",{credentials:"include",method:"GET"}).then(function(e){return Y=e.json()})}function r(e,t){var i=new FormData;return i.append("content",JSON.stringify(t)),i.append("name",e),Y=null,Object(U.fetch)("/save-theme/",{credentials:"include",method:"POST",body:i}).then(function(e){return e.json()},function(e){return $.logError(e)})}function s(e){var t=new FormData;return t.append("name",e),Y=null,Object(U.fetch)("/remove-theme/",{credentials:"include",method:"POST",body:t}).then(function(e){return e.json()},function(e){return $.logError(e)})}function a(e){return n(e).then(function(e){return!!e.content})}function l(){return J||(J=new Promise(function(e){i.e(22).then(function(t){var n,o=i(1245),r=i(1246);e((n={},n[Z.Light]=r,n[Z.Dark]=o,n))}.bind(null,i)).catch(i.oe)})),J}function c(){return[Z.Light,Z.Dark]}function h(){return l().then(function(e){var t;return t={},
t[Z.Light]=JSON.parse(e[Z.Light]),t[Z.Dark]=JSON.parse(e[Z.Dark]),t})}function u(e){return h().then(function(t){return t[e]})}function d(e){return X[e]||e}function p(e){return h().then(function(t){return c().some(function(i){return _(t[i],e)})})}function _(e,t){var i=e.content===t.content;return m(e.content,function(e,n){var o=g(e,t.content);return!(i=f(n,o))}),i}function f(e,t){if("string"==typeof e&&"string"==typeof t)try{return Object(G.areEqualRgb)(Object(G.parseRgb)(e),Object(G.parseRgb)(t))}catch(i){return e===t}return e===t}function m(e,t){void 0===e&&(e={});try{y(e,[],t)}catch(e){return}}function y(e,t,i){var n,o;for(n in e)if(e.hasOwnProperty(n))if(o=t.concat(n),"object"==typeof e[n])y(e[n],o,i);else if(i(o,e[n]))throw Error("exit")}function g(e,t){var i,n;for(void 0===t&&(t={}),i=t,n=0;n<e.length;n++){if(!i||"object"!=typeof i)return;i=i[e[n]]}if("string"==typeof i||"number"==typeof i)return i}function v(e,t){var i,n;return void 0===t&&(t=[]),(i=ee[e])?oe.test(i)?i:(n=i,t.push(e),-1!==t.indexOf(n)?(console.warn("Colors definitions cycled"),i):t.length>ne?(console.warn("Too many variables-link in HEX-color search: "+t[0]),null):v(n,t)):null}function S(e,t){var i=re[e];if(!i)throw Error("No such color "+e);return i}function b(e,t){var i,n;t||(t=window),i=t.document.documentElement;for(n in ae)ae[n].className&&i.classList.toggle(ae[n].className,n===e)}function w(e){return!e.isPrivate}function P(){return ae[ce.value()]||ae[le]}function T(e){return P().getThemedColor(e)}function x(e){ce.setValue(e)}function C(){x(Object(z.getValue)(he)||le)}function L(){return Object(z.getValue)(he)||null}function I(){Object(z.setValue)(he,P().name,{forceFlush:!0})}function A(e){return n(e)}function k(){return o()}function E(){return c()}function M(e){return u(e).then(function(e){return e||{content:void 0}})}function V(){return h()}function D(e,t){return r(e,t)}function O(e){return s(e)}function R(e){return a(e)}function B(e){return d(e)}function N(e){return p(e)}function F(e){return{content:{chartProperties:{paneProperties:e.m_model.properties().paneProperties.state(),scalesProperties:e.m_model.properties().scalesProperties.state()},mainSourceProperties:e.m_model.m_mainSeries.properties().state()}}}var W,H,j,z,U,q,$,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se,ae,le,ce,he;Object.defineProperty(t,"__esModule",{value:!0}),W=i(248),i(11),H=i(16),j=i.n(H),z=i(49),U=i(336),q=i(4),$=Object(q.getLogger)("Themes.Provider"),Y=null,G=i(24),function(e){e.Light="light",e.Dark="dark"}(Z||(Z={})),J=null,K={},K[Z.Light]=window.t("Light",{context:"colorThemeName"}),K[Z.Dark]=window.t("Dark",{context:"colorThemeName"}),K.Black=window.t("Black",{context:"colorThemeName"}),K.Blue=window.t("Blue",{context:"colorThemeName"}),K.Grey=window.t("Grey",{context:"colorThemeName"}),K.White=window.t("White",{context:"colorThemeName"}),X=K,Q=i(480),ee=i(481),te=i(7),ie={},ne=Object.keys(ee).length,oe=/^#[0-9A-F]{6}$/i,Object.keys(ee).forEach(function(e){var t=v(e);ie[e]=Object(te.ensureNotNull)(t)}),re=ie,i.d(t,"themes",function(){return ae}),
i.d(t,"DEFAULT_THEME",function(){return le}),i.d(t,"watchedTheme",function(){return ce}),t.applyTheme=b,t.isPublicTheme=w,t.getCurrentTheme=P,t.setThemedColor=T,t.setTheme=x,t.restoreTheme=C,t.savedThemeName=L,t.syncTheme=I,t.getTheme=A,t.getThemeNames=k,t.getStdThemeNames=E,t.getStdTheme=M,t.getStdThemes=V,t.saveTheme=D,t.removeTheme=O,t.isThemeExist=R,t.translateStdThemeName=B,t.isStdTheme=N,t.extractThemeFromModel=F,se={},se[Z.Light]={name:Z.Light,label:window.t("Light",{context:"colorThemeName"}),className:"theme-light",order:2,getThemedColor:function(e){return S(e)}},se[Z.Dark]={name:Z.Dark,label:window.t("Dark",{context:"colorThemeName"}),className:"theme-dark",order:1,getThemedColor:function(e){return S(Q[e])}},ae=se,le="light",ce=new j.a,ce.subscribe(function(e){b(e,window)}),he="current_theme.name"},function(e,t,i){"use strict";var n=i(31),o=i(12).parseJSONorNot,r=i(4).getLogger("Chart.SaveloadAdapter.Library"),s=function(){var e,t,i,s,a={},l=null;return a.setCustomAdapter=function(e){l=e,r.logNormal("Use custom save-load adapter")},a.initialize=function(n,o,r,a){e=n,t=o,i=r,s=a},a.updateUser=function(e){t=e},a.getCharts=function(n,a){function c(e){e=e.map(function(e){return{id:e.id,name:e.name,image_url:e.id,modified_iso:e.timestamp,short_symbol:e.symbol,interval:e.resolution}}),n(e)}return l?void l.getAllCharts().then(c).catch(a):$.ajax({url:"{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t)),type:"GET",crossDomain:!0}).done(function(e){var t=o(e);if("ok"!==t.status)return r.logWarn("Charts list request failed: "+t.message),void a();c(t.data)}).fail(a)},a.removeChart=function(n,a){if(l)return void l.removeChart(n).then(a);$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t),encodeURIComponent(n)),type:"DELETE",crossDomain:!0}).done(function(e){var t=o(e);"ok"!==t.status&&r.logWarn("Chart delete request failed: "+t.message),a()})},a.saveChart=function(n,a,c,h,u,d,p){var _,f=u.id.value(),m={name:n,content:JSON.stringify(h),symbol:a,resolution:c};if(l)return m.id=f,void l.saveChart(m).then(d).catch(p);_="{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t)),void 0!==f&&null!==f&&(_+="&chart="+encodeURIComponent(f)),$.ajax({url:_,data:m,type:"POST",crossDomain:!0}).done(function(e){var t=o(e);if("ok"!==t.status)return r.logWarn("Chart save request failed: "+t.message),void p();d(t.id)}).fail(function(){p()})},a.getChartContent=function(n,a,c){function h(e){var t=JSON.parse(e);return t.uid=n.id,t}if(l)return void l.getChartContent(n.id).then(function(e){var t=h(e);a(t)}).catch(c);$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t),encodeURIComponent(n.id)),type:"GET",crossDomain:!0}).done(function(e){var t,i=o(e);if("ok"!==i.status)return void r.logWarn("Chart load request failed: "+i.message);t=h(i.data.content),a(t)
t[Z.Light]=JSON.parse(e[Z.Light]),t[Z.Dark]=JSON.parse(e[Z.Dark]),t})}function u(e){return h().then(function(t){return t[e]})}function d(e){return X[e]||e}function p(e){return h().then(function(t){return c().some(function(i){return _(t[i],e)})})}function _(e,t){var i=e.content===t.content;return m(e.content,function(e,n){var o=g(e,t.content);return!(i=f(n,o))}),i}function f(e,t){if("string"==typeof e&&"string"==typeof t)try{return Object(G.areEqualRgb)(Object(G.parseRgb)(e),Object(G.parseRgb)(t))}catch(i){return e===t}return e===t}function m(e,t){void 0===e&&(e={});try{y(e,[],t)}catch(e){return}}function y(e,t,i){var n,o;for(n in e)if(e.hasOwnProperty(n))if(o=t.concat(n),"object"==typeof e[n])y(e[n],o,i);else if(i(o,e[n]))throw Error("exit")}function g(e,t){var i,n;for(void 0===t&&(t={}),i=t,n=0;n<e.length;n++){if(!i||"object"!=typeof i)return;i=i[e[n]]}if("string"==typeof i||"number"==typeof i)return i}function v(e,t){var i,n;return void 0===t&&(t=[]),(i=ee[e])?oe.test(i)?i:(n=i,t.push(e),-1!==t.indexOf(n)?(console.warn("Colors definitions cycled"),i):t.length>ne?(console.warn("Too many variables-link in HEX-color search: "+t[0]),null):v(n,t)):null}function S(e,t){var i=re[e];if(!i)throw Error("No such color "+e);return i}function b(e,t){var i,n;t||(t=window),i=t.document.documentElement;for(n in ae)ae[n].className&&i.classList.toggle(ae[n].className,n===e)}function w(e){return!e.isPrivate}function P(){return ae[ce.value()]||ae[le]}function T(e){return P().getThemedColor(e)}function x(e){ce.setValue(e)}function C(){x(Object(z.getValue)(he)||le)}function L(){return Object(z.getValue)(he)||null}function I(){Object(z.setValue)(he,P().name,{forceFlush:!0})}function A(e){return n(e)}function k(){return o()}function E(){return c()}function M(e){return u(e).then(function(e){return e||{content:void 0}})}function V(){return h()}function D(e,t){return r(e,t)}function O(e){return s(e)}function R(e){return a(e)}function B(e){return d(e)}function F(e){return p(e)}function N(e){return{content:{chartProperties:{paneProperties:e.m_model.properties().paneProperties.state(),scalesProperties:e.m_model.properties().scalesProperties.state()},mainSourceProperties:e.m_model.m_mainSeries.properties().state()}}}var W,H,j,z,U,q,$,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se,ae,le,ce,he;Object.defineProperty(t,"__esModule",{value:!0}),W=i(248),i(11),H=i(16),j=i.n(H),z=i(49),U=i(336),q=i(4),$=Object(q.getLogger)("Themes.Provider"),Y=null,G=i(24),function(e){e.Light="light",e.Dark="dark"}(Z||(Z={})),J=null,K={},K[Z.Light]=window.t("Light",{context:"colorThemeName"}),K[Z.Dark]=window.t("Dark",{context:"colorThemeName"}),K.Black=window.t("Black",{context:"colorThemeName"}),K.Blue=window.t("Blue",{context:"colorThemeName"}),K.Grey=window.t("Grey",{context:"colorThemeName"}),K.White=window.t("White",{context:"colorThemeName"}),X=K,Q=i(480),ee=i(481),te=i(7),ie={},ne=Object.keys(ee).length,oe=/^#[0-9A-F]{6}$/i,Object.keys(ee).forEach(function(e){var t=v(e);ie[e]=Object(te.ensureNotNull)(t)}),re=ie,i.d(t,"themes",function(){return ae}),
i.d(t,"DEFAULT_THEME",function(){return le}),i.d(t,"watchedTheme",function(){return ce}),t.applyTheme=b,t.isPublicTheme=w,t.getCurrentTheme=P,t.setThemedColor=T,t.setTheme=x,t.restoreTheme=C,t.savedThemeName=L,t.syncTheme=I,t.getTheme=A,t.getThemeNames=k,t.getStdThemeNames=E,t.getStdTheme=M,t.getStdThemes=V,t.saveTheme=D,t.removeTheme=O,t.isThemeExist=R,t.translateStdThemeName=B,t.isStdTheme=F,t.extractThemeFromModel=N,se={},se[Z.Light]={name:Z.Light,label:window.t("Light",{context:"colorThemeName"}),className:"theme-light",order:2,getThemedColor:function(e){return S(e)}},se[Z.Dark]={name:Z.Dark,label:window.t("Dark",{context:"colorThemeName"}),className:"theme-dark",order:1,getThemedColor:function(e){return S(Q[e])}},ae=se,le="light",ce=new j.a,ce.subscribe(function(e){b(e,window)}),he="current_theme.name"},function(e,t,i){"use strict";var n=i(31),o=i(12).parseJSONorNot,r=i(4).getLogger("Chart.SaveloadAdapter.Library"),s=function(){var e,t,i,s,a={},l=null;return a.setCustomAdapter=function(e){l=e,r.logNormal("Use custom save-load adapter")},a.initialize=function(n,o,r,a){e=n,t=o,i=r,s=a},a.updateUser=function(e){t=e},a.getCharts=function(n,a){function c(e){e=e.map(function(e){return{id:e.id,name:e.name,image_url:e.id,modified_iso:e.timestamp,short_symbol:e.symbol,interval:e.resolution}}),n(e)}return l?void l.getAllCharts().then(c).catch(a):$.ajax({url:"{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t)),type:"GET",crossDomain:!0}).done(function(e){var t=o(e);if("ok"!==t.status)return r.logWarn("Charts list request failed: "+t.message),void a();c(t.data)}).fail(a)},a.removeChart=function(n,a){if(l)return void l.removeChart(n).then(a);$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t),encodeURIComponent(n)),type:"DELETE",crossDomain:!0}).done(function(e){var t=o(e);"ok"!==t.status&&r.logWarn("Chart delete request failed: "+t.message),a()})},a.saveChart=function(n,a,c,h,u,d,p){var _,f=u.id.value(),m={name:n,content:JSON.stringify(h),symbol:a,resolution:c};if(l)return m.id=f,void l.saveChart(m).then(d).catch(p);_="{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t)),void 0!==f&&null!==f&&(_+="&chart="+encodeURIComponent(f)),$.ajax({url:_,data:m,type:"POST",crossDomain:!0}).done(function(e){var t=o(e);if("ok"!==t.status)return r.logWarn("Chart save request failed: "+t.message),void p();d(t.id)}).fail(function(){p()})},a.getChartContent=function(n,a,c){function h(e){var t=JSON.parse(e);return t.uid=n.id,t}if(l)return void l.getChartContent(n.id).then(function(e){var t=h(e);a(t)}).catch(c);$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t),encodeURIComponent(n.id)),type:"GET",crossDomain:!0}).done(function(e){var t,i=o(e);if("ok"!==i.status)return void r.logWarn("Chart load request failed: "+i.message);t=h(i.data.content),a(t)
}).fail(function(){c&&c()})},a.loadChart=function(e){a.getChartContent(e,function(e){n.emit("chart_load_requested",e)},function(){r.logWarn("Error loading chart")})},a.removeStudyTemplate=function(n,a){if(l)return void l.removeStudyTemplate({name:n}).then(a);$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}&template={4}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t),encodeURIComponent(n)),type:"DELETE",crossDomain:!0}).done(function(e){var t=o(e);"ok"!==t.status&&r.logWarn("Chart delete request failed: "+t.message),a()})},a.getStudyTemplateContent=function(n,r){if(l)return void l.getStudyTemplateContent({name:n}).then(function(e){r({content:e})});$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}&template={4}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t),encodeURIComponent(n)),type:"GET",crossDomain:!0}).done(function(e){r(o(e).data)})},a.saveStudyTemplate=function(n,a){var c={name:n.name,content:n.content};if(l)return void l.saveStudyTemplate(c).then(a.bind(null,{error:""})).catch(function(e){a({error:null!=e?""+e:"error"})});$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t)),type:"POST",crossDomain:!0,data:c}).done(function(e){var t=o(e);"ok"!==t.status&&r.logWarn("Template save request failed: "+t.message),a({error:"ok"===t.status?"":t.status})})},a._templatesCache=null,a.getStudyTemplatesList=function(n){function c(e){e=e.map(function(e){return{is_default:!1,name:e.name}}),a._templatesCache=e,n(e)}return a._templatesCache?void n(a._templatesCache):(a._templatesCache=[],l?void l.getAllStudyTemplates().then(c):void $.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(e),encodeURIComponent(t)),type:"GET",crossDomain:!0}).done(function(e){if(null!==a._templatesCache){var t=o(e);if("ok"!==t.status)return void r.logWarn("Templates list request failed: "+t.message);c(t.data)}}))},a.invalidateStudyTemplatesList=function(){a._templatesCache=null},a}();e.exports=s},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o,r,s,a;Object.defineProperty(t,"__esModule",{value:!0}),t.SaveRenameDialog=void 0,o=function(){function e(e,t){var i,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),i(484),r=i(83),s={YES:"yes",CLOSE:"close"},a=0,t.SaveRenameDialog=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.fields,o=t.confirm,r=t.title,s=void 0===r?"":r,a=t.destroyOnClose,l=void 0===a||a,c=t.modal,h=void 0!==c&&c;n(this,e),this._$form=$("<div></div>"),this._fields=i,this._appendFieldsToForm(),this._title=s,this._destroyOnClose=l,this._modal=h,this._isConfirmDialogOpened=!1,o&&(this._needCheckConfirm=!0,this._shouldShowConfirm=o.shouldShowDialog,
this._getConfirmMessage=o.getMessage)}return o(e,[{key:"setField",value:function(e,t){this._fields.find(function(t){return t.name===e}).value=t}},{key:"show",value:function(){var e=this,t=this._createDialog();return new Promise(function(i){t.then(function(t){t.on("action:submit",function(t){return e._onSubmit(t,i)}),t.open(),t.on("beforeClose",e._unmountFields.bind(e)),e._fields[a].select()})})}},{key:"_appendFieldsToForm",value:function(){var e=this;this._fields.forEach(function(t){t.appendTo(e._$form)})}},{key:"_createDialog",value:function(){var e=this;return new Promise(function(t){i.e(2).then(function(n){var o=i(188).createDialog;t(o({type:e._modal?"modal":"popup",title:e._title,content:e._$form,actionsWrapTemplate:'<div class="tv-dialog__section tv-dialog__section--actions i-align_right tv-dialog__section--no-border">',width:470,destroyOnClose:e._destroyOnClose,isClickOutFn:function(){if(e._isConfirmDialogOpened)return!1},actions:[{name:"submit",type:"primary",text:$.t("Save"),key:13,addClass:"js-submit-button"},{name:"cancel",type:"default",text:$.t("Cancel"),method:"close",addClass:"js-cancel-button"}]}))}.bind(null,i)).catch(i.oe)})}},{key:"_onSubmit",value:function(e,t){var i=this,n=this._validate();if(n)e.error(n.error),n.focus();else{if(!this._needCheckConfirm)return t(this._collectValues(),e),void e.close();Promise.resolve(this._shouldShowConfirm(this._collectValues())).then(function(n){if(!n)return t(i._collectValues(),e),void e.close();i._showConfirmDialog().then(function(n){n===s.CLOSE&&(e.focus(),i._fields[a].focus()),n===s.YES&&(t(i._collectValues(),e),e.close())})})}}},{key:"_showConfirmDialog",value:function(){var e=this;return new Promise(function(t){Promise.resolve(e._getConfirmMessage(e._collectValues())).then(function(i){e._isConfirmDialogOpened=!0,(0,r.createConfirmDialog)({type:"modal",content:i}).then(function(i){i.on("action:yes",function(e){t(s.YES),e.close()}),i.on("afterClose",function(){t(s.CLOSE),e._isConfirmDialogOpened=!1}),i.open()})})})}},{key:"_validate",value:function(){return this._fields.find(function(e){return!e.valid})}},{key:"_collectValues",value:function(){return this._fields.reduce(function(e,t){return e[t.name]=t.value,e},{})}},{key:"_unmountFields",value:function(){this._fields.forEach(function(e){e.unmount&&e.unmount()})}}]),e}()},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o;Object.defineProperty(t,"__esModule",{value:!0}),o=function(){function e(e,t){var i,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),t.InputField=function(){function e(t){var i=t.label,o=t.name,r=t.maxLength,s=t.error,a=void 0===s?"":s;n(this,e),this._name=o,
this._$field=$('<label class="tv-rename-chart-dialog__field">\n\t\t\t\t<span class="tv-rename-chart-dialog__label">'+i+'</span>\n\t\t\t\t<input class="tv-control-input" type="text" name="'+o+'" maxlength="'+r+'"/>\n\t\t\t</label>'),this._$input=this._$field.find("input"),this._error=a}return o(e,[{key:"appendTo",value:function(e){e.append(this._$field)}},{key:"focus",value:function(){return this._$input.focus()}},{key:"select",value:function(){return this.focus().select()}},{key:"value",set:function(e){this._$input.val(e)},get:function(){return this._$input.val()}},{key:"name",get:function(){return this._name}},{key:"valid",get:function(){return!!this._$input.val().trim()}},{key:"error",set:function(e){this._error=e},get:function(){return this._error}}]),e}()},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"ChartChangesWatcher",function(){return r}),n=i(8),o=i.n(n),r=function(){function e(e,t,i){this._hasChanges=!1,this._undoHistory=e,this._chartSaver=t,this._globalEvents=i,this._onValueChanged=new o.a,this._subscribe()}return e.prototype.destroy=function(){this._unsubscribe(),this._onValueChanged.destroy()},e.prototype.hasChanges=function(){return this._hasChanges},e.prototype.getOnChange=function(){return this._onValueChanged},e.prototype._subscribe=function(){this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleChangeUndoStack),this._chartSaver.chartSaved().subscribe(this,this._handleChartSaved)},e.prototype._unsubscribe=function(){this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleChangeUndoStack),this._chartSaver.chartSaved().unsubscribe(this,this._handleChartSaved)},e.prototype._setChanges=function(e){this._hasChanges=e,this._onValueChanged.fire(e)},e.prototype._handleChartLoaded=function(){this._setChanges(!1)},e.prototype._handleChangeUndoStack=function(){var e=this._undoHistory.undoStack().head();e&&!e.customFlag("doesnt_affect_save")&&this._setChanges(!0)},e.prototype._handleChartSaved=function(e){e&&this._setChanges(!1)},e}()},function(e,t,i){"use strict";function n(e,t){o.enabled("saveload_requires_authentication")?window.runOrSignIn(e,t):e()}var o;t.a=n,o=i(5),i.n(o)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"debounce",function(){return n});var n=function(e,t){function i(){e.apply(o,n)}var n,o,r=0;return function(){o=this,n=arguments,clearTimeout(r),r=setTimeout(i,t)}}},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"UndoMacroCommand",function(){return r}),n=i(1),o=i(43),r=function(e){function t(t){var i=e.call(this,t,!1)||this;return i._subcommands=[],i}return n.c(t,e),t.prototype.addCommand=function(e){this._subcommands.push(e)},t.prototype.isEmpty=function(){return 0===this._subcommands.length},t.prototype.redo=function(){
@@ -268,10 +268,10 @@ data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
"right"!==this._data.horzAlign&&"center"!==this._data.horzAlign||(P="center"===this._data.horzAlign?e-S.w/2:e-S.w-(S.x-e),T=P-S.x,t+=T,S.x=P,!0!==this._data.doNotAlignText&&("right"===this._data.horzAlign?(r.textAlign="end",t+=d):(r.textAlign="center",t+=d/2))),S.w%2!=0&&S.w++,S.x+=.5,S.y+=.5,this._boundingRect=[new s(S.x,S.y),new s(S.x+S.w,S.y+S.h)],this._rect=S,this._padding=f,this._defaultPadding=v}else"bottom"!==this._data.vertAlign&&"middle"!==this._data.vertAlign||(n-=Math.round(h*("middle"===this._data.vertAlign?.5:1))),x=t,"right"!==this._data.horzAlign&&"center"!==this._data.horzAlign||(x-=Math.round(d*("center"===this._data.horzAlign?.5:1))),this._boundingRect=[new s(x,n),new s(x+d,n+h)];this._textPoint={x:t,y:n},this._textSizeCache&&(this._textSizeCache.widths=u),this._preRendered=!0,this._maxWidth=d}},n.prototype._drawIcon=function(e,t,i,n){var o,r,s,a;if(u.hasOwnProperty(n)){if(o=u[n],!o.src){for(o.src=document.createElement("canvas"),o.src.width=o.width,o.src.height=o.height,r=o.src.getContext("2d"),s=r.createImageData(o.width,o.height),a=0;a<o.data.length;a++)s.data[a]=o.data[a];r.putImageData(s,0,0)}e.drawImage(o.src,t,i)}},n.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._fontSize+"px "+this._data.font},n.prototype.draw=function(e){var t,i,n,o,r,s,a,l,c,u,d;if(0!==this._data.points.length){for(this._preRender(),t=this._fontSize,i=this._lineSpacing,n=t+i,e.textBaseline="top",e.font=this.fontStyle(),o=this._rect,(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth)&&this._rect?("right"!==this._data.horzAlign&&"center"!==this._data.horzAlign||!0!==this._data.doNotAlignText&&(e.textAlign="right"===this._data.horzAlign?"end":"center"),this._data.backgroundRoundRect?(h(e,o.x,o.y,o.w,o.h,this._data.backgroundRoundRect),this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.globalAlpha=this._data.backgroundTransparency,e.fill(),e.globalAlpha=1),this._data.borderColor&&(r="number"==typeof this._data.borderWidth?this._data.borderWidth:~~Math.max(t/12,1),e.strokeStyle=this._data.borderColor,e.lineWidth=r,e.stroke())):(this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.globalAlpha=this._data.backgroundTransparency,e.fillRect(o.x,o.y,o.w,o.h),e.globalAlpha=1),this._data.borderColor?(r="number"==typeof this._data.borderWidth?this._data.borderWidth:~~Math.max(t/12,1),e.strokeStyle=this._data.borderColor,e.lineWidth=r,e.strokeRect(o.x-r/2,o.y-r/2,o.w+r,o.h+r)):this._data.highlightBorder&&(e.strokeStyle=this._data.color,e.lineWidth=1,e.beginPath(),l=[3,1],e.dashedLineTo(o.x-.5,a=o.y-.5,s=o.x+o.w+.5,a,l),e.dashedLineTo(s,a,s,a=o.y+o.h+.5,l),e.dashedLineTo(s=o.x-.5,a,o.x+o.w+.5,a,l),e.dashedLineTo(s,o.y-.5,s,a,l),e.globalAlpha=.5,e.stroke(),e.globalAlpha=1)),this._data.icons&&this._data.icons.forEach(function(t,i){var r=o.x+this._defaultPadding,s=o.y+this._padding.top+n*i;this._drawIcon(e,r,s,t)
},this)):"right"===this._data.horzAlign?e.textAlign="end":"center"===this._data.horzAlign&&(e.textAlign="center"),c=this._textPoint.x,u=this._textPoint.y,e.fillStyle=this._data.color,this._data.forceTextAlign&&(e.textAlign=this._data.horzAlign?this._data.horzAlign:"left"),d=0;d<this._lines.length;d++)e.fillText(this._lines[d],c,u),u+=n;return{width:o.w+2}}},n.prototype.hitTest=function(e){return 0===this._data.points.length?null:(this._preRender(),this._boundingRect&&a(e,this._boundingRect[0],this._boundingRect[1])?this._hittest:null)},t.TrendLineStatsRenderer=n},,,function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"RiskRewardPointIndex",function(){return n});var n;!function(e){e[e.Entry=0]="Entry",e[e.Close=1]="Close",e[e.ActualEntry=2]="ActualEntry",e[e.ActualClose=3]="ActualClose"}(n||(n={}))},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"AlertStatus",function(){return n}),i.d(t,"Direction",function(){return o}),function(e){e[e.Waiting=0]="Waiting",e[e.Success=1]="Success",e[e.Failure=2]="Failure"}(n||(n={})),function(e){e[e.Up=1]="Up",e[e.Down=2]="Down"}(o||(o={}))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"CalloutConsts",function(){return n});var n;!function(e){e[e.RoundRadius=8]="RoundRadius",e[e.TextMargins=2]="TextMargins",e[e.MinWidth=100]="MinWidth"}(n||(n={}))},function(e,t,i){"use strict";function n(e,t){return e.compareTo(t)}function o(e){return Array.from(e).reduce(function(e,t){var i=+t;return-1===e.indexOf(i)&&e.push(i),e},[])}function r(e,t,i){var n=6e4,o=new Date(t.valueOf()+e*n);return e+(i.offset_loc(t)/n-i.offset_loc(o)/n)}var s,a,l,c,h,u,d,p;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SessionEntry",function(){return d}),i.d(t,"ExchangeSession",function(){return p}),s=i(35),i.n(s),a=i(78),l=i(4),c=Object(l.getLogger)("Chart.Model.ExchangeSession"),h=[s.MONDAY,s.TUESDAY,s.WEDNESDAY,s.THURSDAY,s.FRIDAY],u=[s.SUNDAY,s.MONDAY,s.TUESDAY,s.WEDNESDAY,s.THURSDAY,s.FRIDAY,s.SATURDAY],d=function(){function e(e,t,i){this._dayOfWeek=e,this._start=t,this._length=i}return e.prototype.start=function(){return this._start},e.prototype.alignedStart=function(){return this._start<0?this._start+s.minutesPerDay:this._start},e.prototype.isOvernight=function(){return this._start<0},e.prototype.dayOfWeek=function(){return this._dayOfWeek},e.prototype.length=function(){return this._length},e.prototype.weight=function(){return this._dayOfWeek*s.minutesPerDay+this._start},e.prototype.compareTo=function(e){var t=this.weight(),i=t+this._length,n=e.weight();return t<=n&&n<i?0:t>n?1:-1},e}(),p=function(){function e(e){void 0===e&&(e="0000-0000");var t=this;this._entries=[],this._firstDayOfWeek=s.MONDAY,this._weekEndsCount=null,"24x7"===e.toLowerCase()?u.forEach(function(e){t.addSessionEntry(e,0,0)}):this._parseSpec(e),this._entries.sort(n)}return e.prototype.entries=function(){return this._entries},e.prototype.firstDayOfWeek=function(){return this._firstDayOfWeek},
e.prototype.addSessionEntry=function(e,t,i){i<=t&&0!==t&&(t-=s.minutesPerDay);var n=i===t?s.minutesPerDay:i-t;this._entries.push(new d(e,t,n))},e.prototype.isWeekEnd=function(e){var t=Object(a.lowerbound)(this._entries,new d(e,0,0),function(e,t){return e.dayOfWeek()<t.dayOfWeek()});return t>this._entries.length-1||this._entries[t].dayOfWeek()!==e},e.prototype.weekEndsCount=function(){if(null===this._weekEndsCount){var e={};this._entries.forEach(function(t){e[t.dayOfWeek()]=1}),this._weekEndsCount=7-Object.keys(e).reduce(function(t,i){return t+(e[+i]||0)},0)}return this._weekEndsCount},e.prototype.hasWeekEnds=function(){return this.weekEndsCount()>0},e.prototype.indexOfSessionEntry=function(e,t){var i=Object(a.lowerbound)(this._entries,new d(e,t,0),function(e,t){return e.compareTo(t)<0});return i>this._entries.length-1?0:i},e.prototype.findSessionEntry=function(e,t){return this._entries[this.indexOfSessionEntry(e,t)]},e.prototype.correctTradingDay=function(e,t){var i=s.get_day_of_week(e),n=60*s.get_hours(e)+s.get_minutes(e),o=this.findSessionEntry(i,n),r=o.dayOfWeek(),a=(r-i+7)%7;return 0!==a&&s.add_date(e,a),e},e.prototype.alignToSessionStart=function(e,t){var i=s.get_day_of_week(e),n=s.get_minutes_from_midnight(e),o=this.findSessionEntry(i,n),a=o.alignedStart(),l=o.dayOfWeek(),c=o.isOvernight(),h=(l-i+7)%7-(c?1:0);return 0!==h&&s.add_date(e,h),s.set_hms(e,a/60|0,a%60,0,0,t),r(o.length(),e,t)},e.prototype._parseSpec=function(e){var t=this,i={},n=!1;e=this._parseFirstDayOfWeek(e),e.split("|").forEach(function(e){var t,r,s=e.split(":");if(1!==s.length&&2!==s.length)return void c.logError("Bad session section: "+e);if(t=1===s.length){if(n)return void c.logError("Duplicated default section: "+e);n=!0}r=t?h:o(s[1]),r.forEach(function(e){t&&i[e]||(i[e]=s[0])})}),u.forEach(function(n){var o=i[n];void 0!==o&&o.split(",").forEach(function(i){var o,r,a=i.split("-");2!==a.length&&(c.logError("Bad sessions spec: "+e),a=["0000","0000"]),o=a[0],r=a[1],t.addSessionEntry(n,s.get_minutes_from_hhmm(o),s.get_minutes_from_hhmm(r))})})},e.prototype._parseFirstDayOfWeek=function(e){var t,i,n,o=e.split(";");return o.length>2?(c.logError("Only one `first day` specification expected @ session "+e),e):1===o.length?e:(t=o[0].indexOf("-")>=0,i=t?NaN:parseInt(o[0]),n=1,isNaN(i)&&(n=0,i=parseInt(o[1])),i<s.SUNDAY||i>s.SATURDAY?(c.logError("Unexpected day index @ session: "+e+"; day index "+i),e):(this._firstDayOfWeek=i,o[n]))},e}()},function(e,t,i){"use strict";var n,o,r;i.d(t,"a",function(){return r}),n=i(1),o=i(115),r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.c(t,e),t.prototype._startLoading=function(){return i.e(28).then(i.bind(null,812))},t}(o.a)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";(function(e){function t(){var t=window.parent[window.urlParams.uid].settingsAdapter;null!=t?(TVSettings.setSettingsAdapter(t),TVSettings.sync()):e.enabled("use_localstorage_for_settings")&&TVSettings.sync()}function n(){
var e,t,i,n,o=urlParams.theme;return o?(e=f.savedThemeName(),t=o.toLowerCase(),(i=f.themes[t])?(f.setTheme(i.name),f.syncTheme(),o===e?$.Deferred().resolve():(n=$.Deferred(),f.getStdTheme(i.name).then(function(e){n.resolve(e.content)}).catch(function(e){console.warn("Cannot load theme {0}, reason: {1}".format(i.name,e)),n.resolve()}),n.promise())):$.Deferred().resolve()):$.Deferred().resolve()}function o(e){var t=/(\d+)(\w+)/;return e.map(function(e){var i=t.exec(e.text),n=i[2].toLowerCase(),o=parseInt(i[1]),r="y"===n?12*o+"m":o+n,s=q.Symbol.parsePeriod(e.resolution);return{text:window.t(e.title)||o+window.t(n,{context:"dates",count:o}),description:e.description||"",value:r,targetResolution:e.resolution,requiresIntraday:s.isIntraday}})}function r(){JSON.parse(urlParams.disabledFeatures).forEach(function(t){e.setEnabled(t,!1)}),JSON.parse(urlParams.enabledFeatures).forEach(function(t){e.setEnabled(t,!0)})}function s(){e.enabled("saveload_storage_customization")&&(window.parent[urlParams.uid].saveLoadAdapter?m.setCustomAdapter(window.parent[urlParams.uid].saveLoadAdapter):void 0!==urlParams.chartsStorageUrl&&urlParams.chartsStorageUrl&&void 0!==urlParams.clientId&&urlParams.clientId?m.initialize(urlParams.clientId,urlParams.userId,urlParams.chartsStorageUrl,urlParams.chartsStorageVer||"1.0"):(e.setEnabled("saveload_storage_customization",!1),e.setEnabled("header_saveload",!1)))}function a(){ee.resolve()}function l(t){var n,o,r,s,a,l;return e.enabled("header_widget")?(n=B.allocate({areaName:"top"}),o=i(255).ChartChangesWatcher,r=new o(t.chartWidgetCollection.undoHistory,window.saver,T),s=JSON.parse(urlParams.favorites),s.intervals=s.intervals.map(function(e){var t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t}),a=null,e.enabled("study_templates")&&(a=new w(A,TVSettings),window.studyTemplates=new b({chartWidgetCollection:t.chartWidgetCollection,favoriteStudyTemplatesService:a})),l=Modernizr.touch?["full"]:e.enabled("caption_buttons_text_if_possible")?void 0:["medium"],new d(new u,{chartSaver:window.saver,chartApiInstance:ChartApiInstance,chartWidgetCollection:t.chartWidgetCollection,defaultIntervals:Object.keys(ChartApiInstance.defaultResolutions()),defaultFavoriteStyles:s.chartTypes,defaultFavoriteIntervals:s.intervals,hideStudyTemplates:!0,resizerBridge:n,studyMarket:window.studyMarket,studyTemplates:window.studyTemplates,favoriteStudyTemplatesService:a,allowedModes:l,saveChartService:t.saveChartService,loadChartService:t.loadChartService,chartChangesWatcher:r})):null}function c(e){if(Z){var t=urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)?urlParams.toolbarbg+"":void 0;return t&&$("<style>").text("body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}").appendTo($("head")),new p({bgColor:t,chartWidgetCollection:e,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,resizerBridge:B.allocate({areaName:"left"})})}return null}var h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,N,F,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee,te;i(464),i(11),
h=i(465).i18nReady,i(466),i(133),i(474),r(),u=i(475).RestrictedToolsetBootloader,d=i(476).HeaderToolbarBootloader,p=i(479).DrawingToolbarBootloader,_=i(206).isDrawingToolbarVisible,f=i(251),m=i(252),y=i(41).Action,g=i(482).ChartSaver,v=i(483).SaveChartService,S=i(485).LoadChartService,b=i(487).StudyTemplates,w=i(494).FavoriteStudyTemplateService,P=i(62).linking,T=i(31),x=i(21),C=x.formatterOptions,L=x.customFormatters,I=i(495).StudyMarket,A=i(108).TVXWindowEvents,k=i(497).createDeferredPromise,E=i(205),M=i(15).Interval,V=i(498).Root,D=i(500).ChartPage,O=i(135).destroyQuoteSessions,R=new V(window),B=new D(R.allocate()),i(503),N=i(504),F=i(291).createFavoriteDrawingToolbar,W=i(668),H=i(26),j=i(678),i(183),i(686),z=i(128).setSearchRequestDelay,U=i(40),q=i(25),Y=window.parent[urlParams.uid].customIndicatorsUrl,G=$.Deferred(),K=$.Deferred(),Z=e.enabled("left_toolbar"),$.when(G,K).done(function(){window.ChartApiInstance.start()}),Y?$.getScript(Y).done(function(){void 0!==window.__customIndicators&&window.isArray(window.__customIndicators)&&(window.PineJS=i(25),JSServer.studyLibrary=JSServer.studyLibrary.concat(window.__customIndicators),console.log("{0} custom indicators loaded.".format(window.__customIndicators.length)),G.resolve())}).fail(function(e){console.warn("Error loading custom indicators @ `{0}`: {1} ({2}) ".format(Y,e.statusText,e.status)),G.resolve()}):G.resolve(),window.widgetReady=function(e){T.subscribe("onChartReady",e)},window.customizeUI=function(e){null!=e.studiesOverrides&&H.setDefaultsOverrides(e.studiesOverrides),window.__defaultsOverrides=e.defaultsOverrides},window.applyStudiesOverrides=function(e){e&&window.chartWidgetCollection.applyStudiesOverrides(e)},window.applyOverrides=function(e){$.extend(!0,window.__defaultsOverrides,e),window.applyDefaultsOverrides(TradingView.defaultProperties.chartproperties),window.applyDefaultOverridesToLinetools(),window.chartWidgetCollection.applyOverrides(e)},window.changeTheme=function(e){var t=f.themes[e.toLowerCase()];t&&window.tradingViewApi.themes().setStdTheme(t.name).then(function(){window.applyOverrides(window.__defaultsOverrides)})},window.is_authenticated=!1,window.parent[urlParams.uid].brokerFactory,JSON.parse(window.urlParams.brokerConfig),window.t("charts by TradingView"),window.t("powered by TradingView"),window.t("by TradingView"),J=null,X=k(),Q=function(t){function n(){w&&w.load(),x&&x.load().then(function(e){TradingView.bottomWidgetBar=e}),A&&A.load().then(function(e){window.footerWidget=e}),k&&k.load().then(function(e){window.widgetbar=e,null==window.tradingViewApi.watchlist()&&window.tradingViewApi.setWatchlistManager(null)})}var r,s,a,h,u,d,p,f,m,y,b,w,x,A,k;if(!Modernizr.canvas||!Modernizr.canvastext)throw Error("Charting library cannot be running under this browser");e.setEnabled("charting_library_debug_mode","true"===urlParams.debug),e.setEnabled("chart_property_page_trading",!1),e.setEnabled("chart_property_page_template_button",!1),r=$("#library-container"),e.enabled("remove_library_container_border")&&(r.css("border","0px"),
r.css("padding","1px")),e.enabled("no_min_chart_width")&&(window.document.body.style.minWidth="0px"),window.customizeUI({studiesOverrides:urlParams.studiesOverrides?JSON.parse(urlParams.studiesOverrides):void 0,defaultsOverrides:JSON.parse(urlParams.overrides)}),urlParams.numeric_formatting=urlParams.numeric_formatting&&JSON.parse(urlParams.numeric_formatting),urlParams.numeric_formatting&&"string"==typeof urlParams.numeric_formatting.decimal_sign&&(C.decimalSign=urlParams.numeric_formatting.decimal_sign[0]),window.ChartApiInstance=new W(window.parent[urlParams.uid].datafeed),window.parent[urlParams.uid].customFormatters&&(window.parent[urlParams.uid].customFormatters.timeFormatter&&(L.timeFormatter=window.parent[urlParams.uid].customFormatters.timeFormatter),window.parent[urlParams.uid].customFormatters.dateFormatter&&(L.dateFormatter=window.parent[urlParams.uid].customFormatters.dateFormatter)),window.ChartApiInstance.setStudiesAccessController(window.ChartApiInstance.createStudiesAccessController(urlParams.studiesAccess)),s=urlParams.chartContent?JSON.parse(urlParams.chartContent).json:void 0,a=urlParams.interval||"D",h=o(JSON.parse(urlParams.timeFrames)),u=function(e,t){return e?t!==U.STATUS_DELAYED&&t!==U.STATUS_DELAYED_STREAMING&&t!==U.STATUS_READY?[]:h.filter(function(t){return!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&e.supported_resolutions.indexOf(M.normalize(t.targetResolution))<0)}):[]},d={resizerBridge:B.allocate({areaName:"center"}),padding:e.enabled("border_around_the_chart")?5:0,edge:e.enabled("border_around_the_chart")?4:0,content:s,widgetOptions:{hideIdeas:!0,addVolume:!0,handleSessionErrors:!0,muteSessionErrors:!0,timezone:urlParams.timezone,defSymbol:urlParams.symbol,defInterval:a,defTimeframe:urlParams.timeframe&&urlParams.timeframe.toLowerCase(),crossHairMenuEnabled:e.enabled("chart_crosshair_menu"),paneContextMenuEnabled:e.enabled("pane_context_menu"),priceScaleContextMenuEnabled:e.enabled("scales_context_menu"),marketStatusWidgetEnabled:e.enabled("display_market_status"),timeScaleWidget:{contextMenuEnabled:e.enabled("scales_context_menu"),timezoneMenuEnabled:e.enabled("timezone_menu")},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:e.enabled("lock_visible_time_range_on_resize")},goToDateEnabled:e.enabled("go_to_date"),seriesControlBarEnabled:e.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:e.enabled("go_to_date"),availableTimeFrames:u},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:e.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,extendedHoursButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,scalePropertiesButtonEnabled:e.enabled("main_series_scale_menu"),fullscreenButtonEnabled:!0}},globalEvents:!0,snapshotUrl:urlParams.snapshotUrl},Z&&(F(),d.widgetOptions.isDrawingToolbarVisible=_),s&&void 0!==s.extendedData&&(p=s.extendedData,d.metaInfo={id:p.uid,name:p.name,description:p.description,uid:p.uid,username:"",tags:""}),
f=window.chartWidgetCollection=new N(d),window.studyMarket=new I(f),"undefined"!=typeof serviceLocator&&serviceLocator.registerService(CHART_WIDGET_COLLECTION_SERVICE,f),f.activeChartWidget.subscribe(function(e){T.emit("activeChartChanged",f.getAll().indexOf(e))}),window.saver=new g(f),m=new v(f,window.saver),y=new S(f),window.chartWidget=f.activeChartWidget.value(),window.pro=new TradingView.Pro,b=l({chartWidgetCollection:f,saveChartService:m,loadChartService:y}),null!==b?b.load().then(function(e){J=e,X.resolve()}):(X.promise.catch(function(){}),X.reject("header widget is not loaded")),w=c(f),x=null,A=null,k=null,window.tradingViewApi=new j(f,window.ChartApiInstance,m,y),P.bindToChartWidgetCollection(f),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||z(Math.max(0,+urlParams.ssreqdelay)),window.ChartApiInstance.connect(),i.e(3).then(function(e){var t=i(822);window.lineToolPropertiesToolbar=new t(f)}.bind(null,i)).catch(i.oe),$(".tv-content").bind("contextmenu",function(e){var t=$(e.originalEvent.target);if(!t.is("input")&&!t.is("textarea"))return!1}),K.resolve(),f.undoHistory.undoStack().onChange().subscribe(null,E(function(){T.emit("onAutoSaveNeeded")},1e3*(urlParams.autoSaveDelay||5),{leading:!1,trailing:!0})),chartWidget.withModel(null,function(){ChartApiInstance.on("realtime_tick",function(e){T.emit("onTick",e)}),t&&void 0===s&&(f.applyTheme(t),window.applyOverrides(window.__defaultsOverrides)),e.enabled("charting_library_debug_mode")&&T.subscribeToAll(function(){var e=Array.prototype.slice.call(arguments);console.log('Event "{0}", arguments: {1}'.format(e[0],JSON.stringify(e.slice(1))))})}),f.firstWidgetInitialized?n():chartWidget.chartWidgetInitialized.subscribe(null,n,!0),T.subscribe("chart_load_requested",function(e){window.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})})},window.addEventListener("unload",function(){window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),O(),window.ChartApiInstance&&(window.ChartApiInstance.destroy(),window.ChartApiInstance=null)}),s(),ee=$.Deferred(),window.parent[urlParams.uid].loadLastChart&&e.enabled("saveload_storage_customization")?m.getCharts(function(e){if(0===e.length)return void a();var t=e.sort(function(e,t){return t.modified_iso-e.modified_iso})[0];m.getChartContent(t,function(e){var t=JSON.parse(e.content);t.extendedData=e,urlParams.chartContent=JSON.stringify({json:t}),a()},a)},a):a(),t(),te=$.Deferred(),$.when(n(),h,te,ee).done(function(t){if($(window).resize(),$(".loading-indicator").hide(),setTimeout(Q.bind(null,t),0),e.enabled("14851")&&(Math.random()<=.02||e.enabled("cqg_terminal")||e.enabled("amp_terminal"))){!function(e,t,i,n,o,r,s){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,r=t.createElement(i),s=t.getElementsByTagName(i)[0],r.async=1,r.src=n,s.parentNode.insertBefore(r,s)
var e,t,i,n,o=urlParams.theme;return o?(e=f.savedThemeName(),t=o.toLowerCase(),(i=f.themes[t])?(f.setTheme(i.name),f.syncTheme(),o===e?$.Deferred().resolve():(n=$.Deferred(),f.getStdTheme(i.name).then(function(e){n.resolve(e.content)}).catch(function(e){console.warn("Cannot load theme {0}, reason: {1}".format(i.name,e)),n.resolve()}),n.promise())):$.Deferred().resolve()):$.Deferred().resolve()}function o(e){var t=/(\d+)(\w+)/;return e.map(function(e){var i=t.exec(e.text),n=i[2].toLowerCase(),o=parseInt(i[1]),r="y"===n?12*o+"m":o+n,s=q.Symbol.parsePeriod(e.resolution);return{text:window.t(e.title)||o+window.t(n,{context:"dates",count:o}),description:e.description||"",value:r,targetResolution:e.resolution,requiresIntraday:s.isIntraday}})}function r(){JSON.parse(urlParams.disabledFeatures).forEach(function(t){e.setEnabled(t,!1)}),JSON.parse(urlParams.enabledFeatures).forEach(function(t){e.setEnabled(t,!0)})}function s(){e.enabled("saveload_storage_customization")&&(window.parent[urlParams.uid].saveLoadAdapter?m.setCustomAdapter(window.parent[urlParams.uid].saveLoadAdapter):void 0!==urlParams.chartsStorageUrl&&urlParams.chartsStorageUrl&&void 0!==urlParams.clientId&&urlParams.clientId?m.initialize(urlParams.clientId,urlParams.userId,urlParams.chartsStorageUrl,urlParams.chartsStorageVer||"1.0"):(e.setEnabled("saveload_storage_customization",!1),e.setEnabled("header_saveload",!1)))}function a(){ee.resolve()}function l(t){var n,o,r,s,a,l;return e.enabled("header_widget")?(n=B.allocate({areaName:"top"}),o=i(255).ChartChangesWatcher,r=new o(t.chartWidgetCollection.undoHistory,window.saver,T),s=JSON.parse(urlParams.favorites),s.intervals=s.intervals.map(function(e){var t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t}),a=null,e.enabled("study_templates")&&(a=new w(A,TVSettings),window.studyTemplates=new b({chartWidgetCollection:t.chartWidgetCollection,favoriteStudyTemplatesService:a})),l=Modernizr.touch?["full"]:e.enabled("caption_buttons_text_if_possible")?void 0:["medium"],new d(new u,{chartSaver:window.saver,chartApiInstance:ChartApiInstance,chartWidgetCollection:t.chartWidgetCollection,defaultIntervals:Object.keys(ChartApiInstance.defaultResolutions()),defaultFavoriteStyles:s.chartTypes,defaultFavoriteIntervals:s.intervals,hideStudyTemplates:!0,resizerBridge:n,studyMarket:window.studyMarket,studyTemplates:window.studyTemplates,favoriteStudyTemplatesService:a,allowedModes:l,saveChartService:t.saveChartService,loadChartService:t.loadChartService,chartChangesWatcher:r})):null}function c(e){if(Z){var t=urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)?urlParams.toolbarbg+"":void 0;return t&&$("<style>").text("body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}").appendTo($("head")),new p({bgColor:t,chartWidgetCollection:e,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,resizerBridge:B.allocate({areaName:"left"})})}return null}var h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,F,N,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee,te;i(464),i(11),
h=i(465).i18nReady,i(466),i(133),i(474),r(),u=i(475).RestrictedToolsetBootloader,d=i(476).HeaderToolbarBootloader,p=i(479).DrawingToolbarBootloader,_=i(206).isDrawingToolbarVisible,f=i(251),m=i(252),y=i(41).Action,g=i(482).ChartSaver,v=i(483).SaveChartService,S=i(485).LoadChartService,b=i(487).StudyTemplates,w=i(494).FavoriteStudyTemplateService,P=i(62).linking,T=i(31),x=i(21),C=x.formatterOptions,L=x.customFormatters,I=i(495).StudyMarket,A=i(108).TVXWindowEvents,k=i(497).createDeferredPromise,E=i(205),M=i(15).Interval,V=i(498).Root,D=i(500).ChartPage,O=i(135).destroyQuoteSessions,R=new V(window),B=new D(R.allocate()),i(503),F=i(504),N=i(291).createFavoriteDrawingToolbar,W=i(668),H=i(26),j=i(678),i(183),i(686),z=i(128).setSearchRequestDelay,U=i(40),q=i(25),Y=window.parent[urlParams.uid].customIndicatorsUrl,G=$.Deferred(),K=$.Deferred(),Z=e.enabled("left_toolbar"),$.when(G,K).done(function(){window.ChartApiInstance.start()}),Y?$.getScript(Y).done(function(){void 0!==window.__customIndicators&&window.isArray(window.__customIndicators)&&(window.PineJS=i(25),JSServer.studyLibrary=JSServer.studyLibrary.concat(window.__customIndicators),console.log("{0} custom indicators loaded.".format(window.__customIndicators.length)),G.resolve())}).fail(function(e){console.warn("Error loading custom indicators @ `{0}`: {1} ({2}) ".format(Y,e.statusText,e.status)),G.resolve()}):G.resolve(),window.widgetReady=function(e){T.subscribe("onChartReady",e)},window.customizeUI=function(e){null!=e.studiesOverrides&&H.setDefaultsOverrides(e.studiesOverrides),window.__defaultsOverrides=e.defaultsOverrides},window.applyStudiesOverrides=function(e){e&&window.chartWidgetCollection.applyStudiesOverrides(e)},window.applyOverrides=function(e){$.extend(!0,window.__defaultsOverrides,e),window.applyDefaultsOverrides(TradingView.defaultProperties.chartproperties),window.applyDefaultOverridesToLinetools(),window.chartWidgetCollection.applyOverrides(e)},window.changeTheme=function(e){var t=f.themes[e.toLowerCase()];t&&window.tradingViewApi.themes().setStdTheme(t.name).then(function(){window.applyOverrides(window.__defaultsOverrides)})},window.is_authenticated=!1,window.parent[urlParams.uid].brokerFactory,JSON.parse(window.urlParams.brokerConfig),window.t("charts by TradingView"),window.t("powered by TradingView"),window.t("by TradingView"),J=null,X=k(),Q=function(t){function n(){w&&w.load(),x&&x.load().then(function(e){TradingView.bottomWidgetBar=e}),A&&A.load().then(function(e){window.footerWidget=e}),k&&k.load().then(function(e){window.widgetbar=e,null==window.tradingViewApi.watchlist()&&window.tradingViewApi.setWatchlistManager(null)})}var r,s,a,h,u,d,p,f,m,y,b,w,x,A,k;if(!Modernizr.canvas||!Modernizr.canvastext)throw Error("Charting library cannot be running under this browser");e.setEnabled("charting_library_debug_mode","true"===urlParams.debug),e.setEnabled("chart_property_page_trading",!1),e.setEnabled("chart_property_page_template_button",!1),r=$("#library-container"),e.enabled("remove_library_container_border")&&(r.css("border","0px"),
r.css("padding","1px")),e.enabled("no_min_chart_width")&&(window.document.body.style.minWidth="0px"),window.customizeUI({studiesOverrides:urlParams.studiesOverrides?JSON.parse(urlParams.studiesOverrides):void 0,defaultsOverrides:JSON.parse(urlParams.overrides)}),urlParams.numeric_formatting=urlParams.numeric_formatting&&JSON.parse(urlParams.numeric_formatting),urlParams.numeric_formatting&&"string"==typeof urlParams.numeric_formatting.decimal_sign&&(C.decimalSign=urlParams.numeric_formatting.decimal_sign[0]),window.ChartApiInstance=new W(window.parent[urlParams.uid].datafeed),window.parent[urlParams.uid].customFormatters&&(window.parent[urlParams.uid].customFormatters.timeFormatter&&(L.timeFormatter=window.parent[urlParams.uid].customFormatters.timeFormatter),window.parent[urlParams.uid].customFormatters.dateFormatter&&(L.dateFormatter=window.parent[urlParams.uid].customFormatters.dateFormatter)),window.ChartApiInstance.setStudiesAccessController(window.ChartApiInstance.createStudiesAccessController(urlParams.studiesAccess)),s=urlParams.chartContent?JSON.parse(urlParams.chartContent).json:void 0,a=urlParams.interval||"D",h=o(JSON.parse(urlParams.timeFrames)),u=function(e,t){return e?t!==U.STATUS_DELAYED&&t!==U.STATUS_DELAYED_STREAMING&&t!==U.STATUS_READY?[]:h.filter(function(t){return!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&e.supported_resolutions.indexOf(M.normalize(t.targetResolution))<0)}):[]},d={resizerBridge:B.allocate({areaName:"center"}),padding:e.enabled("border_around_the_chart")?5:0,edge:e.enabled("border_around_the_chart")?4:0,content:s,widgetOptions:{hideIdeas:!0,addVolume:!0,handleSessionErrors:!0,muteSessionErrors:!0,timezone:urlParams.timezone,defSymbol:urlParams.symbol,defInterval:a,defTimeframe:urlParams.timeframe&&urlParams.timeframe.toLowerCase(),crossHairMenuEnabled:e.enabled("chart_crosshair_menu"),paneContextMenuEnabled:e.enabled("pane_context_menu"),priceScaleContextMenuEnabled:e.enabled("scales_context_menu"),marketStatusWidgetEnabled:e.enabled("display_market_status"),timeScaleWidget:{contextMenuEnabled:e.enabled("scales_context_menu"),timezoneMenuEnabled:e.enabled("timezone_menu")},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:e.enabled("lock_visible_time_range_on_resize")},goToDateEnabled:e.enabled("go_to_date"),seriesControlBarEnabled:e.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:e.enabled("go_to_date"),availableTimeFrames:u},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:e.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,extendedHoursButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,scalePropertiesButtonEnabled:e.enabled("main_series_scale_menu"),fullscreenButtonEnabled:!0}},globalEvents:!0,snapshotUrl:urlParams.snapshotUrl},Z&&(N(),d.widgetOptions.isDrawingToolbarVisible=_),s&&void 0!==s.extendedData&&(p=s.extendedData,d.metaInfo={id:p.uid,name:p.name,description:p.description,uid:p.uid,username:"",tags:""}),
f=window.chartWidgetCollection=new F(d),window.studyMarket=new I(f),"undefined"!=typeof serviceLocator&&serviceLocator.registerService(CHART_WIDGET_COLLECTION_SERVICE,f),f.activeChartWidget.subscribe(function(e){T.emit("activeChartChanged",f.getAll().indexOf(e))}),window.saver=new g(f),m=new v(f,window.saver),y=new S(f),window.chartWidget=f.activeChartWidget.value(),window.pro=new TradingView.Pro,b=l({chartWidgetCollection:f,saveChartService:m,loadChartService:y}),null!==b?b.load().then(function(e){J=e,X.resolve()}):(X.promise.catch(function(){}),X.reject("header widget is not loaded")),w=c(f),x=null,A=null,k=null,window.tradingViewApi=new j(f,window.ChartApiInstance,m,y),P.bindToChartWidgetCollection(f),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||z(Math.max(0,+urlParams.ssreqdelay)),window.ChartApiInstance.connect(),i.e(3).then(function(e){var t=i(822);window.lineToolPropertiesToolbar=new t(f)}.bind(null,i)).catch(i.oe),$(".tv-content").bind("contextmenu",function(e){var t=$(e.originalEvent.target);if(!t.is("input")&&!t.is("textarea"))return!1}),K.resolve(),f.undoHistory.undoStack().onChange().subscribe(null,E(function(){T.emit("onAutoSaveNeeded")},1e3*(urlParams.autoSaveDelay||5),{leading:!1,trailing:!0})),chartWidget.withModel(null,function(){ChartApiInstance.on("realtime_tick",function(e){T.emit("onTick",e)}),t&&void 0===s&&(f.applyTheme(t),window.applyOverrides(window.__defaultsOverrides)),e.enabled("charting_library_debug_mode")&&T.subscribeToAll(function(){var e=Array.prototype.slice.call(arguments);console.log('Event "{0}", arguments: {1}'.format(e[0],JSON.stringify(e.slice(1))))})}),f.firstWidgetInitialized?n():chartWidget.chartWidgetInitialized.subscribe(null,n,!0),T.subscribe("chart_load_requested",function(e){window.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})})},window.addEventListener("unload",function(){window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),O(),window.ChartApiInstance&&(window.ChartApiInstance.destroy(),window.ChartApiInstance=null)}),s(),ee=$.Deferred(),window.parent[urlParams.uid].loadLastChart&&e.enabled("saveload_storage_customization")?m.getCharts(function(e){if(0===e.length)return void a();var t=e.sort(function(e,t){return t.modified_iso-e.modified_iso})[0];m.getChartContent(t,function(e){var t=JSON.parse(e.content);t.extendedData=e,urlParams.chartContent=JSON.stringify({json:t}),a()},a)},a):a(),t(),te=$.Deferred(),$.when(n(),h,te,ee).done(function(t){if($(window).resize(),$(".loading-indicator").hide(),setTimeout(Q.bind(null,t),0),e.enabled("14851")&&(Math.random()<=.02||e.enabled("cqg_terminal")||e.enabled("amp_terminal"))){!function(e,t,i,n,o,r,s){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,r=t.createElement(i),s=t.getElementsByTagName(i)[0],r.async=1,r.src=n,s.parentNode.insertBefore(r,s)
}(window,document,"script","//www.google-analytics.com/analytics.js","ga");var i=document.URL.match(RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-126447705-1","auto"),ga("set","anonymizeIp",!0),ga("set",{hostname:i,page:i,referrer:i}),ga("send","pageview")}}),function(){var e=!0;window.parent[urlParams.uid].datafeed.onReady(function(t){e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=t,te.resolve()}),e=!1}(),window.getFunctionFromArguments=function(e){return window.parent[urlParams.uid][e]},window.createShortcutAction=function(){var e={};return function(t,i){void 0===e[t]&&(e[t]=new y({shortcut:t})),e[t].callbacks().subscribe(null,i)}}(),window.initializationFinished=function(){window.chartWidgetCollection.undoHistory.clearStack()},window.resizeWindow=function(){$(window).resize()},window.headerReady=function(){return X.promise},window.createButton=function(e){if(null===J)throw Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");e=e||{};var t=e.align||"left";return J.addButton(t)}}).call(t,i(5))},function(e,t){e.exports={14851:{},custom_items_in_context_menu:{},websocket_connection:{},countdown:{},symbol_search_parser_mixin:{},show_pro_features:{},daily_timeframe_suffix:{},symbollist_context_menu:{},pay_attention_to_ticker_not_symbol:{},graying_disabled_tools_enabled:{},update_study_formatter_on_symbol_resolve:{},constraint_dialogs_movement:{},same_data_requery:{},phone_verification:{},show_trading_notifications_history:{},show_interval_dialog_on_key_press:{},header_interval_dialog_button:{subsets:["show_interval_dialog_on_key_press"]},header_fullscreen_button:{},header_symbol_search:{},symbol_search_hot_key:{},header_resolutions:{subsets:["header_interval_dialog_button"]},header_chart_type:{},header_settings:{},header_indicators:{},header_compare:{},header_undo_redo:{},header_screenshot:{},header_saveload:{},study_on_study:{},header_widget:{subsets:["header_widget_dom_node","header_symbol_search","header_resolutions","header_chart_type","header_settings","header_indicators","header_compare","header_undo_redo","header_fullscreen_button","compare_symbol","header_screenshot"]},compare_symbol:{subsets:["header_compare"]},property_pages:{subsets:["show_chart_property_page","chart_property_page"]},show_chart_property_page:{},chart_property_page:{subsets:["chart_property_page_style","chart_property_page_scales","chart_property_page_background","chart_property_page_timezone_sessions","chart_property_page_events_alerts","chart_property_page_trading","chart_property_page_template_button"]},disable_userlink_popup:{},left_toolbar:{},hide_left_toolbar_by_default:{},control_bar:{},widget_logo:{},timeframes_toolbar:{},edit_buttons_in_legend:{subsets:["show_hide_button_in_legend","format_button_in_legend","study_buttons_in_legend","delete_button_in_legend"]},hide_legend_by_default:{},show_hide_button_in_legend:{},format_button_in_legend:{},
study_buttons_in_legend:{},delete_button_in_legend:{},pane_context_menu:{},scales_context_menu:{},legend_context_menu:{},context_menus:{subsets:["pane_context_menu","scales_context_menu","legend_context_menu","objects_tree_context_menu"]},items_favoriting:{},save_chart_properties_to_local_storage:{},use_localstorage_for_settings:{subsets:["items_favoriting","save_chart_properties_to_local_storage"]},plain_studymarket:{},trading_watch_positions:{},disable_resolution_rebuild:{},border_around_the_chart:{},charting_library_debug_mode:{},cl_feed_return_all_data:{},log_data_request_time:{},saveload_requires_authentication:{},saveload_storage_customization:{},new_chart_creation_available:{},volume_force_overlay:{},create_volume_indicator_by_default:{},create_volume_indicator_by_default_once:{},saved_charts_count_restriction:{},lean_chart_load:{},stop_study_on_restart:{},star_some_intervals_by_default:{},predefined_items_only_may_be_starred:{},move_logo_to_main_pane:{},show_logo_on_all_charts:{},show_animated_logo:{},link_to_tradingview:{},logo_without_link:{},right_bar_stays_on_scroll:{},chart_content_overrides_by_defaults:{},show_dialog_on_snapshot_ready:{},snapshot_trading_drawings:{},allow_supported_resolutions_set_only:{},study_market_minimized:{},widgetbar_tabs:{},collapsible_header:{},show_extension_popup:{},study_templates:{},side_toolbar_in_fullscreen_mode:{},remove_library_container_border:{},whotrades_auth_only:{},support_multicharts:{},display_market_status:{},display_data_mode:{},show_chart_warn_message:{},datasource_copypaste:{},line_tool_templates:{},expand_symbolsearch_items:{},symbol_search_three_columns_exchanges:{},symbol_search_flags:{},symbol_search_limited_exchanges:{},footer_bugreport_button:{},footer_publish_idea_button:{},footer_showdom_button:{},text_notes:{},symbol_info:{},no_bars_status:{},clear_bars_on_series_error:{},hide_loading_screen_on_series_error:{},seconds_resolution:{},dont_show_boolean_study_arguments:{},hide_last_na_study_output:{},price_scale_always_last_bar_value:{},study_dialog_search_control:{},study_dialog_fundamentals_economy_addons:{},uppercase_instrument_names:{},cqg_trading_confirm_risks:{},trading_notifications:{},chart_crosshair_menu:{},japanese_chart_styles:{},hide_series_legend_item:{},hide_study_overlay_legend_item:{},hide_study_compare_legend_item:{},linetoolpropertieswidget_template_button:{},use_overrides_for_overlay:{},timezone_menu:{},main_series_scale_menu:{},show_login_dialog:{},remove_img_from_rss:{},bars_marks:{},chart_scroll:{},chart_zoom:{},source_selection_markers:{},high_density_bars:{},open_account_manager:{},multiple_watchlists:{},onchart_messages:{},custom_resolutions_box:{},referral_program_for_widget_owners:{},no_min_chart_width:{},lock_visible_time_range_on_resize:{},referral_program_policy_aggressive:{subsets:["referral_program_policy_passive","referral_program_policy_normal"]},referral_program_policy_normal:{subsets:["referral_program_policy_passive","header_fake_features_buttons","custom_resolutions_box"]},tv_production:{
subsets:["show_pro_features","countdown","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","header_fullscreen_button","header_widget","dont_show_boolean_study_arguments","left_toolbar","control_bar","symbol_search_hot_key","context_menus","edit_buttons_in_legend","uppercase_instrument_names","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","new_chart_creation_available","saved_charts_count_restriction","create_volume_indicator_by_default","create_volume_indicator_by_default_once","charts_auto_save","right_bar_stays_on_scroll","save_old_chart_before_save_as","chart_content_overrides_by_defaults","alerts","show_dialog_on_snapshot_ready","show_extension_popup","header_saveload","header_layouttoggle","datasource_copypaste","show_saved_watchlists","watchlists_from_to_file","add_to_watchlist","property_pages","support_multicharts","display_market_status","display_data_mode","show_chart_warn_message","support_manage_drawings","widgetbar_tabs","study_templates","collapsible_header","line_tool_templates","caption_buttons_text_if_possible","footer_publish_idea_button","text_notes","trading_watch_positions","symbol_info","linetoolpropertieswidget_template_button","cqg_trading_confirm_risks","trading_notifications","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","phone_verification","chart_events","onchart_messages","custom_resolutions_box","compare_symbol","study_on_study","japanese_chart_styles","show_login_dialog","dome_widget","bars_marks","chart_scroll","chart_zoom","show_trading_notifications_history","source_selection_markers","study_dialog_fundamentals_economy_addons","multiple_watchlists","marked_symbols"]},browser_extension:{subsets:["disable_userlink_popup","show_pro_features","show_saved_watchlists","display_market_status","display_data_mode","show_chart_warn_message","widgetbar_tabs","show_login_dialog"]},widget:{subsets:["show_pro_features","countdown","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","uppercase_instrument_names","left_toolbar","control_bar","symbol_search_hot_key","context_menus","edit_buttons_in_legend","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","create_volume_indicator_by_default","create_volume_indicator_by_default_once","right_bar_stays_on_scroll","show_dialog_on_snapshot_ready","dont_show_boolean_study_arguments","header_widget_dom_node","header_symbol_search","header_resolutions","header_chart_type","header_compare","header_indicators","star_some_intervals_by_default","display_market_status","display_data_mode","show_chart_warn_message","symbol_info","linetoolpropertieswidget_template_button","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","widgetbar_tabs","compare_symbol","show_login_dialog","plain_studymarket","japanese_chart_styles","bars_marks","chart_scroll","chart_zoom","source_selection_markers","property_pages","show_animated_logo"]},
@@ -300,22 +300,22 @@ this._bridge.visible.subscribe(function(){return t._updateVisibility()}),this._b
;this._affectsLayout("footer")&&(o=this._areas.footer,p=this._height.value()-o.height.value(),this._affectsLayout("bottom")&&(p-=this._areas.bottom.height.value()),o.body.value().css({top:p})),this._affectsLayout("dompanel")&&(o=this._areas.dompanel,_=0,this._affectsLayout("right")&&(_+=this._areas.right.width.value()),o.body.value().css({right:_}))},e.prototype._affectsLayout=function(e){var t,i=this._areas[e];return!!i&&(i.rdState.owner.value()===i&&(this._fullscreenArea&&this._fullscreenArea!==e?s(e):!((this._width.value()<=567||this._height.value()<=450)&&(t=["center","top","left"],!t.includes(e)))))},e.prototype._updateVisibility=function(){var e,t,i,n=this._bridge.visible.value();for(e=0;e<this._availableAreas.length;e++)t=this._availableAreas[e],(i=this._areas[t])&&(n&&this._affectsLayout(t)?i.visible.setValue(!0):i.visible.setValue(!1))},e.prototype._onParentFullscreenChange=function(){this._bridge.fullscreen.value()||(this._fullscreenArea=void 0,this._updateFullscreen())},e.prototype._updateFullscreen=function(){var e,t,i,n=void 0!==this._fullscreenArea;for(e=0;e<this._availableAreas.length;e++)t=this._availableAreas[e],(i=this._areas[t])&&(t!==this._fullscreenArea?i.body.value().toggleClass("js-hidden",n&&!s(t)):i.fullscreen.setValue(!0));this._updateVisibility(),this.recalculate()},e.prototype._createDOM=function(e){var t=$("<div>").addClass("layout__area--"+e).css("position","absolute");return"bottom"===e?t.css("bottom",0):t.css("top",0),"right"===e||"dompanel"===e?t.css("right",0):t.css("left",0),t},e}()},function(e,t,i){"use strict";(function(e,t){function n(t,i){this.options=$.extend({throttleTimeout:125},i),this._connected=!1,this._symbol_data={},this._subscriptions={},this._delayed_subscriptions=[],this.fieldsSent=new $.Deferred,this.onConnect=new e,this.onDisconnect=new e,this._quoteApi=new o(window.ChartApiInstance),this._type=t||"full",this.fieldsSent=new $.Deferred,this._delayUpdateFastSymbols=s(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}var o,r=i(21).PriceFormatter,s=i(257).debounce,a=i(205),l=i(204),c=i(33);o=i(502),n.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},n.prototype.typeFields={},n.prototype.typeFields.simple=["ch","chp","current_session","description","local_description","language","exchange","fractional","is_tradable","lp","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","update_mode","volume"],n.prototype.typeFields.simpleDetailed=[].concat(n.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield"]),n.prototype.typeFields.full=[],n.prototype.connect=function(e){
this._quoteApi.connect(this.quoteHandler.bind(this))},n.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},n.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&this._quoteApi.quoteAddSymbols(e,{forcePermission:!0}),this._delayed_subscriptions.forEach(function(e){this.subscribe.apply(this,e)},this),this._delayed_subscriptions=[],this.onConnect.fire()},n.prototype.setFields=function(){var e=n.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e),this.fieldsSent.resolve()},n.prototype.onSymbolData=function(e){var t=e.symbolname,i=this._throttledSymbolData[t];i||(i=this._throttledSymbolData[t]={fnDispatch:a(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?$.extend(!0,i.cache,e):i.cache=e,i.fnDispatch(t)},n.prototype._parseUpdateMode=function(e){var t=e.update_mode;t&&(t=t.match(/(delayed_streaming){1}(?:_([\d]+))?/))&&t[1]&&(t[2]&&(e.update_mode_seconds=+t[2]),e.update_mode=t[1])},n.prototype.dipatchSymbolData=function(e){var t,i,n=this._symbol_data[e],o=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e]){$.extend(!0,n,o),n.values&&this._parseUpdateMode(n.values);for(t in this._subscriptions)i=this._subscriptions[t],i[e]&&i[e].forEach(function(e){e(n,o)})}},n.prototype.subscribe=function(e,t,i){var n,o;if(!this._connected)return void this._delayed_subscriptions.push(arguments);this._subscriptions[e]=this._subscriptions[e]||{},n=this._subscriptions[e],t=[].concat(t),o=[],t.forEach(function(e){this._symbol_data[e]?n&&n[e]||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},o.push(e)),n[e]=n[e]||[],n[e].push(i),n[e].fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])},this),o.length&&(this._quoteApi.quoteAddSymbols(o,{forcePermission:!0}),this._delayUpdateFastSymbols())},n.prototype.unsubscribe=function(e,t,i){var n,o=this._subscriptions[e];o&&(o[t]&&i?(n=o[t].indexOf(i),~n&&o[t].splice(n,1),o[t].length||delete o[t]):delete o[t]),o&&0===Object.keys(o).length&&delete this._subscriptions[e],this._symbol_data.hasOwnProperty(t)&&(o&&!o[t]&&this._symbol_data[t].subscribers_count--,this._symbol_data[t].subscribers_count||(delete this._symbol_data[t],this._quoteApi.quoteRemoveSymbols([t]),this._delayUpdateFastSymbols()))},n.prototype.setFastSymbols=function(e,t){var i,n;if(this._subscriptions[e]){i=this._subscriptions[e];for(n in i)i[n].fast=-1!==t.indexOf(n)}this._delayUpdateFastSymbols()},n.prototype._updateFastSymbols=function(){if(this._connected){var e=this._fastSymbols();0===e.length?this._quoteApi.quoteHibernateAll():this._quoteApi.quoteFastSymbols(e)}},
n.prototype._delayUpdateFastSymbols=n.prototype._updateFastSymbols,n.prototype._fastSymbols=function(){var e,t,i,n=[];for(e in this._subscriptions){t=this._subscriptions[e];for(i in t)t[i].fast&&n.push(i)}return n=l(n)},n.prototype.formatter=function(e,t){function i(e){var i=t&&!e.fractional?1:e.minmov;return new r(e.pricescale,i,e.fractional,e.minmove2)}function n(e){return e&&null!=e.pricescale&&null!=e.minmov}var o,s=this;return this._waitingForFormatters[e]?this._waitingForFormatters[e]:(o=new Promise(function(t,o){if(s._formatterValuesCache[e])t(i(s._formatterValuesCache[e]));else{var r=c.guid();s.subscribe(r,[e],function(a){a.error&&(s._waitingForFormatters[e]=null,o(a.error)),n(a.values)&&(s._waitingForFormatters[e]=null,s._formatterValuesCache[e]=a.values,t(i(a.values)),s.unsubscribe(r,e))})}}),this._waitingForFormatters[e]=o,o)},n.prototype.snapshot=function(e){var t,i=this;return this._waitingForSnapshot[e]?this._waitingForSnapshot[e]:(t=new Promise(function(t,n){if(i._snapshotValuesCache[e])t(i._snapshotValuesCache[e]);else{var o=c.guid();i.subscribe(o,[e],function(r){r.error&&(i._waitingForSnapshot[e]=null,n(r.error));var s=r.values;s&&s.minmov&&s.pricescale&&s.description&&(i._waitingForSnapshot[e]=null,i._snapshotValuesCache[e]=s,t(s),i.unsubscribe(o,e))})}}),this._waitingForSnapshot[e]=t,t)},TradingView.QuoteSessionMultiplexer=n,void 0!==t&&t&&t.exports&&(t.exports=n)}).call(t,i(8),i(51)(e))},function(e,t,i){"use strict";(function(e){function t(e){this._chartApi=e,this._sessionid="qs_"+n(),this._sessionstarted=!1}var n=i(33).randomHash;t.prototype.destroy=function(){this._sessionstarted&&(this._chartApi.quoteDeleteSession(this._sessionid),this._sessionid=null,this._sessionstarted=!1)},t.prototype.connected=function(){return this._chartApi.connected()},t.prototype.connect=function(e){this._globalHandler=e,this._chartApi.createSession(this._sessionid,this),this._chartApi.connect()},t.prototype.disconnect=function(){this._chartApi.disconnect()},t.prototype.quoteAddSymbols=function(e,t){e=[].concat(e),t&&t.forcePermission&&(e=e.concat({flags:["force_permission"]})),this._chartApi.quoteAddSymbols(this._sessionid,e)},t.prototype.quoteRemoveSymbols=function(e){this._chartApi.quoteRemoveSymbols(this._sessionid,e)},t.prototype.quoteFastSymbols=function(e){this._chartApi.quoteFastSymbols(this._sessionid,e)},t.prototype.quoteSetFields=function(e){this._chartApi.quoteSetFields(this._sessionid,e)},t.prototype.onMessage=function(e){switch(e.method){case"connected":this._sessionstarted||(this._chartApi.quoteCreateSession(this._sessionid),this._sessionstarted=!0);break;case"disconnected":this._sessionstarted=!1}this._globalHandler(e)},t.prototype.quoteHibernateAll=function(e){this._chartApi.quoteHibernateAll(this._sessionid)},TradingView.QuoteSession=t,void 0!==e&&e&&e.exports&&(e.exports=t)}).call(t,i(51)(e))},function(e,t,i){"use strict";var n=i(5);window.onload=function(){function e(){var e=0;return JSON.parse(urlParams.logo).image&&(e="C",n.enabled("link_to_tradingview")||(e="D")),e}function t(){try{
return/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(e){return!1}}location.hostname.indexOf(".")>=0&&!t()&&setTimeout(function(){try{var t=e();window.ga&&0!==t&&window.ga("send","event","s",t)}catch(e){}},3e4)}},function(e,t,i){"use strict";(function(t){function n(e){function n(e,t){var i,n,r=[],s=o[mt].count;for(i=0;i<s;i++)r.push(ct[i].chartWidget.state(e,t));return n={layout:mt,charts:r},vt.value()&&(n.symbolLock=1),St.value()&&(n.intervalLock=1),bt.value()&&(n.trackTimeLock=1),n}function x(e){var t,i=$.Deferred(),n=[],r=o[mt].count;for(t=0;t<r;t++)n.push(ct[t].chartWidget.asyncState(e));return $.when.apply($,n).then(function(){var e,t={charts:[]};for(e=0;e<arguments.length;e++)t.charts.push(arguments[e]);i.resolve(t)}),i}function C(){var e,t;for(e=Re?[Re]:ct.slice(0,ft.count).filter(function(e){return!e.hiddenInLayout.value()}),t=0;t<e.length;t++)L(e[t],t,e.length);je.trigger("chart-rect-update",je[0].getBoundingClientRect())}function L(e,t,i){var n=ft.sizer(t,{width:De.value(),height:Oe.value()},ot,rt,i),o={width:Math.max(Math.round(n.width||0)-2*st,0),height:Math.max(Math.round(n.height||0)-2*st,0),top:Math.max(Math.round(n.top||0),0),left:Math.max(Math.round(n.left||0),0)};e.metrics=o,e.body.value().css(o),e.width.setValue(o.width),e.height.setValue(o.height)}function I(){for(var e=0;e<ct.length;e++)ct[e].chartWidget.resizeSeriesControlUI()}function A(){for(var e=0;e<ct.length;e++)ct[e].chartWidget.tickSeriesControlClock()}function k(e){return e.rdState.owner.value()!==e}function E(e){var t,i=0,n=0;for(t=0;t<ft.count;t++)ct[t]&&k(ct[t])||(ct[t]===e&&(n=i),i++);L(e,n,i)}function M(e){function t(){o.visible.setValue(!o.hiddenInLayout.value()&&nt.resizerBridge.visible.value())}var i,n,o;return e=Object.assign({chartWidgetCollection:it,isActive:0===ct.length,barsMarksContainersFactory:V,undoHistory:We,readOnly:lt},e||{}),n=$(document.createElement("div")).addClass("chart-container").appendTo(je).css({position:"absolute",overflow:"hidden"}),o={alive:new _(!0),body:new _(n),width:new _,height:new _,hiddenInLayout:new _(!1),visible:new _,rdState:new f,requestFullscreen:function(){pt.value()&&(at.setValue(o.chartWidget),D(o))},exitFullscreen:function(){at.value()===o.chartWidget&&D(null)},detachable:pt,fullscreenable:pt,fullscreen:new _},o.rdState.pushOwner(o),ct.push(o),o.hiddenInLayout.subscribe(t),nt.resizerBridge.visible.subscribe(t),t(),E(o),Object.assign(e,o.rdState.bridge()),o.chartWidget=i=new r.ChartWidget(e),it.firstWidgetInitialized||i.chartWidgetInitialized.subscribe(null,function(){it.firstWidgetInitialized=!0,I()},!0),(1===ct.length||d.enabled("show_logo_on_all_charts"))&&i.createBranding(),e.containsData?i.finishInitWithoutConnect():i.connect(),B(),F(),Ue.fire(i),i}function V(e){var t,i,n=[];return d.enabled("charting_library_base")&&(t=new S(e),n.push(t),i=new b(e),n.push(i)),n}function D(e){Re!==e&&(Re=e,ht=W(),R(mt))}function O(){D(null);for(var e=0;e<ct.length;e++)ct[e].rdState.bridge().attach()}
function R(e){function t(){ct.every(function(e){return null!==e.chartWidget.model()})&&(B(),h.emit("layout_changed"))}function i(){t()}var n,r,s,a,l,c;e in o||(e="s"),n=o[e].count,h.emit("layout_about_to_be_changed",e),mt=e,ft=o[e];for(r=n;r<ct.length;r++)s=ct[r],k(s)&&s.rdState.bridge().attach();for(r=0;r<n||r<ct.length;r++)s=ct[r],a=Re?Re===s:r<n&&(!s||!k(s)),a?(s?(je.append(s.body.value()),s.hiddenInLayout.setValue(!1),(l=yt.shift())&&(gt=!0,s.chartWidget.loadContent(l.content),gt=!1)):(c=M(Object.assign({},Be,yt.shift()||(at.value()?{content:at.value().state()}:null)||{},0===r||vt.value()?{}:{defSymbol:null})),s=ct[r],c.modelCreated().subscribe(null,i,!0)),s.body.value().toggleClass("multiple",n>1),s.fullscreen.setValue(Re===s)):s&&(s.hiddenInLayout.setValue(!0),s.body.value().detach(),s.fullscreen.setValue(!1));return C(),B(),N(),t(),_t.value()<1&&n>0&&ct[n-1].rdState.bridge().attach(),!0}function B(){var e,t=Math.min(ft.count,ct.length)-1;if(t<0)return void at.deleteValue();e=dt,e<0&&(e=0),e>t&&(e=t),at.setValue(ct[e].chartWidget)}function N(){var e,t=ft.count,i=t;for(e=0;e<t;e++)ct[e]&&k(ct[e])&&i--;_t.setValue(i),pt.setValue(i>1)}function F(){var e,t;for(e=ct.length;e--;)t=e===dt,ct[e].body.value().toggleClass("active",t).toggleClass("inactive",!t)}function W(){return ct.filter(function(e){return!e.hiddenInLayout.value()}).sort(function(e,t){return e.metrics.top-t.metrics.top||e.metrics.left-t.metrics.left})}function H(){var e,t,i,n=Ve.value();"s"!==n&&(e=o[n].count,Re||(ht=W()),t=ut+1,i=ht[t],!i||t>e?(i=ht[0],ut=0):ut=t,at.setValue(i.chartWidget),Re&&R(n))}function j(){return qe}function z(){P("GUI","Save"),qe.fire()}function U(){var e,t=at.value();t&&(e=t.model())&&e.model().setSelectedSource(null)}function q(e){var t=at.value();return!!t&&t.trySetChartStyle(e)}function Y(e){var t,i,n,o;Ge!==e&&(Ge&&(Ge.modelCreated().unsubscribe(null,G),(t=Ge.model())&&(i=t.mainSeries().properties(),i.style.unsubscribe(null,K),n=t.model(),n.onSelectedSourceChanged().unsubscribe(null,Z),Ge=null)),e&&(o=e.model(),o?G(o):e.modelCreated().subscribe(null,G),Ge=e))}function G(e){var t,i=e.mainSeries().properties();i.style.subscribe(null,K),K(i.style),t=e.model(),t.onSelectedSourceChanged().subscribe(null,Z),Z(e.selectedSource())}function K(e){$e.setValue(e.value())}function Z(e){Ye.setValue(e)}function J(e){var t,i,n,o;if(e!==vt.value()){if(We.beginUndoMacro("Symbol Lock"),e)for(t=at.value(),i=t.getSymbol(),n=0;n<ct.length;n++)(o=ct[n].chartWidget)!==t&&o.getSymbol()!==i&&o.setSymbol(i);We.setWatchedValue(vt,e,"Symbol Lock"),We.endUndoMacro()}}function X(e){var t,i,n,o;if(e!==St.value()){if(We.beginUndoMacro("Interval Lock"),e)for(t=at.value(),i=t.getResolution(),n=0;n<ct.length;n++)(o=ct[n].chartWidget)!==t&&o.getResolution()!==i&&o.setResolution(i);We.setWatchedValue(St,e,"Resolution Lock"),We.endUndoMacro()}}function Q(e){bt.value()!==e&&We.setWatchedValue(bt,e,"Track Time")}function ee(e){return e=Ie(e),Ve.value()!==e&&(We.pushUndoCommand(new p(it,e)),!0)}function te(e){vt.value()?ie(e):at.value().setSymbol(e)}
function ie(e){var t,i,n=!1;for(t=0;t<ct.length;t++)i=ct[t].chartWidget,(i.model().mainSeries().properties().symbol.value()!==e||d.enabled("same_data_requery"))&&(n||(We.beginUndoMacro("Change Symbol"),n=!0),i.setSymbol(e));n&&We.endUndoMacro()}function ne(e){var t,i,n;if(!gt)if(St.value()){for(t=!1,i=0;i<ct.length;i++)n=ct[i].chartWidget,n.model().mainSeries().properties().interval.value()!==e&&(t||(We.beginUndoMacro("Change Resolution"),t=!0),n.setResolution(e));t&&We.endUndoMacro()}else at.value().setResolution(e)}function oe(e){var t,i,n;if(e&&e.onlyActiveChart||Re)return{layout:"s",hidpiRatio:window.hidpiCanvasRatio||1,charts:[at.value().images()]};for(t=[],i=ft.count,n=0;n<ct.length&&n<i;n++)t.push(ct[n].chartWidget.images());return{layout:mt,hidpiRatio:window.hidpiCanvasRatio||1,charts:t}}function re(){var e,t=[];for(e=0;e<ct.length&&e<ft.count;e++)t=t.concat(ct[e].chartWidget.tags());return t=$.unique(t),t=$.map(t,function(e){return e.toLowerCase().replace(/\W+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")})}function se(e,t,i,n){var o,r,s,a;if(i||Pt)for(o=ft.count,r=0;r<ct.length&&r<o;r++)(s=ct[r].chartWidget)!==t&&ct[r].rdState.bridge().visible.value()&&(a=s.model())&&a.model().setExternalPosition(e,n)}function ae(e,t){var i,n,o,r;if(bt.value()){for(i=ft.count,We.beginUndoMacro("Sync Time"),n=0;n<ct.length&&n<i;n++)if(o=ct[n].chartWidget,r=o.model()){if(r.model()===t)continue;r.gotoTime(e,{centerIfVisible:!1,model:t})}We.endUndoMacro()}}function le(){Te(!1),ct.forEach(function(e){void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.destroy()}),nt.resizerBridge.remove(),Qe&&clearInterval(Qe),$(window).off("resize",C),$(document).off("onUpdate",C),ze.resolve(),je.remove(),Xe=null}function ce(){return ze.promise()}function he(){return Ue}function ue(){Fe.id.setValue(void 0),Fe.uid.setValue(void 0),Fe.name.setValue(void 0)}function de(){var e={snapshotUrl:nt.snapshotUrl};(d.enabled("show_dialog_on_snapshot_ready")?u.getImageOfChart:u.getImageOfChartSilently)(it,e,function(e){h.emit("onScreenshotReady",e)})}function pe(){for(var e=o[mt].count;e<ct.length;e++)ct[e].chartWidget.destroy();ct.splice(o[mt].count)}function _e(e){for(var t=0;t<ct.length;t++)ct[t].chartWidget.applyOverrides(e)}function fe(e){for(var t=0;t<ct.length;t++)ct[t].chartWidget.applyStudiesOverrides(e)}function me(){nt.resizerBridge.requestFullscreen()}function ye(){nt.resizerBridge.exitFullscreen()}function ge(){return je}function ve(e,t){(t?[{chartWidget:at.value()}]:ct).forEach(function(t){t.chartWidget._model.model().restoreTheme(e)})}function Se(e,t){y.bind(e,function(e){e.preventDefault(),t()})}function be(){for(var e in Ze)Se(e,Ze[e]);Xe.watchOn(window)}function we(){for(var e in Ze)y.unbind(e);Xe.stopWatching(window)}function Pe(e){Be.onWidget||Ke===e||(Ke=e,e?be():we())}function Te(e){if(Pe(e),0!==ct.length){for(var t=ct.length;t--;)ct[t].chartWidget.setActive(!1);ct[dt].chartWidget.setActive(e)}}function xe(){return ct.map(function(e){return e.chartWidget.getMarketStatusTooltip()})}function Ce(){return ct.map(function(e){
var t=e.chartWidget.model(),i=t?t.mainSeries().status():null;return(null===i?"":e.chartWidget.getDataTextStatus(i))+" ("+i+")"})}function Le(){var e=this;return new Promise(function(t){i.e(14).then(function(){var n=i(820).AddCompareDialog,o=new n(e);t(o.show())}.bind(null,i)).catch(i.oe)})}function Ie(e){return d.enabled("charting_library_base")?e:"s"===e||isProductFeatureEnabled(ProductFeatures.MULTIPLE_CHARTS)&&getProductFeatureConfig(ProductFeatures.MULTIPLE_CHARTS).layout.indexOf(e)>=0||Be.containsData||lt?e:"s"}function Ae(e){if(yt=[],e){e.charts||(e={layout:"s",charts:[e]}),mt=Ie(e.layout||"s");for(var t=0;t<e.charts.length;t++)yt.push({content:e.charts[t]});e.symbolLock&&vt.setValue(!0),e.intervalLock&&St.setValue(!0),e.trackTimeLock&&bt.setValue(!0)}Ve.setValue(mt),R(mt)&&(l.init(),yt.splice(0,yt.length))}function ke(){0===--et&&h.emitOnce("onChartReady")}function Ee(){return Promise.all(ct.map(function(e){return m(e.chartWidget.modelCreated())}))}function Me(){return Promise.all(ct.map(function(e){return m(e.chartWidget.model().mainSeries().dataEvents().symbolResolved())}))}var Ve,De,Oe,Re,Be,Ne,Fe,We,He,je,ze,Ue,qe,$e,Ye,Ge,Ke,Ze,Je,Xe,Qe,et,tt,it=this,nt=Object.assign({},T,e),ot=2,rt=0,st=0,at=new _,lt=nt.readOnly||!1,ct=[],ht=[],ut=0,dt=0,pt=new _,_t=new _,ft=null,mt="s",yt=[],gt=!1,vt=new _(!1),St=new _(!1),bt=new _(!1),wt=new _(TVSettings.getBool("chart.syncCrosshair",!0)),Pt=wt.value();wt.subscribe(function(e){e=!!e,Pt=e,TVSettings.setValue("chart.syncCrosshair",e)}),Ve=new _(mt),De=nt.resizerBridge.width,Oe=nt.resizerBridge.height,Re=null,"padding"in nt&&(ot=nt.padding),"edge"in nt&&(rt=nt.edge),"border"in nt&&(st=nt.border),Be=nt.widgetOptions||{},Ne=nt.metaInfo||{},Fe={id:new _(Ne.id||null),name:new _(Ne.name),description:new _(Ne.description),username:new _(Ne.username),uid:new _(Ne.uid),lastModified:new _(Ne.lastModified)},We=a(),He=function(e){h.emit("undo_redo_state_changed",e)},We.onChange().subscribe(null,He),je=$(nt.resizerBridge.body.value()).eq(0),ze=$.Deferred(),Ue=new t,De.subscribe(C),Oe.subscribe(C),this.updateLayout=C,qe=new t,$e=new _,Ye=new _,Ge=null,at.subscribe(function(e){var t,i;if(e){for(i=ct.length;i--;)if(ct[i].chartWidget===e){t=i;break}if(!isFinite(t))throw Error("Cannot make detached ChartWidget active");if(dt!==t){for(Re&&(k(ct[t])||(Re=ct[t])),dt=t,F(),ht.length&&(ut=ht.indexOf(ct[dt])),i=ct.length;i--;)ct[i].chartWidget.setActive(!1);e.setActive(!0)}Y(e)}},{callWithLast:!0}),Ke=!1,Ze={Tab:H},nt.takeScreenshotEnabled&&(Ze["Alt+s"]=de),nt.saveChartEnabled&&(Ze["Ctrl+s"]=z),Je={},Je[v]=U,Xe=new g("keydown",!1),Xe.regHandlers(Je),Pe(!0),Object.assign(this,{createChartWidget:M,getAll:function(){return ct.map(function(e){return e.chartWidget})},destroy:le,layout:Ve,activeChartWidget:at,activeChartStyle:$e.readonly(),trySetChartStyleToActiveWidget:q,selectedSource:Ye.readonly(),metaInfo:Fe,state:n,asyncState:x,readOnly:function(){return lt},lock:{symbol:vt,setSymbolLockWithUndo:J,interval:St,setIntervalLockWithUndo:X,crosshair:wt,trackTime:bt,setTrackTimeWithUndo:Q},
setSymbol:te,setResolution:ne,updateLayout:C,setChartLayoutWithUndo:ee,resizeWidgetsUI:I,images:oe,tags:re,syncCrosshair:se,syncScroll:ae,setSymbolAll:ie,clearChartMetaInfo:ue,onfeatures:nt.onfeatures,takeScreenshot:de,loadContent:Ae,purgeUnusedWidgets:pe,applyOverrides:_e,applyStudiesOverrides:fe,switchChart:H,startFullscreen:me,exitFullscreen:ye,destroyPromise:ce,chartWidgetCreated:he,saveKeysPressed:j,getContainer:ge,onWidget:Be.onWidget,applyTheme:ve,setActive:Te,inlineChartsCount:_t.readonly(),revertToInline:O,chartMarketStatuses:xe,chartSeriesStatuses:Ce,undoHistory:We,showAddCompareDialog:Le}),Ae(nt.onfeatures?void 0:nt.content),Ve.subscribe(function(e){F(),R(e,!1)&&(ht=W(),ut=ht.indexOf(ct[dt]))}),Ve.hook=function(e){return e===this.value()?e:Ie(e)},lt&&(Ve.writeLock=!0),Qe=setInterval(A,1e3),$(window).on("resize",C),$(document).on("onUpdate",C),d.enabled("datasource_copypaste")&&(c.init(),nt.globalEvents&&($(window).on("appclip:paste",function(e){at.value().onAppClipboardPaste(),e.preventDefault()}),$(window).on("appclip:copy",function(e){at.value().onAppClipboardCopy(),e.preventDefault()}),$(window).on("appclip:cut",function(e){at.value().onAppClipboardCut(),e.preventDefault()}))),et=0,ct.forEach(function(e){if(e){et++;var t=e.chartWidget;t.withModel(null,function(){if(t.model().mainSeries().bars().size()>0)ke();else{var e=function(){ke(),t.model().mainSeries().dataEvents().barReceived().unsubscribe(null,e),t.model().mainSeries().dataEvents().completed().unsubscribe(null,e)};t.model().mainSeries().dataEvents().barReceived().subscribe(null,e),t.model().mainSeries().dataEvents().completed().subscribe(null,e)}})}}),s()&&(tt=l.tool.setValue,l.tool.setValue=function(){it.selectedSource.value()&&it.activeChartWidget.value().model().lineBeingCreated()&&it.activeChartWidget.value().model().cancelCreatingLine(),tt.apply(l.tool,arguments)}),Ee().then(Me).then(function(){window.saver&&window.is_authenticated&&nt.widgetOptions.justCloned&&window.saver.saveChartSilently()}).catch(w.logError.bind(w))}var o=i(109).layouts,r=i(505),s=i(71).supportTouch,a=i(659).createUndoHistory,l=i(32),c=i(182),h=i(31),u=i(660),d=i(5),p=i(661).SetChartLayoutCommand,_=i(16),f=i(164).ResizerDetacherState,m=i(662).delegateToPromise,y=i(189),g=i(338).KeyboardListener,v=i(192).ESC,S=i(663),b=i(664),w=i(4).getLogger("Chart.ChartWidgetCollection"),P=i(39).trackEvent,T={publishChartEnabled:!0,saveChartEnabled:!0,takeScreenshotEnabled:!0};e.exports=n}).call(t,i(8))},function(e,t,i){"use strict";(function(t){function n(e){var i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b;this._options=Object.assign({},se,e),i=this,this._guid=K(),this._startSpinner(this._options.body.value()),n=this._options.content,o=this._options.readOnly,o||(C.init(),C.tool.subscribe(function(){i._updateCrossHairPositionIfNeeded()}),r=function(e,t,i){var n,o=t.mainSeries().syncModel(),r=e.mainSeries().syncModel(),s=i;return o&&r&&(n=e._createSyncPoint(o,r),s=n.sourceTimeToTargetTime(i)),e.timeScale().points().roughIndex(s,r&&r.distance.bind(r))},
return/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(e){return!1}}location.hostname.indexOf(".")>=0&&!t()&&setTimeout(function(){try{var t=e();window.ga&&0!==t&&window.ga("send","event","s",t)}catch(e){}},3e4)}},function(e,t,i){"use strict";(function(t){function n(e){function n(e,t){var i,n,r=[],s=o[mt].count;for(i=0;i<s;i++)r.push(ct[i].chartWidget.state(e,t));return n={layout:mt,charts:r},vt.value()&&(n.symbolLock=1),St.value()&&(n.intervalLock=1),bt.value()&&(n.trackTimeLock=1),n}function x(e){var t,i=$.Deferred(),n=[],r=o[mt].count;for(t=0;t<r;t++)n.push(ct[t].chartWidget.asyncState(e));return $.when.apply($,n).then(function(){var e,t={charts:[]};for(e=0;e<arguments.length;e++)t.charts.push(arguments[e]);i.resolve(t)}),i}function C(){var e,t;for(e=Re?[Re]:ct.slice(0,ft.count).filter(function(e){return!e.hiddenInLayout.value()}),t=0;t<e.length;t++)L(e[t],t,e.length);je.trigger("chart-rect-update",je[0].getBoundingClientRect())}function L(e,t,i){var n=ft.sizer(t,{width:De.value(),height:Oe.value()},ot,rt,i),o={width:Math.max(Math.round(n.width||0)-2*st,0),height:Math.max(Math.round(n.height||0)-2*st,0),top:Math.max(Math.round(n.top||0),0),left:Math.max(Math.round(n.left||0),0)};e.metrics=o,e.body.value().css(o),e.width.setValue(o.width),e.height.setValue(o.height)}function I(){for(var e=0;e<ct.length;e++)ct[e].chartWidget.resizeSeriesControlUI()}function A(){for(var e=0;e<ct.length;e++)ct[e].chartWidget.tickSeriesControlClock()}function k(e){return e.rdState.owner.value()!==e}function E(e){var t,i=0,n=0;for(t=0;t<ft.count;t++)ct[t]&&k(ct[t])||(ct[t]===e&&(n=i),i++);L(e,n,i)}function M(e){function t(){o.visible.setValue(!o.hiddenInLayout.value()&&nt.resizerBridge.visible.value())}var i,n,o;return e=Object.assign({chartWidgetCollection:it,isActive:0===ct.length,barsMarksContainersFactory:V,undoHistory:We,readOnly:lt},e||{}),n=$(document.createElement("div")).addClass("chart-container").appendTo(je).css({position:"absolute",overflow:"hidden"}),o={alive:new _(!0),body:new _(n),width:new _,height:new _,hiddenInLayout:new _(!1),visible:new _,rdState:new f,requestFullscreen:function(){pt.value()&&(at.setValue(o.chartWidget),D(o))},exitFullscreen:function(){at.value()===o.chartWidget&&D(null)},detachable:pt,fullscreenable:pt,fullscreen:new _},o.rdState.pushOwner(o),ct.push(o),o.hiddenInLayout.subscribe(t),nt.resizerBridge.visible.subscribe(t),t(),E(o),Object.assign(e,o.rdState.bridge()),o.chartWidget=i=new r.ChartWidget(e),it.firstWidgetInitialized||i.chartWidgetInitialized.subscribe(null,function(){it.firstWidgetInitialized=!0,I()},!0),(1===ct.length||d.enabled("show_logo_on_all_charts"))&&i.createBranding(),e.containsData?i.finishInitWithoutConnect():i.connect(),B(),N(),Ue.fire(i),i}function V(e){var t,i,n=[];return d.enabled("charting_library_base")&&(t=new S(e),n.push(t),i=new b(e),n.push(i)),n}function D(e){Re!==e&&(Re=e,ht=W(),R(mt))}function O(){D(null);for(var e=0;e<ct.length;e++)ct[e].rdState.bridge().attach()}
function R(e){function t(){ct.every(function(e){return null!==e.chartWidget.model()})&&(B(),h.emit("layout_changed"))}function i(){t()}var n,r,s,a,l,c;e in o||(e="s"),n=o[e].count,h.emit("layout_about_to_be_changed",e),mt=e,ft=o[e];for(r=n;r<ct.length;r++)s=ct[r],k(s)&&s.rdState.bridge().attach();for(r=0;r<n||r<ct.length;r++)s=ct[r],a=Re?Re===s:r<n&&(!s||!k(s)),a?(s?(je.append(s.body.value()),s.hiddenInLayout.setValue(!1),(l=yt.shift())&&(gt=!0,s.chartWidget.loadContent(l.content),gt=!1)):(c=M(Object.assign({},Be,yt.shift()||(at.value()?{content:at.value().state()}:null)||{},0===r||vt.value()?{}:{defSymbol:null})),s=ct[r],c.modelCreated().subscribe(null,i,!0)),s.body.value().toggleClass("multiple",n>1),s.fullscreen.setValue(Re===s)):s&&(s.hiddenInLayout.setValue(!0),s.body.value().detach(),s.fullscreen.setValue(!1));return C(),B(),F(),t(),_t.value()<1&&n>0&&ct[n-1].rdState.bridge().attach(),!0}function B(){var e,t=Math.min(ft.count,ct.length)-1;if(t<0)return void at.deleteValue();e=dt,e<0&&(e=0),e>t&&(e=t),at.setValue(ct[e].chartWidget)}function F(){var e,t=ft.count,i=t;for(e=0;e<t;e++)ct[e]&&k(ct[e])&&i--;_t.setValue(i),pt.setValue(i>1)}function N(){var e,t;for(e=ct.length;e--;)t=e===dt,ct[e].body.value().toggleClass("active",t).toggleClass("inactive",!t)}function W(){return ct.filter(function(e){return!e.hiddenInLayout.value()}).sort(function(e,t){return e.metrics.top-t.metrics.top||e.metrics.left-t.metrics.left})}function H(){var e,t,i,n=Ve.value();"s"!==n&&(e=o[n].count,Re||(ht=W()),t=ut+1,i=ht[t],!i||t>e?(i=ht[0],ut=0):ut=t,at.setValue(i.chartWidget),Re&&R(n))}function j(){return qe}function z(){P("GUI","Save"),qe.fire()}function U(){var e,t=at.value();t&&(e=t.model())&&e.model().setSelectedSource(null)}function q(e){var t=at.value();return!!t&&t.trySetChartStyle(e)}function Y(e){var t,i,n,o;Ge!==e&&(Ge&&(Ge.modelCreated().unsubscribe(null,G),(t=Ge.model())&&(i=t.mainSeries().properties(),i.style.unsubscribe(null,K),n=t.model(),n.onSelectedSourceChanged().unsubscribe(null,Z),Ge=null)),e&&(o=e.model(),o?G(o):e.modelCreated().subscribe(null,G),Ge=e))}function G(e){var t,i=e.mainSeries().properties();i.style.subscribe(null,K),K(i.style),t=e.model(),t.onSelectedSourceChanged().subscribe(null,Z),Z(e.selectedSource())}function K(e){$e.setValue(e.value())}function Z(e){Ye.setValue(e)}function J(e){var t,i,n,o;if(e!==vt.value()){if(We.beginUndoMacro("Symbol Lock"),e)for(t=at.value(),i=t.getSymbol(),n=0;n<ct.length;n++)(o=ct[n].chartWidget)!==t&&o.getSymbol()!==i&&o.setSymbol(i);We.setWatchedValue(vt,e,"Symbol Lock"),We.endUndoMacro()}}function X(e){var t,i,n,o;if(e!==St.value()){if(We.beginUndoMacro("Interval Lock"),e)for(t=at.value(),i=t.getResolution(),n=0;n<ct.length;n++)(o=ct[n].chartWidget)!==t&&o.getResolution()!==i&&o.setResolution(i);We.setWatchedValue(St,e,"Resolution Lock"),We.endUndoMacro()}}function Q(e){bt.value()!==e&&We.setWatchedValue(bt,e,"Track Time")}function ee(e){return e=Ie(e),Ve.value()!==e&&(We.pushUndoCommand(new p(it,e)),!0)}function te(e){vt.value()?ie(e):at.value().setSymbol(e)}
function ie(e){var t,i,n=!1;for(t=0;t<ct.length;t++)i=ct[t].chartWidget,(i.model().mainSeries().properties().symbol.value()!==e||d.enabled("same_data_requery"))&&(n||(We.beginUndoMacro("Change Symbol"),n=!0),i.setSymbol(e));n&&We.endUndoMacro()}function ne(e){var t,i,n;if(!gt)if(St.value()){for(t=!1,i=0;i<ct.length;i++)n=ct[i].chartWidget,n.model().mainSeries().properties().interval.value()!==e&&(t||(We.beginUndoMacro("Change Resolution"),t=!0),n.setResolution(e));t&&We.endUndoMacro()}else at.value().setResolution(e)}function oe(e){var t,i,n;if(e&&e.onlyActiveChart||Re)return{layout:"s",hidpiRatio:window.hidpiCanvasRatio||1,charts:[at.value().images()]};for(t=[],i=ft.count,n=0;n<ct.length&&n<i;n++)t.push(ct[n].chartWidget.images());return{layout:mt,hidpiRatio:window.hidpiCanvasRatio||1,charts:t}}function re(){var e,t=[];for(e=0;e<ct.length&&e<ft.count;e++)t=t.concat(ct[e].chartWidget.tags());return t=$.unique(t),t=$.map(t,function(e){return e.toLowerCase().replace(/\W+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")})}function se(e,t,i,n){var o,r,s,a;if(i||Pt)for(o=ft.count,r=0;r<ct.length&&r<o;r++)(s=ct[r].chartWidget)!==t&&ct[r].rdState.bridge().visible.value()&&(a=s.model())&&a.model().setExternalPosition(e,n)}function ae(e,t){var i,n,o,r;if(bt.value()){for(i=ft.count,We.beginUndoMacro("Sync Time"),n=0;n<ct.length&&n<i;n++)if(o=ct[n].chartWidget,r=o.model()){if(r.model()===t)continue;r.gotoTime(e,{centerIfVisible:!1,model:t})}We.endUndoMacro()}}function le(){Te(!1),ct.forEach(function(e){void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.destroy()}),nt.resizerBridge.remove(),Qe&&clearInterval(Qe),$(window).off("resize",C),$(document).off("onUpdate",C),ze.resolve(),je.remove(),Xe=null}function ce(){return ze.promise()}function he(){return Ue}function ue(){Ne.id.setValue(void 0),Ne.uid.setValue(void 0),Ne.name.setValue(void 0)}function de(){var e={snapshotUrl:nt.snapshotUrl};(d.enabled("show_dialog_on_snapshot_ready")?u.getImageOfChart:u.getImageOfChartSilently)(it,e,function(e){h.emit("onScreenshotReady",e)})}function pe(){for(var e=o[mt].count;e<ct.length;e++)ct[e].chartWidget.destroy();ct.splice(o[mt].count)}function _e(e){for(var t=0;t<ct.length;t++)ct[t].chartWidget.applyOverrides(e)}function fe(e){for(var t=0;t<ct.length;t++)ct[t].chartWidget.applyStudiesOverrides(e)}function me(){nt.resizerBridge.requestFullscreen()}function ye(){nt.resizerBridge.exitFullscreen()}function ge(){return je}function ve(e,t){(t?[{chartWidget:at.value()}]:ct).forEach(function(t){t.chartWidget._model.model().restoreTheme(e)})}function Se(e,t){y.bind(e,function(e){e.preventDefault(),t()})}function be(){for(var e in Ze)Se(e,Ze[e]);Xe.watchOn(window)}function we(){for(var e in Ze)y.unbind(e);Xe.stopWatching(window)}function Pe(e){Be.onWidget||Ke===e||(Ke=e,e?be():we())}function Te(e){if(Pe(e),0!==ct.length){for(var t=ct.length;t--;)ct[t].chartWidget.setActive(!1);ct[dt].chartWidget.setActive(e)}}function xe(){return ct.map(function(e){return e.chartWidget.getMarketStatusTooltip()})}function Ce(){return ct.map(function(e){
var t=e.chartWidget.model(),i=t?t.mainSeries().status():null;return(null===i?"":e.chartWidget.getDataTextStatus(i))+" ("+i+")"})}function Le(){var e=this;return new Promise(function(t){i.e(14).then(function(){var n=i(820).AddCompareDialog,o=new n(e);t(o.show())}.bind(null,i)).catch(i.oe)})}function Ie(e){return d.enabled("charting_library_base")?e:"s"===e||isProductFeatureEnabled(ProductFeatures.MULTIPLE_CHARTS)&&getProductFeatureConfig(ProductFeatures.MULTIPLE_CHARTS).layout.indexOf(e)>=0||Be.containsData||lt?e:"s"}function Ae(e){if(yt=[],e){e.charts||(e={layout:"s",charts:[e]}),mt=Ie(e.layout||"s");for(var t=0;t<e.charts.length;t++)yt.push({content:e.charts[t]});e.symbolLock&&vt.setValue(!0),e.intervalLock&&St.setValue(!0),e.trackTimeLock&&bt.setValue(!0)}Ve.setValue(mt),R(mt)&&(l.init(),yt.splice(0,yt.length))}function ke(){0===--et&&h.emitOnce("onChartReady")}function Ee(){return Promise.all(ct.map(function(e){return m(e.chartWidget.modelCreated())}))}function Me(){return Promise.all(ct.map(function(e){return m(e.chartWidget.model().mainSeries().dataEvents().symbolResolved())}))}var Ve,De,Oe,Re,Be,Fe,Ne,We,He,je,ze,Ue,qe,$e,Ye,Ge,Ke,Ze,Je,Xe,Qe,et,tt,it=this,nt=Object.assign({},T,e),ot=2,rt=0,st=0,at=new _,lt=nt.readOnly||!1,ct=[],ht=[],ut=0,dt=0,pt=new _,_t=new _,ft=null,mt="s",yt=[],gt=!1,vt=new _(!1),St=new _(!1),bt=new _(!1),wt=new _(TVSettings.getBool("chart.syncCrosshair",!0)),Pt=wt.value();wt.subscribe(function(e){e=!!e,Pt=e,TVSettings.setValue("chart.syncCrosshair",e)}),Ve=new _(mt),De=nt.resizerBridge.width,Oe=nt.resizerBridge.height,Re=null,"padding"in nt&&(ot=nt.padding),"edge"in nt&&(rt=nt.edge),"border"in nt&&(st=nt.border),Be=nt.widgetOptions||{},Fe=nt.metaInfo||{},Ne={id:new _(Fe.id||null),name:new _(Fe.name),description:new _(Fe.description),username:new _(Fe.username),uid:new _(Fe.uid),lastModified:new _(Fe.lastModified)},We=a(),He=function(e){h.emit("undo_redo_state_changed",e)},We.onChange().subscribe(null,He),je=$(nt.resizerBridge.body.value()).eq(0),ze=$.Deferred(),Ue=new t,De.subscribe(C),Oe.subscribe(C),this.updateLayout=C,qe=new t,$e=new _,Ye=new _,Ge=null,at.subscribe(function(e){var t,i;if(e){for(i=ct.length;i--;)if(ct[i].chartWidget===e){t=i;break}if(!isFinite(t))throw Error("Cannot make detached ChartWidget active");if(dt!==t){for(Re&&(k(ct[t])||(Re=ct[t])),dt=t,N(),ht.length&&(ut=ht.indexOf(ct[dt])),i=ct.length;i--;)ct[i].chartWidget.setActive(!1);e.setActive(!0)}Y(e)}},{callWithLast:!0}),Ke=!1,Ze={Tab:H},nt.takeScreenshotEnabled&&(Ze["Alt+s"]=de),nt.saveChartEnabled&&(Ze["Ctrl+s"]=z),Je={},Je[v]=U,Xe=new g("keydown",!1),Xe.regHandlers(Je),Pe(!0),Object.assign(this,{createChartWidget:M,getAll:function(){return ct.map(function(e){return e.chartWidget})},destroy:le,layout:Ve,activeChartWidget:at,activeChartStyle:$e.readonly(),trySetChartStyleToActiveWidget:q,selectedSource:Ye.readonly(),metaInfo:Ne,state:n,asyncState:x,readOnly:function(){return lt},lock:{symbol:vt,setSymbolLockWithUndo:J,interval:St,setIntervalLockWithUndo:X,crosshair:wt,trackTime:bt,setTrackTimeWithUndo:Q},
setSymbol:te,setResolution:ne,updateLayout:C,setChartLayoutWithUndo:ee,resizeWidgetsUI:I,images:oe,tags:re,syncCrosshair:se,syncScroll:ae,setSymbolAll:ie,clearChartMetaInfo:ue,onfeatures:nt.onfeatures,takeScreenshot:de,loadContent:Ae,purgeUnusedWidgets:pe,applyOverrides:_e,applyStudiesOverrides:fe,switchChart:H,startFullscreen:me,exitFullscreen:ye,destroyPromise:ce,chartWidgetCreated:he,saveKeysPressed:j,getContainer:ge,onWidget:Be.onWidget,applyTheme:ve,setActive:Te,inlineChartsCount:_t.readonly(),revertToInline:O,chartMarketStatuses:xe,chartSeriesStatuses:Ce,undoHistory:We,showAddCompareDialog:Le}),Ae(nt.onfeatures?void 0:nt.content),Ve.subscribe(function(e){N(),R(e,!1)&&(ht=W(),ut=ht.indexOf(ct[dt]))}),Ve.hook=function(e){return e===this.value()?e:Ie(e)},lt&&(Ve.writeLock=!0),Qe=setInterval(A,1e3),$(window).on("resize",C),$(document).on("onUpdate",C),d.enabled("datasource_copypaste")&&(c.init(),nt.globalEvents&&($(window).on("appclip:paste",function(e){at.value().onAppClipboardPaste(),e.preventDefault()}),$(window).on("appclip:copy",function(e){at.value().onAppClipboardCopy(),e.preventDefault()}),$(window).on("appclip:cut",function(e){at.value().onAppClipboardCut(),e.preventDefault()}))),et=0,ct.forEach(function(e){if(e){et++;var t=e.chartWidget;t.withModel(null,function(){if(t.model().mainSeries().bars().size()>0)ke();else{var e=function(){ke(),t.model().mainSeries().dataEvents().barReceived().unsubscribe(null,e),t.model().mainSeries().dataEvents().completed().unsubscribe(null,e)};t.model().mainSeries().dataEvents().barReceived().subscribe(null,e),t.model().mainSeries().dataEvents().completed().subscribe(null,e)}})}}),s()&&(tt=l.tool.setValue,l.tool.setValue=function(){it.selectedSource.value()&&it.activeChartWidget.value().model().lineBeingCreated()&&it.activeChartWidget.value().model().cancelCreatingLine(),tt.apply(l.tool,arguments)}),Ee().then(Me).then(function(){window.saver&&window.is_authenticated&&nt.widgetOptions.justCloned&&window.saver.saveChartSilently()}).catch(w.logError.bind(w))}var o=i(109).layouts,r=i(505),s=i(71).supportTouch,a=i(659).createUndoHistory,l=i(32),c=i(182),h=i(31),u=i(660),d=i(5),p=i(661).SetChartLayoutCommand,_=i(16),f=i(164).ResizerDetacherState,m=i(662).delegateToPromise,y=i(189),g=i(338).KeyboardListener,v=i(192).ESC,S=i(663),b=i(664),w=i(4).getLogger("Chart.ChartWidgetCollection"),P=i(39).trackEvent,T={publishChartEnabled:!0,saveChartEnabled:!0,takeScreenshotEnabled:!0};e.exports=n}).call(t,i(8))},function(e,t,i){"use strict";(function(t){function n(e){var i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b;this._options=Object.assign({},se,e),i=this,this._guid=K(),this._startSpinner(this._options.body.value()),n=this._options.content,o=this._options.readOnly,o||(C.init(),C.tool.subscribe(function(){i._updateCrossHairPositionIfNeeded()}),r=function(e,t,i){var n,o=t.mainSeries().syncModel(),r=e.mainSeries().syncModel(),s=i;return o&&r&&(n=e._createSyncPoint(o,r),s=n.sourceTimeToTargetTime(i)),e.timeScale().points().roughIndex(s,r&&r.distance.bind(r))},
C.createdLineTool.subscribe(null,function(e){var t,n,o;i._model&&(t=i._model.model(),e.model!==t&&(n=t.paneForSource(i._model.model().mainSeries()),o={index:r(t,e.model,e.point.timeStamp),price:e.point.price},i._model.createLineTool(n,o,e.linetool,e.properties,e.linkKey)))}),C.continuedLineTool.subscribe(null,function(e){var t,n,o;i._model&&(t=i._model.model(),e.model!==t&&(n={index:r(t,e.model,e.point.timeStamp),price:e.point.price},(o=i._model.lineBeingCreated())&&i._model.model().coninueCreatingLine(n,e.envState,!!e.finalState)&&e.finalState&&o.restoreExternalPoints(e.finalState)))}),C.cancelledLineTool.subscribe(null,function(e){if(i._model){var t=i._model.model();e.model!==t&&i._model.model().cancelCreatingLine()}}),C.startedMovingLineTool.subscribe(null,function(e){var t,n,o;i._model&&(t=i._model.model(),e.model!==t&&(n=t.dataSources().filter(function(t){return t.linkKey===e.linkKey})[0])&&(o={index:r(t,e.model,e.point.timeStamp),price:e.point.price},i._model.model().startMovingSource(n,o)))}),C.movedLineTool.subscribe(null,function(e){var t,n;i._model&&(t=i._model.model(),e.model!==t&&t.sourceBeingMoved()&&t.sourceBeingMoved().linkKey===e.linkKey&&(n={index:r(t,e.model,e.point.timeStamp),price:e.point.price},i._model.model().moveSource(n)))}),C.finishedMovingLineTool.subscribe(null,function(e){var t,n;i._model&&(t=i._model.model(),e.model!==t&&(n=t.sourceBeingMoved())&&(i._model.model().endMovingSource(!!e.finalState),e.finalState&&n.restoreExternalPoints(e.finalState)))}),C.startedChangingLineTool.subscribe(null,function(e){var t,n,o;i._model&&(t=i._model.model(),e.model!==t&&(n=t.dataSources().filter(function(t){return t.linkKey===e.linkKey})[0])&&(o={index:r(t,e.model,e.point.timeStamp),price:e.point.price},i._model.model().startChangingLinetool(n,o,e.pointIndex,e.envState)))}),C.changedLineTool.subscribe(null,function(e){var t,n;i._model&&(t=i._model.model(),e.model!==t&&t.lineBeingEdited()&&t.lineBeingEdited().linkKey===e.linkKey&&(n={index:r(t,e.model,e.point.timeStamp),price:e.point.price},i._model.model().changeLinePoint(n,e.envState)))}),C.finishedChangingLineTool.subscribe(null,function(e){var t,n;i._model&&(t=i._model.model(),e.model!==t&&(n=t.dataSources().filter(function(t){return t.linkKey===e.linkKey})[0],t.lineBeingEdited()&&i._model.model().endChangingLinetool(!!e.finalState),n&&e.finalState&&n.restoreExternalPoints(e.finalState)))}),C.removedLineTool.subscribe(null,function(e){var t,n;i._model&&(t=i._model.model(),e.model!==t&&(n=t.dataSources().filter(function(t){return t.linkKey===e.linkKey})[0])&&i._model.model().removeSource(n))}),C.finishedLineTool.subscribe(null,function(e){var t;i._model&&(t=i._model.model(),e.model!==t&&t.dataSources().filter(function(t){return t.linkKey===e.linkKey})[0]&&i._model.model().finishLineTool())}),C.changedLineStyle.subscribe(null,function(e){var t,n;i._model&&(t=i._model.model(),e.model!==t&&(n=t.dataSources().filter(function(t){return t.linkKey===e.linkKey})[0])&&(n.properties().merge(e.state),n.propertiesChanged()))}),
C.restoredLineToolState.subscribe(null,function(e){var t,n,o;i._model&&(t=i._model.model(),e.model!==t&&(n=t.dataSources().filter(function(t){return t.linkKey===e.linkKey})[0])&&(o=$.extend({},e.state),o.indexes=o.points.map(function(i){return{index:r(t,e.model,i.time_t),price:i.price}}),t.restoreLineToolState(n,o)))}),C.restoredLineTool.subscribe(null,function(e){if(i._model){var t=i._model.model();e.model!==t&&t.restoreSource(e.state.restorePane,e.state.paneIndex,e.state.paneState,e.state.sourceState,e.state.priceScaleName)}}),C.copiedLineTool.subscribe(null,function(e){var t,n,o,s,a,l;if(i._model&&(t=i._model.model(),e.model!==t)){if(n=t.paneForSource(t.mainSeries()),o=e.points.map(function(i){return{index:r(t,e.model,i.timeStamp),price:i.price}}),s=o[0],a=t.createLineTool(n,s,e.linetool,null,e.linkKey),t.lineBeingCreated())for(l=1;l<o.length;l++)l!==o.length-1||"LineToolBrush"!==e.linetool&&"LineToolGhostFeed"!==e.linetool||t.finishLineTool(!0),t.coninueCreatingLine(o[l],{},l<o.length-1,!0);a.properties().interval.setValue(e.state.interval),a.properties().merge(e.state),a.restoreData&&a.restoreData(e),a.propertiesChanged(),a&&e.finalState&&(a.calcIsActualSymbol(),a.restoreExternalPoints(e.finalState))}})),s=this._options.containsData,a=this._options.onWidget,l=this._options.onCmeWidget,l&&te.logWarn("[ChartWidget] 'onCmeWidget' option is depricated"),c=this._options.widgetCustomer,h=this._options.timezone,u=this._options.hideSymbolSearch,d=this._options.defSymbol,p=L.isValid(this._options.defInterval)?this._options.defInterval:void 0,_=parseInt(this._options.defStyle),f=E.isValidStyle(_)?_:void 0,m=this._options.defExtendedHours,y=this._options.defTimeframe,this._chartWidgetCollection=this._options.chartWidgetCollection||null,this._setContent(n),this._readOnly=o,this._containsData=s,this._showChartEvents=!s&&this._options.chartEventsEnabled,this._defSymbol=d,this._defInterval=p,this._defTimeframe=y,this._defStyle=f,this._onWidget=!!a,this._onWidget&&(l?this._widgetCustomer="cme":c&&(this._widgetCustomer=c)),this.controlBarHeight=33,this._hideSymbolSearch=u,this._paneWidgets=[],this._paneSeparators=[],this._timeAxisWidget=null,this._frameTime=30,this._model=null,this._metaInfo={},this._drawRafId=0,g=this._contentSeriesProperties(),g&&(d=g.symbol,p=g.interval),void 0===this._options.useUserChartPreferences&&(this._options.useUserChartPreferences=!0),this._properties=new W("chartproperties",void 0,void 0,this._options.useUserChartPreferences),v="chartproperties.mainSeriesProperties",S=this._options.useUserChartPreferences?ee.defaults(v):ee.factoryDefaults(v),this._properties.mainSeriesProperties.merge(S),p=p||S.interval||"D",f=f||S.style||V(L.isRange(p)),this._properties.mainSeriesProperties.merge({visible:!0,symbol:d||DEFAULT_SYMBOL,shortName:"",timeframe:"",onWidget:this._onWidget,interval:p,style:f,extendedHours:m,lineStyle:{styleType:ee.factoryDefaults("chartproperties.mainSeriesProperties.lineStyle.styleType")}}),this._containsData&&this._properties.mainSeriesProperties.merge({showCountdown:!1}),
h&&z(h)&&this._properties.timezone.setValue(h),this._tagsChanged=new t,this._modelCreated=new t,this._disconnected=new t,this._reconnectBailout=new t,this._connected=new t,this._redrawPanes=new t,this._onScroll=new t,this.chartWidgetInitialized=new t,this._chartSession=new U(ChartApiInstance),this._metaInfoRepository=new ne(this._chartSession),this.lhsPriceAxisWidthChanged=new t,this.rhsPriceAxisWidthChanged=new t,this._timingsMeter=null,this._isActive=this._options.isActive,this._options.body.subscribe(function(e){i._setElement(e)},{callWithLast:!0}),b=function(){i.resize()},this._options.width.subscribe(b),this._options.height.subscribe(b),this._options.visible.subscribe(this._updateTimingsMeterState.bind(this))}function o(e){return{UTC:"Etc/UTC",EST:"America/New_York",CST:"America/Chicago",PST:"America/Los_Angeles"}[e]||"exchange"}var r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,N,F,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se;i(11),r=i(7).assert,s=i(506),a=i(641),l=i(643),c=i(125).PriceAxisWidget,h=i(649).TimeAxisWidget,u=i(88).BarsMarksContainer,d=i(63).Series,p=i(5),_=i(107).isFeatureEnabled,f=i(181).ActionBinder,m=i(197).showEditObjectDialog,y=i(328).showGoToDateDialog,g=i(240).CustomEvent,v=i(34).Study,S=i(124),b=i(0).LineDataSource,w=i(73).isLineToolName,P=i(41),T=P.Action,x=P.ActionSeparator,C=i(32),L=i(15).Interval,I=i(61),A=I.setLastUsedResolution,k=I.getDefaultResolution,E=i(42),M=E.isRangeStyle,V=E.getDefaultStyle,D=i(651).showSymbolInfoDialog,O=i(18),R=i(62).linking,B=i(249).showChangeIntervalDialog,N=i(128).showDialog,F=i(128).activateKeyPressHandler,W=i(3).DefaultProperty,H=i(200),j=H.availableTimezones,z=H.timezoneIsAvailable,U=i(652).ChartSession,q=i(26),Y=i(305).Spinner,G=i(39).trackEvent,K=i(33).guid,Z=i(82).Size,J=i(83).createConfirmDialog,X=i(653).MarketStatusIndicator,Q=i(655).DataModeIndicator,ee=i(133),te=i(4).getLogger("ChartWidget",{color:"#606"}),ie=i(38).IS_RTL,ne=i(657).StudyMetaInfoRepository,oe=i(109).isMultipleLayout,re=i(658).addPerfMark,se={addToWatchlistEnabled:!0,sourceSelectionEnabled:!0,propertyPagesEnabled:!0,paneContextMenuEnabled:!0,priceScaleContextMenuEnabled:!0,verticalTouchScroll:!1,seriesControlBarEnabled:!0,goToDateEnabled:!1,marketStatusWidgetEnabled:!0,chartWarningWidgetEnabled:!0,isSymbolAvailable:function(e){return Promise.resolve(!0)},legendWidgetEnabled:!0,chartEventsEnabled:!0,esdEnabled:!1,noMouseWheelScroll:!1},n.prototype._updateCrossHairPositionIfNeeded=function(){var e,t,i,n;this._model&&(e=C.tool.value(),this._model.model().setCurrentTool(e),TradingView.isMobile.any()&&(t=this._maximizedPaneWidget||this._paneWidgets[0],w(e)&&"LineToolBrush"!==e&&!this.selectBarMode().value()?(i=.5*this._model.model().timeScale().width(),n=.5*t._state.defaultPriceScale().height(),this._model.model().setAndSaveCurrentPosition(i,n,t._state),t._updateTooltip(i,n)):t._hideTooltip()),this._model&&TradingView.isMobile.any()&&this._model.model().crossHairSource().updateAllViews())},n.prototype._setElement=function(e){var t,n
h&&z(h)&&this._properties.timezone.setValue(h),this._tagsChanged=new t,this._modelCreated=new t,this._disconnected=new t,this._reconnectBailout=new t,this._connected=new t,this._redrawPanes=new t,this._onScroll=new t,this.chartWidgetInitialized=new t,this._chartSession=new U(ChartApiInstance),this._metaInfoRepository=new ne(this._chartSession),this.lhsPriceAxisWidthChanged=new t,this.rhsPriceAxisWidthChanged=new t,this._timingsMeter=null,this._isActive=this._options.isActive,this._options.body.subscribe(function(e){i._setElement(e)},{callWithLast:!0}),b=function(){i.resize()},this._options.width.subscribe(b),this._options.height.subscribe(b),this._options.visible.subscribe(this._updateTimingsMeterState.bind(this))}function o(e){return{UTC:"Etc/UTC",EST:"America/New_York",CST:"America/Chicago",PST:"America/Los_Angeles"}[e]||"exchange"}var r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,F,N,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se;i(11),r=i(7).assert,s=i(506),a=i(641),l=i(643),c=i(125).PriceAxisWidget,h=i(649).TimeAxisWidget,u=i(88).BarsMarksContainer,d=i(63).Series,p=i(5),_=i(107).isFeatureEnabled,f=i(181).ActionBinder,m=i(197).showEditObjectDialog,y=i(328).showGoToDateDialog,g=i(240).CustomEvent,v=i(34).Study,S=i(124),b=i(0).LineDataSource,w=i(73).isLineToolName,P=i(41),T=P.Action,x=P.ActionSeparator,C=i(32),L=i(15).Interval,I=i(61),A=I.setLastUsedResolution,k=I.getDefaultResolution,E=i(42),M=E.isRangeStyle,V=E.getDefaultStyle,D=i(651).showSymbolInfoDialog,O=i(18),R=i(62).linking,B=i(249).showChangeIntervalDialog,F=i(128).showDialog,N=i(128).activateKeyPressHandler,W=i(3).DefaultProperty,H=i(200),j=H.availableTimezones,z=H.timezoneIsAvailable,U=i(652).ChartSession,q=i(26),Y=i(305).Spinner,G=i(39).trackEvent,K=i(33).guid,Z=i(82).Size,J=i(83).createConfirmDialog,X=i(653).MarketStatusIndicator,Q=i(655).DataModeIndicator,ee=i(133),te=i(4).getLogger("ChartWidget",{color:"#606"}),ie=i(38).IS_RTL,ne=i(657).StudyMetaInfoRepository,oe=i(109).isMultipleLayout,re=i(658).addPerfMark,se={addToWatchlistEnabled:!0,sourceSelectionEnabled:!0,propertyPagesEnabled:!0,paneContextMenuEnabled:!0,priceScaleContextMenuEnabled:!0,verticalTouchScroll:!1,seriesControlBarEnabled:!0,goToDateEnabled:!1,marketStatusWidgetEnabled:!0,chartWarningWidgetEnabled:!0,isSymbolAvailable:function(e){return Promise.resolve(!0)},legendWidgetEnabled:!0,chartEventsEnabled:!0,esdEnabled:!1,noMouseWheelScroll:!1},n.prototype._updateCrossHairPositionIfNeeded=function(){var e,t,i,n;this._model&&(e=C.tool.value(),this._model.model().setCurrentTool(e),TradingView.isMobile.any()&&(t=this._maximizedPaneWidget||this._paneWidgets[0],w(e)&&"LineToolBrush"!==e&&!this.selectBarMode().value()?(i=.5*this._model.model().timeScale().width(),n=.5*t._state.defaultPriceScale().height(),this._model.model().setAndSaveCurrentPosition(i,n,t._state),t._updateTooltip(i,n)):t._hideTooltip()),this._model&&TradingView.isMobile.any()&&this._model.model().crossHairSource().updateAllViews())},n.prototype._setElement=function(e){var t,n
;this._jqMainDiv&&(this._jqMainDiv.remove(),this._jqParent.empty()),this._controlBarNavigation&&this._controlBarNavigation.destroy(),this._seriesControlWidget&&this._seriesControlWidget.destroy(),t=e.prop("ownerDocument"),this._jqParent=$(t.createElement("div")).addClass("chart-container-border").prependTo(e),this._jqMainDiv=$('<div class="chart-widget"/>',t),this._elTooltipDiv=t.createElement("div"),this._elTooltipDiv.className="tooltip-wrapper",this._jqMainDiv.append(this._elTooltipDiv),this._elMainTable=t.createElement("table"),this._elMainTable.className="chart-markup-table",this._elMainTable.setAttribute("cellpading","0"),this._elMainTable.setAttribute("cellspacing","0"),this._jqMainDiv.append(this._elMainTable),n=this._options.seriesControlBarEnabled&&(!p.enabled("lean_chart_load")||!this._chartControlsBar),n&&(this._chartControlsBar=t.createElement("div"),this._chartControlsBar.className="chart-controls-bar",this._chartControlsBar.classList.toggle("chart-controls-bar--inactive",!this._isActive),this._jqParent.append(this._chartControlsBar),i.e(12).then(function(e){var t=i(816).BottomToolbarRenderer;this._isDestroyed||(this._seriesControlWidget=new t(this._chartControlsBar,this,this._chartWidgetCollection,ChartApiInstance,this._options,this._options.seriesControlBar))}.bind(this).bind(null,i)).catch(i.oe)),(this._options.controlBar||p.enabled("control_bar"))&&i.e(1).then(function(e){if(!this._isDestroyed){this._controlBarNavigation&&this._controlBarNavigation.destroy();var t=i(817).ControlBarNavigation;this._controlBarNavigation=new t(this,this._jqMainDiv[0]),this._model&&this._adjustSize()}}.bind(this).bind(null,i)).catch(i.oe),this._containsData||this.createIndicatorImage(),this._options.noMouseWheelScroll||this._jqMainDiv.mousewheel(this._onMousewheel.bind(this)),this.resize(),this.withModel(this,function(){this._jqParent.append(this._jqMainDiv),this._jqMainDiv.on("mousedown",this._requestActive.bind(this)),this._jqMainDiv.on("touchstart",this._requestActive.bind(this))}),this._inited&&(null!==this._timeAxisWidget&&(this._timeAxisWidget.destroy(),this._timeAxisWidget=null),this._paneWidgets.length=0,this._update(new O(O.FULL_UPDATE)))},n.prototype._requestActive=function(){this._chartWidgetCollection&&this._chartWidgetCollection.activeChartWidget.setValue(this)},n.prototype._onMousewheel=function(e,t,i,n){var o,r,s,a,l;if((TradingView.onWidget()||!parent||parent===window||!parent.IS_DEMO_PAGE)&&this.model()&&!this.noScroll&&!this.model().timeScale().isEmpty())return o=e.pageX-5,r=this._paneWidgets[0].lhsPriceAxisWidget.size.w,s=this._timeAxisWidget.size.w,r&&(o=Math.max(0,o-r)),o=Math.min(o,s),a=p.enabled("right_bar_stays_on_scroll")?1:2*(o/s-.5),l=Math.min(1,Math.abs(n)),n>0?this.model().zoomIn(a,l):n<0&&this.model().zoomOut(a,l),i&&this.model().scrollChart(-80*i),!1},n.prototype.getStudyScriptingPkgVers=function(e){return this._metaInfoRepository.getStudyScriptingPkgVers()},n.prototype.setTimezone=function(e){
e&&z(e)?this._properties.timezone.setValue(e):console.warn("Incorrect timezone: "+JSON.stringify(e))},n.prototype.refreshMarks=function(){this.model().barsMarksSources().forEach(function(e){e.refreshData()})},n.prototype.clearMarks=function(){this.model().barsMarksSources().forEach(function(e){e.clearMarks()})},n.prototype._init=function(){var e,t,i=this;this.model()&&this.model().mainSeries().clearData(),this.initColors(),this._makeDefaultGui(),e=function(){i._checkObsoleteTimezone(),i._chartSession&&i._chartSession.connected()&&this._model.restart(),this._content&&(this.initColors(),this._updateGui(),this.update());var e=i._model.mainSeries();e.marketStatus.subscribe(function(t){i.indicatorImage&&i._updateDataAndMarketStatus(t,e.status(),e.quoteData.update_mode_seconds)},{callWithLast:!0}),this._resizeHandler=function(){this._adjustSize(),this._model&&this._model.mainSeries().requestMoreData(),this.paint(),this.resizeSeriesControlUI(),this.checkCompactMode(),this.resizeIndicator()}.bind(this),this._resizeHandler(),this._jqParent.append(this._jqMainDiv),this._spinner&&(this._spinner.stop(),delete this._spinner),_("chrome_canvas_fix")&&navigator.userAgent.match(/windows.+chrome/i)&&$(window).on("visibilitychange:chart_"+this._guid,function(e,t){if(t){for(var n=0;n<i._paneWidgets.length;n++)i._paneWidgets[n].hardResetCanvas();i._timeaxiswidget&&i._timeaxiswidget.hardResetCanvas(),i.paint(new O(O.LIGHT_UPDATE))}}),$(window).on("keydown:chart_"+this._guid,function(e){27===e.which&&e.preventDefault()}),this._initBarsMarksSources(),this._activateSymbolSearchHotkeys(),this.model().timeScale().onScroll().subscribe(this,function(){this._onScroll.fire()}),this._inited=!0}.bind(this),t=this._makeDefaultModel(),void 0===t?e():t.then(e)},n.prototype._activateSymbolSearchHotkeys=function(){this.readOnly()||this._hideSymbolSearch||F()},n.prototype._checkObsoleteTimezone=function(){var e=this._properties.timezone.value();z(e)||this._properties.timezone.setValue(o(e))},n.prototype._initBarsMarksSources=function(){var e=this;this.withModel(this,function(){this.model().barsMarksSources().forEach(function(t){t.onNeedRepaint.subscribe(e,e.paint)})})},n.prototype.initESDTimelineWidget=function(){new ESDTimelineWidget(this)},n.prototype.initColors=function(){this._properties.paneProperties.background.listeners().subscribe(this,n.prototype.setBackgroundColor),this._properties.paneProperties.vertGridProperties.color.listeners().subscribe(this,n.prototype.redrawPanes),this._properties.paneProperties.horzGridProperties.color.listeners().subscribe(this,n.prototype.redrawPanes),this._properties.scalesProperties.lineColor.listeners().subscribe(this,n.prototype.setScaleLineColor),this._properties.scalesProperties.textColor.listeners().subscribe(this,n.prototype.setScaleTextColor)},n.prototype.paneWidgets=function(){return this._paneWidgets},n.prototype.paneByCanvas=function(e){for(var t=0;t<this._paneWidgets.length;t++)if(this._paneWidgets[t].canvas===e||this._paneWidgets[t].top_canvas===e)return this._paneWidgets[t];return null},
e&&z(e)?this._properties.timezone.setValue(e):console.warn("Incorrect timezone: "+JSON.stringify(e))},n.prototype.refreshMarks=function(){this.model().barsMarksSources().forEach(function(e){e.refreshData()})},n.prototype.clearMarks=function(){this.model().barsMarksSources().forEach(function(e){e.clearMarks()})},n.prototype._init=function(){var e,t,i=this;this.model()&&this.model().mainSeries().clearData(),this.initColors(),this._makeDefaultGui(),e=function(){i._checkObsoleteTimezone(),i._chartSession&&i._chartSession.connected()&&this._model.restart(),this._content&&(this.initColors(),this._updateGui(),this.update());var e=i._model.mainSeries();e.marketStatus.subscribe(function(t){i.indicatorImage&&i._updateDataAndMarketStatus(t,e.status(),e.quoteData.update_mode_seconds)},{callWithLast:!0}),this._resizeHandler=function(){this._adjustSize(),this._model&&this._model.mainSeries().requestMoreData(),this.paint(),this.resizeSeriesControlUI(),this.checkCompactMode(),this.resizeIndicator()}.bind(this),this._resizeHandler(),this._jqParent.append(this._jqMainDiv),this._spinner&&(this._spinner.stop(),delete this._spinner),_("chrome_canvas_fix")&&navigator.userAgent.match(/windows.+chrome/i)&&$(window).on("visibilitychange:chart_"+this._guid,function(e,t){if(t){for(var n=0;n<i._paneWidgets.length;n++)i._paneWidgets[n].hardResetCanvas();i._timeaxiswidget&&i._timeaxiswidget.hardResetCanvas(),i.paint(new O(O.LIGHT_UPDATE))}}),$(window).on("keydown:chart_"+this._guid,function(e){27===e.which&&e.preventDefault()}),this._initBarsMarksSources(),this._activateSymbolSearchHotkeys(),this.model().timeScale().onScroll().subscribe(this,function(){this._onScroll.fire()}),this._inited=!0}.bind(this),t=this._makeDefaultModel(),void 0===t?e():t.then(e)},n.prototype._activateSymbolSearchHotkeys=function(){this.readOnly()||this._hideSymbolSearch||N()},n.prototype._checkObsoleteTimezone=function(){var e=this._properties.timezone.value();z(e)||this._properties.timezone.setValue(o(e))},n.prototype._initBarsMarksSources=function(){var e=this;this.withModel(this,function(){this.model().barsMarksSources().forEach(function(t){t.onNeedRepaint.subscribe(e,e.paint)})})},n.prototype.initESDTimelineWidget=function(){new ESDTimelineWidget(this)},n.prototype.initColors=function(){this._properties.paneProperties.background.listeners().subscribe(this,n.prototype.setBackgroundColor),this._properties.paneProperties.vertGridProperties.color.listeners().subscribe(this,n.prototype.redrawPanes),this._properties.paneProperties.horzGridProperties.color.listeners().subscribe(this,n.prototype.redrawPanes),this._properties.scalesProperties.lineColor.listeners().subscribe(this,n.prototype.setScaleLineColor),this._properties.scalesProperties.textColor.listeners().subscribe(this,n.prototype.setScaleTextColor)},n.prototype.paneWidgets=function(){return this._paneWidgets},n.prototype.paneByCanvas=function(e){for(var t=0;t<this._paneWidgets.length;t++)if(this._paneWidgets[t].canvas===e||this._paneWidgets[t].top_canvas===e)return this._paneWidgets[t];return null},
n.prototype.paneByState=function(e){for(var t=0;t<this._paneWidgets.length;t++)if(this._paneWidgets[t]._state===e)return this._paneWidgets[t];return null},n.prototype.priceAxisByCanvas=function(e){var t,i,n;for(t=0;t<this._paneWidgets.length;t++)if(i=this._paneWidgets[t],n=i.priceAxisByCanvas(e))return n;return null},n.prototype.timeAxisByCanvas=function(e){return e===this._timeAxisWidget.canvas||e===this._timeAxisWidget.top_canvas?this._timeAxisWidget:null},n.prototype.properties=function(){return this._properties},n.prototype.emulateCriticalError=function(){this._chartSession.removeSeries("-1",null)},n.prototype.readOnly=function(){return this._readOnly},n.prototype.onDisconnected=function(){return this._disconnected},n.prototype.onReconnectBailout=function(){return this._reconnectBailout},n.prototype.onConnected=function(){return this._connected},n.prototype.onRedrawPanes=function(){return this._redrawPanes},n.prototype.onScroll=function(){return this._onScroll},n.prototype.modelCreated=function(){return this._modelCreated},n.prototype.setResolution=function(e){var t,i;if(!this._model)return void this._properties.mainSeriesProperties.merge({interval:e});t=this._model.mainSeries().properties(),i=window.t("Change Resolution"),this._model.setResolutionProperty(t.interval,e,this,i)},n.prototype.getResolution=function(){return this._model?this._model.mainSeries().properties().interval.value():this._properties.mainSeriesProperties.interval.value()},n.prototype._addSymbol=function(e,t){var i=this.model(),n=i.studiesMetaData(),o="study_Overlay@tv-basicstudies",r=p.enabled("use_overrides_for_overlay")&&TradingView.defaultProperties[o]&&TradingView.defaultProperties[o].style,s=r||(i.mainSeries().properties().style.value()===d.STYLE_CANDLES?d.STYLE_BARS:d.STYLE_CANDLES),a={inputs:{symbol:e},style:s},l=n.filter(function(e){return"Overlay@tv-basicstudies"===e.id})[0];i.insertStudy(l,a,t)},n.prototype.addSymbol=function(e,t){var i=Array.prototype.slice.call(arguments),n=function(){this._addSymbol.apply(this,i)}.bind(this);this._options.isSymbolAvailable(e).then(function(e){e&&n()})},n.prototype.updateActions=function(){function e(){var e,t,i=studyTemplates.plainList("custom"),n=studyTemplates.plainList("default");l.applyStudyTemplate.subActions||(l.applyStudyTemplate.subActions=[]),e=l.applyStudyTemplate.subActions,e.splice(0,e.length),t=new T({text:$.t("Save Indicator Template As..."),statName:"Save"}),t.callbacks().subscribe(studyTemplates,studyTemplates.showSaveAsDialog),e.push(t,new x),i.length||n.length?(i.length&&($.each(i,function(t,i){function n(e){return function(){return studyTemplates.deleteStudyTemplate(e),this._parentMenu._parentMenuItem._parentMenu.destroy(),!1}}var o=new T({text:i,statName:"SetStudyTemplate"});o.callbacks().subscribe(studyTemplates,function(){this.applyTemplate(i)}),o.deleteButton={action:n(o.text)},e.push(o)}),n.length&&e.push(new x)),$.each(n,function(t,i){var n=new T({text:i,statName:"SetStudyTemplateFromDefaults"});n.callbacks().subscribe(studyTemplates,function(){this.applyTemplate(i)}),
e.push(n)})):e.push(new T({text:window.t("No study templates saved"),enabled:!1}))}var t,i,n,o,r,s,a,l=this.actions(),c=this._model.dataSources(),h=!1,u=!1;for(t=0,i=c.length;t<i;t++)n=c[t],TradingView.isInherited(n.constructor,b)&&n.isUserDeletable()&&(h=!0),TradingView.isInherited(n.constructor,v)&&n.removeByRemoveAllStudies()&&(u=!0),TradingView.isInherited(n.constructor,S)&&(u=!0);this._readOnly||(l.paneRemoveAllStudies&&l.paneRemoveAllStudies.setEnabled(u),l.paneRemoveAllDrawingTools&&l.paneRemoveAllDrawingTools.setEnabled(h),l.paneRemoveAllStudiesDrawingTools&&l.paneRemoveAllStudiesDrawingTools.setEnabled(u||h)),window.studyTemplates&&(e(),studyTemplates.refreshStudyTemplateList(e)),o=this,r=[],s=j,a=function(e){return e.id===o.model().model().properties().timezone.value()},s.forEach(function(e){if(!e.separator){var t=new T({text:e.title,checkable:!0,checked:a(e),statName:"SetTimeZone"});t.callbacks().subscribe(this,function(){o.model().setProperty(o.model().model().properties().timezone,e.id,"Changed Time Zone")}),r.push(t)}},this),l.applyTimeZone.subActions=r,l.addToWatchlist&&(l.addToWatchlist.text=window.t("Add {0} to Watchlist").format(this.getSymbol(!0))),l.addToTextNotes&&(l.addToTextNotes.text=window.t("Add Text Note for {0}").format(this.getSymbol(!0))),this.updateActionForIntradayOnly(l.sessionBreaks)},n.prototype.actions=function(){return this._actions||this._setActions(),this._actions},n.prototype._setActions=function(){var e,t,i,o,r,s,a,l,c,h,u,d,m,g,v,S,b,w,P,L,I,k,E,M,V,F,W,H,j,z,U,q,$,Y,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se,ae,le,ce,he,ue,de,pe,_e,fe=this,me=[];if(!this._readOnly){for(me=[new T({text:window.t("Eraser"),callbackContext:"eraser",statName:"Eraser"}),new x,new T({text:window.t("Trend Line"),callbackContext:"LineToolTrendLine",statName:"LineToolTrendLine"}),new T({text:window.t("Horizontal Line"),callbackContext:"LineToolHorzLine",statName:"LineToolHorzLine"}),new T({text:window.t("Vertical Line"),callbackContext:"LineToolVertLine",statName:"LineToolVertLine"}),new T({text:window.t("Arrow"),callbackContext:"LineToolArrow",statName:"LineToolArrow"}),new T({text:window.t("Ray"),callbackContext:"LineToolRay",statName:"LineToolRay"}),new T({text:window.t("Extended"),callbackContext:"LineToolExtended",statName:"LineToolExtended"}),new T({text:window.t("Parallel Channel"),callbackContext:"LineToolParallelChannel",statName:"LineToolParallelChannel"}),new x,new T({text:window.t("Pitchfork"),callbackContext:"LineToolPitchfork",statName:"LineToolPitchfork"}),new T({text:window.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork",statName:"LineToolSchiffPitchfork"}),new T({text:window.t("Pitchfan"),callbackContext:"LineToolPitchfan",statName:"LineToolPitchfan"}),new T({text:window.t("Gann Square"),callbackContext:"LineToolGannSquare",statName:"LineToolGannSquare"}),new T({text:window.t("Gann Fan"),callbackContext:"LineToolGannFan",statName:"LineToolGannFan"}),new T({text:window.t("Fib Retracement"),callbackContext:"LineToolFibRetracement",statName:"LineToolFibRetracement"}),new T({
e.push(n)})):e.push(new T({text:window.t("No study templates saved"),enabled:!1}))}var t,i,n,o,r,s,a,l=this.actions(),c=this._model.dataSources(),h=!1,u=!1;for(t=0,i=c.length;t<i;t++)n=c[t],TradingView.isInherited(n.constructor,b)&&n.isUserDeletable()&&(h=!0),TradingView.isInherited(n.constructor,v)&&n.removeByRemoveAllStudies()&&(u=!0),TradingView.isInherited(n.constructor,S)&&(u=!0);this._readOnly||(l.paneRemoveAllStudies&&l.paneRemoveAllStudies.setEnabled(u),l.paneRemoveAllDrawingTools&&l.paneRemoveAllDrawingTools.setEnabled(h),l.paneRemoveAllStudiesDrawingTools&&l.paneRemoveAllStudiesDrawingTools.setEnabled(u||h)),window.studyTemplates&&(e(),studyTemplates.refreshStudyTemplateList(e)),o=this,r=[],s=j,a=function(e){return e.id===o.model().model().properties().timezone.value()},s.forEach(function(e){if(!e.separator){var t=new T({text:e.title,checkable:!0,checked:a(e),statName:"SetTimeZone"});t.callbacks().subscribe(this,function(){o.model().setProperty(o.model().model().properties().timezone,e.id,"Changed Time Zone")}),r.push(t)}},this),l.applyTimeZone.subActions=r,l.addToWatchlist&&(l.addToWatchlist.text=window.t("Add {0} to Watchlist").format(this.getSymbol(!0))),l.addToTextNotes&&(l.addToTextNotes.text=window.t("Add Text Note for {0}").format(this.getSymbol(!0))),this.updateActionForIntradayOnly(l.sessionBreaks)},n.prototype.actions=function(){return this._actions||this._setActions(),this._actions},n.prototype._setActions=function(){var e,t,i,o,r,s,a,l,c,h,u,d,m,g,v,S,b,w,P,L,I,k,E,M,V,N,W,H,j,z,U,q,$,Y,K,Z,J,X,Q,ee,te,ie,ne,oe,re,se,ae,le,ce,he,ue,de,pe,_e,fe=this,me=[];if(!this._readOnly){for(me=[new T({text:window.t("Eraser"),callbackContext:"eraser",statName:"Eraser"}),new x,new T({text:window.t("Trend Line"),callbackContext:"LineToolTrendLine",statName:"LineToolTrendLine"}),new T({text:window.t("Horizontal Line"),callbackContext:"LineToolHorzLine",statName:"LineToolHorzLine"}),new T({text:window.t("Vertical Line"),callbackContext:"LineToolVertLine",statName:"LineToolVertLine"}),new T({text:window.t("Arrow"),callbackContext:"LineToolArrow",statName:"LineToolArrow"}),new T({text:window.t("Ray"),callbackContext:"LineToolRay",statName:"LineToolRay"}),new T({text:window.t("Extended"),callbackContext:"LineToolExtended",statName:"LineToolExtended"}),new T({text:window.t("Parallel Channel"),callbackContext:"LineToolParallelChannel",statName:"LineToolParallelChannel"}),new x,new T({text:window.t("Pitchfork"),callbackContext:"LineToolPitchfork",statName:"LineToolPitchfork"}),new T({text:window.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork",statName:"LineToolSchiffPitchfork"}),new T({text:window.t("Pitchfan"),callbackContext:"LineToolPitchfan",statName:"LineToolPitchfan"}),new T({text:window.t("Gann Square"),callbackContext:"LineToolGannSquare",statName:"LineToolGannSquare"}),new T({text:window.t("Gann Fan"),callbackContext:"LineToolGannFan",statName:"LineToolGannFan"}),new T({text:window.t("Fib Retracement"),callbackContext:"LineToolFibRetracement",statName:"LineToolFibRetracement"}),new T({
text:window.t("Trend-Based Fib Extension"),callbackContext:"LineToolTrendBasedFibExtension",statName:"LineToolTrendBasedFibExtension"}),new T({text:window.t("Fib Speed Resistance Fan"),callbackContext:"LineToolFibSpeedResistanceFan",statName:"LineToolFibSpeedResistanceFan"}),new T({text:window.t("Fib Time Zone"),callbackContext:"LineToolFibTimeZone",statName:"LineToolFibTimeZone"}),new T({text:window.t("Circle Lines"),callbackContext:"LineToolCircleLines",statName:"LineToolCircleLines"}),new T({text:window.t("Fib Circles"),callbackContext:"LineToolFibCircles",statName:"LineToolFibCircles"}),new T({text:window.t("Fib Speed Resistance Arcs"),callbackContext:"LineToolFibSpeedResistanceArcs",statName:"LineToolFibSpeedResistanceArcs"}),new x,new T({text:window.t("Rectangle"),callbackContext:"LineToolRectangle",statName:"LineToolRectangle"}),new T({text:window.t("Ellipse"),callbackContext:"LineToolEllipse",statName:"LineToolEllipse"}),new T({text:window.t("Triangle"),callbackContext:"LineToolTriangle",statName:"LineToolTriangle"}),new T({text:window.t("Polyline"),callbackContext:"LineToolPolyline",statName:"LineToolPolyline"}),new T({text:window.t("Arc"),callbackContext:"LineToolArc",statName:"LineToolArc"}),new x,new T({text:window.t("Text",{context:"tool"}),callbackContext:"LineToolText",statName:"LineToolText"}),new T({text:window.t("Anchored Text"),callbackContext:"LineToolTextAbsolute",statName:"LineToolTextAbsolute"}),new T({text:window.t("Balloon"),callbackContext:"LineToolBalloon",statName:"LineToolBalloon"}),new T({text:window.t("Price Label"),callbackContext:"LineToolPriceLabel",statName:"LineToolPriceLabel"}),new x,new T({text:window.t("Elliott Wave Subminuette"),callbackContext:"LineToolElliottSubminuette",statName:"LineToolElliottSubminuette"}),new T({text:window.t("Elliott Wave Minor"),callbackContext:"LineToolElliottMinor",statName:"LineToolElliottMinor"}),new T({text:window.t("Elliott Wave Circle"),callbackContext:"LineToolElliottCircle",statName:"LineToolElliottCircle"}),new T({text:window.t("Elliott Minor Retracement"),callbackContext:"LineToolElliottMinorRetr",statName:"LineToolElliottMinorRetr"}),new T({text:window.t("Elliott Major Retracement"),callbackContext:"LineToolElliottMajorRetr",statName:"LineToolElliottMajorRetr"}),new x,new T({text:window.t("Brush"),callbackContext:"LineToolBrush",statName:"LineToolBrush"}),new x,new T({text:window.t("Forecast"),callbackContext:"LineToolPrediction",statName:"LineToolPrediction"})],fe=this,i=function(e){C.tool.setValue(e.callbackContext())},o=0;o<me.length;o++)me[o].callbacks().subscribe(null,i);e=new T({text:window.t("Scales Properties..."),statName:"ScalesProperties"}),t=new T({text:window.t("Timezone/Sessions Properties..."),statName:"TimezoneSessionsProperties"})}r=new T({text:window.t("Reset Chart"),shortcut:"Alt+R",statName:"ResetChart"}),r.callbacks().subscribe(this,this.GUIResetScales),s=new T({text:window.t("Undo"),shortcut:"ctrl+z"}),s.callbacks().subscribe(null,function(){G("GUI","Undo"),fe._model.undoHistory.undo()}),s.disable(),a=new T({
text:window.t("Redo"),shortcut:"ctrl+y"}),a.callbacks().subscribe(null,function(){G("GUI","Redo"),fe._model.undoHistory.redo()}),a.disable(),fe.withModel(null,function(){fe._model.undoHistory.undoStack().onChange().subscribe(fe,fe.updateUndoRedo),fe._model.undoHistory.redoStack().onChange().subscribe(fe,fe.updateUndoRedo)}),l=new T({text:window.t("Loading")}),c=[l],h=new T({text:window.t("Color Theme"),subActions:c,statName:"ColorTheme"}),u=new T({text:window.t("TimeZone"),statName:"TimeZone"}),d=new T({text:window.t("Change Symbol..."),shortcut:window.t("Any Symbol"),doNotBindShortcut:!0,statName:"ChangeSymbol"}),TVSettings.setValue("symboledit.dialog_last_entry",""),d.callbacks().subscribe(this,function(){N({callback:this.setSymbol.bind(this),ownerDocument:this._jqParent.prop("ownerDocument")})}),m=new T({text:window.t("Change Interval..."),shortcut:window.t("Any Number"),doNotBindShortcut:!0,statName:"ChangeInterval"}),m.callbacks().subscribe(this,function(){B({callback:function(e){A(e),R.interval.setValue(e)},ownerDocument:this._jqParent.prop("ownerDocument")})}),TradingView.onWidget()||(this._options.addToWatchlistEnabled&&(g=new T({text:window.t("Add To Watchlist"),shortcut:"Alt+W",statName:"AddToWatchlist"}),g.callbacks().subscribe(this,function(){var e,t,i;if(window.widgetbar){for(e=window.widgetbar.setPage("base"),i=0;i<e.widgets.length;i++)if("watchlist"===e.widgets[i].type){t=e.widgets[i].widgetObject;break}if(!t)return;t.addHighlight(this.getSymbol())}})),_("text_notes")&&(v=new T({text:window.t("Add To Text Notes"),shortcut:"Alt+N",statName:"AddToTextNotes"}),v.callbacks().subscribe(this,function(){var e=this;runOrSignIn(function(){TradingView.bottomWidgetBar&&(TradingView.bottomWidgetBar.toggleWidget("text_notes",!0),TradingView.bottomWidgetBar._widgets.text_notes.addNote(null,e.getSymbol(!0),e.getSymbol()))},{source:"Add text note in chart context menu"})}))),S=new T({text:window.t("Insert Study Template"),statName:"InserStudyTemplate"}),b=new T({shortcut:"Ctrl+Alt+Q",text:window.t("Reset Scale"),statName:"ResetScale"}),b.callbacks().subscribe(null,function(e){fe.model().resetTimeScale()}),w=new T({text:window.t("Insert Drawing Tool"),subActions:me,statName:"InsertDravingTool"}),P=new T({text:window.t("Remove All Indicators"),statName:"RemoveAllIndicators"}),L=new T({text:window.t("Remove All Drawing Tools"),statName:"RemoveAllDrawingTools"}),I=new T({text:window.t("All Indicators And Drawing Tools"),statName:"RemoveAllIndicatorsAndDrawingTools"}),k=new T({text:window.t("Insert Indicator..."),shortcut:"/",statName:"InsertIndicator"}),E=new T({text:window.t("Script Editor..."),statName:"ScriptEditor"}),M=new T({text:window.t("Compare or Add Symbol..."),statName:"CompareOrAddSymbol"}),V=new T({text:window.t("Compare..."),statName:"Compare"}),F=new T({text:window.t("Objects Tree..."),statName:"ObjectsTree"}),W=new T({text:window.t("Properties..."),statName:"ChartProperties",callback:function(e,t){fe.showChartProperties()}}),H=new T({text:window.t("Lock/Unlock"),statName:"ToggleLockSelectedObject"}),
text:window.t("Redo"),shortcut:"ctrl+y"}),a.callbacks().subscribe(null,function(){G("GUI","Redo"),fe._model.undoHistory.redo()}),a.disable(),fe.withModel(null,function(){fe._model.undoHistory.undoStack().onChange().subscribe(fe,fe.updateUndoRedo),fe._model.undoHistory.redoStack().onChange().subscribe(fe,fe.updateUndoRedo)}),l=new T({text:window.t("Loading")}),c=[l],h=new T({text:window.t("Color Theme"),subActions:c,statName:"ColorTheme"}),u=new T({text:window.t("TimeZone"),statName:"TimeZone"}),d=new T({text:window.t("Change Symbol..."),shortcut:window.t("Any Symbol"),doNotBindShortcut:!0,statName:"ChangeSymbol"}),TVSettings.setValue("symboledit.dialog_last_entry",""),d.callbacks().subscribe(this,function(){F({callback:this.setSymbol.bind(this),ownerDocument:this._jqParent.prop("ownerDocument")})}),m=new T({text:window.t("Change Interval..."),shortcut:window.t("Any Number"),doNotBindShortcut:!0,statName:"ChangeInterval"}),m.callbacks().subscribe(this,function(){B({callback:function(e){A(e),R.interval.setValue(e)},ownerDocument:this._jqParent.prop("ownerDocument")})}),TradingView.onWidget()||(this._options.addToWatchlistEnabled&&(g=new T({text:window.t("Add To Watchlist"),shortcut:"Alt+W",statName:"AddToWatchlist"}),g.callbacks().subscribe(this,function(){var e,t,i;if(window.widgetbar){for(e=window.widgetbar.setPage("base"),i=0;i<e.widgets.length;i++)if("watchlist"===e.widgets[i].type){t=e.widgets[i].widgetObject;break}if(!t)return;t.addHighlight(this.getSymbol())}})),_("text_notes")&&(v=new T({text:window.t("Add To Text Notes"),shortcut:"Alt+N",statName:"AddToTextNotes"}),v.callbacks().subscribe(this,function(){var e=this;runOrSignIn(function(){TradingView.bottomWidgetBar&&(TradingView.bottomWidgetBar.toggleWidget("text_notes",!0),TradingView.bottomWidgetBar._widgets.text_notes.addNote(null,e.getSymbol(!0),e.getSymbol()))},{source:"Add text note in chart context menu"})}))),S=new T({text:window.t("Insert Study Template"),statName:"InserStudyTemplate"}),b=new T({shortcut:"Ctrl+Alt+Q",text:window.t("Reset Scale"),statName:"ResetScale"}),b.callbacks().subscribe(null,function(e){fe.model().resetTimeScale()}),w=new T({text:window.t("Insert Drawing Tool"),subActions:me,statName:"InsertDravingTool"}),P=new T({text:window.t("Remove All Indicators"),statName:"RemoveAllIndicators"}),L=new T({text:window.t("Remove All Drawing Tools"),statName:"RemoveAllDrawingTools"}),I=new T({text:window.t("All Indicators And Drawing Tools"),statName:"RemoveAllIndicatorsAndDrawingTools"}),k=new T({text:window.t("Insert Indicator..."),shortcut:"/",statName:"InsertIndicator"}),E=new T({text:window.t("Script Editor..."),statName:"ScriptEditor"}),M=new T({text:window.t("Compare or Add Symbol..."),statName:"CompareOrAddSymbol"}),V=new T({text:window.t("Compare..."),statName:"Compare"}),N=new T({text:window.t("Objects Tree..."),statName:"ObjectsTree"}),W=new T({text:window.t("Properties..."),statName:"ChartProperties",callback:function(e,t){fe.showChartProperties()}}),H=new T({text:window.t("Lock/Unlock"),statName:"ToggleLockSelectedObject"}),
H.callbacks().subscribe(this,n.prototype.toggleLockSelectedObject),j=new T({text:window.t("Hide"),statName:"HideSelectedObject"}),j.callbacks().subscribe(this,n.prototype.hideSelectedObject),p.enabled("property_pages")&&(z=new T({text:window.t("Format..."),statName:"EditSelectedObject"}),z.callbacks().subscribe(this,n.prototype.editSelectedObject)),U=new T({text:window.t("Source Code..."),statName:"OpenSelectedObjectSource"}),U.callbacks().subscribe(this,this.openSelectedObjectSource),q=new T({text:window.t("Left Axis"),checkable:!0,statName:"ToggleLeftAxis"}),q.binder=new f(q,this._properties.scalesProperties.showLeftScale,this.model(),window.t("Show Left Scale")),$=new T({text:window.t("Right Axis"),checkable:!0,statName:"ToggleRightAxis"}),$.binder=new f($,this._properties.scalesProperties.showRightScale,this.model(),window.t("Show Right Scale")),this._properties.scalesProperties.showLeftScale.listeners().subscribe(this,n.prototype._updateScalesActions),this._properties.scalesProperties.showRightScale.listeners().subscribe(this,n.prototype._updateScalesActions),Y=new T({text:window.t("Scale Price Chart Only"),checkable:!0,statName:"ScalePriceChartOnly"}),Y.binder=new f(Y,this._properties.scalesProperties.scaleSeriesOnly,this.model(),window.t("Scale Price Chart Only")),K=this.model().model(),this._properties.scalesProperties.scaleSeriesOnly.listeners().subscribe(null,function(){K.recalculateAllPanes(),K.invalidate(new O(O.FULL_UPDATE))}),Z=new T({text:window.t("Drawings Toolbar"),checkable:!0,statName:"ToggleDrawingToolbar"}),J=this._options.isDrawingToolbarVisible,J&&(J.subscribe(function(e){Z.setChecked(e)},{callWithLast:!0}),Z.callbacks().subscribe(null,function(){J.setValue(!J.value())})),X=new T({text:window.t("Magnet Mode"),checkable:!0,statName:"ToggleMagnetMode"}),X.binder=new f(X,C.properties().magnet,this.model(),"Magnet"),Q=new T({text:window.t("Stay in Drawing Mode"),checkable:!0,statName:"ToggleStayInDrawingMode"}),Q.binder=new f(Q,C.properties().stayInDrawingMode,this.model(),window.t("Stay In Drawing Mode")),ee=new T({text:window.t("Sync drawings to all charts"),checkable:!0,statName:"ToggleSyncDrawings"}),ee.binder=new f(ee,C.properties().drawOnAllCharts,this.model(),"SyncDrawings"),te=new T({text:window.t("Lock All Drawing Tools"),checkable:!0,statName:"ToggleLockDrawings"}),te.binder=new f(te,C.lockDrawings(),this.model(),window.t("Lock drawings"),function(e){e||this.binder.setValue(!this.binder.value()),C.lockDrawings().setValue(this.binder.value())}.bind(te)),ie=new T({text:window.t("Hide All Drawing Tools"),checkable:!0,statName:"ToggleHideAllDrawingTools"}),ie.binder=new f(ie,C.hideAllDrawings(),this.model(),window.t("Hide All Drawing Tools"),function(e){e||this.binder.setValue(!this.binder.value()),C.hideAllDrawings().setValue(this.binder.value())}.bind(ie)),ne=new T({text:window.t("Hide Marks On Bars"),checkable:!0,statName:"ToggleHideMarksOnBars"}),ne.binder=new f(ne,C.hideMarksOnBars(),this.model(),window.t("Hide Marks On Bars"),function(e){e||this.binder.setValue(!this.binder.value()),
C.hideMarksOnBars().setValue(this.binder.value())}.bind(ne)),oe=new T({text:window.t("Extended Hours"),checkable:!0,statName:"ToggleExtendedHours"}),oe.binder=new f(oe,this.model().mainSeries().properties().extendedHours,this.model(),window.t("Change Extended Hours")),re=new T({text:window.t("Symbol Last Value"),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"}),re.binder=new f(re,this.properties().scalesProperties.showSeriesLastValue,this.model(),window.t("Show Symbol Last Value")),se=new T({text:window.t("Symbol Labels"),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"}),se.binding=new f(se,this.properties().scalesProperties.showSymbolLabels,this.model(),"Undo Show Symbol Labels"),ae=new T({text:window.t("Indicator Last Value"),checkable:!0,checked:!1,statName:"ToggleStudyLastValue"}),ae.binder=new f(ae,this.properties().scalesProperties.showStudyLastValue,this.model(),window.t("Show Indicator Last Value")),le=new T({text:window.t("Indicator Labels"),checkable:!0,checked:!1,statName:"ToggleIndicatorsLabels"}),le.binding=new f(le,this.properties().scalesProperties.showStudyPlotLabels,this.model(),"Undo Show Indicator Labels"),ce=new T({text:window.t("Countdown"),checkable:!0,checked:!1,statName:"ToggleCountdown"}),ce.binder=new f(ce,this.model().mainSeries().properties().showCountdown,this.model(),window.t("Show Countdown")),he=null,this._options.goToDateEnabled&&(he=new T({text:window.t("Go to Date..."),shortcut:"Alt+G",statName:"GoToDate"}),he.callbacks().subscribe(null,function(){var e=fe._chartWidgetCollection.activeChartWidget.value();y(e.model())})),ue=new T({text:window.t("Symbol Info..."),checkable:!1,statName:"SymbolInfo"}),ue.callbacks().subscribe(null,function(){var e=fe.model().mainSeries().symbol(),t=fe.model().mainSeries().symbolInfo();D(e,{symbolInfo:t})}),this._actions={chartProperties:W,timeScaleReset:b,chartReset:r,compareOrAdd:M,compare:V,paneObjectTree:F,insertIndicator:k,insertDrawingTool:w,applyColorTheme:h,applyStudyTemplate:S,symbolSearch:d,showSymbolInfoDialog:ue,changeInterval:m,seriesHide:j,studyHide:j,lineToggleLock:H,lineHide:j,showLeftAxis:q,showRightAxis:$,scaleSeriesOnly:Y,drawingToolbarAction:Z,magnetAction:X,stayInDrawingModeAction:Q,syncModeAction:ee,lockDrawingsAction:te,hideAllDrawingsAction:ie,hideAllMarks:ne,applyTimeZone:u,extendedHours:oe,showCountdown:ce,showSeriesLastValue:re,showSymbolLabelsAction:se,showStudyLastValue:ae,showStudyPlotNamesAction:le,undo:s,redo:a,viewSourceCode:U},e&&(this._actions.scalesProperties=e),t&&(this._actions.tmzProperties=t),g&&(this._actions.addToWatchlist=g),!TradingView.onWidget()&&p.enabled("text_notes")&&_("text_notes")&&(this._actions.addToTextNotes=v),null!==he&&(this._actions.gotoDate=he),p.enabled("charting_library_base")||(this._actions.scriptEditor=E),this.createSessionBreaksActions(),this.readOnly()||(de=new T({text:window.t("Remove"),shortcut:"Del",statName:"RemoveSelectedObject"}),de.callbacks().subscribe(this,function(){var e;this._chartWidgetCollection&&(e=this._chartWidgetCollection.activeChartWidget.value()),
C.hideMarksOnBars().setValue(this.binder.value())}.bind(ne)),oe=new T({text:window.t("Extended Hours"),checkable:!0,statName:"ToggleExtendedHours"}),oe.binder=new f(oe,this.model().mainSeries().properties().extendedHours,this.model(),window.t("Change Extended Hours")),re=new T({text:window.t("Symbol Last Value"),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"}),re.binder=new f(re,this.properties().scalesProperties.showSeriesLastValue,this.model(),window.t("Show Symbol Last Value")),se=new T({text:window.t("Symbol Labels"),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"}),se.binding=new f(se,this.properties().scalesProperties.showSymbolLabels,this.model(),"Undo Show Symbol Labels"),ae=new T({text:window.t("Indicator Last Value"),checkable:!0,checked:!1,statName:"ToggleStudyLastValue"}),ae.binder=new f(ae,this.properties().scalesProperties.showStudyLastValue,this.model(),window.t("Show Indicator Last Value")),le=new T({text:window.t("Indicator Labels"),checkable:!0,checked:!1,statName:"ToggleIndicatorsLabels"}),le.binding=new f(le,this.properties().scalesProperties.showStudyPlotLabels,this.model(),"Undo Show Indicator Labels"),ce=new T({text:window.t("Countdown"),checkable:!0,checked:!1,statName:"ToggleCountdown"}),ce.binder=new f(ce,this.model().mainSeries().properties().showCountdown,this.model(),window.t("Show Countdown")),he=null,this._options.goToDateEnabled&&(he=new T({text:window.t("Go to Date..."),shortcut:"Alt+G",statName:"GoToDate"}),he.callbacks().subscribe(null,function(){var e=fe._chartWidgetCollection.activeChartWidget.value();y(e.model())})),ue=new T({text:window.t("Symbol Info..."),checkable:!1,statName:"SymbolInfo"}),ue.callbacks().subscribe(null,function(){var e=fe.model().mainSeries().symbol(),t=fe.model().mainSeries().symbolInfo();D(e,{symbolInfo:t})}),this._actions={chartProperties:W,timeScaleReset:b,chartReset:r,compareOrAdd:M,compare:V,paneObjectTree:N,insertIndicator:k,insertDrawingTool:w,applyColorTheme:h,applyStudyTemplate:S,symbolSearch:d,showSymbolInfoDialog:ue,changeInterval:m,seriesHide:j,studyHide:j,lineToggleLock:H,lineHide:j,showLeftAxis:q,showRightAxis:$,scaleSeriesOnly:Y,drawingToolbarAction:Z,magnetAction:X,stayInDrawingModeAction:Q,syncModeAction:ee,lockDrawingsAction:te,hideAllDrawingsAction:ie,hideAllMarks:ne,applyTimeZone:u,extendedHours:oe,showCountdown:ce,showSeriesLastValue:re,showSymbolLabelsAction:se,showStudyLastValue:ae,showStudyPlotNamesAction:le,undo:s,redo:a,viewSourceCode:U},e&&(this._actions.scalesProperties=e),t&&(this._actions.tmzProperties=t),g&&(this._actions.addToWatchlist=g),!TradingView.onWidget()&&p.enabled("text_notes")&&_("text_notes")&&(this._actions.addToTextNotes=v),null!==he&&(this._actions.gotoDate=he),p.enabled("charting_library_base")||(this._actions.scriptEditor=E),this.createSessionBreaksActions(),this.readOnly()||(de=new T({text:window.t("Remove"),shortcut:"Del",statName:"RemoveSelectedObject"}),de.callbacks().subscribe(this,function(){var e;this._chartWidgetCollection&&(e=this._chartWidgetCollection.activeChartWidget.value()),
e||(e=this),e.removeSelectedSource()}),pe=new T({text:window.t("Stop syncing drawing"),statName:"StopSyncingDrawing"}),pe.callbacks().subscribe(this,function(){var e;this._chartWidgetCollection&&(e=this._chartWidgetCollection.activeChartWidget.value()),e||(e=this),e.unlinkSelectedLine()}),_e=new T({text:window.t("Sync drawing to all charts"),statName:"SyncDrawingToAllCharts"}),_e.callbacks().subscribe(this,function(){var e;this._chartWidgetCollection&&(e=this._chartWidgetCollection.activeChartWidget.value()),e||(e=this),e.copyLineToOtherCharts()}),this._actions.insertDrawingTool=w,this._actions.paneRemoveAllStudies=P,this._actions.paneRemoveAllDrawingTools=L,this._actions.paneRemoveAllStudiesDrawingTools=I,this._actions.seriesRemove=de,this._actions.studyRemove=de,this._actions.lineRemove=de,this._actions.lineUnlink=pe,this._actions.lineCopyToCharts=_e,p.enabled("property_pages")&&(this._actions.format=z),this._actions.lockDrawingsAction=te,this._actions.hideAllDrawingsAction=ie,this._actions.hideAllMarks=ne,this._actions.paneRemoveAllStudies.callbacks().subscribe(this,n.prototype.removeAllStudies),this._actions.paneRemoveAllDrawingTools.callbacks().subscribe(this,n.prototype.removeAllDrawingTools),this._actions.paneRemoveAllStudiesDrawingTools.callbacks().subscribe(this,n.prototype.removeAllStudiesDrawingTools)),this._actions.paneObjectTree.callbacks().subscribe(this,n.prototype.showObjectsTreeDialog),this._actions.chartProperties.callbacks().subscribe(this,n.prototype.showChartProperties),this._actions.insertIndicator.callbacks().subscribe(this,n.prototype.showIndicators),this._actions.scriptEditor&&this._actions.scriptEditor.callbacks().subscribe(this,n.prototype.showScriptEditor),this._actions.compareOrAdd.callbacks().subscribe(this,n.prototype.showCompareOrAdd),this._actions.compare.callbacks().subscribe(this,n.prototype.showCompareOrAdd),this._actions.scalesProperties&&this._actions.scalesProperties.callbacks().subscribe(this,n.prototype.showScalesProperties),this._actions.tmzProperties&&this._actions.tmzProperties.callbacks().subscribe(this,n.prototype.showTimezoneProperties),this._updateScalesActions()},n.prototype.executeActionById=function(e){if("takeScreenshot"===e)return console.warn('Action "takeScreenshot" is deprecated. Use method "takeScreenshot" instead'),void this._chartWidgetCollection.takeScreenshot();if("lockDrawingsAction"===e&&console.warn('Action "lockDrawingsAction" is deprecated. Use method "lockAllDrawingTools" instead'),"hideAllDrawingsAction"===e&&console.warn('Action "hideAllDrawingsAction" is deprecated. Use method "hideAllDrawingTools" instead'),e in this._actions){var t=this._actions[e];t.checkable&&t.setChecked(!t.checked),this._actions[e].callbacks().fire(t)}else console.warn("Unknown action id: "+e)},n.prototype.getCheckableActionState=function(e){if("lockDrawingsAction"===e)return console.warn('Action "lockDrawingsAction" is deprecated. Use method "lockAllDrawingTools" instead'),null
;if("hideAllDrawingsAction"===e)return console.warn('Action "hideAllDrawingsAction" is deprecated. Use method "hideAllDrawingTools" instead'),null;if(e in this._actions){var t=this._actions[e];if(t.checkable)return t.checked;console.warn("Action "+e+" has no state")}else console.warn("Unknown action id: "+e);return null},n.prototype._updateScalesActions=function(){if(this._actions){for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].updateScalesVisibility();this._timeAxisWidget.updatePriceScalesVisibility()}},n.prototype.removeAllStudies=function(){this._model.removeAllStudies()},n.prototype.removeAllDrawingTools=function(){this._model.removeAllDrawingTools()},n.prototype.removeAllStudiesDrawingTools=function(){this._model.removeAllStudies(),this._model.removeAllDrawingTools()},n.prototype.model=function(){return this._model},n.prototype.defaultSymbol=function(){return this._defSymbol},n.prototype.connect=function(){this._handler=function(e){this._onData(e)}.bind(this),this._boundOnChartSessionIsConnectedChanged=this._onChartSessionIsConnectedChanged.bind(this),this._chartSession.isConnected().subscribe(this._boundOnChartSessionIsConnectedChanged),this._chartSession.criticalError().subscribe(this,this._onChartSessionCriticalError),this._chartSession.connect(this._handler)},n.prototype.finishInitWithoutConnect=function(){this._chartSession.disable(),this._init(),this.chartWidgetInitialized.fire()},n.prototype.reconnect=function(){this._chartSession.disconnect(),this._chartSession.connect()},n.prototype.update=function(){if(this._model){for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].update();this._timeAxisWidget.update()}},n.prototype.paint=function(e){e||(e=new O(O.FULL_UPDATE));for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].paint(e.invalidateForPane(t),!1);this._timeAxisWidget&&this._timeAxisWidget.paint(e.fullInvalidation()),this._redrawPanes.fire()},n.prototype._makeDefaultGui=function(){this._makeChartWidget(),this._makeLoadingScreen(),this._model&&this._makePaneWidgetsAndSeparators(),this._makeTimeAxisWidget(),this._adjustSize(),this._updateScalesActions(),$(this._elMainTable).selectable(!1),this.update(),this.paint()},n.prototype.widget=function(){return this._jqMainDiv},n.prototype.restoreState=function(e,t){this._adjustSize();this._model.restoreState(this._content,t);this._setActions()},n.prototype.redrawPanes=function(e){for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].paint();this._redrawPanes.fire()},n.prototype.setBackgroundColor=function(e){this.scaleBackgroundColor=e.value();for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].paint(),this._paneWidgets[t].setCursorForTool();this.update(),this.paint()},n.prototype.setScaleLineColor=function(e){this.scaleLineColor=e.value(),$.each(this._paneSeparators,function(){this.update()}),this.update(),this.paint()},n.prototype.setScaleTextColor=function(e){this.scaleTextColor=e.value(),this.update(),this.paint()},n.prototype.setTimingsMeter=function(e){this._timingsMeter=e,
this._updateTimingsMeterState()},n.prototype._updateTimingsMeterState=function(){var e=this._options.visible.value();null!==this._timingsMeter&&(e?this._timingsMeter.startCollect():this._timingsMeter.stopCollect())},n.prototype._update=function(e){var t,i=e?e.fullInvalidation():O.FULL_UPDATE;if(null!==this._timingsMeter&&this._timingsMeter.startDraw(i),i===O.FULL_UPDATE){for(this._model?this._updateGui():this._adjustSize(),this._timeAxisWidget.update(),t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t]._state=this._model.panes()[t],null!==this._paneWidgets[t].statusWidget()&&this._paneWidgets[t].statusWidget().updateLayout();this._dataWindowWidget&&this._dataWindowWidget.fullUpdate()}else if(i===O.LIGHT_UPDATE){for(this._timeAxisWidget.update(),t=0;t<this._paneWidgets.length;t++)null!==this._paneWidgets[t].statusWidget()&&this._paneWidgets[t].statusWidget().update();this._dataWindowWidget&&this._dataWindowWidget.update()}else if(i===O.UPDATE_CURSOR_ONLY){for(t=0;t<this._paneWidgets.length;t++)null!==this._paneWidgets[t].statusWidget()&&this._paneWidgets[t].statusWidget().update();this._dataWindowWidget&&this._dataWindowWidget.update()}this.paint(e),null!==this._timingsMeter&&this._timingsMeter.stopDraw()},n.prototype._createVolumeIfNeeded=function(){var e=p.enabled("create_volume_indicator_by_default")&&this._options.addVolume,t=!this._content,i=p.enabled("charting_library_base"),n=p.enabled("create_volume_indicator_by_default_once"),o=this._content&&!this._content.loading;e&&(t||i&&o&&!n)&&this._model.mainSeries().dataEvents().symbolResolved().subscribe(this,function(){var e=this;setTimeout(function(){var t,i,n,o,r=e._model.model().mainSeries().symbolInfo();r&&(t=!r.has_no_volume,!e.containsVolume()&&t?(i=ee.factoryDefaults("chartproperties.volumePaneSize"),n={paneSize:i},p.enabled("hide_volume_ma")&&(n.styles={vol_ma:{visible:!1}}),e.insertStudy("Volume@tv-basicstudies",!1,p.enabled("volume_force_overlay"),void 0,n)):!t&&e.containsVolume()&&(o=e.model().dataSources().filter(function(e){return e instanceof v&&"Volume"===e.metaInfo().shortId})[0],e._model.model().removeSource(o)))},0)},n)},n.prototype._makeDefaultModel=function(){function e(){var e={readOnly:c.readOnly(),isSnapshot:!!c._containsData,timeScale:c._options.timeScale};return void 0!==c._options.watermarkEnabled&&(e.watermarkEnabled=c._options.watermarkEnabled),void 0!==c._options.crossHairMenuEnabled&&(e.crossHairMenuEnabled=c._options.crossHairMenuEnabled),l(c._chartSession,function(e){if(!(e instanceof O))throw Error("Invalid mask");c._invalidateMask?c._invalidateMask.merge(e):c._invalidateMask=e,c._draw_planned||(c._draw_planned=!0,c._options.visible.when(function(){var e=!document.hidden,i=c.screen&&c.screen.isShown();null!==c._timingsMeter&&e&&!i&&c._timingsMeter.startWaitingDraw(),c._drawRafId=c._jqParent.prop("ownerDocument").defaultView.requestAnimationFrame(t)}))},c._properties,o,c._metaInfoRepository,c,c._options.undoHistory,c._options.barsMarksContainersFactory,e)}function t(){c._draw_planned=!1,c._drawRafId=0,
@@ -330,15 +330,15 @@ onWidget:i._onWidget,interval:s.interval||"D",style:s.style}),i._init(),R.interv
return this._options.width.value()},n.prototype._height=function(){var e=this._options.height.value();return this._chartControlsBar&&(e=Math.max(e-this.controlBarHeight,0)),e},n.prototype.resize=function(){var e={height:this._height()+"px",width:this._width()+"px"};this._jqMainDiv.css(e),this._elMainTable.style.height=e.height,this._elMainTable.style.width=e.width,this._resizeHandler&&this._jqMainDiv&&this._resizeHandler()},n.prototype.chartSession=function(){return this._chartSession},n.prototype.maxLhsPriceAxisWidth=0,n.prototype.maxRhsPriceAxisWidth=0,n.prototype.GUIResetScales=function(){G("GUI","Reset Scales");var e=this.model();e&&e.resetScales()},n.prototype.onLineCancelled=function(){C.resetToCursor()},n.prototype.createIndicatorImage=function(){var e=this;this._indicatorBindingPriceAxisName="right",this._indicatorImageMargin="marginRight",this.indicatorImage=this._jqParent[0].getElementsByClassName("chart-status-picture")[0],this.indicatorImage?this.indicatorImage.innerHTML="":(this.indicatorImage=this._jqParent.prop("ownerDocument").createElement("span"),this.indicatorImage.className="chart-status-picture",this._jqParent.append(this.indicatorImage)),this._options.marketStatusWidgetEnabled&&(this.indicatorText=$('<span class="series-status-text apply-common-tooltip"><span class="js-market-status tv-market-status--series-status"></span></span>'),this.indicatorText.appendTo(this.indicatorImage),this.indicatorDot&&this.indicatorDot.stop(),this.indicatorDot=new X({el:this.indicatorText.find(".js-market-status")[0],classSuffix:"--for-chart"}),this.indicatorDot.start(),p.enabled("display_data_mode")&&($('<span class="js-data-mode tv-data-mode--series-status"></span>').appendTo(this.indicatorText),this.dataModeIndicator&&this.dataModeIndicator.stop(),this.dataModeIndicator=new Q({el:this.indicatorText.find(".js-data-mode")[0],classSuffix:"--for-chart"}),this.dataModeIndicator.start())),e.withModel(null,function(){var t=e._model.mainSeries();t.onStatusChanged().subscribe(null,e.updateIndicatorImage.bind(e)),t.marketStatus.subscribe(e.updateIndicatorImage.bind(e)),e.updateIndicatorImage(),e.checkCompactMode(),e._model.onRearrangePanes().subscribe(null,function(){e.resetIndicatorSize(),e.resizeIndicator()})}),this._indicatorPriceAxisWidthChanged=this.getPriceAxisWidthChangedByName(this._indicatorBindingPriceAxisName),this._indicatorPriceAxisWidthChanged.subscribe(this,this.updateIndicatorImagePosition),this.updateIndicatorImagePosition()},n.prototype.updateIndicatorImage=function(){var e,t,i,n=this,o=this._model;o&&(e=o.mainSeries(),t=e.status(),i=e.quoteData?e.quoteData.update_mode_seconds:null,n._updateDataAndMarketStatus(e.marketStatus.value(),t,i))},n.prototype.checkCompactMode=function(){this._jqMainDiv.toggleClass("i-compact",this._width()<=400),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.clientWidth)},n.prototype.getDataTextStatus=function(e){var t;switch(e){case d.STATUS_LOADING:case d.STATUS_RESOLVING:t="loading";break;case d.STATUS_INVALID_SYMBOL:t="invalid";break;case d.STATUS_NO_BARS:
t="forbidden";break;case d.STATUS_DELAYED:t="delayed";break;case d.STATUS_DELAYED_STREAMING:t="delayed_streaming";break;case d.STATUS_EOD:case d.STATUS_PULSE:t="endofday";break;case d.STATUS_OFFLINE:t="connecting";break;case d.STATUS_SNAPSHOT:t="snapshot";break;case d.STATUS_READY:t="realtime";break;case d.STATUS_REPLAY:t="replay";break;default:t=e}return t},n.prototype._updateDataAndMarketStatus=function(e,t){var i,n;void 0!==this.indicatorText&&(i=this.getDataTextStatus(t),t===d.STATUS_LOADING||t===d.STATUS_RESOLVING?this.indicatorDot.setStatus("loading"):t===d.STATUS_INVALID_SYMBOL?this.indicatorDot.reset():i===t&&te.logWarn("unhandled data mode "+i),p.enabled("display_data_mode")&&this.dataModeIndicator.setMode(i),n=["loading","invalid","replay"],!n.includes(i)&&e?this.indicatorDot.setStatus(e,!0):"invalid"===i?this.indicatorDot.setStatus("invalid",!0):"replay"===i&&this.indicatorDot.setStatus("replay"),this.resizeIndicator())},n.prototype.resetIndicatorSize=function(){var e,t;if(this._paneWidgets[0]&&this._paneWidgets[0].statusWidget()&&ie)for(e=0;e<this._paneWidgets.length;e++)null!==(t=this._paneWidgets[e].statusWidget())&&t.firstTitle().css("padding-right","")},n.prototype.resizeIndicator=function(){var e,t,i,n,o=this._getMainSeriesPaneWidget();null!==o&&null!==(e=o.statusWidget())&&e.firstTitle().css("padding-right",this._indicatorWidth+10),this._options.marketStatusWidgetEnabled&&p.enabled("display_data_mode")&&this.indicatorDot&&this.dataModeIndicator&&(this.indicatorDot.isShortModeEnabled()&&this.dataModeIndicator.isShortModeEnabled()?(t=[this.indicatorDot.getTooltipText(),this.dataModeIndicator.getTooltipText()],t=t.filter(function(e){return e}),i=t.join(", "),this.indicatorText.attr("title",i)):this.indicatorText.attr("title",""),this.indicatorText.get(0).dispatchEvent(new g("common-tooltip-update"))),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.clientWidth),n=this._width(),this._options.marketStatusWidgetEnabled&&this.indicatorDot&&(n>650?(this.indicatorDot.setTooltipEnabled(!1),this.indicatorDot.disableShortMode()):n>550?(this.indicatorDot.setTooltipEnabled(!1),this.indicatorDot.disableShortMode()):(this.indicatorDot.setTooltipEnabled(!1),this.indicatorDot.enableShortMode())),p.enabled("display_data_mode")&&this.dataModeIndicator&&(n>650?(this.dataModeIndicator.setTooltipEnabled(!1),this.dataModeIndicator.disableShortMode()):n>550?(this.dataModeIndicator.setTooltipEnabled(!0),this.dataModeIndicator.enableShortMode()):(this.dataModeIndicator.setTooltipEnabled(!1),this.dataModeIndicator.enableShortMode()))},n.prototype.updateIndicatorImagePosition=function(){this.indicatorImage&&(this.indicatorImage.style[this._indicatorImageMargin]=this.getPriceAxisMaxWidthByName(this._indicatorBindingPriceAxisName)+"px")},n.prototype._getMainSeriesPaneWidget=function(){for(var e=0;e<this._paneWidgets.length;e++)if(this._paneWidgets[e].containsMainSeries())return this._paneWidgets[e];return null},n.prototype.getMarketStatusTooltip=function(){
return this._options.marketStatusWidgetEnabled&&this.indicatorDot?this.indicatorDot.getTooltipText():"-"},n.prototype._startSpinner=function(e){if(!this._spinner){var t=$(e).get(0);t&&(this._spinner=(new Y).spin(t))}},n.prototype.isJustClonedChart=function(){return!!(this._options||{}).justCloned},n.prototype.getLastPaneLeftBottom=function(){var e=this._paneWidgets[this._paneWidgets.length-1].jqPane,t=e.offset();return{left:t.left,bottom:$(document.body).height()-t.top-e.height()}},n.prototype.setDataWindowWidget=function(e){this._dataWindowWidget=e},n.prototype.removeDataWindowWidget=function(){this._dataWindowWidget=null},p.enabled("datasource_copypaste")&&(n.prototype.onAppClipboardPaste=function(e,t){te.logDebug("[[paste]]"),this._model&&this._model.pasteSourceFromClip(e,t)},n.prototype.onAppClipboardCopy=function(e){if(e||(e=this._model.selectedSource()),e instanceof v&&e.isChildStudy())return void te.logDebug("Can not copy child study");te.logDebug("[[copy]]"),this._model&&this._model.copySourceToClip(e)},n.prototype.onAppClipboardCut=function(e){te.logDebug("[[cut]]"),this._model&&this._model.cutSourceToClip(e||this._model.selectedSource())}),n.prototype.applyOverrides=function(e){applyPropertiesOverrides(this.properties(),null,!1,e),this._model&&(applyPropertiesOverrides(this._model.model().properties(),null,!1,e),applyPropertiesOverrides(this._model.mainSeries().properties(),null,!1,e,"mainSeriesProperties"))},n.prototype.applyStudiesOverrides=function(e){q.setDefaultsOverrides(e),this._applyStudiesOverrides()},n.prototype._setActionsActive=function(e){var t,i=this.actions();for(t in i)i.hasOwnProperty(t)&&this.actions()[t].setActive(e)},n.prototype.setActive=function(e){this._setActionsActive(e),this._isActive=e,this._paneWidgets.forEach(function(e){e.update()}),this._chartControlsBar&&this._chartControlsBar.classList.toggle("chart-controls-bar--inactive",!e)},n.prototype.isActive=function(){return this._isActive},n.prototype.trackTime=function(){return this._chartWidgetCollection.lock.trackTime},n.prototype.isMultipleLayout=function(){return oe(this._chartWidgetCollection.layout.value())},n.prototype.id=function(){return this._guid},n.prototype.createBranding=function(){this._modelCreated.subscribe(this,function(){this._model.model().createBrandingSource()},!0)},n.prototype.selectBarMode=function(){return this._model.model().selectBarMode()},n.prototype.toggleSelectBarMode=function(){this._model.model().toggleSelectBarMode()},n.prototype.onBarSelected=function(){return this._model.model().onBarSelected()},n.prototype.trySetChartStyle=function(e){var t=this.model();return!!t&&(t.mainSeries().properties().style.value()===e||!!p.enabled("charting_library_base")&&(this._setChartStyle(e),!0))},n.prototype._setChartStyle=function(e){var t=this.model(),i=t.mainSeries().properties().style;t.setChartStyleProperty(i,e,"Change Series Style")},n.prototype.showReplayOrderConfirmationDialog=function(){if(!this.model().isInReplay())return Promise.resolve()},n.prototype._addPerfMark=function(e){
re("ChartWidget."+this._guid+"."+e)},e.exports.ChartWidget=n}).call(t,i(8))},function(e,t,i){"use strict";(function(t){function n(e,t,o){this._options=Object.assign({},Y,o),this._chart=e,this.dialog=e.dialog,this._state=t,this._state&&this._state.onDestroyed().subscribe(this,n.prototype._onStateDestroyed,!0);var r={contextMenuEnabled:this._options.priceScaleContextMenuEnabled};this.lhsPriceAxisWidget=new l(this,l.LHS,r),this.rhsPriceAxisWidget=new l(this,l.RHS,r),this.jqPane=$(document.createElement("td")),this.jqPane.addClass("chart-markup-table"),this.jqPane.addClass("pane"),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqPane),this.canvas=N(this._dv,new F(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=N(this._dv,new F(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._zoomSelector=$("<div>"),this._zoomSelector.addClass("zoom-selector"),this._zoomSelector.css("display","none"),this._zoomSelector.appendTo(this._dv),this._tooltipSelector=$("<div>"),this._tooltipSelector.addClass("tooltip tooltip-selector tooltip-selector-hidden"),this._tooltipSelector.appendTo(this._dv),this.jqRow=$(document.createElement("tr")),this.lhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.jqPane.appendTo(this.jqRow),this._legendWidget=null,this._options.legendWidgetEnabled&&i.e(1).then(function(e){if(!this._isDestroyed){var t=i(814).LegendWidget;this._legendWidget=new t(this,this._chart.model(),this._chart._jqMainDiv,this._options.legendWidget),this._legendWidget.$el.appendTo(this._dv),this._legendWidget.update()}}.bind(this).bind(null,i)).catch(i.oe),this.rhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.setCursorForTool(),this._mouseEventHandler=new W($(this.top_canvas),this,!0,this._options.verticalTouchScroll),this._paneControls=null,t&&!this._chart.readOnly()&&i.e(1).then(function(e){if(!this._isDestroyed){var t=i(815);this._paneControls=new t(this,this._chart.model(),this._dv),this.updateControls()}}.bind(this).bind(null,i)).catch(i.oe),this.updateScalesVisibility(),this.actions=[],this.readonlyActions=[],this._onKeyUpListener=this._onKeyUpListener.bind(this),this._lineCancelledCallback=this._lineCancelledCallback.bind(this),$(window).on("keyup.panewidget",this._onKeyUpListener),this._chart.withModel(this,this._lineCancelledCallback),this._overlays={},this._contextMenuX=0,this._contextMenuY=0,this._lockDrawingsProperty=k.lockDrawings(),this._prevHoveredHittest=null,this._chart.withModel(this,function(){var e=this._chart.model();e.onSimpleZoomIn().subscribe(this,this._updateCrosshairOnZoom),e.onSimpleZoomOut().subscribe(this,this._updateCrosshairOnZoom)}),this._isDestroyed=!1}
var o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,N,F,W,H,j,z,U,q,Y;i(507),i(11),o=i(6).Point,r=i(258).UndoMacroCommand,s=i(34).Study,a=i(180).NonSeriesStudy,l=i(125).PriceAxisWidget,c=i(125).scaleRatioForContextMenuTransformer(7),h=i(45).LineToolOrder,u=i(45).LineToolPosition,d=i(0).LineDataSource,p=i(45).LineToolBrush,_=i(73),f=_.isLineToolName,m=_.isStudyLineToolName,y=i(88).BarsMarksContainer,g=i(39).trackEvent,v=i(107).isFeatureEnabled,S=i(197).showEditObjectDialog,b=i(181).ActionBinder,i(640).makeTimeLimited,w=i(291).createToolbarAction,P=i(7).ensureNotNull,T=i(28).PriceDataSource,x=i(41),C=x.Action,L=x.ActionPlaceholder,I=x.ActionSeparator,A=i(89),k=i(32),E=i(9).HitTestResult,M=i(18),V=i(31),D=i(82),O=D.resizeCanvas,R=D.hardResizeCanvas,B=D.clearRect,N=D.addCanvasTo,F=D.Size,W=i(111).MouseEventHandler,H=i(182),j=i(132),z=i(284).PaneCursorType,U=i(4).getLogger("Chart.PaneWidget"),q=["LineToolOrder","LineToolPosition","AlertLabel"],Y={contextMenuEnabled:!0,priceScaleContextMenuEnabled:!0,legendWidgetEnabled:!0,legendWidget:{},verticalTouchScroll:!1,propertyPagesEnabled:!0,sourceSelectionEnabled:!0},n.prototype.destroy=function(){$(window).off("keyup.panewidget",this._onKeyUpListener),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget.$el.remove(),delete this._legendWidget),null!==this._paneControls&&(this._paneControls.destroy(),delete this._paneControls),this.lhsPriceAxisWidget.destroy(),this.rhsPriceAxisWidget.destroy(),this._chart.withModel({chart:this._chart,instance:this,callback:this._hideTooltip},function(){this.chart.model().lineCancelled().unsubscribe(this.instance,this.callback)}),this.jqRow.remove(),this.jqRow.find("*").remove(),this._prevHoveredHittest=null,this._state&&this._state.onDestroyed().unsubscribe(this,n.prototype._onStateDestroyed),this._mouseEventHandler.destroy();for(var e in this)delete this[e];this._isDestroyed=!0},n.prototype.cancelZoom=function(){this._zoomSelector.css("display","none"),delete this._firstZoomPoint},n.prototype._onKeyUpListener=function(e){if(27===e.keyCode){this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine(),this._firstZoomPoint&&this.cancelZoom();this._chart.model().model().crossHairSource().clearMeasure(),this.setCursorForTool(),this._hideTooltip()}},n.prototype._lineCancelledCallback=function(){try{this._chart.model().lineCancelled().subscribe(this,this._hideTooltip)}catch(e){}},n.prototype.backgroundColor=function(){return this._chart.properties().paneProperties.background.value()},n.prototype.priceAxisByCanvas=function(e){return e===this.lhsPriceAxisWidget.canvas||e===this.lhsPriceAxisWidget.top_canvas?this.lhsPriceAxisWidget:e===this.rhsPriceAxisWidget.canvas||e===this.rhsPriceAxisWidget.top_canvas?this.rhsPriceAxisWidget:null},n.prototype.updateScalesVisibility=function(){this.lhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showLeftScale.value()),this.rhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showRightScale.value())},
re("ChartWidget."+this._guid+"."+e)},e.exports.ChartWidget=n}).call(t,i(8))},function(e,t,i){"use strict";(function(t){function n(e,t,o){this._options=Object.assign({},Y,o),this._chart=e,this.dialog=e.dialog,this._state=t,this._state&&this._state.onDestroyed().subscribe(this,n.prototype._onStateDestroyed,!0);var r={contextMenuEnabled:this._options.priceScaleContextMenuEnabled};this.lhsPriceAxisWidget=new l(this,l.LHS,r),this.rhsPriceAxisWidget=new l(this,l.RHS,r),this.jqPane=$(document.createElement("td")),this.jqPane.addClass("chart-markup-table"),this.jqPane.addClass("pane"),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqPane),this.canvas=F(this._dv,new N(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=F(this._dv,new N(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._zoomSelector=$("<div>"),this._zoomSelector.addClass("zoom-selector"),this._zoomSelector.css("display","none"),this._zoomSelector.appendTo(this._dv),this._tooltipSelector=$("<div>"),this._tooltipSelector.addClass("tooltip tooltip-selector tooltip-selector-hidden"),this._tooltipSelector.appendTo(this._dv),this.jqRow=$(document.createElement("tr")),this.lhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.jqPane.appendTo(this.jqRow),this._legendWidget=null,this._options.legendWidgetEnabled&&i.e(1).then(function(e){if(!this._isDestroyed){var t=i(814).LegendWidget;this._legendWidget=new t(this,this._chart.model(),this._chart._jqMainDiv,this._options.legendWidget),this._legendWidget.$el.appendTo(this._dv),this._legendWidget.update()}}.bind(this).bind(null,i)).catch(i.oe),this.rhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.setCursorForTool(),this._mouseEventHandler=new W($(this.top_canvas),this,!0,this._options.verticalTouchScroll),this._paneControls=null,t&&!this._chart.readOnly()&&i.e(1).then(function(e){if(!this._isDestroyed){var t=i(815);this._paneControls=new t(this,this._chart.model(),this._dv),this.updateControls()}}.bind(this).bind(null,i)).catch(i.oe),this.updateScalesVisibility(),this.actions=[],this.readonlyActions=[],this._onKeyUpListener=this._onKeyUpListener.bind(this),this._lineCancelledCallback=this._lineCancelledCallback.bind(this),$(window).on("keyup.panewidget",this._onKeyUpListener),this._chart.withModel(this,this._lineCancelledCallback),this._overlays={},this._contextMenuX=0,this._contextMenuY=0,this._lockDrawingsProperty=k.lockDrawings(),this._prevHoveredHittest=null,this._chart.withModel(this,function(){var e=this._chart.model();e.onSimpleZoomIn().subscribe(this,this._updateCrosshairOnZoom),e.onSimpleZoomOut().subscribe(this,this._updateCrosshairOnZoom)}),this._isDestroyed=!1}
var o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,F,N,W,H,j,z,U,q,Y;i(507),i(11),o=i(6).Point,r=i(258).UndoMacroCommand,s=i(34).Study,a=i(180).NonSeriesStudy,l=i(125).PriceAxisWidget,c=i(125).scaleRatioForContextMenuTransformer(7),h=i(45).LineToolOrder,u=i(45).LineToolPosition,d=i(0).LineDataSource,p=i(45).LineToolBrush,_=i(73),f=_.isLineToolName,m=_.isStudyLineToolName,y=i(88).BarsMarksContainer,g=i(39).trackEvent,v=i(107).isFeatureEnabled,S=i(197).showEditObjectDialog,b=i(181).ActionBinder,i(640).makeTimeLimited,w=i(291).createToolbarAction,P=i(7).ensureNotNull,T=i(28).PriceDataSource,x=i(41),C=x.Action,L=x.ActionPlaceholder,I=x.ActionSeparator,A=i(89),k=i(32),E=i(9).HitTestResult,M=i(18),V=i(31),D=i(82),O=D.resizeCanvas,R=D.hardResizeCanvas,B=D.clearRect,F=D.addCanvasTo,N=D.Size,W=i(111).MouseEventHandler,H=i(182),j=i(132),z=i(284).PaneCursorType,U=i(4).getLogger("Chart.PaneWidget"),q=["LineToolOrder","LineToolPosition","AlertLabel"],Y={contextMenuEnabled:!0,priceScaleContextMenuEnabled:!0,legendWidgetEnabled:!0,legendWidget:{},verticalTouchScroll:!1,propertyPagesEnabled:!0,sourceSelectionEnabled:!0},n.prototype.destroy=function(){$(window).off("keyup.panewidget",this._onKeyUpListener),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget.$el.remove(),delete this._legendWidget),null!==this._paneControls&&(this._paneControls.destroy(),delete this._paneControls),this.lhsPriceAxisWidget.destroy(),this.rhsPriceAxisWidget.destroy(),this._chart.withModel({chart:this._chart,instance:this,callback:this._hideTooltip},function(){this.chart.model().lineCancelled().unsubscribe(this.instance,this.callback)}),this.jqRow.remove(),this.jqRow.find("*").remove(),this._prevHoveredHittest=null,this._state&&this._state.onDestroyed().unsubscribe(this,n.prototype._onStateDestroyed),this._mouseEventHandler.destroy();for(var e in this)delete this[e];this._isDestroyed=!0},n.prototype.cancelZoom=function(){this._zoomSelector.css("display","none"),delete this._firstZoomPoint},n.prototype._onKeyUpListener=function(e){if(27===e.keyCode){this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine(),this._firstZoomPoint&&this.cancelZoom();this._chart.model().model().crossHairSource().clearMeasure(),this.setCursorForTool(),this._hideTooltip()}},n.prototype._lineCancelledCallback=function(){try{this._chart.model().lineCancelled().subscribe(this,this._hideTooltip)}catch(e){}},n.prototype.backgroundColor=function(){return this._chart.properties().paneProperties.background.value()},n.prototype.priceAxisByCanvas=function(e){return e===this.lhsPriceAxisWidget.canvas||e===this.lhsPriceAxisWidget.top_canvas?this.lhsPriceAxisWidget:e===this.rhsPriceAxisWidget.canvas||e===this.rhsPriceAxisWidget.top_canvas?this.rhsPriceAxisWidget:null},n.prototype.updateScalesVisibility=function(){this.lhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showLeftScale.value()),this.rhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showRightScale.value())},
n.prototype.chart=function(){return this._chart},n.prototype._chartModel=function(){return this._chart.model().model()},n.prototype.state=function(){return this._state},n.prototype.setState=function(e){this._state&&this._state.onDestroyed().unsubscribe(this,n.prototype._onStateDestroyed),this._state=e,this._state&&this._state.onDestroyed().subscribe(this,n.prototype._onStateDestroyed,!0)},n.prototype._onStateDestroyed=function(){this._state&&this._state.onDestroyed().unsubscribe(this,n.prototype._onStateDestroyed),this._state=null},n.prototype.stretchFactor=function(){return this._state?this._state._stretchFactor:0},n.prototype.setStretchFactor=function(e){this._state&&(this._state._stretchFactor=e)},n.prototype.mouseEnterEvent=function(e){var t=this._chart.model();t&&(t.crossHairSource().visible=!0,"function"==typeof this.onMouseEnter&&this.onMouseEnter(this))},n.prototype.hideInplaceEditor=function(){return!!this._inplaceEditor&&(this._inplaceEditor.remove(),this._inplaceEditor=void 0,!0)},n.prototype._processMouseMoveWhileZoom=function(e){var t=Math.floor(this._chart.model().timeScale().coordinateToIndex(e.localX)),i=this._chart.model().timeScale().indexToCoordinate(t)-.5*this._chart.model().timeScale().barSpacing(),n=e.localY,o=Math.abs(i-this._firstZoomPoint.x),r=Math.abs(n-this._firstZoomPoint.y);i<this._firstZoomPoint.x?this._zoomSelector.css("left",i):this._zoomSelector.css("left",this._firstZoomPoint.x),e.localY<this._firstZoomPoint.y?this._zoomSelector.css("top",e.localY):this._zoomSelector.css("top",this._firstZoomPoint.y),this._zoomSelector.width(o),this._zoomSelector.height(r)},n.prototype._finishZoom=function(e){var t=P(this._state),i=t.defaultPriceScale(),n=t.mainDataSource().firstValue(),o=i.coordinateToPrice(e.localY,n),r=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX));r!==this._firstZoomPoint.index&&this._chart.model().zoomToViewport(this._firstZoomPoint.index,r,this._firstZoomPoint.price,o,t),this._zoomSelector.css("display","none"),this._firstZoomPoint=null,k.resetToCursor()},n.EvironmentState=function(e){e.shiftKey&&(this.shift=!0),e.ctrlKey&&(this.control=!0)},n.prototype.checkMovepoint=function(e){return e===E.MOVEPOINT||e===E.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any()},n.prototype.mouseDownEvent=function(e){var i,r,a,l,c,h,u,p,_,m,y,g,v,S,b;if(this._state&&(document.activeElement!==document.body&&document.activeElement!==document.documentElement?document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus():document.getSelection?document.getSelection().removeAllRanges():document.selection&&document.selection.clear(),V.emit("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),this._updateCommonTooltip(null),i=this._chart.model(),r=new n.EvironmentState(e),i.mainSeries().clearGotoDateResult(),this.hideInplaceEditor(),a=this._state.defaultPriceScale(),!a.isEmpty()&&!i.timeScale().isEmpty())){if(l=i.crossHairSource(),
TradingView.supportTouch()&&"LineToolBrush"!==k.tool.value()||i.setAndSaveCurrentPosition(e.localX,e.localY,this._state),c=l.price,h=l.index,l.startMeasurePoint()&&l.endMeasurePoint()&&l.clearMeasure(),r.shift&&k.toolIsCursor(k.tool.value())&&k.tool.setValue("measure"),"measure"===k.tool.value()&&!l.startMeasurePoint())return void l.startMeasuring({price:c,index:h,x:e.localX,y:e.localY},this._state);if(l.startMeasurePoint()&&!l.endMeasurePoint())return l.finishMeasure({price:c,index:h,x:e.localX,y:e.localY}),void k.resetToCursor();if(this._firstZoomPoint)return void this._finishZoom(e);if("zoom"===k.tool.value()&&t.enabled("chart_zoom"))return u=i.timeScale().indexToCoordinate(h)-.5*i.timeScale().barSpacing(),this._firstZoomPoint={price:c,index:h,x:u,y:e.localY},this._zoomSelector.css("display","block"),this._zoomSelector.css("left",u),this._zoomSelector.css("top",e.localY),this._zoomSelector.width(0),void this._zoomSelector.height(0);if(!this._isSelectBarModeEnabled()&&(f(k.tool.value())||i.lineBeingCreated()))return void((!t.enabled("charting_library_base")||h>=0)&&this._mouseDownEventForLineTool(e,r,h,c));if(p=this.dataSourceAtPoint(e.localX,e.localY),_=p&&p.source&&p.source.customization?p.source.customization:{},p.hittest&&p.hittest.result()===E.CUSTOM&&(m=p.hittest.data().mouseDownHandler)&&m(e),!this._chart.readOnly()){if(p&&p.hittest&&p.hittest.result()===E.CUSTOM_MOVE&&(m=p.hittest.data().pressedMouseMoveHandler))return void i.startCustomMoving(p.source,new o(e.localX,e.localY),m);if(p&&!_.disableSelection&&(y=p.hittest&&p.hittest.result()>E.MOVEPOINT_BACKGROUND,y=y||p.hittest&&p.hittest.result()===E.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any(),y?i.setSelectedSource(p.source,p.hittest&&p.hittest.data()):i.setSelectedSource(null)),p.source&&"eraser"===k.tool.value()&&!_.disableErasing&&(TradingView.isInherited(p.source.constructor,d)||TradingView.isInherited(p.source.constructor,s)))return g=p.hittest.eraseMarker(),void(e.ctrlKey&&void 0!==g&&p.source.processErase?p.source.processErase(i,g):i.removeSource(p.source));if(v=p.source&&TradingView.isInherited(p.source.constructor,d)&&p.source.isLocked(),!(this._lockDrawingsProperty.value()||v)){if(p.source&&p.source.userEditEnabled&&!p.source.userEditEnabled())return;if(p.hittest&&p.hittest.result()===E.CHANGEPOINT)return S=this._state.mainDataSource().firstValue(),a=p.source.priceScale(),c=a.coordinateToPrice(e.localY,S),i.startChangingLinetool(p.source,{index:h,price:c},p.hittest.data(),r),void this._updateTooltip(e.localX,e.localY);if(p.hittest&&this.checkMovepoint(p.hittest.result()))return b=p.source.properties(),r.control&&b.clonable&&b.clonable.value()?void(this._clonningAtMoveLineTool=p.source):void(p.source.isFixed&&p.source.isFixed()?i.startMovingSource(p.source,new o(e.localX,e.localY),p.hittest.data()):(S=this._state.mainDataSource().firstValue(),a=p.source.priceScale(),c=a.coordinateToPrice(e.localY,S),i.startMovingSource(p.source,{index:h,price:c},p.hittest.data())))}
if(p.source&&TradingView.isInherited(p.source.constructor,T)&&p.source.isDraggable())return void(this._chart.draggingSource=p.source)}p.hittest&&p.hittest.result()===E.REGULAR||(this._processing=!0)}},n.prototype.drawRightThere=function(e){var t,i;f(e)&&(t=this._chart.model(),i=t.crossHairSource(),t.createLineTool(P(this._state),{index:i.index,price:i.price},e))},n.prototype._finishTool=function(e){var t,i=this._chart.model(),n=k.tool.value();k.resetToCursor(),this._hideTooltip(),i.setSelectedSource(e),this._chart.isTextTool(n)&&(t=i.createUndoCheckpoint(),S(e,i,null,t).then(function(e){e.focusOnText()}))},n.prototype._mouseDownEventForLineTool=function(e,t,i,n){var r,s,a,l,c,h,u,d,_,m,y,g,v,S,b,w,P;if(this._state){if(r=this._chart.model(),s=!1,a=null,l=e.localX,c=e.localY,h=this._chart.model().model().crossHairSource(),u=k.tool.value(),k.hideAllDrawings().setValue(!1),k.lockDrawings().setValue(!1),TradingView.supportTouch()&&f(u)&&"LineToolBrush"!==u&&!r.lineBeingCreated()&&(this._startTouchPoint=new o(l,c),this._initCrossHairPosition=h.currentPoint()),!r.lineBeingCreated()||r.lineBeingCreated()instanceof p)TradingView.supportTouch()&&"LineToolBrush"!==u||(P={index:i,price:n},a=r.createLineTool(this._state,P,u),r.lineBeingCreated()||(s=!0));else if(d=r.lineBeingCreated().ownerSource().firstValue(),TradingView.supportTouch()){if(!this._startTouchPoint)return this._startTouchPoint=new o(l,c),_=r.lineBeingCreated().points(),m=_[_.length-1],y=r.timeScale().indexToCoordinate(m.index),n=m.price,g=r.lineBeingCreated().priceScale(),v=g.priceToCoordinate(n,d),void(this._lastDrawingPoint=new o(y,v))}else a=r.lineBeingCreated(),S=r.paneForSource(a),S!==this._state?(b=this._dv.offset(),l=e.localX+b.left,c=e.localY+b.top,w=this._chart.paneByState(S),b=w._dv.offset(),l-=b.left,c-=b.top,n=a.priceScale().coordinateToPrice(c,d),i=Math.round(r.timeScale().coordinateToIndex(l)),s=r.coninueCreatingLine({index:i,price:n},t)):s=r.coninueCreatingLine({index:i,price:n},t);r.setSelectedSource(a),s?this._finishTool(a):TradingView.supportTouch()&&"LineToolBrush"!==u||this._updateTooltip(e.localX,e.localY)}},n.prototype._equalsCursorCache=function(e,t){return k.toolIsCursor(e.tool)?e.tool===t.tool&&e.theme===t.theme&&e.crosshair===t.crosshair:e.tool===t.tool&&e.theme===t.theme},n.prototype._setCursorClassName=function(e){var t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this.jqPane.removeClass(this._currentCursorClassName),t&&this.jqPane.addClass(t),this._currentCursorClassName=t,this.jqPane.css("cursor"))},n.prototype.setCursorForTool=function(e,t){var i,n=k.tool.value();if(k.toolIsCursor(n)){if(this._chart.draggingSource||this._isScrolling||this._chart.model()&&this._chart.model().sourceBeingMoved())return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}
return"eraser"===n?void this._setCursorClassName("eraser"):"zoom"===n?void this._setCursorClassName("zoom-in"):"dot"===(i=k.cursorTool.value())?void this._setCursorClassName("dot"):"arrow"===i?void this._setCursorClassName("default"):void this._setCursorClassName("")},n.prototype.setDragToAnotherPaneCursor=function(){this._setCursorClassName("grabbing")},n.prototype.gestureStartEvent=function(e){this._prev_pinch_scale=1,this._pinching=!0},n.prototype.gestureChangeEvent=function(e){var t,i,n=e.center.x-5,o=this._chart.paneWidgets()[0].lhsPriceAxisWidget.size.w,r=this._chart.model().timeScale().width();o&&(n=Math.max(0,n-o)),n=Math.min(n,r),t=2*(n/r-.5),i=5*(e.scale-this._prev_pinch_scale),i>0?this._chart.model().zoomIn(t,i):i<0&&this._chart.model().zoomOut(t,-i),this._prev_pinch_scale=e.scale},n.prototype.gestureEndEvent=function(e){this._pinching=!1},n.prototype._updateCommonTooltip=function(e){var t,i,n,o=this._lastCommonTooltipData,r=null;if(e&&e.hittest&&e.hittest.result()===E.CUSTOM&&(t=e.hittest.data())&&(r=t.tooltip||null),null!=o||null!=r)return null==r?(this._lastCommonTooltipData=null,void j.hide()):void(o&&r.text===o.text&&r.rect.x===o.rect.x&&r.rect.y===o.rect.y&&r.rect.w===o.rect.w&&r.rect.h===o.rect.h||(this._lastCommonTooltipData=r,i=TradingView.clone(r),n=this.jqPane.offset(),i.rect.x+=n.left,i.rect.y+=n.top,j.show(i)))},n.prototype._processMouseMoveForCustomHandler=function(e){var t,i,n,o=this.dataSourceAtPoint(e.localX,e.localY),r=o.hittest&&o.hittest.result()===E.CUSTOM;!r||null!==this._prevHoveredHittest&&this._prevHoveredHittest.renderer===o.renderer||(t=o.hittest.data().mouseEnterHandler,t&&t(e),this._prevHoveredHittest=o),r&&(i=o.hittest.data().mouseMoveHandler)&&i(e),null!==this._prevHoveredHittest&&this._prevHoveredHittest.renderer!==o.renderer&&(n=this._prevHoveredHittest.hittest.data().mouseLeaveHandler,n&&n(e),this._prevHoveredHittest=null)},n.prototype.mouseMoveEvent=function(e){var t,i,o,r,s,a,l,c,h,u,d,p,_,m,y;if(this._state&&(this._processMouseMoveForCustomHandler(e),t=this._chart.model())){if(i=e.localX,o=e.localY,r=new n.EvironmentState(e),this._firstZoomPoint)return void this._processMouseMoveWhileZoom(e);if(s=!1,!(this._chart.readOnly()||this._editDialog&&this._editDialog.isVisible())&&(a=k.tool.value(),l=null,c=null,h=null,this._processing||!k.toolIsCursor(a)&&"eraser"!==a||(l=this.dataSourceAtPoint(e.localX,e.localY),u=l&&l.source,s=!!u&&-1!==q.indexOf(u.toolname),l.hittest&&l.hittest.result()>E.MOVEPOINT_BACKGROUND?(c=l.source,h=l.hittest.result(),!l.source||"eraser"===a&&l.source.constructor===TradingView.Series?t.setHoveredSource(null):t.setHoveredSource(l.source,l.hittest.data())):t.setHoveredSource(null)),this._options.sourceSelectionEnabled&&(this._isSelectBarModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(c,h)),this._updateCommonTooltip(l),null!==l&&null!==l.hittest&&l.hittest.result()===E.CUSTOM_MOVE))switch(d=l.hittest.data()||{},d.cursorType){case z.VerticalResize:this._setCursorClassName("ns-resize")}
if(this._chart.model().crossHairSource().setLinesShouldBeHidden(s),this._chart.readOnly()&&this._options.sourceSelectionEnabled&&(l=this.dataSourceAtPoint(e.localX,e.localY),null!==l.source?t.setHoveredSource(l.source,l.hittest.data()):t.setHoveredSource(null,null)),this._chart.model().lineBeingCreated()&&(p=this._chart.model().lineBeingCreated(),(_=this._chart.model().paneForSource(p))!==this._state))return m=this._dv.offset(),i+=m.left,o+=m.top,y=this._chart.paneByState(_),m=y._dv.offset(),i-=m.left,o-=m.top,void t.setAndSaveCurrentPosition(i,o,_);a=k.tool.value(),TradingView.supportTouch()&&f(a)||(t.setAndSaveCurrentPosition(i,o,this._state,r),this._updateTooltip(i,o))}},n.prototype.pressedMouseMoveEvent=function(e){var i,r,s,a,l,c,h,u,_,m,y,g,v,S,b,w,P,T,x,C,L,I,A,E,M,V,D,O,R,B,N;if(this._state&&!this._pinching){if(this._touchMove=!0,i=new n.EvironmentState(e),r=this._chart.model(),s=e.localX,a=e.localY,this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);if(l=k.tool.value(),TradingView.supportTouch()&&this._startTouchPoint&&f(l)&&"LineToolBrush"!==l&&!r.lineBeingCreated()&&!this._isSelectBarModeEnabled())return c=this._initCrossHairPosition,h=new o(s,a),u=h.subtract(this._startTouchPoint),_=c.add(u),this._chart.model().setAndSaveCurrentPosition(_.x,_.y,this._state),void this._updateTooltip(_.x,_.y);if(TradingView.supportTouch()&&r.lineBeingCreated()&&!(r.lineBeingCreated()instanceof p))return void(this._startTouchPoint&&(m=r.lineBeingCreated(),y=e.localX-this._startTouchPoint.x,g=e.localY-this._startTouchPoint.y,v=this._lastDrawingPoint.x+y,S=this._lastDrawingPoint.y+g,b=this._chart.model().paneForSource(m),r.setAndSaveCurrentPosition(v,S,b),this._updateTooltip(v,S)));if(r.setAndSaveCurrentPosition(s,a,this._state,i),this._updateTooltip(s,a),w=k.tool.value(),P=this._isSelectBarModeEnabled(),(!f(w)||"LineToolBrush"===l||P)&&(0===e.button||Modernizr.touch)){if("LineToolBrush"===w&&!P){if(T=this._state.defaultPriceScale(),T.isEmpty())return;if(!(x=this._chart.model().lineBeingCreated()))return;return C=x.ownerSource().firstValue(),L=T.coordinateToPrice(e.localY,C),I=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX)),void((!t.enabled("charting_library_base")||I>=0)&&this._chart.model().coninueCreatingLine({index:I,price:L}))}if(this._chart.draggingSource&&(A=e.target,E=this._chart.paneByCanvas(A),E&&(E!==this?E.setDragToAnotherPaneCursor():E.setCursorForTool()),M=this._chart.priceAxisByCanvas(A),M&&M.setCursor("grabbing"),(V=this._chart.timeAxisByCanvas(A))&&V.setCursor("grabbing")),r.timeScale().isEmpty())return;if(r.customMoveBeingProcessed())return void r.processCustomMove(new o(s,a));if(r.lineBeingEdited())return I=Math.round(this._chart.model().timeScale().coordinateToIndex(s)),(!t.enabled("charting_library_base")||I>=0)&&r.changeLinePoint({x:s,y:a},i),this._updateTooltip(s,a),void this.setCursorForTool();if(r.sourceBeingMoved()){if(D=r.sourceBeingMoved(),T=D.priceScale(),T.isEmpty())return;if(O=D.ownerSource(),
C=(O||this._state.mainDataSource()).firstValue(),I=this._chart.model().timeScale().coordinateToIndex(e.localX),L=T.coordinateToPrice(e.localY,C),this.setCursorForTool(),t.enabled("charting_library_base")&&!D.onlyYMoving()&&(R=D.points(),0!==R.length&&R.reduce(function(e,t){return t.index<e.index?t:e}).index-((D._currentMovingPoint||D._startMovingPoint).index-I)<0))return;return TradingView.isInherited(D.constructor,d)&&D.isFixed()?void r.moveSource(new o(s,a)):void r.moveSource({index:I,price:L},i)}if(i.control&&this._clonningAtMoveLineTool)return m=this._clonningAtMoveLineTool,B=this.cloneLineTool(m,!0),N=this._chart.model().model().dataSourceForId(B),this._chart.model().setSelectedSource(N),C=this._state.mainDataSource().firstValue(),r.startMovingSource(N,{index:this._chart.model().timeScale().coordinateToIndex(e.localX),price:m.priceScale().coordinateToPrice(e.localY,C)}),void(this._clonningAtMoveLineTool=null);T=this._state.defaultPriceScale(),!this._startScrollingPos&&t.enabled("chart_scroll")&&(this._startScrollingPos={x:e.clientX,y:e.clientY}),this._startScrollingPos&&(this._startScrollingPos.x===e.clientX&&this._startScrollingPos.y===e.clientY||this._isScrolling||(r.beginUndoMacro("scroll").setCustomFlag("doesnt_affect_save",!0),T.isEmpty()||r.startScrollPrice(this._state,T,e.localY),r.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool())),this._isScrolling&&(T.isEmpty()||r.scrollPriceTo(this._state,T,e.localY),r.scrollTimeTo(e.localX))}}},n.prototype._processMouseUpForCustomHandler=function(e){var t,i=this.dataSourceAtPoint(e.localX,e.localY);i.hittest&&i.hittest.result()===E.CUSTOM&&(t=i.hittest.data().mouseUpHandler)&&t(e)},n.prototype.mouseUpEvent=function(e){var t,i,n,o,s,a,l,c,h,u,d,_,m,y,g,v,S,b,w,P,T,x,C,L,I,A,E,D,O,R,B,N,F;if(this._state){if(this._processMouseUpForCustomHandler(e),this._clonningAtMoveLineTool=null,t=this,V.emit("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),i=this._chart.model(),n=this._touchMove,delete this._touchMove,o=k.tool.value(),TradingView.supportTouch()&&!n&&"LineToolBrush"!==o&&f(o)&&!i.lineBeingCreated())return s=i.crossHairSource().currentPoint(),a=this._state.defaultPriceScale(),l=this._state.mainDataSource().firstValue(),c=a.coordinateToPrice(s.y,l),h=Math.round(i.timeScale().coordinateToIndex(s.x)),u={index:h,price:c},d=i.createLineTool(this._state,u,o),i.setSelectedSource(d),i.lineBeingCreated()||this._finishTool(d),this._updateTooltip(s.x,s.y),void delete this._startTouchPoint;if(i.lineBeingCreated()&&!(i.lineBeingCreated()instanceof p)&&this._startTouchPoint)return _=!1,delete this._startTouchPoint,n||(d=i.lineBeingCreated(),m=d.points()[d.points().length-1],c=m.price,_=i.coninueCreatingLine({index:m.index,price:c},{}),delete this._lastDrawingPoint),void(_&&this._finishTool(d));if(this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(0===e.button||TradingView.supportTouch()){if(this._processing=!1,i=this._chart.model(),
i.customMoveBeingProcessed()&&i.endCustomMoving(),i.lineBeingEdited())return i.endChangingLinetool(),void this._hideTooltip();if("LineToolBrush"===o&&!this._isSelectBarModeEnabled()){if(i.finishLineTool(),a=this._state.defaultPriceScale(),a.isEmpty())return;if(!(y=this._chart.model().lineBeingCreated()))return;return l=y.ownerSource().firstValue(),c=a.coordinateToPrice(e.localY,l),h=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX)),void this._chart.model().coninueCreatingLine({index:h,price:c})}if(g=i.sourceBeingMoved())return i.endMovingSource(),this._hideTooltip(),this.setCursorForTool(g),void i.invalidate(new M(M.UPDATE_CURSOR_ONLY));if(this._chart.readOnly()||(v=this.dataSourceAtPoint(e.localX,e.localY),S=this._chart.model().crossHairSource(),b=e.localX>=0&&e.localX<this.size.w,v&&v.source===S||!b||(w=t._chart.model().timeScale().coordinateToIndex(e.localX),t._chart.model().model().onSyncScrollNeeded(w))),P=this._isScrolling&&this._chart.model().undoHistory.undoStack().head()instanceof r,this._isScrolling&&(a=this._state.defaultPriceScale(),i.endScrollPrice(this._state,a),t=this,T=function(){i.endScrollTime(),i.endUndoMacro(),t._startScrollingPos=void 0,t._isScrolling=!1,t.setCursorForTool()},TradingView.supportTouch()?(x=i.timeScale().m_scrollStartPoint,C=.05*(e.localX-x),L=null,I=function(t){var n,o;null===L&&(L=t),n=.01*Math.min(100,3*(t-L)),n=Math.sqrt(n),o=e.localX+C*n,i.scrollTimeTo(o),n>=1?T():requestAnimationFrame(I)},requestAnimationFrame(I)):T()),this._chart.draggingSource)for(A=e.target,E=this._chart.paneByCanvas(A),E&&E!==this&&(D=E._state.findSuitableScale(this._chart.draggingSource),P&&(P=!1,this._chart.model().undoHistory.undo()),this._chart.model().move(this._chart.draggingSource,E._state,D)),O=this._chart.timeAxisByCanvas(A),O&&(P&&(P=!1,this._chart.model().undoHistory.undo()),this._chart.model().move(this._chart.draggingSource,null,null)),this._chart.draggingSource=null,R=this._chart.getTimeScale(),R&&R.restoreDefaultCursor(),v=this.dataSourceAtPoint(e.localX,e.localY),B=this._chart.paneWidgets(),N=0;N<B.length;N++)F=B[N],F===this&&v?F.setCursorForTool(v.source,v.hittest||null):F.setCursorForTool(),F.lhsPriceAxisWidget.restoreDefaultCursor(),F.rhsPriceAxisWidget.restoreDefaultCursor()}delete this._touchMove}},n.prototype.mouseLeaveEvent=function(e){var t,i;this._state&&(t=this._chart.model())&&(TradingView.isMobile.any()||t.model().clearCurrentPosition(),t.setHoveredSource(null),null!==this._prevHoveredHittest&&(i=this._prevHoveredHittest.hittest.data().mouseLeaveHandler,i&&i(e),this._prevHoveredHittest=null),this._updateCommonTooltip(null),"function"==typeof this.onMouseLeave&&this.onMouseLeave(this))},n.prototype.mouseClickEvent=function(e){var t,i,n,o;this._state&&(t=this.dataSourceAtPoint(e.localX,e.localY),i=this._chart.model(),n=t.source,this._lastClickedSource!==n&&(this._lastClickedSource&&(this._lastClickedSource.onClickOutside(e),i.chartModel().updateSource(this._lastClickedSource)),this._lastClickedSource=n),
if(this._chart.model().crossHairSource().setLinesShouldBeHidden(s),this._chart.readOnly()&&this._options.sourceSelectionEnabled&&(l=this.dataSourceAtPoint(e.localX,e.localY),null!==l.source?t.setHoveredSource(l.source,l.hittest.data()):t.setHoveredSource(null,null)),this._chart.model().lineBeingCreated()&&(p=this._chart.model().lineBeingCreated(),(_=this._chart.model().paneForSource(p))!==this._state))return m=this._dv.offset(),i+=m.left,o+=m.top,y=this._chart.paneByState(_),m=y._dv.offset(),i-=m.left,o-=m.top,void t.setAndSaveCurrentPosition(i,o,_);a=k.tool.value(),TradingView.supportTouch()&&f(a)||(t.setAndSaveCurrentPosition(i,o,this._state,r),this._updateTooltip(i,o))}},n.prototype.pressedMouseMoveEvent=function(e){var i,r,s,a,l,c,h,u,_,m,y,g,v,S,b,w,P,T,x,C,L,I,A,E,M,V,D,O,R,B,F;if(this._state&&!this._pinching){if(this._touchMove=!0,i=new n.EvironmentState(e),r=this._chart.model(),s=e.localX,a=e.localY,this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);if(l=k.tool.value(),TradingView.supportTouch()&&this._startTouchPoint&&f(l)&&"LineToolBrush"!==l&&!r.lineBeingCreated()&&!this._isSelectBarModeEnabled())return c=this._initCrossHairPosition,h=new o(s,a),u=h.subtract(this._startTouchPoint),_=c.add(u),this._chart.model().setAndSaveCurrentPosition(_.x,_.y,this._state),void this._updateTooltip(_.x,_.y);if(TradingView.supportTouch()&&r.lineBeingCreated()&&!(r.lineBeingCreated()instanceof p))return void(this._startTouchPoint&&(m=r.lineBeingCreated(),y=e.localX-this._startTouchPoint.x,g=e.localY-this._startTouchPoint.y,v=this._lastDrawingPoint.x+y,S=this._lastDrawingPoint.y+g,b=this._chart.model().paneForSource(m),r.setAndSaveCurrentPosition(v,S,b),this._updateTooltip(v,S)));if(r.setAndSaveCurrentPosition(s,a,this._state,i),this._updateTooltip(s,a),w=k.tool.value(),P=this._isSelectBarModeEnabled(),(!f(w)||"LineToolBrush"===l||P)&&(0===e.button||Modernizr.touch)){if("LineToolBrush"===w&&!P){if(T=this._state.defaultPriceScale(),T.isEmpty())return;if(!(x=this._chart.model().lineBeingCreated()))return;return C=x.ownerSource().firstValue(),L=T.coordinateToPrice(e.localY,C),I=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX)),void((!t.enabled("charting_library_base")||I>=0)&&this._chart.model().coninueCreatingLine({index:I,price:L}))}if(this._chart.draggingSource&&(A=e.target,E=this._chart.paneByCanvas(A),E&&(E!==this?E.setDragToAnotherPaneCursor():E.setCursorForTool()),M=this._chart.priceAxisByCanvas(A),M&&M.setCursor("grabbing"),(V=this._chart.timeAxisByCanvas(A))&&V.setCursor("grabbing")),r.timeScale().isEmpty())return;if(r.customMoveBeingProcessed())return void r.processCustomMove(new o(s,a));if(r.lineBeingEdited())return I=Math.round(this._chart.model().timeScale().coordinateToIndex(s)),(!t.enabled("charting_library_base")||I>=0)&&r.changeLinePoint({x:s,y:a},i),this._updateTooltip(s,a),void this.setCursorForTool();if(r.sourceBeingMoved()){if(D=r.sourceBeingMoved(),T=D.priceScale(),T.isEmpty())return;if(O=D.ownerSource(),
C=(O||this._state.mainDataSource()).firstValue(),I=this._chart.model().timeScale().coordinateToIndex(e.localX),L=T.coordinateToPrice(e.localY,C),this.setCursorForTool(),t.enabled("charting_library_base")&&!D.onlyYMoving()&&(R=D.points(),0!==R.length&&R.reduce(function(e,t){return t.index<e.index?t:e}).index-((D._currentMovingPoint||D._startMovingPoint).index-I)<0))return;return TradingView.isInherited(D.constructor,d)&&D.isFixed()?void r.moveSource(new o(s,a)):void r.moveSource({index:I,price:L},i)}if(i.control&&this._clonningAtMoveLineTool)return m=this._clonningAtMoveLineTool,B=this.cloneLineTool(m,!0),F=this._chart.model().model().dataSourceForId(B),this._chart.model().setSelectedSource(F),C=this._state.mainDataSource().firstValue(),r.startMovingSource(F,{index:this._chart.model().timeScale().coordinateToIndex(e.localX),price:m.priceScale().coordinateToPrice(e.localY,C)}),void(this._clonningAtMoveLineTool=null);T=this._state.defaultPriceScale(),!this._startScrollingPos&&t.enabled("chart_scroll")&&(this._startScrollingPos={x:e.clientX,y:e.clientY}),this._startScrollingPos&&(this._startScrollingPos.x===e.clientX&&this._startScrollingPos.y===e.clientY||this._isScrolling||(r.beginUndoMacro("scroll").setCustomFlag("doesnt_affect_save",!0),T.isEmpty()||r.startScrollPrice(this._state,T,e.localY),r.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool())),this._isScrolling&&(T.isEmpty()||r.scrollPriceTo(this._state,T,e.localY),r.scrollTimeTo(e.localX))}}},n.prototype._processMouseUpForCustomHandler=function(e){var t,i=this.dataSourceAtPoint(e.localX,e.localY);i.hittest&&i.hittest.result()===E.CUSTOM&&(t=i.hittest.data().mouseUpHandler)&&t(e)},n.prototype.mouseUpEvent=function(e){var t,i,n,o,s,a,l,c,h,u,d,_,m,y,g,v,S,b,w,P,T,x,C,L,I,A,E,D,O,R,B,F,N;if(this._state){if(this._processMouseUpForCustomHandler(e),this._clonningAtMoveLineTool=null,t=this,V.emit("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),i=this._chart.model(),n=this._touchMove,delete this._touchMove,o=k.tool.value(),TradingView.supportTouch()&&!n&&"LineToolBrush"!==o&&f(o)&&!i.lineBeingCreated())return s=i.crossHairSource().currentPoint(),a=this._state.defaultPriceScale(),l=this._state.mainDataSource().firstValue(),c=a.coordinateToPrice(s.y,l),h=Math.round(i.timeScale().coordinateToIndex(s.x)),u={index:h,price:c},d=i.createLineTool(this._state,u,o),i.setSelectedSource(d),i.lineBeingCreated()||this._finishTool(d),this._updateTooltip(s.x,s.y),void delete this._startTouchPoint;if(i.lineBeingCreated()&&!(i.lineBeingCreated()instanceof p)&&this._startTouchPoint)return _=!1,delete this._startTouchPoint,n||(d=i.lineBeingCreated(),m=d.points()[d.points().length-1],c=m.price,_=i.coninueCreatingLine({index:m.index,price:c},{}),delete this._lastDrawingPoint),void(_&&this._finishTool(d));if(this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(0===e.button||TradingView.supportTouch()){if(this._processing=!1,i=this._chart.model(),
i.customMoveBeingProcessed()&&i.endCustomMoving(),i.lineBeingEdited())return i.endChangingLinetool(),void this._hideTooltip();if("LineToolBrush"===o&&!this._isSelectBarModeEnabled()){if(i.finishLineTool(),a=this._state.defaultPriceScale(),a.isEmpty())return;if(!(y=this._chart.model().lineBeingCreated()))return;return l=y.ownerSource().firstValue(),c=a.coordinateToPrice(e.localY,l),h=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX)),void this._chart.model().coninueCreatingLine({index:h,price:c})}if(g=i.sourceBeingMoved())return i.endMovingSource(),this._hideTooltip(),this.setCursorForTool(g),void i.invalidate(new M(M.UPDATE_CURSOR_ONLY));if(this._chart.readOnly()||(v=this.dataSourceAtPoint(e.localX,e.localY),S=this._chart.model().crossHairSource(),b=e.localX>=0&&e.localX<this.size.w,v&&v.source===S||!b||(w=t._chart.model().timeScale().coordinateToIndex(e.localX),t._chart.model().model().onSyncScrollNeeded(w))),P=this._isScrolling&&this._chart.model().undoHistory.undoStack().head()instanceof r,this._isScrolling&&(a=this._state.defaultPriceScale(),i.endScrollPrice(this._state,a),t=this,T=function(){i.endScrollTime(),i.endUndoMacro(),t._startScrollingPos=void 0,t._isScrolling=!1,t.setCursorForTool()},TradingView.supportTouch()?(x=i.timeScale().m_scrollStartPoint,C=.05*(e.localX-x),L=null,I=function(t){var n,o;null===L&&(L=t),n=.01*Math.min(100,3*(t-L)),n=Math.sqrt(n),o=e.localX+C*n,i.scrollTimeTo(o),n>=1?T():requestAnimationFrame(I)},requestAnimationFrame(I)):T()),this._chart.draggingSource)for(A=e.target,E=this._chart.paneByCanvas(A),E&&E!==this&&(D=E._state.findSuitableScale(this._chart.draggingSource),P&&(P=!1,this._chart.model().undoHistory.undo()),this._chart.model().move(this._chart.draggingSource,E._state,D)),O=this._chart.timeAxisByCanvas(A),O&&(P&&(P=!1,this._chart.model().undoHistory.undo()),this._chart.model().move(this._chart.draggingSource,null,null)),this._chart.draggingSource=null,R=this._chart.getTimeScale(),R&&R.restoreDefaultCursor(),v=this.dataSourceAtPoint(e.localX,e.localY),B=this._chart.paneWidgets(),F=0;F<B.length;F++)N=B[F],N===this&&v?N.setCursorForTool(v.source,v.hittest||null):N.setCursorForTool(),N.lhsPriceAxisWidget.restoreDefaultCursor(),N.rhsPriceAxisWidget.restoreDefaultCursor()}delete this._touchMove}},n.prototype.mouseLeaveEvent=function(e){var t,i;this._state&&(t=this._chart.model())&&(TradingView.isMobile.any()||t.model().clearCurrentPosition(),t.setHoveredSource(null),null!==this._prevHoveredHittest&&(i=this._prevHoveredHittest.hittest.data().mouseLeaveHandler,i&&i(e),this._prevHoveredHittest=null),this._updateCommonTooltip(null),"function"==typeof this.onMouseLeave&&this.onMouseLeave(this))},n.prototype.mouseClickEvent=function(e){var t,i,n,o;this._state&&(t=this.dataSourceAtPoint(e.localX,e.localY),i=this._chart.model(),n=t.source,this._lastClickedSource!==n&&(this._lastClickedSource&&(this._lastClickedSource.onClickOutside(e),i.chartModel().updateSource(this._lastClickedSource)),this._lastClickedSource=n),
t.hittest&&t.hittest.result()===E.CUSTOM&&(o=t.hittest.data().mouseClickHandler)&&(o(e),i.chartModel().updateSource(n)),i.hoveredSource()instanceof y&&i.hoveredSource().onClicked())},n.prototype.showEditDialogForSource=function(e){if(this._options.propertyPagesEnabled&&(!e.userEditEnabled||e.userEditEnabled())){var t=this;S(e,this._chart.model()).then(function(e){t._editDialog=e})}},n.prototype.mouseDoubleClickEvent=function(e){var t,i,n;this._state&&(t=!this._chart.readOnly()&&!f(k.tool.value())&&this.dataSourceAtPoint(e.localX,e.localY),i=t&&t.hittest&&t.source,i&&t.hittest.result()<=E.MOVEPOINT_BACKGROUND&&!TradingView.isMobile.any()&&(i=null),i&&i.customization&&i.customization.disableSelection&&(i=null),i&&i._metaInfo&&"Sessions@tv-basicstudies"===i._metaInfo.id&&(i=this._chart.model().mainSeries()),i?(n=!1,n?TradingView.alertsDispatcher.openEditDialog(t.source.alert()):this.showEditDialogForSource(i)):this._chart.readOnly()||f(k.tool.value())||this._chart.model().lineBeingCreated()||this._chart.model().selectedSource()||this._chart.toggleMaximizePane(this))},n.prototype.showContextMenuForSource=function(e,t){e.hasContextMenu()&&(this._chart.model().setSelectedSource(e),e.constructor===TradingView.Series?this._seriesContextMenu(e).show(t):TradingView.isInherited(e.constructor,s)?this._studyContextMenu(e).show(t):TradingView.isInherited(e.constructor,h)||TradingView.isInherited(e.constructor,u)?this._tradingDrawingsContextMenu(e).show(t):TradingView.isInherited(e.constructor,d)?this._lineContextMenu(e).then(function(e){e.show(t)}):e===this._chart.model().crossHairSource()&&e.handleContextMenuEvent(t))},n.prototype.contextMenuEvent=function(e,t){var i,n,o,r;if(this._chart.model().crossHairSource().startMeasurePoint())return void this._chart.model().crossHairSource().clearMeasure();if(!this._pinching&&(this._firstZoomPoint&&this.cancelZoom(),!this.hideInplaceEditor())){if(!k.toolIsCursor(k.tool.value())&&!this._isSelectBarModeEnabled()){if(TradingView.isMobile.any())return;return k.resetToCursor(!0),this.setCursorForTool(),this._hideTooltip(),void(this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine())}this._options.contextMenuEnabled&&(this._chart.model().mainSeries().createSessStudy(),this._contextMenuX=e.localX,this._contextMenuY=e.localY,i=this.dataSourceAtPoint(e.localX,e.localY),n=i?i.source:null,o=i&&i.hittest?i.hittest.result():0,r=o>=E.REGULAR||o>=E.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any(),this._chart.updateActions(),null!==n&&r?this.showContextMenuForSource(n,e):(this._contextMenu(e).then(function(t){return t.show(e)}),this._chart.model().setSelectedSource(null)),this.paint())}},n.prototype._contextMenu=function(e){function t(e){return null===e.text}var i=this;return Promise.all(this._initActions(e)).then(function(e){var n,o,r=i._customActions();for(e=e.filter(function(e){return null!==e}),r.remove.forEach(function(t){for(var i=0;i<e.length;i++)if(e[i].text===t){e.splice(i,1);break}}),n=r.top.concat(e).concat(r.bottom),
o=n.length-1;o>0;o--)t(n[o])&&t(n[o-1])&&n.splice(o,1);return n.length&&t(n[0])&&n.splice(0,1),n.length&&t(n[n.length-1])&&n.splice(n.length-1,1),A.createMenu(n,{statName:"ChartContextMenu"})})},n.prototype.createRemoveMenu=function(){var e,t=this._chart.actions(),i=new C({text:window.t("Remove"),statName:"Remove"});return i.subActions||(i.subActions=[]),e=i.subActions,e.push(t.paneRemoveAllStudies,t.paneRemoveAllDrawingTools,t.paneRemoveAllStudiesDrawingTools),i},n.prototype.createDrawingMenu=function(){var e,i,n=this._chart.actions(),o=new C({text:window.t("Drawing Tools"),statName:"DrawingTools"});return o.subActions||(o.subActions=[]),e=o.subActions,t.enabled("left_toolbar")&&e.push(n.drawingToolbarAction),t.enabled("items_favoriting")&&null!==(i=w())&&e.push(i),0!==o.subActions.length&&e.push(new I),e.push(n.magnetAction,n.stayInDrawingModeAction),this._chart.isMultipleLayout()&&e.push(n.syncModeAction),e.push(new I,n.lockDrawingsAction,n.hideAllDrawingsAction,n.paneRemoveAllDrawingTools),o},n.prototype._initActions=function(e){var i,n,o,r,s,a=this,l=this._chart.actions(),c=[];return t.enabled("datasource_copypaste")&&(!(i=H.get())||"study"!==i.type&&"drawing"!==i.type||(n=new C({text:window.t("Paste %s").replace("%s",window.t(i.title||i.type)),shortcut:"Ctrl-V",statName:"Paste"}),n.callbacks().subscribe(null,function(){a._chart.onAppClipboardPaste(a.state())}),c.push(n))),l.gotoDate&&c.push(l.gotoDate),c.length&&c.push(new I),c.push(l.chartReset,l.symbolSearch,l.changeInterval),o=window.widgetbar&&(!window.widgetbar._customization||window.widgetbar._customization.watchlist),o&&l.addToWatchlist&&c.push(l.addToWatchlist),t.enabled("text_notes")&&v("text_notes")&&c.push(l.addToTextNotes),t.enabled("symbol_info")&&c.push(l.showSymbolInfoDialog),c.push(new I,this._createLockTimeAxisAction(e),new I,l.paneObjectTree,l.insertIndicator),t.enabled("charting_library_base")||c.push(l.applyStudyTemplate),t.enabled("compare_symbol")&&c.push(l.compareOrAdd),c.push(this.createDrawingMenu()),t.enabled("charting_library_base")&&c.push(l.hideAllMarks),c.push(this.createRemoveMenu(),new I),r=this._priceAxisMenu(),r&&c.push(r),s=this._timeAxisMenu(),s&&c.push(s),t.enabled("charting_library_base")||c.push(l.applyColorTheme),t.enabled("show_chart_property_page")&&c.push(l.chartProperties),pro.hasPackage("mtp-mtpredictor")&&P(this._state).containsMainSeries()&&c.push(new I,this._createMTPredictorActions()),c},n.prototype._customActions=function(){var e,i,n,o={top:[],bottom:[],remove:[]},r=this._chart.model(),s=r.timeScale(),a=this._state&&this._state.defaultPriceScale();return t.enabled("custom_items_in_context_menu")?(e=s.isEmpty()?void 0:s.indexToUserTime(s.coordinateToIndex(this._contextMenuX)),a&&!a.isEmpty()&&(n=this._state.mainDataSource().firstValue(),i=a.coordinateToPrice(this._contextMenuY,n)),V.emit("onContextMenu",{unixtime:e?e/1e3:void 0,price:i,callback:function(e){[].concat(e).forEach(function(e){if(e.text)if(e.text.length>1&&"-"===e.text[0])o.remove.push(e.text.slice(1));else{var t;"-"===e.text?t=new I:(t=new C({
text:e.text}),t.callbacks().subscribe(null,e.click)),e.position&&"top"===e.position?o.top.push(t):o.bottom.push(t)}})}}),o):o},n.prototype._timeAxisMenu=function(){if(this._chart.model().timeScale().isEmpty())return null;var e=this._chart.getTimeScale();return new C({text:window.t("Time Scale"),subActions:e.getContextMenuActions(),statName:"TimeScale"})},n.prototype.getDefaultPriceAxisWidget=function(){if(!this._state)return null;var e=this._state.defaultPriceScale();return e.isEmpty()?null:e===this._state.leftPriceScale?this.leftPriceAxisWidget():this.rightPriceAxisWidget()},n.prototype._priceAxisMenu=function(){var e=this.getDefaultPriceAxisWidget();return e?new C({text:window.t("Price Scale"),subActions:e.getContextMenuActions(),statName:"PriceScale"}):null},n.prototype._seriesContextMenu=function(e){var i,n,o,r,s,a=this._chart.actions(),l=e.properties().visible.value(),c=null;if(this._chart.readOnly())i=[l?a.seriesHide:this.createActionShow(e),new I,this.createActionShowCountdown(e),new I,this.createActionScaleLeft(e),this.createActionScaleRight(e),this.createActionNoScale(e)],t.enabled("countdown")||i.splice(3,1),c=A.createMenu(i);else{if(n=this._mergeContentMenuItems(e),o=[a.showSymbolInfoDialog,a.compare,l?a.seriesHide:this.createActionShow(e),this.createVisualOrderAction(e),new I,this.createActionShowCountdown(e),new I],t.enabled("countdown")||o.splice(5,2),t.enabled("compare_symbol")||o.splice(1,1),t.enabled("symbol_info")||o.splice(0,1),!this.chart().onWidget()&&t.enabled("show_chart_property_page")&&o.unshift(a.format),r=this.createActionLockScale(e),r&&o.push(r,new I),n.length>0){for(s=0;s<n.length;s++)o.push(n[s]);o.push(new I)}o.push(this.createActionScaleLeft(e),this.createActionScaleRight(e),this.createActionNoScale(e)),pro.hasPackage("mtp-mtpredictor")&&o.push(new I,this._createMTPredictorActions()),c=A.createMenu(o)}return c},n.prototype.toggleLockTimeAxis=function(e,t){var i,n,o;"boolean"!=typeof t&&(t=!k.lockTimeAxis().value()),t&&(i=this._chart.model().timeScale(),n=i.coordinateToIndex(e),o=i.points().roughTime(n),k.lockTimeAxisTime.setValue(o)),k.lockTimeAxis().setValue(t)},n.prototype._createLockTimeAxisAction=function(e){var t=new C({text:window.t("Lock Cursor in Time"),checkable:!0,statName:"ToggleLockCursorInTime"}),i=k.lockTimeAxis().value();return t.setChecked(i),t.callbacks().subscribe(null,this.toggleLockTimeAxis.bind(this,e.localX,!i)),t},n.prototype._createHVLineAction=function(e,t){t="vertical"===t&&"vertical"||"horizontal";var i=new C({text:"vertical"===t?window.t("Create Vertical Line"):window.t("Create Horizontal Line"),statName:"vertical"===t?"CreateVerticalLine":"CreateHorizontalLine"});return i.callbacks().subscribe(this,function(){var i=P(this._state),n=i.mainDataSource().firstValue(),o=this._chart.model().timeScale().coordinateToIndex(e.localX),r=i.defaultPriceScale().coordinateToPrice(e.localY,n),s=this._chart.model().createLineTool(i,{index:o,price:r},"vertical"===t&&"LineToolVertLine"||"LineToolHorzLine");this._finishTool(s)}),i},
@@ -352,13 +352,13 @@ if(!this._chart.model().model().isMergeUpAvailableForSource(e))return null;var t
var t,i,o,r,s,a,l=new C({text:window.t("Visual Order"),statName:"VisualOrder"});return l.subActions||(l.subActions=[]),t=new C({text:window.t("Bring to Front"),statName:"BringToFront"}),t.callbacks().subscribe(this,n.prototype.bringObjectToFront),l.subActions.push(t),i=new C({text:window.t("Send to Back"),statName:"SendToBack"}),i.callbacks().subscribe(this,n.prototype.sendObjectToBack),l.subActions.push(i),o=new C({text:window.t("Bring Forward"),statName:"BringForward"}),o.callbacks().subscribe(this,n.prototype.bringObjectForward),l.subActions.push(o),r=new C({text:window.t("Send Backward"),statName:"SendBackward"}),r.callbacks().subscribe(this,n.prototype.sendObjectBackward),l.subActions.push(r),s=this._chart.model().paneForSource(e),a=s.getZOrderMinMax(),i.setEnabled(!0),o.setEnabled(!0),r.setEnabled(!0),t.setEnabled(!0),e.zorder()===a.minZOrder&&(i.setEnabled(!1),r.setEnabled(!1)),e.zorder()===a.maxZOrder&&(o.setEnabled(!1),t.setEnabled(!1)),l},n.prototype.image=function(){var e={};return e.leftAxis=this.leftPriceAxisWidget().image(),e.rightAxis=this.rightPriceAxisWidget().image(),e.content=this.canvas.toDataURL(),e.contentWidth=this.size.w,e.contentHeight=this.size.h,e},n.prototype._updateTooltip=function(e,t){if(!this._rafSet){var i=this;requestAnimationFrame(function(){i._state&&(i._updateTooltipImpl(e,t),i._rafSet=!1)}),this._rafSet=!0}},n.prototype._updateTooltipImpl=function(e,t){function i(i){function o(){return TradingView.isMobile.any()?{left:e-n._tooltipSelector.outerWidth()-16,top:t-n._tooltipSelector.outerHeight()-16}:{left:e+16,top:t+16}}TradingView[r].getTooltipText&&(i=TradingView[r].getTooltipText(a)||i),n._tooltipSelector.html(i).removeClass("tooltip-selector-hidden").css(o())}var n,o,r,s,a,l;if(this._chart){for(n=this,o=this._chart.paneWidgets(),r=k.tool.value(),s=P(this._state).model(),a=s.lineBeingCreated(),l=o.length-1;l>=0;l--)o[l]._hideTooltip();this._isSelectBarModeEnabled()||(m(r)&&!TradingView.isMobile.any()?i(window.t("Click to set a point")):TradingView.isMobile.any()&&"LineToolBrush"!==r&&f(r)&&!n._chart.model().lineBeingCreated()?i(window.t("1. Slide your finger to select location for first anchor<br>2. Tap anywhere to place the first anchor")):TradingView.isMobile.any()&&"LineToolBrush"!==r&&f(r)&&i(window.t("1. Slide your finger to select location for next anchor<br>2. Tap anywhere to place the next anchor")))}},n.prototype._hideTooltip=function(){this._tooltipSelector.addClass("tooltip-selector-hidden")},n.prototype._updateCrosshairOnZoom=function(){var e,t;k.lockTimeAxis().value()&&(e=this._chart.model(),t=e.crossHairSource(),t.setPosition(t.index,t.price,P(this._state)))},n.prototype._isSelectBarModeEnabled=function(){return this._chart.model().crossHairSource().selectBarMode().value()},e.exports=n}).call(t,i(5))},function(e,t){},function(e,t,i){"use strict";function n(e,t){this._source=t,this._properties=e,this._points=[new l(-1,-1)],this._invalidated=!0,this._lineRenderer=new h}function o(){this._data=null}function r(e){this._source=e,this._points=[],this._bandBgRenderer=new o
}function s(e,t,i){this._source=e,this._points=[],a(t.type===u.FilledArea.TYPE_HLINES,"Wrong filledArea type: "+t.type),this._initBandIndexes(t.objAId,t.objBId),this._fillStyleProps=i,this._bandBgRenderer=new o}var a=i(7).assert,l=i(6).Point,c=i(50).clamp,h=i(110).HorizontalLineRenderer,u=i(26),d=i(29);n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){var e,t,i=this._source.priceScale();if(!i||i.isEmpty())return void(this._points[0]=new l(-1,-1));e=this._properties.value.value(),isNumber(e)?(t=this._source.firstValue(),this._points[0]=new l(-1,i.priceToCoordinate(e,t))):this._points[0]=new l(-1,NaN)},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};return e.width=this._source.model().timeScale().width(),e.height=this._source.priceScale().height(),e.points=this._points,e.color=this._properties.color.value(),e.linewidth=this._properties.linewidth.value(),e.linestyle=this._properties.linestyle.value(),this._lineRenderer.setData(e),this._lineRenderer},o.prototype.setData=function(e){this._data=e},o.prototype.draw=function(e){var t,i,n;null!==this._data&&0!==this._data.points.length&&(t=e.canvas.width,e.fillStyle=d.generateColor(this._data.backcolor,this._data.transparency),i=Math.min(this._data.points[0],this._data.points[1]),n=Math.max(this._data.points[0],this._data.points[1]),e.fillRect(0,i,t,n-i))},o.prototype.hitTest=function(e){return null},r.prototype.update=function(){var e,t,i,n,o;this._points=[],e=this._source.properties().bandsBackground,e.fillBackground.value()&&(t=this._source.properties().bands[0],i=this._source.properties().bands[1],(n=this._source.priceScale())&&!n.isEmpty()&&(o=this._source.firstValue(),this._points.push(n.priceToCoordinate(t.value.value(),o)),this._points.push(n.priceToCoordinate(i.value.value(),o))))},r.prototype.renderer=function(){var e={};return e.points=this._points,e.backcolor=this._source.properties().bandsBackground.backgroundColor.value(),e.transparency=this._source.properties().bandsBackground.transparency.value(),this._bandBgRenderer.setData(e),this._bandBgRenderer},s.prototype._initBandIndexes=function(e,t){var i,n;for(this._bandAKey=null,this._bandBKey=null,i=0;i<this._source.metaInfo().bands.length;++i)n=this._source.metaInfo().bands[i],null!==this._bandAKey||n.id!==e?null!==this._bandBKey||n.id!==t||(this._bandBKey=i):this._bandAKey=i},s.prototype.update=function(){var e,t,i,n;this._points=[],this._fillStyleProps.visible.value()&&(e=this._source.properties().bands[this._bandAKey],t=this._source.properties().bands[this._bandBKey],(i=this._source.priceScale())&&!i.isEmpty()&&(n=this._source.firstValue(),this._points.push(i.priceToCoordinate(e.value.value(),n)),this._points.push(i.priceToCoordinate(t.value.value(),n))))},s.prototype.renderer=function(){var e,t=this._fillStyleProps.transparency.value();return t=c(t,0,100),e={},e.points=this._points,e.backcolor=d.generateColor(this._fillStyleProps.color.value(),t),e.transparency=this._fillStyleProps.transparency.value(),
this._bandBgRenderer.setData(e),this._bandBgRenderer},t.BandPaneView=n,t.BandBackgroundPaneView=r,t.HlineFillPaneView=s},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyPriceAxisView",function(){return r}),n=i(1),o=i(58),r=function(e){function t(t,i){var n=e.call(this)||this;return n._source=t,n._data=i,n}return n.c(t,e),t.prototype._updateRendererData=function(e){e.visible=!1;var t=this._source.lastValueData(this._data.plotIndex,!1);t.noData||(e.background=t.color,e.color=this.generateTextColor(t.color),e.coordinate=t.coordinate,e.floatCoordinate=t.floatCoordinate,e.text=t.text,e.visible=!0)},t}(o.a)},function(e,t,i){"use strict";function n(e,t,i,n){var o,r;for(this.m_study=e,this.m_series=t,this.m_model=i,this._plotName=n,this.m_items=[],this._invalidated=!0,this._isMarkersEnabled=K.enabled("source_selection_markers"),o=this.m_study.metaInfo().plots,this._colorer=null,this._palette=null,this._paletterProps=null,this._plotIndex=0,r=0;r<o.length;r++)o[r].id===this._plotName&&(this._plotIndex=r),this.m_study.isSelfColorerPlot(r)&&o[r].target===this._plotName&&(this._colorer=r,this._palette=this.m_study.metaInfo().palettes[o[r].palette],this._paletterProps=this.m_study.properties().palettes[o[r].palette])}function o(e,t,i,n){var o,r;for(this._study=e,this._series=t,this._model=i,this._plotName=n,this._items=[],this._invalidated=!0,this._isMarkersEnabled=K.enabled("source_selection_markers"),o=this._study.metaInfo().plots,r=0;r<o.length;r++)o[r].id===this._plotName&&(this._plotIndex=r,d(this._study.isBgColorerPlot(r),"Plot '"+this._plotName+"' is not a background colorer!"))}function r(e,t,i,n){var o,r;for(this.m_study=e,this.m_series=t,this.m_model=i,this.m_plotName=n,this.m_items=[],this.m_invalidated=!0,this._isMarkersEnabled=K.enabled("source_selection_markers"),this.m_selectionData=null,this.m_plotIndex=null,o=this.m_study.metaInfo().plots,r=0;r<o.length;r++)if(o[r].id===this.m_plotName){this.m_plotIndex=r;break}for(o=this.m_study.metaInfo().plots,this._colorer=null,this._textColorer=null,this._palette=null,this._textPalette=null,this._paletterProps=null,this._textPaletterProps=null,this._plotIndex=0,r=0;r<o.length;r++)o[r].id===this.m_plotName&&(this._plotIndex=r),this.m_study.isSelfColorerPlot(r)&&o[r].target===this.m_plotName&&(this._colorer=r,this._palette=this.m_study.metaInfo().palettes[o[r].palette],this._paletterProps=this.m_study.properties().palettes[o[r].palette]),this.m_study.isTextColorerPlot(r)&&o[r].target===this.m_plotName&&(this._textColorer=r,this._textPalette=this.m_study.metaInfo().palettes[o[r].palette],this._textPaletterProps=this.m_study.properties().palettes[o[r].palette])}function s(e,t,i,n){r.call(this,e,t,i,n)}function a(e,t,i,n){s.call(this,e,t,i,n)}function l(e,t,i,n){r.call(this,e,t,i,n),this._maxAbsValue=0}function c(e,t,i,n){var o,r;for(this.m_study=e,this.m_series=t,this.m_model=i,this.m_plotName=n,this.m_bars=[],this._invalidated=!0,this._isMarkersEnabled=K.enabled("source_selection_markers"),o=this.m_study.metaInfo().plots,
this._colorer=null,this._palette=null,this._paletterProps=null,this._ohlcPlotIndexes={},r=0;r<o.length;r++)o[r].target===this.m_plotName&&(this.m_study.isOHLCOpenPlot(r)&&(this._ohlcPlotIndexes[TradingView.OPEN_PLOT]=r),this.m_study.isOHLCHighPlot(r)&&(this._ohlcPlotIndexes[TradingView.HIGH_PLOT]=r),this.m_study.isOHLCLowPlot(r)&&(this._ohlcPlotIndexes[TradingView.LOW_PLOT]=r),this.m_study.isOHLCClosePlot(r)&&(this._ohlcPlotIndexes[TradingView.CLOSE_PLOT]=r),this.m_study.isOHLCColorerPlot(r)&&(this._colorer=r,this._palette=this.m_study.metaInfo().palettes[o[r].palette],this._paletterProps=this.m_study.properties().palettes[o[r].palette]))}function h(e,t,i,n){c.call(this,e,t,i,n)}function u(e,t,i,n){c.call(this,e,t,i,n)}var d=i(7).assert,p=i(6).Point,_=i(24),f=_.rgbToHsl,m=_.hslToRgb,y=_.rgbToHexString,g=_.parseRgb,v=_.parseRgba,S=i(9).HitTestResult,b=i(190),w=b.SelectionRenderer,P=b.SelectionRendererArrowsUpDown,T=i(263).PaneRendererBars,x=i(511).PaneRendererHistogram,C=i(512).PaneRendererColumns,L=i(136).PaneRendererLine,I=i(264).PaneRendererArea,A=i(210).PaneRendererCandles,k=i(513).PaneRendererCross,E=i(514).PaneRendererCircles,M=i(167).PaneRendererArrowsUpDownItem,V=i(167).PaneRendererArrowsUpDown,D=i(339).PaneRendererUnicodeChar,O=i(515).PaneRendererBackground,R=i(516).PaneRendererStepLine,B=i(265),N=i(69).CompositeRenderer,F=i(266),W=i(50).clamp,H=i(211),j=i(87),z=j.PlotType,U=j.PlotSymbolSize,q=i(212).MarkLocation,$=i(517),Y=i(29),G=i(17).PlotRowSearchMode,K=i(5);i(518),i(519),i(520),i(521),i(522),i(523),i(524),i(525),i(526),n.isIndexValid=function(e,t){return null!==e&&e>=0&&e<t._length()},n.prototype.items=function(){return this.m_items},n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){var e,t,i,o,r,s,a,l,c,h,u,d,_,f,m,y,g,v,b,w,P,T,x,C,L,I;if(this._histogramBase=null,this.m_items=[],!(this.m_model.timeScale().isEmpty()||this.m_study.priceScale().isEmpty()||null===(e=this.m_model.timeScale().visibleBars())||(t=this.m_series.nearestIndex(e.firstBar(),G.NearestRight),i=this.m_series.nearestIndex(e.lastBar(),G.NearestLeft),o=this.m_study.offset(this._plotName),o>0?(t-=o,i+=o):(t+=o,i-=o),(r=this.m_study.getMinFirstBarIndexForPlot(this._plotName))>i))){if(t=Math.max(r,t),s=this.m_study.properties().styles[this._plotName],a=s.plottype.value(),l=[z.Line,z.Area,z.Circles,z.Cross].indexOf(a)>=0,c=this.m_study.data(),h=this.m_study.firstValue(),l&&c._length()>0){for(u=c._bsearch(t);n.isIndexValid(u,c)&&void 0===c._valueAt(u)[this._plotIndex+1];)u-=1;for(t=n.isIndexValid(u,c)?c._indexAt(u):t,d=c._bsearch(i);n.isIndexValid(d,c)&&void 0===c._valueAt(d)[this._plotIndex+1];)d+=1;i=n.isIndexValid(d,c)?c._indexAt(d):i}if(_=c.range(t,i),f=this.m_study.priceScale(),m=W(this._getTranspValue(),0,100),y={},g=function(e,t){var i=e+"@"+t;return y[i]||(this._plotName&&"vol"===this._plotName?y[i]=Y.generateColor(e,t):y[i]=Y.generateColor(e,t,!0)),y[i]}.bind(this),_.each(function(e,t){var i,n,r,a,c,h,u,d,_;return e+=o,e=Math.floor(e),i=t[this._plotIndex+1],n=void 0===i||null===i,i=n?NaN:i,
(!l||!n)&&(r=new p(e,i),a=void 0!==t[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&a&&(i=t[this._colorer+1],r.style={},null!=i?(c=this._palette.valToIndex?this._palette.valToIndex[i]:i,h=this._paletterProps.colors[c],u=h.color.value(),r.style.color=Y.isHexColor(u)?g(u,m):u):(u=s.color.value(),r.style.color=g(u,100)),d=void 0!==c?h.width.value():s.linewidth.value(),_=void 0!==c?h.style.value():s.linestyle.value(),r.style.width=d,r.style.style=_),this.m_items.push(r),!1)}.bind(this)),f.pointsArrayToCoordinates(this.m_items,h),this.m_model.timeScale().indexesToCoordinates(this.m_items),s.histogramBase&&(this._histogramBase=this.m_study.priceScale().priceToCoordinate(s.histogramBase.value(),h)),this.m_study===this.m_model.selectedSource())for(v=F(t,i),this._selectionData={points:[]},this._selectionData.hittestResult=S.REGULAR,b=0;b<v.length;b++)w=v[b],P=this.m_study.data().valueAt(w),w+=o,null!==P&&(T=P[this._plotIndex+1],x=this.m_model.timeScale().indexToCoordinate(Math.floor(w)),C=this.m_study.priceScale().priceToCoordinate(T,h),this._selectionData.points.push(new p(x,C)));L=s,this._lineColor=Y.generateColor(L.color.value(),m),this._lineWidth=L.linewidth.value(),I=L.color.value(),this._colorer&&null!=(T=this._paletterProps.colors[0])&&(I=T.color.value(),this._lineWidth=T.width.value(),this._lineColor=Y.generateColor(T.color.value(),m)),this._color2=Y.generateColor(I,m),this._color1=Y.generateColor(n.addHueForColor(I),m)}},n.addHueForColor=$(function(e){var t=f(g(e)),i=t[0]+.05;return t[0]=i-Math.floor(i),y(m(t))}),n.prototype._getTranspValue=function(){var e=this.m_study.properties(),t=e.styles[this._plotName],i=0,n=0,o=this.m_study.metaInfo();return"Volume@tv-basicstudies"===o.id&&o.version<=46&&"transparency"in e?(i=e.transparency.value(),i=isNumber(i)?i:n):(t.transparency&&(i=t.transparency.value(),i=isNumber(i)?i:n),i)},n.prototype.renderer=function(){var e,t,i,n,o,r=this.m_study.properties().styles[this._plotName];if(r.visible.value()&&this.m_study.priceScale()){switch(this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={},e.barSpacing=this.m_model.timeScale().barSpacing(),e.items=this.m_items,e.histogramBase=this._histogramBase?this._histogramBase:this.m_study.priceScale().height(),e.lineIndex=0,e.lineStyle=r.linestyle.value(),e.lineColor=this._lineColor,e.lineWidth=this._lineWidth,e.lineWidth=isNumber(e.lineWidth)?e.lineWidth:1,e.color1=this._color1,e.color2=this._color2,e.bottom=e.histogramBase,this._colorer||(e.simpleMode=!0),t=new N,i=!!r.joinPoints&&r.joinPoints.value(),r.plottype.value()){case z.Line:case z.LineWithBreaks:t.append(new L(e));break;case z.Area:case z.AreaWithBreaks:t.append(new I(e));break;case z.Histogram:t.append(new x(e));break;case z.Columns:t.append(new C(e));break;case z.Cross:t.append(new k(e)),i&&(n=TradingView.merge({},e),n.lineWidth=1,n.forceLineWidth=!0,t.append(new L(n)));break;case z.Circles:t.append(new E(e)),i&&(n=TradingView.merge({},e),n.lineWidth=1,n.ignorePaletteLineWidth=!0,t.append(new L(n)));break;case z.StepLine:o=new R,
o.setData(e),t.append(o);break;default:t.append(new L(e))}return this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&t.append(new w(this._selectionData)),t}},o.prototype.items=function(){return this._items},o.prototype.update=function(){this._invalidated=!0},o.prototype._scalesReady=function(){var e=this._model.timeScale(),t=this._study.priceScale();return e&&t&&!e.isEmpty()&&!t.isEmpty()},o.prototype._getTranspValue=function(){var e=this._study.properties(),t=e.styles[this._plotName],i=0;return t.transparency&&(i=t.transparency.value(),i=isNumber(i)?i:40),i},o.prototype._updateImpl=function(){var e,t,i,n,o,r,s,a,l,c,h,u,_;this._items=[],d(this._scalesReady(),"Scales must be ready!"),null!==(e=this._model.timeScale().visibleBars())&&(t=this._study.metaInfo().plots,i=t[this._plotIndex].palette,n=this._study.properties().palettes[i],o=n.colors,r=this._study.metaInfo().palettes[i],s=this._getTranspValue(),a=this._series.nearestIndex(e.firstBar(),G.NearestRight),l=this._series.nearestIndex(e.lastBar(),G.NearestLeft),c=this._study.offset(this._plotName),c>0?(a-=c,l+=c):(a+=c,l-=c),(h=this._study.getMinFirstBarIndexForPlot(this._plotName))>l||(a=Math.max(h,a),u=this._study.data(),_=u.range(a,l),_.each(function(e,t){var i,n,a,l;return e+=c,i=t[this._plotIndex+1],n=new p(Math.floor(e)-.5),a=isNumber(s)?s:50,a=Math.min(a,100),a=Math.max(a,0),null!=i?(l=r.valToIndex?r.valToIndex[i]:i,n.color=Y.generateColor(o[l].color.value(),a)):n.color=null,this._items.push(n),!1}.bind(this)),this._model.timeScale().indexesToCoordinates(this._items)))},o.prototype.renderer=function(){var e,t;if(this._study.properties().styles[this._plotName].visible&&this._study.properties().styles[this._plotName].visible.value()&&this._scalesReady())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={items:this._items,y:0,h:this._study.priceScale().height(),w:Math.ceil(this._model.timeScale().barSpacing())},t=new N,t.append(new O(e)),t},r.prototype.items=function(){return this.m_items},r.prototype.update=function(){this.m_invalidated=!0},r.prototype._scalesReady=function(){var e=this.m_model.timeScale(),t=this.m_study.priceScale();return e&&t&&!e.isEmpty()&&!t.isEmpty()},r.prototype._updateImpl=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m;this.m_items=[],this._scalesReady()&&(e=this.m_model.timeScale(),t=this.m_study.priceScale(),null!==(i=e.visibleBars())&&(n=this.m_series.nearestIndex(i.firstBar(),G.NearestRight),o=this.m_series.nearestIndex(i.lastBar(),G.NearestLeft),r=this.m_study.offset(this.m_plotName),r>0?(n-=r,o+=r):(n+=r,o-=r),(s=this.m_study.getMinFirstBarIndexForPlot(this.m_plotName))>o||(n=Math.max(s,n),a=this.m_study.data(),l=this.m_study.firstValue(),c=a.range(n,o),h=this._getTranspValue(),u=F(n,o),d=this.m_study===this.m_model.selectedSource(),this.m_selectionData=d?{points:[],hittestResult:S.REGULAR,vertOffset:0}:null,p=this.m_series.properties().style.value(),_=p===TradingView.Series.STYLE_LINE?"lineStyle":p===TradingView.Series.STYLE_AREA?"areaStyle":null,
this._colorer=null,this._palette=null,this._paletterProps=null,this._ohlcPlotIndexes={},r=0;r<o.length;r++)o[r].target===this.m_plotName&&(this.m_study.isOHLCOpenPlot(r)&&(this._ohlcPlotIndexes[TradingView.OPEN_PLOT]=r),this.m_study.isOHLCHighPlot(r)&&(this._ohlcPlotIndexes[TradingView.HIGH_PLOT]=r),this.m_study.isOHLCLowPlot(r)&&(this._ohlcPlotIndexes[TradingView.LOW_PLOT]=r),this.m_study.isOHLCClosePlot(r)&&(this._ohlcPlotIndexes[TradingView.CLOSE_PLOT]=r),this.m_study.isOHLCColorerPlot(r)&&(this._colorer=r,this._palette=this.m_study.metaInfo().palettes[o[r].palette],this._paletterProps=this.m_study.properties().palettes[o[r].palette]))}function h(e,t,i,n){c.call(this,e,t,i,n)}function u(e,t,i,n){c.call(this,e,t,i,n)}var d=i(7).assert,p=i(6).Point,_=i(24),f=_.rgbToHsl,m=_.hslToRgb,y=_.rgbToHexString,g=_.parseRgb,v=_.parseRgba,S=i(9).HitTestResult,b=i(190),w=b.SelectionRenderer,P=b.SelectionRendererArrowsUpDown,T=i(263).PaneRendererBars,x=i(511).PaneRendererHistogram,C=i(512).PaneRendererColumns,L=i(136).PaneRendererLine,I=i(264).PaneRendererArea,A=i(210).PaneRendererCandles,k=i(513).PaneRendererCross,E=i(514).PaneRendererCircles,M=i(167).PaneRendererArrowsUpDownItem,V=i(167).PaneRendererArrowsUpDown,D=i(339).PaneRendererUnicodeChar,O=i(515).PaneRendererBackground,R=i(516).PaneRendererStepLine,B=i(265),F=i(69).CompositeRenderer,N=i(266),W=i(50).clamp,H=i(211),j=i(87),z=j.PlotType,U=j.PlotSymbolSize,q=i(212).MarkLocation,$=i(517),Y=i(29),G=i(17).PlotRowSearchMode,K=i(5);i(518),i(519),i(520),i(521),i(522),i(523),i(524),i(525),i(526),n.isIndexValid=function(e,t){return null!==e&&e>=0&&e<t._length()},n.prototype.items=function(){return this.m_items},n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){var e,t,i,o,r,s,a,l,c,h,u,d,_,f,m,y,g,v,b,w,P,T,x,C,L,I;if(this._histogramBase=null,this.m_items=[],!(this.m_model.timeScale().isEmpty()||this.m_study.priceScale().isEmpty()||null===(e=this.m_model.timeScale().visibleBars())||(t=this.m_series.nearestIndex(e.firstBar(),G.NearestRight),i=this.m_series.nearestIndex(e.lastBar(),G.NearestLeft),o=this.m_study.offset(this._plotName),o>0?(t-=o,i+=o):(t+=o,i-=o),(r=this.m_study.getMinFirstBarIndexForPlot(this._plotName))>i))){if(t=Math.max(r,t),s=this.m_study.properties().styles[this._plotName],a=s.plottype.value(),l=[z.Line,z.Area,z.Circles,z.Cross].indexOf(a)>=0,c=this.m_study.data(),h=this.m_study.firstValue(),l&&c._length()>0){for(u=c._bsearch(t);n.isIndexValid(u,c)&&void 0===c._valueAt(u)[this._plotIndex+1];)u-=1;for(t=n.isIndexValid(u,c)?c._indexAt(u):t,d=c._bsearch(i);n.isIndexValid(d,c)&&void 0===c._valueAt(d)[this._plotIndex+1];)d+=1;i=n.isIndexValid(d,c)?c._indexAt(d):i}if(_=c.range(t,i),f=this.m_study.priceScale(),m=W(this._getTranspValue(),0,100),y={},g=function(e,t){var i=e+"@"+t;return y[i]||(this._plotName&&"vol"===this._plotName?y[i]=Y.generateColor(e,t):y[i]=Y.generateColor(e,t,!0)),y[i]}.bind(this),_.each(function(e,t){var i,n,r,a,c,h,u,d,_;return e+=o,e=Math.floor(e),i=t[this._plotIndex+1],n=void 0===i||null===i,i=n?NaN:i,
(!l||!n)&&(r=new p(e,i),a=void 0!==t[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&a&&(i=t[this._colorer+1],r.style={},null!=i?(c=this._palette.valToIndex?this._palette.valToIndex[i]:i,h=this._paletterProps.colors[c],u=h.color.value(),r.style.color=Y.isHexColor(u)?g(u,m):u):(u=s.color.value(),r.style.color=g(u,100)),d=void 0!==c?h.width.value():s.linewidth.value(),_=void 0!==c?h.style.value():s.linestyle.value(),r.style.width=d,r.style.style=_),this.m_items.push(r),!1)}.bind(this)),f.pointsArrayToCoordinates(this.m_items,h),this.m_model.timeScale().indexesToCoordinates(this.m_items),s.histogramBase&&(this._histogramBase=this.m_study.priceScale().priceToCoordinate(s.histogramBase.value(),h)),this.m_study===this.m_model.selectedSource())for(v=N(t,i),this._selectionData={points:[]},this._selectionData.hittestResult=S.REGULAR,b=0;b<v.length;b++)w=v[b],P=this.m_study.data().valueAt(w),w+=o,null!==P&&(T=P[this._plotIndex+1],x=this.m_model.timeScale().indexToCoordinate(Math.floor(w)),C=this.m_study.priceScale().priceToCoordinate(T,h),this._selectionData.points.push(new p(x,C)));L=s,this._lineColor=Y.generateColor(L.color.value(),m),this._lineWidth=L.linewidth.value(),I=L.color.value(),this._colorer&&null!=(T=this._paletterProps.colors[0])&&(I=T.color.value(),this._lineWidth=T.width.value(),this._lineColor=Y.generateColor(T.color.value(),m)),this._color2=Y.generateColor(I,m),this._color1=Y.generateColor(n.addHueForColor(I),m)}},n.addHueForColor=$(function(e){var t=f(g(e)),i=t[0]+.05;return t[0]=i-Math.floor(i),y(m(t))}),n.prototype._getTranspValue=function(){var e=this.m_study.properties(),t=e.styles[this._plotName],i=0,n=0,o=this.m_study.metaInfo();return"Volume@tv-basicstudies"===o.id&&o.version<=46&&"transparency"in e?(i=e.transparency.value(),i=isNumber(i)?i:n):(t.transparency&&(i=t.transparency.value(),i=isNumber(i)?i:n),i)},n.prototype.renderer=function(){var e,t,i,n,o,r=this.m_study.properties().styles[this._plotName];if(r.visible.value()&&this.m_study.priceScale()){switch(this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={},e.barSpacing=this.m_model.timeScale().barSpacing(),e.items=this.m_items,e.histogramBase=this._histogramBase?this._histogramBase:this.m_study.priceScale().height(),e.lineIndex=0,e.lineStyle=r.linestyle.value(),e.lineColor=this._lineColor,e.lineWidth=this._lineWidth,e.lineWidth=isNumber(e.lineWidth)?e.lineWidth:1,e.color1=this._color1,e.color2=this._color2,e.bottom=e.histogramBase,this._colorer||(e.simpleMode=!0),t=new F,i=!!r.joinPoints&&r.joinPoints.value(),r.plottype.value()){case z.Line:case z.LineWithBreaks:t.append(new L(e));break;case z.Area:case z.AreaWithBreaks:t.append(new I(e));break;case z.Histogram:t.append(new x(e));break;case z.Columns:t.append(new C(e));break;case z.Cross:t.append(new k(e)),i&&(n=TradingView.merge({},e),n.lineWidth=1,n.forceLineWidth=!0,t.append(new L(n)));break;case z.Circles:t.append(new E(e)),i&&(n=TradingView.merge({},e),n.lineWidth=1,n.ignorePaletteLineWidth=!0,t.append(new L(n)));break;case z.StepLine:o=new R,
o.setData(e),t.append(o);break;default:t.append(new L(e))}return this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&t.append(new w(this._selectionData)),t}},o.prototype.items=function(){return this._items},o.prototype.update=function(){this._invalidated=!0},o.prototype._scalesReady=function(){var e=this._model.timeScale(),t=this._study.priceScale();return e&&t&&!e.isEmpty()&&!t.isEmpty()},o.prototype._getTranspValue=function(){var e=this._study.properties(),t=e.styles[this._plotName],i=0;return t.transparency&&(i=t.transparency.value(),i=isNumber(i)?i:40),i},o.prototype._updateImpl=function(){var e,t,i,n,o,r,s,a,l,c,h,u,_;this._items=[],d(this._scalesReady(),"Scales must be ready!"),null!==(e=this._model.timeScale().visibleBars())&&(t=this._study.metaInfo().plots,i=t[this._plotIndex].palette,n=this._study.properties().palettes[i],o=n.colors,r=this._study.metaInfo().palettes[i],s=this._getTranspValue(),a=this._series.nearestIndex(e.firstBar(),G.NearestRight),l=this._series.nearestIndex(e.lastBar(),G.NearestLeft),c=this._study.offset(this._plotName),c>0?(a-=c,l+=c):(a+=c,l-=c),(h=this._study.getMinFirstBarIndexForPlot(this._plotName))>l||(a=Math.max(h,a),u=this._study.data(),_=u.range(a,l),_.each(function(e,t){var i,n,a,l;return e+=c,i=t[this._plotIndex+1],n=new p(Math.floor(e)-.5),a=isNumber(s)?s:50,a=Math.min(a,100),a=Math.max(a,0),null!=i?(l=r.valToIndex?r.valToIndex[i]:i,n.color=Y.generateColor(o[l].color.value(),a)):n.color=null,this._items.push(n),!1}.bind(this)),this._model.timeScale().indexesToCoordinates(this._items)))},o.prototype.renderer=function(){var e,t;if(this._study.properties().styles[this._plotName].visible&&this._study.properties().styles[this._plotName].visible.value()&&this._scalesReady())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={items:this._items,y:0,h:this._study.priceScale().height(),w:Math.ceil(this._model.timeScale().barSpacing())},t=new F,t.append(new O(e)),t},r.prototype.items=function(){return this.m_items},r.prototype.update=function(){this.m_invalidated=!0},r.prototype._scalesReady=function(){var e=this.m_model.timeScale(),t=this.m_study.priceScale();return e&&t&&!e.isEmpty()&&!t.isEmpty()},r.prototype._updateImpl=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m;this.m_items=[],this._scalesReady()&&(e=this.m_model.timeScale(),t=this.m_study.priceScale(),null!==(i=e.visibleBars())&&(n=this.m_series.nearestIndex(i.firstBar(),G.NearestRight),o=this.m_series.nearestIndex(i.lastBar(),G.NearestLeft),r=this.m_study.offset(this.m_plotName),r>0?(n-=r,o+=r):(n+=r,o-=r),(s=this.m_study.getMinFirstBarIndexForPlot(this.m_plotName))>o||(n=Math.max(s,n),a=this.m_study.data(),l=this.m_study.firstValue(),c=a.range(n,o),h=this._getTranspValue(),u=N(n,o),d=this.m_study===this.m_model.selectedSource(),this.m_selectionData=d?{points:[],hittestResult:S.REGULAR,vertOffset:0}:null,p=this.m_series.properties().style.value(),_=p===TradingView.Series.STYLE_LINE?"lineStyle":p===TradingView.Series.STYLE_AREA?"areaStyle":null,
_?(f=this.m_series.properties()[_].priceSource.value(),m=f):(f="high",m="low"),this._topCoord=t.coordinateToPrice(t.height()*t.topMargin(),l),this._bottomCoord=t.coordinateToPrice(t.height()*(1-t.bottomMargin()),l),c.each(function(e,t){var i,n,o,s,a,l,c,p=Math.floor(e+r),_=t[this.m_plotIndex+1];return null!==_&&void 0!==_&&(i=this._createItem(p,_,f,m),void 0!==i&&null!==i?(n=void 0!==t[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&n&&(_=t[this._colorer+1],i.style={},null!=_?(s=this._palette.valToIndex?this._palette.valToIndex[_]:_,o=this._paletterProps.colors[s].color.value(),i.style.color=Y.generateColor(o,h)):(o=this.m_study.properties().styles[this.m_plotName].color.value(),i.style.color=Y.generateColor(o,100)),a=h>9?h-10:0,i.style.borderColor=Y.generateColor(o,a)),l=void 0!==t[this._textColorer+1]||this._textPalette&&this._textPalette.addDefaultColor,this._textColorer&&l&&(_=t[this._textColorer+1],i.style||(i.style={}),null!=_?(s=this._textPalette.valToIndex?this._textPalette.valToIndex[_]:_,c=this._textPaletterProps.colors[s].color.value(),i.style.textColor=Y.generateColor(c,h)):(c=this.m_study.properties().styles[this.m_plotName].textColor.value(),i.style.textColor=Y.generateColor(c,100))),d&&-1!==u.indexOf(e)&&this.m_selectionData.points.push(i),this.m_items.push(i),!1):void 0)}.bind(this)),this._convertItemsToCoordinates())))},r.prototype._getSeriesVal=function(e,t){var i;e=e||"close",i=null;try{i=this.m_series[e](t)}catch(e){}return i},r.prototype._getTranspValue=function(){var e,t=0;return this.m_study.properties().transparency&&(t=this.m_study.properties().transparency.value(),t=isNumber(t)?t:50),e=this.m_study.properties().styles[this.m_plotName],e.transparency&&(t=e.transparency.value(),t=isNumber(t)?t:50),W(t,0,100)},r.prototype._createItem=function(e,t,i,n){var o,r,s,a=this.m_study.properties().styles[this.m_plotName].location.value();if(!t&&a!==q.Absolute)return null;switch(a){case q.AboveBar:if(void 0===(o=this._getSeriesVal(i,e))||null==o)return null;r=o;break;case q.BelowBar:if(void 0===(s=this._getSeriesVal(n,e))||null==s)return null;r=s;break;case q.Top:r=this._topCoord;break;case q.Bottom:r=this._bottomCoord;break;case q.Absolute:r=t;break;default:throw Error("Bad value: "+a)}return new p(e,r)},r.prototype._convertItemsToCoordinates=function(){var e=this.m_model.timeScale(),t=this.m_study.priceScale();e.indexesToCoordinates(this.m_items),t.pointsArrayToCoordinates(this.m_items,this.m_study.firstValue())},r.prototype._calculateVerticalOffset=function(e,t){var i=0;switch(e){case q.AboveBar:case q.Bottom:i=-t;break;case q.BelowBar:case q.Top:i=t}return i},r.prototype._calculateShapeHeight=function(e,t){var i=e;switch(t){case U.Tiny:i=.3*e;break;case U.Small:i=.6*e;break;case U.Normal:i=e;break;case U.Large:i=1.5*e;break;case U.Huge:i=2*e}return i},r.prototype.renderer=function(){var e,t,i,n,o,r,s,a,l,c
;if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady())return e=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),t={},i=this._getTranspValue(),n=e.barSpacing(),o=this._calculateShapeHeight(n),r=this.m_study.properties().styles[this.m_plotName].location.value(),s=this._calculateVerticalOffset(r,o+o/2),t.barSpacing=n,t.items=this.m_items,t.color=Y.generateColor(this.m_study.properties().styles[this.m_plotName].color.value(),i),t.height=o,t.vertOffset=s,a=this.m_study.properties().styles[this.m_plotName].plottype.value(),l=H.plotShapesData[a],c=new N,l&&c.append(new TradingView[l.paneRendererClass](t)),this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&null!==this.m_selectionData&&(this.m_selectionData.vertOffset=s,c.append(new w(this.m_selectionData))),c},inherit(s,r),s.prototype.renderer=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S=this.m_study.properties().styles[this.m_plotName];if(S.visible&&S.visible.value()&&this._scalesReady())return e=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),t={},i=this._getTranspValue(),n=e.barSpacing(),S.size?(r=S.size.value(),o=this._calculateShapeHeight(25,r)):o=Math.round(n/2),s=S.location.value(),a=Y.generateColor(S.color.value(),i),l=i>19?i-10:0,c=this._calculateVerticalOffset(s,Math.round(1.5*o)),t.barSpacing=n,t.items=this.items(),t.color=a,t.borderColor=Y.generateColor(S.color.value(),l),t.height=o,t.vertOffset=c,h=S.plottype.value(),u=H.plotShapesData[h],d=new N,p=S.text?S.text.value():void 0,void 0!==p&&""!==p.trim()&&(_=p.trim().replace(/\\n/gm,"\n"),_=TradingView.cleanButAmpersand(_,!0),f=!1,m=!1,y="Arial",g=12,t.textCache=new B(_,f,m,y,g),v=S.textColor?S.textColor.value():void 0,t.textColor=v?Y.generateColor(v,i):a),null!=u&&d.append(new TradingView[u.paneRendererClass](t)),this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&null!==this.m_selectionData&&(this.m_selectionData.vertOffset=c,d.append(new w(this.m_selectionData))),d},inherit(a,s),a.prototype.renderer=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y=this.m_study.properties().styles[this.m_plotName];if(y.visible&&y.visible.value()&&this._scalesReady())return e=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),t={},i=this._getTranspValue(),n=e.barSpacing(),y.size?(r=y.size.value(),o=this._calculateShapeHeight(50,r)):o=Math.round(n),s=y.location.value(),a=Y.generateColor(y.color.value(),i),l=this._calculateVerticalOffset(s,o),t.items=this.items(),t.char=y.char.value(),t.height=o,t.vertOffset=l,t.color=a,c=new N,h=y.text?y.text.value():void 0,void 0!==h&&""!==h.trim()&&(u=h.trim().replace(/\\n/gm,"\n"),u=TradingView.cleanButAmpersand(u,!0),d=!1,p=!1,_="Arial",f=12,t.textCache=new B(u,d,p,_,f),m=y.textColor?y.textColor.value():void 0,t.textColor=m?Y.generateColor(m,i):a),c.append(new D(t)),
this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&null!==this.m_selectionData&&(this.m_selectionData.vertOffset=l,c.append(new w(this.m_selectionData))),c},inherit(l,r),l.prototype.renderer=function(){var e,t,i,n,o,r,s,a,l;if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady())return this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),e={},t=W(this._getTranspValue(),0,100),i=this.m_model.timeScale().barSpacing(),e.items=this.m_items,e.barSpacing=i,e.colorup=Y.generateColor(this.m_study.properties().styles[this.m_plotName].colorup.value(),t),e.colordown=Y.generateColor(this.m_study.properties().styles[this.m_plotName].colordown.value(),t),n=v(e.colorup),o=n?100*(1-n[3]):0,r=v(e.colordown),s=r?100*(1-r[3]):0,e.colorBorderUp=Y.generateColor("#000000",o),e.colorBorderDown=Y.generateColor("#000000",s),e.minHeight=this.m_study.properties().styles[this.m_plotName].minHeight.value(),e.maxHeight=this.m_study.properties().styles[this.m_plotName].maxHeight.value(),a=new N,a.append(new V(e)),this.m_study===this.m_model.selectedSource()&&null!==this.m_selectionData&&(l=this.m_selectionData,l.barSpacing=i,a.append(new P(l))),a},l.prototype._createItem=function(e,t,i,n){var o,r,s,a;if(0!==t){if(Math.abs(t)>this._maxAbsValue&&(this._maxAbsValue=Math.abs(t)),o=t>0){if(void 0===(s=this._getSeriesVal(n,e))||null==s)return null;r=s}else{if(void 0===(a=this._getSeriesVal(i,e))||null==a)return null;r=a}return new M(e,r,t,o)}},l.prototype._convertItemsToCoordinates=function(){var e,t,i,n,o,r,s,a,l,c=this.m_model.timeScale(),h=this.m_study.priceScale();for(c.indexesToCoordinates(this.m_items),h.pointsArrayToCoordinates(this.m_items,this.m_study.firstValue()),e=Math.abs(this.m_study.properties().styles[this.m_plotName].minHeight.value()),t=Math.abs(this.m_study.properties().styles[this.m_plotName].maxHeight.value()),e>t&&(i=e,e=t,t=i),n=t-e,o=n/this._maxAbsValue,r=this.m_items,s=0;s<r.length;s++)a=r[s],l=Math.abs(a.height),a.height=l*o+e},c.prototype.update=function(){this._invalidated=!0},c.prototype._updateImpl=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,_,v,b,w,P,T;if(this.m_bars.length=0,!(this.m_model.timeScale().isEmpty()||this.m_study.priceScale().isEmpty()||null===(e=this.m_model.timeScale().visibleBars())||(t=this.m_series.nearestIndex(e.firstBar(),G.NearestRight),i=this.m_series.nearestIndex(e.lastBar(),G.NearestLeft),(n=this.m_study.getMinFirstBarIndexForPlot(this.m_plotName))>i||(t=Math.max(n,t),o=this.m_study.data(),r=this.m_study.firstValue(),s=o.range(t,i),a=0,l=this.m_study.properties().ohlcPlots[this.m_plotName],c={},h=function(e,t){var i=e+"@"+t;return c[i]||(c[i]=Y.generateColor(e,t)),c[i]},s.each(function(e,t){var i,n,o,r,s,c,u,d,p,_,v,S,b,w,P,T;for(e=Math.floor(e),i=!0,n={},o=TradingView.OPEN_PLOT;o<=TradingView.CLOSE_PLOT;++o){if(void 0===(r=t[this._ohlcPlotIndexes[o]+1])||null===r){i=!1;break}n[o]=r}return!!i&&(s=n[TradingView.OPEN_PLOT],c=n[TradingView.CLOSE_PLOT],
u=Math.max(s,n[TradingView.HIGH_PLOT],n[TradingView.LOW_PLOT],c),d=Math.min(s,n[TradingView.HIGH_PLOT],n[TradingView.LOW_PLOT],c),p={},p.time=Math.round(e),p.open=s,p.high=u,p.low=d,p.close=c,_=l.color.value(),v=void 0!==t[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&v&&null!=(r=t[this._colorer+1])&&(S=this._palette.valToIndex?this._palette.valToIndex[r]:r,b=this._paletterProps.colors[S],_=b.color.value()),p.color=h(_,a),w=f(g(_)),P=w[2]>.25?w[2]-.26:w[2]+.75,T=m(w[0],w[1],P),p.borderColor=h(y(T),a),p.hollow=null,this.m_bars.push(p),!1)}.bind(this)),u=this.m_study.priceScale(),u.barPricesToCoordinates(this.m_bars,r),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_study!==this.m_model.selectedSource()))))for(d=F(t,i),this._selectionData={points:[],hittestResult:S.REGULAR},_=0;_<d.length;_++)v=d[_],null!==(b=this.m_study.data().valueAt(v))&&(w=b[this._plotIndex+1],P=this.m_model.timeScale().indexToCoordinate(Math.floor(v)),T=this.m_study.priceScale().priceToCoordinate(w,r),this._selectionData.points.push(new p(P,T)))},c.prototype.items=function(){return this.m_bars},inherit(h,c),h.prototype.renderer=function(){var e,t;if(this.m_study.properties().ohlcPlots[this.m_plotName].visible.value())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={},e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.dontDrawOpen=this.m_series.properties().barStyle.dontDrawOpen.value(),t=new N,t.append(new T(e)),this.m_series===this.m_model.selectedSource()&&this._isMarkersEnabled&&t.append(new w(this._selectionData)),t},inherit(u,c),u.prototype.renderer=function(){var e,t,i,n=this.m_study.properties().ohlcPlots[this.m_plotName];if(n.visible.value())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={},e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.drawWick=n.drawWick.value(),e.drawBorder=n.drawBorder.value(),t=n.wickColor.value(),e.borderColor=t,e.wickColor=t,i=new N,i.append(new A(e)),this.m_series===this.m_model.selectedSource()&&this._isMarkersEnabled&&i.append(new w(this._selectionData)),i},t.StudyPaneView=n,t.StudyBackgroundPaneView=o,t.StudyPlotShapesPaneView=s,t.StudyPlotCharsPaneView=a,t.StudyPlotArrowsPaneView=l,t.StudyPlotCandlesPaneView=u,t.StudyPlotBarsPaneView=h},function(e,t,i){"use strict";function n(e){this.items=e.items,this.barSpacing=e.barSpacing,this.histogramBase=e.histogramBase,this.lineColor=e.lineColor,this.lineWidth=e.lineWidth}var o=i(6).Point,r=i(30).distanceToSegment,s=i(27).selectionTolerance,a=i(9).HitTestResult;n.prototype.draw=function(e){var t,i,n,o,r;for(e.translate(.5,.5),e.fillStyle=this.lineColor,t=this.lineWidth,i=0;i<this.items.length;++i)n=this.items[i],o=n.x,r=n.y,n.style&&(e.fillStyle=n.style.color,t=n.style.width),e.fillRect(Math.round(o-.5*t),r,t,this.histogramBase-r)},n.prototype.hitTest=function(e){var t,i,n,l,c,h=s(this.lineWidth);for(c=0;c<this.items.length;++c)if(t=this.items[c],i=t.x,n=t.y,l=r(new o(i,n),new o(i,this.histogramBase),new o(e.x,e.y)),
;if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady())return e=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),t={},i=this._getTranspValue(),n=e.barSpacing(),o=this._calculateShapeHeight(n),r=this.m_study.properties().styles[this.m_plotName].location.value(),s=this._calculateVerticalOffset(r,o+o/2),t.barSpacing=n,t.items=this.m_items,t.color=Y.generateColor(this.m_study.properties().styles[this.m_plotName].color.value(),i),t.height=o,t.vertOffset=s,a=this.m_study.properties().styles[this.m_plotName].plottype.value(),l=H.plotShapesData[a],c=new F,l&&c.append(new TradingView[l.paneRendererClass](t)),this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&null!==this.m_selectionData&&(this.m_selectionData.vertOffset=s,c.append(new w(this.m_selectionData))),c},inherit(s,r),s.prototype.renderer=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S=this.m_study.properties().styles[this.m_plotName];if(S.visible&&S.visible.value()&&this._scalesReady())return e=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),t={},i=this._getTranspValue(),n=e.barSpacing(),S.size?(r=S.size.value(),o=this._calculateShapeHeight(25,r)):o=Math.round(n/2),s=S.location.value(),a=Y.generateColor(S.color.value(),i),l=i>19?i-10:0,c=this._calculateVerticalOffset(s,Math.round(1.5*o)),t.barSpacing=n,t.items=this.items(),t.color=a,t.borderColor=Y.generateColor(S.color.value(),l),t.height=o,t.vertOffset=c,h=S.plottype.value(),u=H.plotShapesData[h],d=new F,p=S.text?S.text.value():void 0,void 0!==p&&""!==p.trim()&&(_=p.trim().replace(/\\n/gm,"\n"),_=TradingView.cleanButAmpersand(_,!0),f=!1,m=!1,y="Arial",g=12,t.textCache=new B(_,f,m,y,g),v=S.textColor?S.textColor.value():void 0,t.textColor=v?Y.generateColor(v,i):a),null!=u&&d.append(new TradingView[u.paneRendererClass](t)),this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&null!==this.m_selectionData&&(this.m_selectionData.vertOffset=c,d.append(new w(this.m_selectionData))),d},inherit(a,s),a.prototype.renderer=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y=this.m_study.properties().styles[this.m_plotName];if(y.visible&&y.visible.value()&&this._scalesReady())return e=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),t={},i=this._getTranspValue(),n=e.barSpacing(),y.size?(r=y.size.value(),o=this._calculateShapeHeight(50,r)):o=Math.round(n),s=y.location.value(),a=Y.generateColor(y.color.value(),i),l=this._calculateVerticalOffset(s,o),t.items=this.items(),t.char=y.char.value(),t.height=o,t.vertOffset=l,t.color=a,c=new F,h=y.text?y.text.value():void 0,void 0!==h&&""!==h.trim()&&(u=h.trim().replace(/\\n/gm,"\n"),u=TradingView.cleanButAmpersand(u,!0),d=!1,p=!1,_="Arial",f=12,t.textCache=new B(u,d,p,_,f),m=y.textColor?y.textColor.value():void 0,t.textColor=m?Y.generateColor(m,i):a),c.append(new D(t)),
this.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&null!==this.m_selectionData&&(this.m_selectionData.vertOffset=l,c.append(new w(this.m_selectionData))),c},inherit(l,r),l.prototype.renderer=function(){var e,t,i,n,o,r,s,a,l;if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady())return this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),e={},t=W(this._getTranspValue(),0,100),i=this.m_model.timeScale().barSpacing(),e.items=this.m_items,e.barSpacing=i,e.colorup=Y.generateColor(this.m_study.properties().styles[this.m_plotName].colorup.value(),t),e.colordown=Y.generateColor(this.m_study.properties().styles[this.m_plotName].colordown.value(),t),n=v(e.colorup),o=n?100*(1-n[3]):0,r=v(e.colordown),s=r?100*(1-r[3]):0,e.colorBorderUp=Y.generateColor("#000000",o),e.colorBorderDown=Y.generateColor("#000000",s),e.minHeight=this.m_study.properties().styles[this.m_plotName].minHeight.value(),e.maxHeight=this.m_study.properties().styles[this.m_plotName].maxHeight.value(),a=new F,a.append(new V(e)),this.m_study===this.m_model.selectedSource()&&null!==this.m_selectionData&&(l=this.m_selectionData,l.barSpacing=i,a.append(new P(l))),a},l.prototype._createItem=function(e,t,i,n){var o,r,s,a;if(0!==t){if(Math.abs(t)>this._maxAbsValue&&(this._maxAbsValue=Math.abs(t)),o=t>0){if(void 0===(s=this._getSeriesVal(n,e))||null==s)return null;r=s}else{if(void 0===(a=this._getSeriesVal(i,e))||null==a)return null;r=a}return new M(e,r,t,o)}},l.prototype._convertItemsToCoordinates=function(){var e,t,i,n,o,r,s,a,l,c=this.m_model.timeScale(),h=this.m_study.priceScale();for(c.indexesToCoordinates(this.m_items),h.pointsArrayToCoordinates(this.m_items,this.m_study.firstValue()),e=Math.abs(this.m_study.properties().styles[this.m_plotName].minHeight.value()),t=Math.abs(this.m_study.properties().styles[this.m_plotName].maxHeight.value()),e>t&&(i=e,e=t,t=i),n=t-e,o=n/this._maxAbsValue,r=this.m_items,s=0;s<r.length;s++)a=r[s],l=Math.abs(a.height),a.height=l*o+e},c.prototype.update=function(){this._invalidated=!0},c.prototype._updateImpl=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,_,v,b,w,P,T;if(this.m_bars.length=0,!(this.m_model.timeScale().isEmpty()||this.m_study.priceScale().isEmpty()||null===(e=this.m_model.timeScale().visibleBars())||(t=this.m_series.nearestIndex(e.firstBar(),G.NearestRight),i=this.m_series.nearestIndex(e.lastBar(),G.NearestLeft),(n=this.m_study.getMinFirstBarIndexForPlot(this.m_plotName))>i||(t=Math.max(n,t),o=this.m_study.data(),r=this.m_study.firstValue(),s=o.range(t,i),a=0,l=this.m_study.properties().ohlcPlots[this.m_plotName],c={},h=function(e,t){var i=e+"@"+t;return c[i]||(c[i]=Y.generateColor(e,t)),c[i]},s.each(function(e,t){var i,n,o,r,s,c,u,d,p,_,v,S,b,w,P,T;for(e=Math.floor(e),i=!0,n={},o=TradingView.OPEN_PLOT;o<=TradingView.CLOSE_PLOT;++o){if(void 0===(r=t[this._ohlcPlotIndexes[o]+1])||null===r){i=!1;break}n[o]=r}return!!i&&(s=n[TradingView.OPEN_PLOT],c=n[TradingView.CLOSE_PLOT],
u=Math.max(s,n[TradingView.HIGH_PLOT],n[TradingView.LOW_PLOT],c),d=Math.min(s,n[TradingView.HIGH_PLOT],n[TradingView.LOW_PLOT],c),p={},p.time=Math.round(e),p.open=s,p.high=u,p.low=d,p.close=c,_=l.color.value(),v=void 0!==t[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&v&&null!=(r=t[this._colorer+1])&&(S=this._palette.valToIndex?this._palette.valToIndex[r]:r,b=this._paletterProps.colors[S],_=b.color.value()),p.color=h(_,a),w=f(g(_)),P=w[2]>.25?w[2]-.26:w[2]+.75,T=m(w[0],w[1],P),p.borderColor=h(y(T),a),p.hollow=null,this.m_bars.push(p),!1)}.bind(this)),u=this.m_study.priceScale(),u.barPricesToCoordinates(this.m_bars,r),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_study!==this.m_model.selectedSource()))))for(d=N(t,i),this._selectionData={points:[],hittestResult:S.REGULAR},_=0;_<d.length;_++)v=d[_],null!==(b=this.m_study.data().valueAt(v))&&(w=b[this._plotIndex+1],P=this.m_model.timeScale().indexToCoordinate(Math.floor(v)),T=this.m_study.priceScale().priceToCoordinate(w,r),this._selectionData.points.push(new p(P,T)))},c.prototype.items=function(){return this.m_bars},inherit(h,c),h.prototype.renderer=function(){var e,t;if(this.m_study.properties().ohlcPlots[this.m_plotName].visible.value())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={},e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.dontDrawOpen=this.m_series.properties().barStyle.dontDrawOpen.value(),t=new F,t.append(new T(e)),this.m_series===this.m_model.selectedSource()&&this._isMarkersEnabled&&t.append(new w(this._selectionData)),t},inherit(u,c),u.prototype.renderer=function(){var e,t,i,n=this.m_study.properties().ohlcPlots[this.m_plotName];if(n.visible.value())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),e={},e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.drawWick=n.drawWick.value(),e.drawBorder=n.drawBorder.value(),t=n.wickColor.value(),e.borderColor=t,e.wickColor=t,i=new F,i.append(new A(e)),this.m_series===this.m_model.selectedSource()&&this._isMarkersEnabled&&i.append(new w(this._selectionData)),i},t.StudyPaneView=n,t.StudyBackgroundPaneView=o,t.StudyPlotShapesPaneView=s,t.StudyPlotCharsPaneView=a,t.StudyPlotArrowsPaneView=l,t.StudyPlotCandlesPaneView=u,t.StudyPlotBarsPaneView=h},function(e,t,i){"use strict";function n(e){this.items=e.items,this.barSpacing=e.barSpacing,this.histogramBase=e.histogramBase,this.lineColor=e.lineColor,this.lineWidth=e.lineWidth}var o=i(6).Point,r=i(30).distanceToSegment,s=i(27).selectionTolerance,a=i(9).HitTestResult;n.prototype.draw=function(e){var t,i,n,o,r;for(e.translate(.5,.5),e.fillStyle=this.lineColor,t=this.lineWidth,i=0;i<this.items.length;++i)n=this.items[i],o=n.x,r=n.y,n.style&&(e.fillStyle=n.style.color,t=n.style.width),e.fillRect(Math.round(o-.5*t),r,t,this.histogramBase-r)},n.prototype.hitTest=function(e){var t,i,n,l,c,h=s(this.lineWidth);for(c=0;c<this.items.length;++c)if(t=this.items[c],i=t.x,n=t.y,l=r(new o(i,n),new o(i,this.histogramBase),new o(e.x,e.y)),
l.distance<=h)return new a(a.REGULAR);return null},t.PaneRendererHistogram=TradingView.PaneRendererHistogram=n},function(e,t,i){"use strict";function n(e){this.items=e.items,this.barSpacing=e.barSpacing,this.histogramBase=e.histogramBase,this.lineColor=e.lineColor,this.lineWidth=e.lineWidth}var o=i(9).HitTestResult;n.prototype.draw=function(e){var t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m;if(0!==this.items.length){for(t=this.barSpacing,i=this.lineColor,n=this.histogramBase,e.translate(.5,.5),o={},r=this.items,s=null,a=0;a<r.length;++a)l=r[a],c=0===a?null:r[a-1],h=l.style?l.style.color:i,u=o[h]||[],d=Math.floor(l.x-.5*t),p=Math.ceil(d+t),s&&(_=p-d>5?1:0,s.right=d-_),f={item:l,prev:c,left:d,right:p},u.push(f),s=f,o[h]=u;for(h in o){for(u=o[h],e.fillStyle=h,e.strokeStyle=h,e.lineWidth=1,e.beginPath(),a=0;a<u.length;a++)l=u[a],m=l.item.y,d=l.left,p=l.right,e.rect(d,m,p-d,n-m);e.fill()}}},n.prototype.hitTest=function(e){var t,i,n,r=.5*this.barSpacing+this.lineWidth,s=e.x-r,a=e.x+r,l=this.items;for(t=l.length;t--;)if((i=l[t].x)>=s&&i<=a&&(n=l[t].y,e.y>=Math.min(n,this.histogramBase)&&e.y<=Math.max(n,this.histogramBase)))return new o(o.REGULAR);return null},t.PaneRendererColumns=TradingView.PaneRendererColumns=n},function(e,t,i){"use strict";function n(e){this.items=e.items,this.barSpacing=e.barSpacing,this.lineColor=e.lineColor,this.lineWidth=e.lineWidth,this.lineStyle=e.lineStyle}var o=i(6).Point,r=i(30).distanceToSegment,s=i(27).selectionTolerance,a=i(9).HitTestResult;n.prototype.draw=function(e){var t,i,n,o,r,s,a,l,c=!1;for(n=0;n<this.items.length;++n)o=this.items[n],r=o.x,s=o.y,TradingView.isNaN(r)||TradingView.isNaN(s)||(null!=o.style?(a=o.style.color,t=o.style.width):(a=this.lineColor,t=this.lineWidth),a!==i&&(i=a,c&&e.fill(),e.beginPath(),e.fillStyle=a),l=3*t,e.rect(r-l/2,s-t/2,l,t),e.rect(r-t/2,s-l/2,t,l),c=!0);c&&e.fill()},n.prototype.hitTest=function(e){var t,i,n,l,c,h,u=s(this.lineWidth);for(h=1;h<this.items.length;++h)if(t=this.items[h-1],i=this.items[h],n=t.x,l=i.x,c=r(new o(n,t.y),new o(l,i.y),new o(e.x,e.y)),c.distance<=u)return new a(a.REGULAR);return null},t.PaneRendererCross=TradingView.PaneRendererCross=n},function(e,t,i){"use strict";function n(e){this.items=e.items,this.barSpacing=e.barSpacing,this.lineColor=e.lineColor||e.color,this.radius=e.lineWidth||e.height/2,this.vertOffset=e.vertOffset||0}var o=i(6).Point,r=i(27).selectionTolerance,s=i(9).HitTestResult;n.prototype.draw=function(e){var t,i,n,o,r,s,a,l=2*Math.PI,c=!1;for(n=0;n<this.items.length;++n)o=this.items[n],r=o.x,s=o.y+this.vertOffset,TradingView.isNaN(r)||TradingView.isNaN(s)||(null!=o.style?(a=o.style.color,t=o.style.width):(a=this.lineColor,t=this.radius),a!==i&&(i=a,c&&e.fill(),e.beginPath(),e.fillStyle=a),e.moveTo(r+t,s),e.arc(r,s,t,0,l,!1),c=!0);c&&e.fill()},n.prototype.hitTest=function(e){var t,i,n,a=2*this.radius,l=this.vertOffset,c=r(a);for(t=0;t<this.items.length;++t)if((i=this.items[t])&&(n=new o(i.x,i.y+l),n.subtract(e).length()+this.radius<=c))return new s(s.REGULAR);return null},t.PaneRendererCircles=TradingView.PaneRendererCircles=n
},function(e,t,i){"use strict";function n(e){this._items=e.items,this._y=e.y,this._h=e.h,this._w=e.w}n.prototype.draw=function(e){},n.prototype.drawBackground=function(e){var t,i,n;for(e.save(),e.translate(-.5,-.5),t=0;t<this._items.length;++t)i=this._items[t],null!=i.color&&(e.fillStyle=i.color,n=t===this._items.length-1?this._w:this._items[t+1].x-i.x,e.fillRect(i.x,this._y,n,this._h));e.restore()},n.prototype.hitTest=function(e){return null},t.PaneRendererBackground=TradingView.PaneRendererBackground=n},function(e,t,i){"use strict";var n,o,r,s,a,l,c;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"PaneRendererStepLine",function(){return c}),n=i(9),o=i(6),i.n(o),r=i(46),i.n(r),s=i(78),a=i(30),i.n(a),l=i(27),c=function(){function e(){this._data=null}return e.prototype.setData=function(e){this._data=e},e.prototype.draw=function(e){var t,i,n,o,s,a,l,c,h,u;if(null!==this._data&&0!==this._data.items.length){for(t=this._data,i=t.lineWidth,n=t.lineStyle,o=t.lineColor,s=t.items,e.save(),e.lineCap="square",e.strokeStyle=o,e.lineWidth=i,i%2==0&&e.translate(-.5,-.5),void 0!==n&&Object(r.setLineStyle)(e,n),e.beginPath(),e.moveTo(s[0].x,s[0].y),a=s.length,l=0;l<a;l++)c=s[l],e.lineTo(c.x,c.y),(h=s[l+1])&&(u=Math.round((c.x+h.x)/2),e.lineTo(u,c.y),e.lineTo(u,h.y));e.stroke(),e.restore()}},e.prototype.hitTest=function(e){var t,i,r,c,h,u,d,p,_,f,m,y,g;if(null===this._data||0===this._data.items.length)return null;for(t=this._data,i=t.items,r=t.lineWidth,c=Object(l.selectionTolerance)(r),h=Object(s.lowerbound)(i,e,function(e,t){return e.x<=t.x}),u=Math.max(0,h-1),d=Math.min(i.length-1,h+1),p=u;p<d;p++)if(_=i[p],(f=i[p+1])&&(m=Math.round((_.x+f.x)/2),y=new o.Point(m,_.y),g=new o.Point(m,f.y),Math.min(Object(a.distanceToSegment)(_,y,e).distance,Object(a.distanceToSegment)(y,g,e).distance,Object(a.distanceToSegment)(g,f,e).distance)<=c))return new n.HitTestResult(n.HitTestResult.REGULAR);return null},e}()},function(e,t,i){"use strict";function n(e,t){var i=function i(n){var o=i.cache,r=""+(t?t.apply(this,arguments):n);return o.hasOwnProperty(r)||(o[r]=e.apply(this,arguments)),o[r]};return i.cache={},i}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,i){"use strict";function n(e){s.call(this,e),this.width=this._calculateWidth(e.barSpacing),this._isUp=!1}function o(e){n.call(this,e),this._isUp=!0}function r(e){n.call(this,e),this._isUp=!1}var s=i(44).PaneRendererAbstractShape;inherit(n,s),n.prototype._calculateWidth=function(e){return e=e||this.barSpacing,Math.round(e/4)},n.prototype.drawShape=function(e){var t,i,n,o,r,s,a,l,c=!1,h=this.width,u=Math.abs(this.height),d=h<4,p=Math.max(parseInt(h/2),1),_=Math.round(this.width/2),f=Math.round(this.width),m=this._isUp?-1:1;for(i=0,n=this.items.length;i<n;i++)o=this.items[i],r=o.x,s=o.y+this._vertOffset+m*Math.round(u/2),o.style&&null!=o.style.color?(a=o.style.color,l=o.style.borderColor):(a=this._color,l=this._borderColor),a!==t&&(t=a,c&&(e.fill(),e.stroke()),e.beginPath(),e.fillStyle=a,e.strokeStyle=l),e.translate(r,s),d?(e.moveTo(0,0),
e.lineTo(-_,-_*m),e.moveTo(0,0),e.lineTo(_,-_*m),e.moveTo(0,0),e.lineTo(0,-u*m),e.moveTo(-_,-u*m),e.lineTo(_,-u*m),e.lineWidth=p):(e.moveTo(0,0),u<f?(e.lineTo(h,-u*m),e.lineTo(-h,-u*m)):(e.lineTo(h,-f*m),e.lineTo(_,-f*m),e.lineTo(_,-u*m),e.lineTo(-_,-u*m),e.lineTo(-_,-f*m),e.lineTo(-h,-f*m)),e.lineTo(0,0)),e.translate(-r,-s),c=!0;c&&(e.fill(),e.stroke())},inherit(o,n),inherit(r,n),t.PaneRendererArrowBase=TradingView.PaneRendererArrowBase=n,t.PaneRendererArrowUp=TradingView.PaneRendererArrowUp=o,t.PaneRendererArrowDown=TradingView.PaneRendererArrowDown=r},function(e,t,i){"use strict";function n(e){o.call(this,e)}var o=i(44).PaneRendererAbstractShape;inherit(n,o),n.prototype.drawShape=function(e){var t,i,n,o,r,s,a,l,c=Math.max(this.width,this.height)/2,h=this._vertOffset,u=2*Math.PI,d=!1;for(i=0,n=this.items.length;i<n;i++)o=this.items[i],o.style&&null!=o.style.color?(r=o.style.color,s=o.style.borderColor):(r=this._color,s=this._borderColor),r!==t&&(t=r,d&&(e.fill(),e.stroke()),e.beginPath(),e.fillStyle=r,e.strokeStyle=s),a=o.x,l=o.y+h,e.moveTo(a+c,l),e.arc(a,l,c,0,u,!1),d=!0;d&&(e.fill(),e.stroke())},t.PaneRendererCircleShape=TradingView.PaneRendererCircleShape=n},function(e,t,i){"use strict";function n(e){o.call(this,e)}var o=i(44).PaneRendererAbstractShape;inherit(n,o),n.prototype.drawShape=function(e){var t,i,n,o,r,s,a,l,c,h,u;for(e.lineWidth=2,t=this.width,i=this.height,n=this._vertOffset,r=!1,s=0,a=this.items.length;s<a;s++)l=this.items[s],c=l.style&&null!=l.style.color?l.style.color:this._color,c!==o&&(o=c,r&&e.stroke(),e.beginPath(),e.strokeStyle=c),h=l.x-t/2,u=l.y-i/2+n,e.moveTo(h+t/2,u),e.lineTo(h+t/2,u+i),e.moveTo(h,u+i/2),e.lineTo(h+t,u+i/2),r=!0;r&&e.stroke()},t.PaneRendererCrossShape=TradingView.PaneRendererCrossShape=n},function(e,t,i){"use strict";function n(e){o.call(this,e)}var o=i(44).PaneRendererAbstractShape;inherit(n,o),n.prototype.drawShape=function(e){var t,i,n,o,r,s,a,l,c=!1,h=Math.round(this.height/2);for(i=0,n=this.items.length;i<n;i++)o=this.items[i],o.style&&null!=o.style.color?(r=o.style.color,s=o.style.borderColor):(r=this._color,s=this._borderColor),r!==t&&(t=r,c&&(e.fill(),e.stroke()),e.beginPath(),e.fillStyle=r,e.strokeStyle=s),a=o.x,l=o.y+this._vertOffset,e.moveTo(a,l-h),e.lineTo(a+h,l),e.lineTo(a,l+h),e.lineTo(a-h,l),e.lineTo(a,l-h),c=!0;c&&(e.fill(),e.stroke())},t.PaneRendererDiamond=TradingView.PaneRendererDiamond=n},function(e,t,i){"use strict";function n(e){o.call(this,e)}var o=i(44).PaneRendererAbstractShape;inherit(n,o),n.prototype.drawShape=function(e){var t,i,n,o,r,s,a,l,c=this.width,h=this.height,u=h/2,d=this._vertOffset,p=3,_=(c-p)/3,f=!1;for(i=0,n=this.items.length;i<n;i++)o=this.items[i],o.style&&null!=o.style.color?(r=o.style.color,s=o.style.borderColor):(r=this._color,s=this._borderColor),r!==t&&(t=r,f&&(e.fill(),e.stroke()),e.beginPath(),e.fillStyle=r,e.strokeStyle=s),a=o.x-c/2,l=o.y-u+d,e.moveTo(a,l),e.lineTo(a+p,l),e.bezierCurveTo(a+_,l-_,a+2*_,l+_,a+c,l),e.lineTo(a+c,l+u),e.bezierCurveTo(a+c-_,l+u+_,a+c-2*_,l+u-_,a+p,l+u),e.lineTo(a+p,l+h),e.lineTo(a,l+h),
@@ -406,11 +406,11 @@ time:[-2524521600,-1892678400,-1688428800,-1619222400,-1593820800,-1336003200,-1
time:[-2177452800,-599616e3,152071200,162961200,1443924e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[40312,40320,41400,45e3,41400,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200]},"America/Juneau":{time:[-3225169588,-2188987200,-880236e3,-769420800,-765410400,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,438998400,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[54139,-32261,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-28800,-28800,-25200,-28800,-25200,-28800,-25200,-32400,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400]},"Asia/Ho_Chi_Minh":{time:[-2004048e3,-1851552e3,-852080400,-782614800,-767836800,-718070400,-457747200,-315622800,171849600,1925017200],offset:[25600,25590,25200,28800,32400,25200,28800,25200,28800,25200]},"Australia/Perth":{
time:[-2337897600,-1672531140,-1665352800,-883605600,-876088800,-860364e3,-844639200,152071200,162961200,436327200,447217200,690343200,699418800,1165111200,1174791600,1193536800,1206846e3,1224986400,1238295600,1925020800],offset:[27804,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Europe/Oslo":{time:[-2366755200,-1691881200,-1680566400,-927507600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-340840800,-324507600,-308786400,-293058e3,-277336800,-261608400,-245887200,-230158800,-214437600,-198709200,-182988e3,-166654800,-147909600,-135205200,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[2580,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]}}},function(e,t,i){"use strict";function n(e){this._studyId=e,this._maxToVers=o.ZERO,this._maxFromVers=o.ZERO,this._migrs=[]}var o=i(163).Version,r=i(4).getLogger("Chart.StudyMigration");n.prototype.addMigration=function(e,t,i){var n=o.parse(e),r=o.parse(t);n.isGreater(this._maxFromVers)&&(this._maxFromVers=n),r.isGreater(this._maxToVers)&&(this._maxToVers=r),this._migrs.push({fromVers:n,toVers:r,rules:i})},n.prototype.updateInputs=function(e,t,i){var n,o,s;if(!i)return i;for(n=TradingView.clone(i),o=e;o.isLess(t)&&null!=(s=this._findMigration(o));){
if(r.logNormal("Migrating study inputs from "+s.fromVers+" to "+s.toVers+" version, studyId: "+this._studyId+", migration: "+JSON.stringify(s)+", inputs: "+JSON.stringify(i)),n=this._applyMigration(n,s),!o.isLess(s.toVers))throw Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");o=s.toVers}return o>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(n)),n},n.prototype._findMigration=function(e){var t,i,n=-1,o=this._maxFromVers;for(t=0;t<this._migrs.length;t++)i=this._migrs[t],i.fromVers.isLess(e)||i.fromVers.isLessOrEqual(o)&&(o=i.fromVers,n=t);return n<0?null:this._migrs[n]},n.prototype._applyMigration=function(e,t){var i,n,o,r=e;for(i=0;i<t.rules.length;i++)n=t.rules[i],o=this._getApplyRuleFun(n.type),r=o(r,n);return r},n.prototype._getApplyRuleFun=function(e){if("inputRemoved"===e)return n._applyInputRemovedRule;if("inputChangedType"===e)return n._applyInputChangedTypeRule;if("inputChangedMinMax"===e)return n._applyInputChangedMinMaxRule;if("inputChangedOptions"===e)return n._applyInputChangedOptionsRule;throw Error("Unknown migration rule type: "+e)},n._applyInputRemovedRule=function(e,t){if(!(t.inputId in e))return e;if("removeVal"!==t.action)throw Error("Unexpected rule.action="+t.action+" in rule.type="+t.type);var i=e[t.inputId];return delete e[t.inputId],r.logNormal("Input "+t.inputId+"="+i+" removed"),e},n._applyInputChangedTypeRule=function(e,t){var i=e[t.inputId];if("resetToDefVal"===t.action)return e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal),e;if("convertVal"===t.action){if(null==i)return e;if("float"===t.inputTypeFrom&&"integer"===t.inputType)return e[t.inputId]=Math.round(e[t.inputId]),r.logNormal("Input "+t.inputId+"="+i+" converted to value "+e[t.inputId]),e;if("integer"===t.inputTypeFrom&&"float"===t.inputType)return e;if("text"===t.inputTypeFrom&&"source"===t.inputType)return n._isValidSource(i,t.options)?e:(e[t.inputId]=t.defVal,e);throw Error("Cannot convertVal from "+t.inputTypeFrom+" to "+t.inputType)}throw Error("Unknown action "+t.action+" for rule with type "+t.type)},n._isValidSource=function(e,t){return e.indexOf("$")>=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throw Error("Unknown action "+t.action+" for rule with type "+t.type);var i=e[t.inputId];return i<t.minVal?e[t.inputId]=t.minVal:i>t.maxVal&&(e[t.inputId]=t.maxVal),r.logNormal("Input "+t.inputId+"="+i+" adjusted to value "+e[t.inputId]),e},n._applyInputChangedOptionsRule=function(e,t){if(!(["text"].indexOf(t.inputType)>=0&&"resetToDefValIfNeeded"===t.action))throw Error("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);var i=e[t.inputId];return t.options.indexOf(i)<0&&(e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal)),e},e.exports=n},function(e,t,i){"use strict";(function(t,n,o,r){function s(e){return e instanceof M}function a(e){
return e.isNoScale()?null:e.priceScale()}function l(e,t,i,n,o){if(void 0!==o)switch(o){case"right":return e.rightPriceScale();case"left":return e.leftPriceScale();case"no-scale":return null;case"as-series":if(!e.isMainPane()){Y.logWarn('BEWARE: Attempt to set "as-series" price scale to study, but series and study are on different panes');break}return a(t);default:Y.logWarn("Unknown override for priceScale type - "+o+", default will be used")}var r=i.priceScale;return n?null:(s(t)||e.isMainPane()&&void 0===r)&&i.is_price_study?a(t):r===N.None?i.is_price_study?null:(Y.logWarn("Cannot add study "+i.id+" with 'No Scale' setting, because study is not a price study. Using right price scale."),e.rightPriceScale()):r===N.Left?e.leftPriceScale():e.rightPriceScale()}function c(e,i,r,s,a,l,h,u){var d,p,_;for(u=Object.assign({},Z,u),this._version=c.version,this._readOnly=u.readOnly,this._undoModel=l,this._studiesMetaInfoRepository=a,this._properties=r,this._modelIntervals=[],this._isSnapshot=u.isSnapshot,this.setStudiesMetaData(this._studiesMetaInfoRepository.getInternalMetaInfoArray(),this._studiesMetaInfoRepository.getMigrations()),this.m_timeScale=new x(this,u.timeScale),H.init(),d=this,this.m_panes=[],this.m_gridSource=new P,this.m_crossHairSource=new S(this,H.properties(),{additionalMenuEnabled:u.crossHairMenuEnabled}),this.m_crossHairSource.selectBarMode().subscribe(function(e){if(e&&d.lineBeingCreated()){var t=H.tool.value();d.cancelCreatingLine(),H.tool.setValue(t)}}),this.m_width=0,this._tagsChanged=new t,this._lineCancelled=new t,this._magnet=new T(H.properties().magnet,this.m_timeScale,r.paneProperties.magnetSensivity),p=new j("chartproperties.mainSeriesProperties"),p.addExclusion("minTick"),p.addExclusion("priceAxisProperties.lockScale"),p.addExclusion("priceAxisProperties.percentage"),p.addExclusion("priceAxisProperties.log"),this.createPane(void 0,{rightAxisProperties:p.priceAxisProperties.state(["autoScale"])}),this.m_panes[0]._stretchFactor=2*b.DEFAULT_STRETCH_FACTOR,this.m_panes[0]._isMainPane=!0,this.m_selectedSource=null,this._selectedSourceChanged=new t,this._chartApi=e,this._invalidateHandler=i,this.m_hoveredSource=null,this._properties.listeners().subscribe(this,c.prototype.propertyChangeHandler),this._properties.timezone.listeners().subscribe(null,function(){d._chartApi&&d._chartApi.connected()&&d._chartApi.switchTimezone(d.timezone())}),this.m_timeScale.defaultRightOffsetProperty().listeners().subscribe(null,function(){d.recalculateAllPanes()}),p.merge(r.mainSeriesProperties.state()),this.m_mainSeries=new W(this,p,s),this.m_panes[0].addDataSource(this.m_mainSeries,this.m_panes[0].rightPriceScale()),this._mainSeriesPriceScaleNameChanged=new t,this._mainSeriesPriceScaleNameProperty=new K(this),this._mainSeriesScaleRatioProperty=new G(this),this.m_mainSeries.dataEvents().completed().subscribe(this,function(){if(d.clearCurrentPosition(),d._scrollingState&&d.gotoTime(),n.enabled("fix_left_edge")&&this.m_mainSeries.endOfData()){var e=this.m_mainSeries.bars().first()
;null!==e&&this.m_timeScale.setLeftEdgeFix(e.index)}}.bind(this)),this.m_mainSeries.onIntervalChanged().subscribe(this,function(){this._oldStartVisibleIndex=-1,this._oldEndVisibleIndex=-1}),this.m_mainSeries.dataEvents().barReceived().subscribe(this,c.prototype.updateTimeScaleBaseIndex),this.m_mainSeries.properties().symbol.listeners().subscribe(this,this.setPriceAutoScaleForAllMainSources),this._readOnly||(p.addChild("priceAxisProperties",this.m_mainSeries.m_priceScale.properties()),this._properties.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,function(e){e.value()||d._properties.paneProperties.legendProperties.showStudyArguments.setValue(!1)})),this._barsMarksSources=h(this),_=0;_<this._barsMarksSources.length;_++)this._barsMarksSources[_].setOwnerSource(this.m_mainSeries);this._syncPointCache={},this.m_watermarkSource=u.watermarkEnabled?new w(this.m_mainSeries):null,this._brandingSource=null,this.strategySources=[],this.strategySources.change=new t,this._activeStrategySource=new o(null),this._oldStartVisibleIndex=-1,this._oldEndVisibleIndex=-1,this._currentTool="",H.hideAllDrawings().subscribe(this,this.visibilityChangeHandler),this._properties.scalesProperties.listeners().subscribe(this,c.prototype.fullUpdate),this._id=q.guid(),this._studyInserted=new t,this._chartThemeLoaded=new t,this._resetScales=new t,this._isScalesResetAvailableChanged=new t,this._isScalesResetAvailable=!1,this._studyShiftColorStartOffset=void 0}var h=i(7).ensureNotNull,u=i(6).Point,d=i(24),p=d.parseRgb,_=d.rgbToBlackWhiteString,f=i(73),m=f.createLineTool,y=f.isLineToolName,g=f.isLineTool,v=f.isStudyLineTool,S=i(598).CrossHair,b=i(176).Pane,w=i(614).Watermark,P=i(615).Grid,T=i(616),x=i(617).TimeScale,C=i(177).PriceScale,L=i(88).BarsMarksContainer,I=i(622).Branding,A=i(28).PriceDataSource,k=i(18),E=i(34),M=E.Study,V=i(180).NonSeriesStudy,D=i(285).createStudy,O=E.prepareStudyProperties,R=i(168),B=i(124),N=i(211).ScaleType,F=i(17).PlotRowSearchMode,W=i(63).Series,H=i(32),j=i(3).DefaultProperty,z=i(39).trackEvent,U=i(632).TimeSynchronizer,q=i(33),Y=i(4).getLogger("Chart.ChartModel"),G=i(633).MainSeriesScaleRatioProperty,K=i(634).MainSeriesPriceScaleNameProperty,Z={isSnapshot:!1,readOnly:!1,watermarkEnabled:!0,crossHairMenuEnabled:!1};c.prototype.applyPreferences=function(e){var t,i;for(t in e)void 0!==this._properties[t]&&"m_mainSeries"!==this._properties[t]&&this._properties[t].mergeAndFire(e[t]);void 0!==e.mainSeriesPriceScaleName&&this.setMainSeriesPriceScaleName(this.mainSeriesPriceScaleName(),e.mainSeriesPriceScaleName),this.m_timeScale.defaultRightOffsetProperty().setValue(e.timeScale.defaultRightOffset),this._properties.saveDefaults(),this.m_mainSeries.checkSessStudy(),i=this.m_mainSeries.sessionsStudy(),i&&i.applyPreferences(e.sessionsStudy),this.m_mainSeries.applyPreferences(e.mainSeries),this.recalculateAllPanes(),this.invalidate(new k(k.FULL_UPDATE))},c.prototype.setStudiesMetaData=function(e,t){this._studiesMetaData=e,this._studyVersioning=new R(this._studiesMetaData,t)},
return e.isNoScale()?null:e.priceScale()}function l(e,t,i,n,o){if(void 0!==o)switch(o){case"right":return e.rightPriceScale();case"left":return e.leftPriceScale();case"no-scale":return null;case"as-series":if(!e.isMainPane()){Y.logWarn('BEWARE: Attempt to set "as-series" price scale to study, but series and study are on different panes');break}return a(t);default:Y.logWarn("Unknown override for priceScale type - "+o+", default will be used")}var r=i.priceScale;return n?null:(s(t)||e.isMainPane()&&void 0===r)&&i.is_price_study?a(t):r===F.None?i.is_price_study?null:(Y.logWarn("Cannot add study "+i.id+" with 'No Scale' setting, because study is not a price study. Using right price scale."),e.rightPriceScale()):r===F.Left?e.leftPriceScale():e.rightPriceScale()}function c(e,i,r,s,a,l,h,u){var d,p,_;for(u=Object.assign({},Z,u),this._version=c.version,this._readOnly=u.readOnly,this._undoModel=l,this._studiesMetaInfoRepository=a,this._properties=r,this._modelIntervals=[],this._isSnapshot=u.isSnapshot,this.setStudiesMetaData(this._studiesMetaInfoRepository.getInternalMetaInfoArray(),this._studiesMetaInfoRepository.getMigrations()),this.m_timeScale=new x(this,u.timeScale),H.init(),d=this,this.m_panes=[],this.m_gridSource=new P,this.m_crossHairSource=new S(this,H.properties(),{additionalMenuEnabled:u.crossHairMenuEnabled}),this.m_crossHairSource.selectBarMode().subscribe(function(e){if(e&&d.lineBeingCreated()){var t=H.tool.value();d.cancelCreatingLine(),H.tool.setValue(t)}}),this.m_width=0,this._tagsChanged=new t,this._lineCancelled=new t,this._magnet=new T(H.properties().magnet,this.m_timeScale,r.paneProperties.magnetSensivity),p=new j("chartproperties.mainSeriesProperties"),p.addExclusion("minTick"),p.addExclusion("priceAxisProperties.lockScale"),p.addExclusion("priceAxisProperties.percentage"),p.addExclusion("priceAxisProperties.log"),this.createPane(void 0,{rightAxisProperties:p.priceAxisProperties.state(["autoScale"])}),this.m_panes[0]._stretchFactor=2*b.DEFAULT_STRETCH_FACTOR,this.m_panes[0]._isMainPane=!0,this.m_selectedSource=null,this._selectedSourceChanged=new t,this._chartApi=e,this._invalidateHandler=i,this.m_hoveredSource=null,this._properties.listeners().subscribe(this,c.prototype.propertyChangeHandler),this._properties.timezone.listeners().subscribe(null,function(){d._chartApi&&d._chartApi.connected()&&d._chartApi.switchTimezone(d.timezone())}),this.m_timeScale.defaultRightOffsetProperty().listeners().subscribe(null,function(){d.recalculateAllPanes()}),p.merge(r.mainSeriesProperties.state()),this.m_mainSeries=new W(this,p,s),this.m_panes[0].addDataSource(this.m_mainSeries,this.m_panes[0].rightPriceScale()),this._mainSeriesPriceScaleNameChanged=new t,this._mainSeriesPriceScaleNameProperty=new K(this),this._mainSeriesScaleRatioProperty=new G(this),this.m_mainSeries.dataEvents().completed().subscribe(this,function(){if(d.clearCurrentPosition(),d._scrollingState&&d.gotoTime(),n.enabled("fix_left_edge")&&this.m_mainSeries.endOfData()){var e=this.m_mainSeries.bars().first()
;null!==e&&this.m_timeScale.setLeftEdgeFix(e.index)}}.bind(this)),this.m_mainSeries.onIntervalChanged().subscribe(this,function(){this._oldStartVisibleIndex=-1,this._oldEndVisibleIndex=-1}),this.m_mainSeries.dataEvents().barReceived().subscribe(this,c.prototype.updateTimeScaleBaseIndex),this.m_mainSeries.properties().symbol.listeners().subscribe(this,this.setPriceAutoScaleForAllMainSources),this._readOnly||(p.addChild("priceAxisProperties",this.m_mainSeries.m_priceScale.properties()),this._properties.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,function(e){e.value()||d._properties.paneProperties.legendProperties.showStudyArguments.setValue(!1)})),this._barsMarksSources=h(this),_=0;_<this._barsMarksSources.length;_++)this._barsMarksSources[_].setOwnerSource(this.m_mainSeries);this._syncPointCache={},this.m_watermarkSource=u.watermarkEnabled?new w(this.m_mainSeries):null,this._brandingSource=null,this.strategySources=[],this.strategySources.change=new t,this._activeStrategySource=new o(null),this._oldStartVisibleIndex=-1,this._oldEndVisibleIndex=-1,this._currentTool="",H.hideAllDrawings().subscribe(this,this.visibilityChangeHandler),this._properties.scalesProperties.listeners().subscribe(this,c.prototype.fullUpdate),this._id=q.guid(),this._studyInserted=new t,this._chartThemeLoaded=new t,this._resetScales=new t,this._isScalesResetAvailableChanged=new t,this._isScalesResetAvailable=!1,this._studyShiftColorStartOffset=void 0}var h=i(7).ensureNotNull,u=i(6).Point,d=i(24),p=d.parseRgb,_=d.rgbToBlackWhiteString,f=i(73),m=f.createLineTool,y=f.isLineToolName,g=f.isLineTool,v=f.isStudyLineTool,S=i(598).CrossHair,b=i(176).Pane,w=i(614).Watermark,P=i(615).Grid,T=i(616),x=i(617).TimeScale,C=i(177).PriceScale,L=i(88).BarsMarksContainer,I=i(622).Branding,A=i(28).PriceDataSource,k=i(18),E=i(34),M=E.Study,V=i(180).NonSeriesStudy,D=i(285).createStudy,O=E.prepareStudyProperties,R=i(168),B=i(124),F=i(211).ScaleType,N=i(17).PlotRowSearchMode,W=i(63).Series,H=i(32),j=i(3).DefaultProperty,z=i(39).trackEvent,U=i(632).TimeSynchronizer,q=i(33),Y=i(4).getLogger("Chart.ChartModel"),G=i(633).MainSeriesScaleRatioProperty,K=i(634).MainSeriesPriceScaleNameProperty,Z={isSnapshot:!1,readOnly:!1,watermarkEnabled:!0,crossHairMenuEnabled:!1};c.prototype.applyPreferences=function(e){var t,i;for(t in e)void 0!==this._properties[t]&&"m_mainSeries"!==this._properties[t]&&this._properties[t].mergeAndFire(e[t]);void 0!==e.mainSeriesPriceScaleName&&this.setMainSeriesPriceScaleName(this.mainSeriesPriceScaleName(),e.mainSeriesPriceScaleName),this.m_timeScale.defaultRightOffsetProperty().setValue(e.timeScale.defaultRightOffset),this._properties.saveDefaults(),this.m_mainSeries.checkSessStudy(),i=this.m_mainSeries.sessionsStudy(),i&&i.applyPreferences(e.sessionsStudy),this.m_mainSeries.applyPreferences(e.mainSeries),this.recalculateAllPanes(),this.invalidate(new k(k.FULL_UPDATE))},c.prototype.setStudiesMetaData=function(e,t){this._studiesMetaData=e,this._studyVersioning=new R(this._studiesMetaData,t)},
c.prototype.isSnapshot=function(){return this._isSnapshot},c.prototype.currentTool=function(){return this._currentTool},c.prototype.setCurrentTool=function(e){this._currentTool=e},c.prototype.timezone=function(){return this._properties.timezone.value()},c.prototype.version=function(){return this._version},c.prototype.initConnection=function(){this._chartApi.switchTimezone(this.timezone())},c.prototype.dumpViews=function(){var e,t,i,n,o={};for(o.panes=[],e=0;e<this.m_panes.length;e++)o.panes.push(this.m_panes[e].dumpViews());for(o.dataWindow=[],t=this.dataSources(),e=0;e<t.length;e++)i=t[e],(n=i.dataWindowView())&&o.dataWindow.push(n.dump());return o},c.prototype._paneInvalidationMask=function(e,t){var i=new k,n=this.m_panes.indexOf(e);return void 0===t&&(t=k.LIGHT_UPDATE),i.invalidatePane(n,t),i},c.prototype.updatePane=function(e){var t=this._paneInvalidationMask(e);this.invalidate(t)},c.prototype.fullUpdate=function(){this.invalidate(new k(k.FULL_UPDATE))},c.prototype.lightUpdate=function(){this.invalidate(new k(k.LIGHT_UPDATE))},c.prototype.updateSource=function(e){var t=this.paneForSource(e),i=this._paneInvalidationMask(t);this.invalidate(i)},c.prototype.studiesMetaData=function(){return this._studiesMetaData},c.prototype.studyVersioning=function(){return this._studyVersioning},c.prototype.disconnect=function(){var e,t,i=this.dataSources();for(t=0;t<i.length;t++)e=i[t],e.disconnect&&e.disconnect()},c.prototype.restart=function(){var e,t,i;for(this.initConnection(),this.m_timeScale.reset(),this.m_mainSeries.restart(),e=this.dataSources(),t=0;t<e.length;t++)i=e[t],i.restart&&i!==this.m_mainSeries&&i.restart()},c.prototype.startNotStartedStudies=function(){var e,t;if(!this.m_mainSeries.isStarted())throw Error("Cannot start studies: main series is not started");for(e=this.dataSources(),t=0;t<e.length;t++)s(e[t])&&!e[t].isStarted()&&e[t].restart&&e[t]!==this.m_mainSeries&&e[t].restart()},c.prototype.updateLineTools=function(){var e,t,i=this.dataSources();for(e=0;e<i.length;e++)g(i[e])&&(t=i[e],t.tryCreateServerPoints(),t.checkAlert&&t.checkAlert())},c.prototype.realignLineTools=function(){var e,t,i=this.dataSources();for(e=0;e<i.length;e++)g(i[e])&&(t=i[e],t.calcIsActualSymbol());for(e=0;e<this.m_panes.length;e++)this.m_panes[e].invalidateSourcesCache()},c.prototype.readOnly=function(){return this._readOnly},c.prototype.properties=function(){return this._properties},c.prototype.lineCancelled=function(){return this._lineCancelled},c.prototype.crossHairMoved=function(){return this.m_crossHairSource.moved()},c.prototype.chartApi=function(){return this._chartApi},c.prototype.propertyChangeHandler=function(){this.invalidate(new k(k.LIGHT_UPDATE))},c.prototype.visibilityChangeHandler=function(){this.setSelectedSource(),this.invalidate(new k(k.LIGHT_UPDATE))},c.prototype.updateAllPaneViews=function(){var e,t;for(e=0;e<this.m_panes.length;e++)t=this.m_panes[e],t.updateAllViews()},c.prototype.mainSeries=function(){return this.m_mainSeries},c.prototype.timeScale=function(){return this.m_timeScale},c.prototype.panes=function(){
return this.m_panes},c.prototype.gridSource=function(){return this.m_gridSource},c.prototype.watermarkSource=function(){return this.m_watermarkSource},c.prototype.brandingSource=function(){return this._brandingSource},c.prototype.crossHairSource=function(){return this.m_crossHairSource},c.prototype.publishedChartsTimelineSource=function(){return null},c.prototype.barsMarksSources=function(){return this._barsMarksSources},c.prototype.width=function(){return this.m_width},c.prototype.setPaneHeight=function(e,t){e.setHeight(t),this.recalculateAllPanes(),this.invalidate(new k(k.LIGHT_UPDATE))},c.prototype.setWidth=function(e){var t,i;for(this.m_width=e,this.m_timeScale.setWidth(this.m_width),t=0;t<this.m_panes.length;++t)i=this.m_panes[t],i.setWidth(e);this.recalculateAllPanes(),this.recalcVisibleRangeStudy(this.dataSources())},c.prototype.createPane=function(e,t){var i,n;if(this._undoModel._chartWidget.isMaximizedPane()&&this._undoModel._chartWidget.toggleMaximizePane(),i=this._properties.paneProperties,t&&i.merge(t),n=new b(this.m_timeScale,i,this),"number"==typeof e&&isFinite(e)){if(e<0||e>this.m_panes.length)return void Y.logDebug("ChartModel.createPane: invalid index: "+e);this.m_panes.splice(e,0,n)}else this.m_panes.push(n);return n.onTagsChanged().subscribe(this,c.prototype.onPaneTagsChanged),n},c.prototype.removePane=function(e){var t,i;this._undoModel._chartWidget.isMaximizedPane()&&this._undoModel._chartWidget.toggleMaximizePane(),e.destroy(),t=this.m_panes.indexOf(e),-1!==t&&this.m_panes.splice(t,1),i=this.crossHairSource(),i.pane===e&&this.clearCurrentPosition(),this.invalidate(new k(k.FULL_UPDATE))},c.prototype.startScalePrice=function(e,t,i){e.startScalePrice(t,i)},c.prototype.scalePriceTo=function(e,t,i){e.scalePriceTo(t,i),this.mainSeries().priceScale().isLockScale()?this.invalidate(new k(k.LIGHT_UPDATE)):this.invalidate(this._paneInvalidationMask(e,k.LIGHT_UPDATE)),this._setScalesResetAvailable(!0)},c.prototype.endScalePrice=function(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,k.LIGHT_UPDATE))},c.prototype.startScrollPrice=function(e,t,i){e.startScrollPrice(t,i)},c.prototype.scrollPriceTo=function(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,k.LIGHT_UPDATE))},c.prototype.endScrollPrice=function(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,k.LIGHT_UPDATE))},c.prototype.setPriceAutoScale=function(e,t,i){e.setPriceAutoScale(t,i),this.invalidate(this._paneInvalidationMask(e,k.LIGHT_UPDATE))},c.prototype.restorePriceScaleState=function(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,k.LIGHT_UPDATE))},c.prototype.resetPriceScale=function(e,t){this._setScalesResetAvailable(!1),e.resetPriceScale(t),this.invalidate(this._paneInvalidationMask(e,k.LIGHT_UPDATE))},c.prototype.updateScales=function(e,t){this._undoModel._chartWidget._updateScalesActions()},c.prototype.startScaleTime=function(e){this.m_timeScale.startScale(e)},c.prototype.mainSeriesPriceScaleNameProperty=function(){
return this._mainSeriesPriceScaleNameProperty},c.prototype.mainSeriesPriceScaleName=function(){var e=this.paneForSource(this.m_mainSeries),t=this._mainSeriesPriceScaleName(),i=null;return"left"===t||"right"===t?i=t:e.isOverlay(this.m_mainSeries)&&(i="none"),i},c.prototype.setMainSeriesPriceScaleName=function(e,t){var i,n=this.paneForSource(this.m_mainSeries);e===t||"none"===t&&!n.actionNoScaleIsEnabled(this.m_mainSeries)||(i=n.priceScaleByName(t),this.move(this.m_mainSeries,n,i))},c.prototype.mainSeriesPriceScaleNameChanged=function(){return this._mainSeriesPriceScaleNameChanged},c.prototype.onMainSeriesPriceScaleNameChanged=function(){this._mainSeriesPriceScaleNameChanged.fire()},c.prototype.mainSeriesScaleRatioProperty=function(){return this._mainSeriesScaleRatioProperty},c.prototype.mainSeriesScaleRatioPropertyOnChanged=function(){this._mainSeriesScaleRatioProperty.listeners().fire(this._mainSeriesScaleRatioProperty)},c.prototype._mainSeriesPriceScaleName=function(){var e=this.paneForSource(this.m_mainSeries);return e.priceScaleName(e.priceScaleForSource(this.m_mainSeries))},c.prototype.mainSeriesScaleRatio=function(){var e=this.paneForSource(this.m_mainSeries);return"left"===this._mainSeriesPriceScaleName()?e.leftPriceScaleRatio():e.rightPriceScaleRatio()},c.prototype.setMainSeriesScaleRatio=function(e){var t=this.paneForSource(this.m_mainSeries);"left"===this._mainSeriesPriceScaleName()?t.applyLeftPriceScaleRatio(e):t.applyRightPriceScaleRatio(e)},c.prototype.scaleTimeTo=function(e){this.m_timeScale.scaleTo(e),this.recalculateAllPanes(),this.invalidate(new k(k.LIGHT_UPDATE)),this._setScalesResetAvailable(!0)},c.prototype.endScaleTime=function(){this.m_timeScale.endScale(),this.invalidate(new k(k.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources())},c.prototype.startScrollTime=function(e){this.m_timeScale.startScroll(e),this._isTimeScrolling=!0},c.prototype.scrollTimeTo=function(e){this.m_timeScale.scrollTo(e),this.recalculateAllPanes(),this.updateCrossHair(),this.invalidate(new k(k.LIGHT_UPDATE)),this._setScalesResetAvailable(!0)},c.prototype.endScrollTime=function(){this.m_timeScale.endScroll(),this.invalidate(new k(k.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources()),this._isTimeScrolling=!1},c.prototype.recalcStudyBasedLineTools=function(){this.dataSources().forEach(function(e){v(e)&&e.recalcStudyIfNeeded&&e.recalcStudyIfNeeded()})},c.prototype.recalcVisibleRangeStudy=function(e,t){void 0!==this._recalcVRTimerId&&clearTimeout(this._recalcVRTimerId);var i=this;this._recalcVRTimerId=setTimeout(function(){i._recalcVisibleRangeStudy(e,t)},500)},c.prototype._recalcVisibleRangeStudy=function(e,t){var i,n,o,r,a,l,c,h,u,d,p,_,f,m,y,g;if(!this.timeScale().isEmpty()&&(i=this.timeScale().visibleBars(),n=this.mainSeries().nearestData(i.firstBar(),F.NearestRight),o=this.mainSeries().nearestData(i.lastBar(),F.NearestLeft),r=this.mainSeries().bars().lastIndex(),a=n?n.index:void 0,l=o?o.index:void 0,
return this._mainSeriesPriceScaleNameProperty},c.prototype.mainSeriesPriceScaleName=function(){var e=this.paneForSource(this.m_mainSeries),t=this._mainSeriesPriceScaleName(),i=null;return"left"===t||"right"===t?i=t:e.isOverlay(this.m_mainSeries)&&(i="none"),i},c.prototype.setMainSeriesPriceScaleName=function(e,t){var i,n=this.paneForSource(this.m_mainSeries);e===t||"none"===t&&!n.actionNoScaleIsEnabled(this.m_mainSeries)||(i=n.priceScaleByName(t),this.move(this.m_mainSeries,n,i))},c.prototype.mainSeriesPriceScaleNameChanged=function(){return this._mainSeriesPriceScaleNameChanged},c.prototype.onMainSeriesPriceScaleNameChanged=function(){this._mainSeriesPriceScaleNameChanged.fire()},c.prototype.mainSeriesScaleRatioProperty=function(){return this._mainSeriesScaleRatioProperty},c.prototype.mainSeriesScaleRatioPropertyOnChanged=function(){this._mainSeriesScaleRatioProperty.listeners().fire(this._mainSeriesScaleRatioProperty)},c.prototype._mainSeriesPriceScaleName=function(){var e=this.paneForSource(this.m_mainSeries);return e.priceScaleName(e.priceScaleForSource(this.m_mainSeries))},c.prototype.mainSeriesScaleRatio=function(){var e=this.paneForSource(this.m_mainSeries);return"left"===this._mainSeriesPriceScaleName()?e.leftPriceScaleRatio():e.rightPriceScaleRatio()},c.prototype.setMainSeriesScaleRatio=function(e){var t=this.paneForSource(this.m_mainSeries);"left"===this._mainSeriesPriceScaleName()?t.applyLeftPriceScaleRatio(e):t.applyRightPriceScaleRatio(e)},c.prototype.scaleTimeTo=function(e){this.m_timeScale.scaleTo(e),this.recalculateAllPanes(),this.invalidate(new k(k.LIGHT_UPDATE)),this._setScalesResetAvailable(!0)},c.prototype.endScaleTime=function(){this.m_timeScale.endScale(),this.invalidate(new k(k.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources())},c.prototype.startScrollTime=function(e){this.m_timeScale.startScroll(e),this._isTimeScrolling=!0},c.prototype.scrollTimeTo=function(e){this.m_timeScale.scrollTo(e),this.recalculateAllPanes(),this.updateCrossHair(),this.invalidate(new k(k.LIGHT_UPDATE)),this._setScalesResetAvailable(!0)},c.prototype.endScrollTime=function(){this.m_timeScale.endScroll(),this.invalidate(new k(k.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources()),this._isTimeScrolling=!1},c.prototype.recalcStudyBasedLineTools=function(){this.dataSources().forEach(function(e){v(e)&&e.recalcStudyIfNeeded&&e.recalcStudyIfNeeded()})},c.prototype.recalcVisibleRangeStudy=function(e,t){void 0!==this._recalcVRTimerId&&clearTimeout(this._recalcVRTimerId);var i=this;this._recalcVRTimerId=setTimeout(function(){i._recalcVisibleRangeStudy(e,t)},500)},c.prototype._recalcVisibleRangeStudy=function(e,t){var i,n,o,r,a,l,c,h,u,d,p,_,f,m,y,g;if(!this.timeScale().isEmpty()&&(i=this.timeScale().visibleBars(),n=this.mainSeries().nearestData(i.firstBar(),N.NearestRight),o=this.mainSeries().nearestData(i.lastBar(),N.NearestLeft),r=this.mainSeries().bars().lastIndex(),a=n?n.index:void 0,l=o?o.index:void 0,
c=a===this._oldStartVisibleIndex,h=l===this._oldEndVisibleIndex,!c||!h||t))for(this._oldStartVisibleIndex=a,this._oldEndVisibleIndex=l,u={first_visible_bar_time:1e3*Math.floor(n&&n.value?n.value[TradingView.TIME_PLOT]:0),last_visible_bar_time:1e3*Math.floor(o&&o.value?o.value[TradingView.TIME_PLOT]:0),subscribeRealtime:o&&o.index===r},d=0;d<e.length;d++)if(s(e[d])){for(p=e[d],_=p.metaInfo().inputs,f=[],m=0;m<_.length;m++)u.hasOwnProperty(_[m].id)&&f.push(_[m].id);for(y=p.properties().inputs,m=0;m<f.length;m++)g=f[m],y[g].setValueSilently(u[g]);f.length>0&&y.listeners().fire(y)}},c.prototype.onResetScales=function(){return this._resetScales},c.prototype.resetTimeScale=function(){this.m_timeScale.restoreDefault(),this.recalculateAllPanes(),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources()),this.updateCrossHair(),this.invalidate(new k(k.LIGHT_UPDATE)),this._resetScales.fire(),this._setScalesResetAvailable(!1)},c.prototype.restoreTimeScaleState=function(e){this.m_timeScale.restoreState(e),this.recalculateAllPanes(),this.updateCrossHair(),this.invalidate(new k(k.LIGHT_UPDATE)),this._setScalesResetAvailable(!0)},c.prototype.restoreFactoryDefaults=function(e){e.restoreFactoryDefaults(),this.recalcVisibleRangeStudy(this.dataSources(),!0),this.mainSeries().onChartStyleChanged()},c.prototype.restoreDefaults=function(e){e.restoreDefaults(this._studyVersioning),this.recalcVisibleRangeStudy(this.dataSources(),!0),this.mainSeries().onChartStyleChanged()},c.prototype.setSelectedSource=function(e,t){if(!(this.m_selectedSource===e&&this._lastHittestData===t||e&&e.customization&&e.customization.disableSelection)){this._lastHittestData=t;var i=new k;this.m_selectedSource&&(this.m_selectedSource.updateAllViews(),TradingView.alertsDispatcher&&this.m_selectedSource.hasAlert.value()&&this.m_selectedSource.getAlert({fromCache:!0}).done(function(e){e&&e.set("selected",!1)})),this.m_selectedSource=e,this._selectedSourceChanged.fire(e),e&&(e.updateAllViews(),TradingView.alertsDispatcher&&e.hasAlert.value()&&e.getAlert({fromCache:!0}).done(function(e){e&&e.set("selected",!0)})),i.force=!0,this.invalidate(new k(k.LIGHT_UPDATE)),this.setHoveredSource(e,t)}},c.prototype.checkLineToolSelection=function(){this.m_selectedSource&&g(this.m_selectedSource)&&(this.m_selectedSource.calcIsActualSymbol(),this.m_selectedSource.isActualSymbol()||this.setSelectedSource(null))},c.prototype.onSelectedSourceChanged=function(){return this._selectedSourceChanged},c.prototype.setHoveredSource=function(e,t){if(this.m_hoveredSource!==e||this._lastHittestData!==t){this._lastHittestData=t;var i=null;this.m_hoveredSource&&(this.m_hoveredSource.updateAllViews(),i||(i=new k),TradingView.alertsDispatcher&&this.m_hoveredSource.hasAlert.value()&&this.m_hoveredSource.getAlert({fromCache:!0}).done(function(e){e&&e.set("hovered",!1)}),i.merge(this._paneInvalidationMask(this.paneForSource(this.m_hoveredSource),k.LIGHT_UPDATE))),this.m_hoveredSource=e,e&&(e.updateAllViews(),i||(i=new k),
i.merge(this._paneInvalidationMask(this.paneForSource(e),k.LIGHT_UPDATE)),TradingView.alertsDispatcher&&e.hasAlert.value()&&e.getAlert({fromCache:!0}).done(function(e){e&&e.set("hovered",!0)})),i&&this.invalidate(i)}},c.prototype.selectedSource=function(){return this.m_selectedSource},c.prototype.hoveredSource=function(){return this.m_hoveredSource},c.prototype.lastHittestData=function(){return this._lastHittestData},c.prototype.invalidate=function(e){this._invalidateHandler&&this._invalidateHandler(e)},c.prototype.dataSources=function(){var e,t,i,n=[];for(n.push(this.m_crossHairSource),e=0;e<this.m_panes.length;++e)for(t=this.m_panes[e].dataSources(),i=0;i<t.length;i++)n.push(t[i]);return n},c.prototype.orderedDataSources=function(e){var t,i,n=[];for(n.push(this.m_crossHairSource),t=0;t<this.m_panes.length;t++)i=this.m_panes[t].orderedSources().slice(),e&&i.reverse(),n=n.concat(i);return n},c.prototype.dataSourceForId=function(e){var t,i;for(i=0;i<this.m_panes.length;++i)if(t=this.m_panes[i].dataSourceForId(e))return t;return null},c.prototype.children=function(e,t){return this.dataSources().filter(function(i){return(!0!==t||!s(i)||!i.isChildStudy())&&i.ownerSource()===e})},c.prototype.setAndSaveCurrentPosition=function(e,t,i,n){this.m_crossHairSource.saveOriginCoord(e,t),this.setCurrentPosition(e,t,i,n)},c.prototype.setCurrentPosition=function(e,t,i,n){var o,r,s,a,l,c,h,u,d,p,_,f,m,g,v,S=NaN,b=Math.round(this.m_timeScale.coordinateToIndex(e));if(i&&(o=i.defaultPriceScale(),o.isEmpty()||(r=i.mainDataSource().firstValue(),S=o.coordinateToPrice(t,r))),(this._lineBeingCreated||y(this.currentTool()))&&(S=this._magnet.align(S,b,i)),this._isTimeScrolling)return void this.m_crossHairSource.setPosition(this.m_crossHairSource.index,S,i);for(this.m_crossHairSource.setOnHoveredChartWidget(!0),this.m_crossHairSource.setPosition(b,S,i),this.m_crossHairSource.dataWindowView().update(),s=this.m_panes,a=s.length;a--;)for(l=s[a].dataSources(),c=l.length;c--;)h=l[c].dataWindowView(),h&&h.update(),(u=l[c].legendView())&&u.update();this._lineBeingCreated?(this._lineBeingCreated.setLastPoint({index:b,price:S},n),this._lineBeingCreated.updateAllViews(),this.invalidate(new k(k.LIGHT_UPDATE))):this.crossHairSource().startMeasurePoint()?this.invalidate(new k(k.LIGHT_UPDATE)):this.invalidate(new k(k.UPDATE_CURSOR_ONLY)),this._isSettingsExternalPosition||(d=this._undoModel._chartWidget,d._chartWidgetCollection&&(p=this.mainSeries(),(_=p.syncModel())&&(f=this.m_timeScale.points().roughTime(b,_.projectTime.bind(_)),m={timeStamp:f},g=i.mainDataSource(),g instanceof W&&(m.price=S,m.symbol=g.symbol()),m.syncModel=_,v=this._lineBeingCreated||this._linePointBeingEdited||this._sourceBeingMoved,v=v&&H.drawOnAllCharts().value(),d._chartWidgetCollection.syncCrosshair(m,d,v,n))))},c.prototype.clearCurrentPosition=function(){var e,t,i,n,o,r,s,a=this.crossHairSource();for(a.clearPosition(),a.dataWindowView().update(),e=this.m_panes,t=e.length;t--;)for(i=e[t].dataSources(),n=i.length;n--;)o=i[n].dataWindowView(),o&&o.update(),
(r=i[n].legendView())&&r.update();this.invalidate(new k(k.UPDATE_CURSOR_ONLY)),s=this._undoModel._chartWidget,s._chartWidgetCollection&&s._chartWidgetCollection.syncCrosshair(NaN,s)},c.prototype.onSyncScrollNeeded=function(e){var t,i,n,o=this._undoModel._chartWidget;o._chartWidgetCollection&&(t=this.mainSeries(),(i=t.syncModel())&&(n=1e3*this.m_timeScale.points().roughTime(e,i.projectTime.bind(i)),o._chartWidgetCollection.syncScroll(n,this)))},c.prototype.gotoTime=function(e,t){function i(){return p.tickMarks().indexToTime(p.tickMarks().minIndex).valueOf()-e}function n(t){var n,o,r,s,a;if(i()<0){for(n=p.tickMarks().nearestIndex(e),o=h(_.bars().lastIndex()),n=Math.min(n,o),r=p.tickMarks().indexToTime(n).valueOf();r<e&&n<o;)n++,r=p.tickMarks().indexToTime(n).valueOf();return s=p.visibleBars(),a=s.lastBar()-s.firstBar(),!t&&s.contains(n)||(p.zoomToBarsRange(n-a/2,n+a/2),_.requestMoreData()),{timestamp:p.indexToTimePoint(n)}}}var o,r,s,a,l,c,u,d,p=this.timeScale(),_=this.mainSeries();if(t&&t.model&&(o=_.syncModel())&&(r=this._createSyncPoint(t.model.mainSeries().syncModel(),o),e=1e3*r.sourceTimeToTargetTime(e/1e3)),t=t||{centerIfVisible:!0},e)this._scrollingState&&this._scrollingState.deferred.reject(),s=$.Deferred(),this._scrollingState={targetDate:e,deferred:s,centerIfVisible:t.centerIfVisible};else{if(!this._scrollingState)return Y.logError("scrollTo called without an argument"),$.Deferred().reject().promise();e=this._scrollingState.targetDate,s=this._scrollingState.deferred}return a=n(this._scrollingState.centerIfVisible),a||(l=p.tickMarks().minIndex,c=p.visibleBars(),u=c.lastBar()-c.firstBar(),_.endOfData()?(p.zoomToBarsRange(l-u/2,l+u/2),a={timestamp:p.indexToTimePoint(l),eod:!0}):(d=this.timeScale().tickMarks().estimateLeft(e),_.requestMoreData(Math.ceil(d+u/2)))),a&&(this.fullUpdate(),this._scrollingState=null,s.resolve(a)),s.promise()},c.prototype._createSyncPoint=function(e,t){var i,n,o=this._syncPointCache[e.uniqueId()];if(o){if(i=o[t.uniqueId()])return i}else this._syncPointCache[e.uniqueId()]={};return n=new U(e,t),this._syncPointCache[e.uniqueId()][t.uniqueId()]=n,n},c.prototype.setExternalPosition=function(e,t){var i,n,o,r,s,a,l,c,h,u,d,p,_,f=this.crossHairSource();if(f.setOnHoveredChartWidget(!1),!Number.isNaN(e)&&isNumber(e.timeStamp)&&(n=this.mainSeries(),(o=n.syncModel())&&(r=this._createSyncPoint(e.syncModel,o),s=r.sourceTimeToTargetTime(e.timeStamp),i=this.m_timeScale.points().roughIndex(s,o.distance.bind(o)))),this.mainSeries().symbol()===e.symbol)return this._isSettingsExternalPosition=!0,a=this.paneForSource(this.mainSeries()),l=this.m_timeScale.indexToCoordinate(i),c=a.mainDataSource().firstValue(),h=this.mainSeries().priceScale().priceToCoordinate(e.price,c,!0),this.setCurrentPosition(l,h,a,t||{}),f.setOnHoveredChartWidget(!1),void delete this._isSettingsExternalPosition;for(isFinite(i)?f.setPosition(i,NaN,null):(f.clearPosition(),f.dataWindowView().update()),u=this.dataSources(),d=u.length;d--;)p=u[d].dataWindowView(),p&&p.update(),(_=u[d].legendView())&&_.update()
@@ -470,7 +470,7 @@ return n.extended&&(r.extended=window.t("ext",{context:"shorthand_for_extended_s
n._items[3].setTitle(a.close),n._items[5].setTitle(""),n._showBarChange.subscribe(n,n.update),n._showSeriesOHLC.subscribe(n,n.update),n._items[4].setTitle(a[t.priceSource()]),n}return n.c(t,e),t.prototype.isValuesVisible=function(){return this._showSeriesOHLC.value()||this._showBarChange.value()},t.prototype.additional=function(){return null},t.prototype.destroy=function(){this._showBarChange.unsubscribeAll(this),this._showSeriesOHLC.unsubscribeAll(this)},t.prototype._updateImpl=function(){var t,i,n,o;e.prototype._updateImpl.call(this),t=s&&this._showOnlyPriceSourceValue(),i=this._showSeriesOHLC.value(),n=i&&!t,o=i&&t,this._items[0].setVisible(n),this._items[1].setVisible(n),this._items[2].setVisible(n),this._items[3].setVisible(n),this._items[4].setVisible(o),this._items[5].setVisible(this._showBarChange.value()),this._items[4].setTitle(a[this._series.priceSource()])},t.prototype._showOnlyPriceSourceValue=function(){return this._showOnlyPriceSource.value()&&Object(r.isPriceSourceStyle)(this._seriesStyle.value())},t}(o.SeriesDataWindowView)},function(e,t,i){"use strict";function n(e){var t,i;if(0===e.length)return!1;if(-1===(t=e.findIndex(function(e){return Object(l.coordinateIsValid)(e.y)})))return!1;for(i=e.length-1;i>t&&!Object(l.coordinateIsValid)(e[i].y);)i--;return!(t>=i)}function o(e,t){var i,n,o,a,c,h=[],u=[],d=null;for(i=0;i<e.length;i++){if(n=e[i],o=e[i+1]||{},Object(l.coordinateIsValid)(n.y))n.y<=t&&h.push(n),n.y>=t&&u.push(n),d=n;else{if(null===d)continue;n=d}Object(l.coordinateIsValid)(o.y)&&((n.y>t&&o.y<t||n.y<t&&o.y>t)&&(Math.abs(n.x-o.x)<1?(a=new r.Point(n.x,t),h.push(a),u.push(a)):null!==(c=Object(s.intersectLineSegments)(n,o,new r.Point(n.x,t),new r.Point(o.x,t)))&&(a=n.add(o.subtract(n).scaled(c)),h.push(a),u.push(a))))}return{topItems:h,bottomItems:u}}var r,s,a,l,c,h,u;Object.defineProperty(t,"__esModule",{value:!0}),t.itemsRangeIsValid=n,t.splitItems=o,i.d(t,"PaneRendererBaseline",function(){return u}),r=i(6),i.n(r),s=i(129),i.n(s),a=i(30),i.n(a),l=i(27),c=i(78),h=i(9),u=function(){function e(){this._data=null}return e.prototype.setData=function(e){this._data=e},e.prototype.draw=function(e){var t,i,r,s,a,l,c,h,u,d,p,_,f,m,y;null!==this._data&&(t=this._data,i=t.items,r=t.baseLevelCoordinate,s=t.bottom,a=t.bottomFillColor1,l=t.bottomFillColor2,c=t.topFillColor1,h=t.topFillColor2,u=t.topLineColor,d=t.bottomLineColor,p=t.topLineWidth,_=t.bottomLineWidth,n(i)&&(f=o(i,r),m=f.topItems,y=f.bottomItems,e.lineCap="round",e.lineJoin="round",e.translate(.5,.5),0!==m.length&&(e.beginPath(),e.moveTo(m[0].x,r),this._makeLine(e,m,!0,0),e.closePath(),e.fillStyle=this._makeLinearGradient(e,c,h,r-s,r),e.fill(),e.beginPath(),this._makeLine(e,m,!1,0),e.lineWidth=p,e.strokeStyle=u,e.stroke()),0!==y.length&&(e.beginPath(),e.moveTo(y[0].x,r),this._makeLine(e,y,!0,1),e.closePath(),e.fillStyle=this._makeLinearGradient(e,a,l,r,r+s),e.fill(),e.beginPath(),this._makeLine(e,y,!1,1),e.lineWidth=_,e.strokeStyle=d,e.stroke())))},e.prototype.hitTest=function(e){var t,i,n,o,s,u,d,p,_,f,m;if(null===this._data)return null
;for(t=this._data,i=t.items,n=t.topLineWidth,o=t.bottomLineWidth,s=Object(l.selectionTolerance)((n+o)/2),u=Object(c.lowerbound)(i,e,function(e,t){return e.x<=t.x}),d=Math.max(1,u-1),p=Math.min(i.length-1,u+1),_=d;_<=p;++_)if(f=i[_-1],m=i[_],Object(a.distanceToSegment)(new r.Point(f.x,f.y),new r.Point(m.x,m.y),new r.Point(e.x,e.y)).distance<=s)return new h.HitTestResult(h.HitTestResult.REGULAR);return null},e.prototype._makeLine=function(e,t,i,n){var o,r,s,a,c,h,u,d,p,_;if(null!==this._data&&-1!==(o=t.findIndex(function(e){return Object(l.coordinateIsValid)(e.y)})))for(r=this._data,s=r.barSpacing,a=r.baseLevelCoordinate,c=.25*s,u=t.length,d=o;d<u;d++)if(p=t[d],_=t[d+1]||{},Object(l.coordinateIsValid)(p.y)){if(0===n){if(h&&h.y>=a&&p.y>=a){e.moveTo(p.x,p.y);continue}}else if(h&&h.y<=a&&p.y<=a){e.moveTo(p.x,p.y);continue}if(h&&Object(l.coordinateIsValid)(h.y))e.lineTo(p.x,p.y),i&&!Object(l.coordinateIsValid)(_.y)&&e.lineTo(p.x,a);else if(_&&Object(l.coordinateIsValid)(_.y))i?(d!==o&&e.lineTo(p.x,a),e.lineTo(p.x,p.y)):e.moveTo(p.x,p.y);else if(i){if(0===d)continue;d!==o&&e.lineTo(p.x-c,a),e.lineTo(p.x-c,p.y),e.lineTo(p.x+c,p.y),e.lineTo(p.x+c,a)}else e.moveTo(p.x-c,p.y),e.lineTo(p.x+c,p.y);h=p}},e.prototype._makeLinearGradient=function(e,t,i,n,o){var r=e.createLinearGradient(0,n,0,o);return r.addColorStop(0,t),r.addColorStop(1,i),r},e}()},function(e,t,i){"use strict";(function(t){var i=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],n=function(){function e(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function n(e){return e.replace(/[\^\$\(\)\[\]\{\}\*\+\?\|\\]/g,"\\$&")}function o(){}function r(e){this.value=e}function s(){}function a(){}function l(){}function c(){}function h(){}function u(){}function d(){}function p(){}function _(e){this.value=e}function f(e){this.value=e}function m(e){this.value=e}function y(){_.apply(this,arguments)}function g(){f.apply(this,arguments)}function v(e,t){var i,n,o,s,a,l,c,h,u=[];e:for(;i=H.exec(e);){for(n=j.length;n--;)if(i[n+1]){j[n].ctor&&(o=new j[n].ctor(i[n+1]),o._offset=i.index,u.push(o));continue e}s=new m(i[0]),s._offset=i.index,u.push(s)}if(t&&t.recover)for(n=u.length;n--;)l=u[n],l instanceof f||l instanceof _?(void 0!==a&&(c=new _(""),h=u.splice(n,a-n+1,c),c.value=h.map(function(e){return e.value}).join("")),a=n):l instanceof r||(a=void 0);return u}function S(e){var i,n,o,c,h,u,d,p,y,g;if(t.enabled("charting_library_base"))return{currentState:"var"};for(i="init",n="var",o="operator",c=i,h={warnings:[],errors:[],isEmpty:!0},u=[],d=0;d<e.length;d++)if(!((p=e[d])instanceof r))if(delete h.isEmpty,p.isIncomplete&&(y={status:"incomplete",reason:"incomplete_token",offset:p._offset,token:p},p.incompleteSuggest&&(y.recover={
append:p.incompleteSuggest()}),h.warnings.push(y),d!==e.length-1))y.status="error";else if(p instanceof _||p instanceof f){if(c===n){h.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}c=n}else if(p instanceof l){if(c!==n){h.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}c=o}else if(p instanceof s){if(c===n){h.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}u.push(p),c=i}else if(p instanceof a){if(c!==n){h.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}g=u.pop(),g||h.errors.push({status:"error",reason:"unbalanced_brace",offset:p._offset,token:p,recover:{prepend:new s}}),c=n}else p instanceof m&&h.errors.push({status:"error",reason:"unparsed_entity",offset:p._offset,token:p});for(h.braceBalance=u.length,c!==n&&h.warnings.push({status:"incomplete"}),g=null;u.length;)p=u.pop(),y={status:"incomplete",reason:"unbalanced_brace",offset:p._offset,token:p},c===n&&(y.recover={append:new a}),h.warnings.push(y);return h.currentState=c,0===h.warnings.length&&delete h.warnings,0===h.errors.length&&delete h.errors,h}function b(e){var t,i=[];for(t=0;t<e.length;t++)e[t]instanceof r||i.push(e[t]);return i}function w(e){var t,i,n,o,r,c,h;for(e=b(e),t=[],i=[],o=0;o<e.length;o++)r=e[o],r instanceof l?i.length&&i[i.length-1].minPrecedence>r.precedence&&(i[i.length-1].minPrecedence=r.precedence):r instanceof s?i.push(n={minPrecedence:1/0,openBraceIndex:o}):r instanceof a&&(n=i.pop(),c=e[n.openBraceIndex-1],(h=e[o+1])instanceof l&&!(h.precedence<=n.minPrecedence)||!(!(c instanceof l)||c.precedence<n.minPrecedence||c.precedence===n.minPrecedence&&c.commutative)||(t.unshift(n.openBraceIndex),t.push(o),i.length&&i[i.length-1].minPrecedence>n.minPrecedence&&(i[i.length-1].minPrecedence=n.minPrecedence)));for(o=t.length;o--;)e.splice(t[o],1);return e}function P(e){for(var t=0;t<e.length;t++)e[t].parse&&e[t].parse();return e}function T(e){var t=x(e);return w(t?t:[new f("1"),new d,new s].concat(e).concat(new a))}function x(e){var t,i,n,o=0,c=1,h=2,u=3,p=o,_=0;for(i=0;i<e.length;i++)if(!((n=e[i])instanceof r))switch(p){case o:if(!(n instanceof f&&1==+n.value))return!1;p=c;break;case c:if(!(p===c&&n instanceof d))return!1;p=h,t=i+1;break;case h:if(n instanceof s)p=u,_=1;else if(n instanceof l)return!1;break;case u:n instanceof s?_++:n instanceof a&&--_<=0&&(p=h)}return e.slice(t)}function C(e){return new _(e).ticker()}function L(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return e=v(e),e.filter(function(e){return e instanceof _}).map(function(e){return e.exchange()}).filter(function(e){return e})}function I(e){return e=L(e),1!==e.length?null:e[0]}function A(e,t){return e=L(e),e.some(function(e){return!!~t.indexOf((e||"").toUpperCase())})}function k(e){return A(e,["BATS"])}function E(e){return(e=I(e))&&-1!==e.toUpperCase().indexOf("_EOD")}function M(e){return A(e,["CHXEUR"])}function V(e){return A(e,["CHXJPY"])}function D(e){
return A(e,pro.getProductsByType(pro.PRODUCT_TYPES.exchange).map(function(e){return e.exchange.toUpperCase()+"_DLY"}))}function O(e,t){return!!(e=I(e))&&e.substr(0,t.length)===t}function R(e){if("string"!=typeof e)throw new TypeError("expression must be a string");var t=w(b(v(e)));return t.forEach(function(e){e instanceof _&&e.exchange(null)}),N(t)}function B(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return N(w(b(v(e))))}function N(e){return e.join("")}var F,W,H,j=[{pattern:"(",ctor:s},{pattern:")",ctor:a},{pattern:"+",ctor:c},{pattern:"-",ctor:h},{pattern:"*",ctor:u},{pattern:"/",ctor:d},{pattern:"^",ctor:p},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:\.&]))|\.\d+/,ctor:f},{pattern:/\./,ctor:g},{pattern:t.enabled("charting_library_base")?/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:\.&]*|'.+?'/:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!|:\.&]*|'.+?'/,ctor:_},{pattern:/'[^']*/,ctor:y},{pattern:/[\0-\x20\s]+/,ctor:r}];return o.prototype.toString=function(){return this.value},e(r,o),e(s,o),s.prototype.value="(",e(a,o),a.prototype.value=")",e(l,o),e(c,l),c.prototype.value="+",c.prototype.precedence=0,c.prototype.commutative=!0,e(h,l),h.prototype.value="-",h.prototype.precedence=0,h.prototype.commutative=!1,e(u,l),u.prototype.value="*",u.prototype.precedence=1,u.prototype.commutative=!0,e(d,l),d.prototype.value="/",d.prototype.precedence=1,d.prototype.commutative=!1,e(p,l),p.prototype.value="^",p.prototype.precedence=2,p.prototype.commutative=!1,F=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,W=/[\+\-\/\*]/,e(_,o),_.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=W.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},_.prototype.parse=function(){var e=F.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},_.prototype.parseAsFutures=function(){var e,t,n;for(this.hasOwnProperty("_ticker")||this.parse(),e=function(e){return i.some(function(t){return t.t===e})},t=2;t>=1;--t)if(n=this._ticker.slice(0,t),e(n)){this._root=n,this._contract=this._ticker.slice(t);break}},_.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._exchange;null===e||void 0===e?delete this._exchange:this._exchange=e+""},_.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null===e||void 0===e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},_.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null===e||void 0===e?delete this._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},_.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))return this._root;null===e||void 0===e?delete this._contract:(this._contract=e+"",
return A(e,pro.getProductsByType(pro.PRODUCT_TYPES.exchange).map(function(e){return e.exchange.toUpperCase()+"_DLY"}))}function O(e,t){return!!(e=I(e))&&e.substr(0,t.length)===t}function R(e){if("string"!=typeof e)throw new TypeError("expression must be a string");var t=w(b(v(e)));return t.forEach(function(e){e instanceof _&&e.exchange(null)}),F(t)}function B(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return F(w(b(v(e))))}function F(e){return e.join("")}var N,W,H,j=[{pattern:"(",ctor:s},{pattern:")",ctor:a},{pattern:"+",ctor:c},{pattern:"-",ctor:h},{pattern:"*",ctor:u},{pattern:"/",ctor:d},{pattern:"^",ctor:p},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:\.&]))|\.\d+/,ctor:f},{pattern:/\./,ctor:g},{pattern:t.enabled("charting_library_base")?/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:\.&]*|'.+?'/:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!|:\.&]*|'.+?'/,ctor:_},{pattern:/'[^']*/,ctor:y},{pattern:/[\0-\x20\s]+/,ctor:r}];return o.prototype.toString=function(){return this.value},e(r,o),e(s,o),s.prototype.value="(",e(a,o),a.prototype.value=")",e(l,o),e(c,l),c.prototype.value="+",c.prototype.precedence=0,c.prototype.commutative=!0,e(h,l),h.prototype.value="-",h.prototype.precedence=0,h.prototype.commutative=!1,e(u,l),u.prototype.value="*",u.prototype.precedence=1,u.prototype.commutative=!0,e(d,l),d.prototype.value="/",d.prototype.precedence=1,d.prototype.commutative=!1,e(p,l),p.prototype.value="^",p.prototype.precedence=2,p.prototype.commutative=!1,N=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,W=/[\+\-\/\*]/,e(_,o),_.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=W.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},_.prototype.parse=function(){var e=N.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},_.prototype.parseAsFutures=function(){var e,t,n;for(this.hasOwnProperty("_ticker")||this.parse(),e=function(e){return i.some(function(t){return t.t===e})},t=2;t>=1;--t)if(n=this._ticker.slice(0,t),e(n)){this._root=n,this._contract=this._ticker.slice(t);break}},_.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._exchange;null===e||void 0===e?delete this._exchange:this._exchange=e+""},_.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null===e||void 0===e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},_.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null===e||void 0===e?delete this._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},_.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))return this._root;null===e||void 0===e?delete this._contract:(this._contract=e+"",
this._root&&(this._ticker=this._root+this._contract))},e(f,o),f.prototype.toString=function(){return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},f.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},m.prototype.toString=function(){return this.value},e(y,_),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)return"'"},e(g,f),g.prototype.isIncomplete=!0,H=RegExp(j.map(function(e){return"("+("string"==typeof e.pattern?n(e.pattern):e.pattern.source)+")"}).concat(".").join("|"),"g"),{tokenize:v,validate:S,factorOutBraces:w,normalizeTokens:P,flip:T,hasBatsSymbols:k,hasEodSymbols:E,hasChxeurSymbols:M,hasChxjpySymbols:V,hasFreeDelaySymbols:D,getExchange:I,isExchange:O,SymbolToken:_,IncompleteSymbolToken:y,NumberToken:f,BinaryOperatorToken:l,OpenBraceToken:s,CloseBraceToken:a,ticker:C,shortName:R,normalize:B}}();e.exports=n}).call(t,i(5))},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SyncModel",function(){return r}),n=i(37),i.n(n),o=0,r=function(){function e(e,t){this._session=new n.Session,this._extrapolatedData=[],this._modelId=o++,this._builderCache=null,this._resolution=t,this._symbolInfo=e,this._valid=!!e.timezone&&!!e.session,this._session.init(e.timezone,e.session)}return e.prototype.getSymbolInfo=function(){return this._symbolInfo},e.prototype.getSession=function(){return this._session},e.prototype.getResolution=function(){return this._resolution},e.prototype.uniqueId=function(){return this._modelId},e.prototype.distance=function(e,t){var i,o,r,s,a;return this.isValid()?(i=this._extrapolatedData.length,o=0!==i?this._extrapolatedData[0]:null,r=null!==o?this._extrapolatedData[i-1]:null,1e3*e!==o&&(this._extrapolatedData=[1e3*e],o=null,r=null),(null===o||null!==r&&1e3*t>r)&&(s=Object(n.extrapolateBarsFrontToTime)(this._barBuilder(),r||1e3*e,1e3*t,2e3),this._extrapolatedData=this._extrapolatedData.concat(s),i=this._extrapolatedData.length),(r=this._extrapolatedData[i-1])<1e3*t?{success:!1}:(a=this._extrapolatedData.indexOf(1e3*t),-1===a?{success:!1}:{success:!0,result:a})):{success:!1}},e.prototype.projectTime=function(e,t){var i,o,r,s;return this.isValid()?(i=this._extrapolatedData.length,o=i>0?this._extrapolatedData[0]:null,r=null!==o?this._extrapolatedData[i-1]:null,1e3*e!==o&&(this._extrapolatedData=[1e3*e],o=null,r=null),(null===o||t>=i)&&(s=Object(n.extrapolateBarsFrontByCount)(this._barBuilder(),r||1e3*e,t-i+1),this._extrapolatedData=this._extrapolatedData.concat(s)),i<t?e:this._extrapolatedData[t]/1e3):e},e.prototype.isValid=function(){return this._valid},e.prototype._barBuilder=function(){return null===this._builderCache&&(this._builderCache=Object(n.newBarBuilder)(this._resolution,this._session,this._session)),this._builderCache},e}()},function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SeriesHorizontalBaseLinePaneView",function(){return s}),n=i(1),o=i(6),i.n(o),
r=i(178),s=function(e){function t(t){return e.call(this,t)||this}return n.c(t,e),t.prototype._updateImpl=function(){var e,t;this._lineRendererData.visible=!1,e=this._series.priceScale().mode(),(e.percentage||e.indexedTo100)&&null!=(t=this._series.firstValue())&&(this._lineRendererData.visible=!0,this._lineRendererData.points=[new o.Point(0,this._series.priceScale().priceToCoordinate(t,t))],this._lineRendererData.width=this._model.timeScale().width(),this._lineRendererData.height=this._series.priceScale().height(),this._lineRendererData.color=this._series.properties().baseLineColor.value())},t}(r.a)},function(e,t,i){"use strict";var n,o,r,s,a;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SeriesPriceLinePaneView",function(){return a}),n=i(1),o=i(6),i.n(o),r=i(178),s=i(85),a=function(e){function t(t){var i=e.call(this,t)||this;return i._lineRendererData.linestyle=s.LINESTYLE_DOTTED,i}return n.c(t,e),t.prototype._updateImpl=function(){if(this._lineRendererData.visible=!1,this._series.properties().showPriceLine.value()){var e=this._series.lastValueData(void 0,!0);e.noData||(this._lineRendererData.visible=!0,this._lineRendererData.points=[new o.Point(0,e.coordinate)],this._lineRendererData.color=this._series.priceLineColor(e.color),this._lineRendererData.width=this._model.timeScale().width(),this._lineRendererData.height=this._series.priceScale().height(),this._lineRendererData.linewidth=this._series.properties().priceLineWidth.value())}},t}(r.a)},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SeriesDataEvents",function(){return r}),n=i(8),o=i.n(n),r=function(){function e(){this._completed=new o.a,this._error=new o.a,this._symbolError=new o.a,this._symbolResolved=new o.a,this._seriesError=new o.a,this._symbolNotPermitted=new o.a,this._symbolGroupNotPermitted=new o.a,this._extendedHoursNotPermitted=new o.a,this._chartTypeNotPermitted=new o.a,this._intradaySpreadNotPermitted=new o.a,this._intradayExchangeNotPermitted=new o.a,this._customIntervalNotPermitted=new o.a,this._tickMarksRangeChanged=new o.a,this._barReceived=new o.a,this._messageReceived=new o.a}return e.prototype.completed=function(){return this._completed},e.prototype.error=function(){return this._error},e.prototype.symbolError=function(){return this._symbolError},e.prototype.symbolResolved=function(){return this._symbolResolved},e.prototype.seriesError=function(){return this._seriesError},e.prototype.symbolNotPermitted=function(){return this._symbolNotPermitted},e.prototype.symbolGroupNotPermitted=function(){return this._symbolGroupNotPermitted},e.prototype.extendedHoursNotPermitted=function(){return this._extendedHoursNotPermitted},e.prototype.chartTypeNotPermitted=function(){return this._chartTypeNotPermitted},e.prototype.intradaySpreadNotPermitted=function(){return this._intradaySpreadNotPermitted},e.prototype.intradayExchangeNotPermitted=function(){return this._intradayExchangeNotPermitted},e.prototype.customIntervalNotPermitted=function(){return this._customIntervalNotPermitted},
e.prototype.tickMarksRangeChanged=function(){return this._tickMarksRangeChanged},e.prototype.barReceived=function(){return this._barReceived},e.prototype.messageReceived=function(){return this._messageReceived},e.prototype.fireCompleted=function(){this._completed.fire()},e.prototype.fireError=function(){this._error.fire()},e.prototype.fireSymbolError=function(e){this._symbolError.fire(e),this.fireError()},e.prototype.fireSymbolResolved=function(e){this._symbolResolved.fire(e)},e.prototype.fireSeriesError=function(e){this._seriesError.fire(e),this.fireError()},e.prototype.fireSymbolNotPermitted=function(e){this._symbolNotPermitted.fire(e),this.fireError()},e.prototype.fireSymbolGroupNotPermitted=function(e){this._symbolGroupNotPermitted.fire(e),this.fireError()},e.prototype.fireExtendedHoursNotPermitted=function(){this._extendedHoursNotPermitted.fire(),this.fireError()},e.prototype.fireChartTypeNotPermitted=function(e){this._chartTypeNotPermitted.fire(e),this.fireError()},e.prototype.fireIntradaySpreadNotPermitted=function(){this._intradaySpreadNotPermitted.fire(),this.fireError()},e.prototype.fireIntradayExchangeNotPermitted=function(){this._intradayExchangeNotPermitted.fire(),this.fireError()},e.prototype.fireCustomIntervalNotPermitted=function(){this._customIntervalNotPermitted.fire(),this.fireError()},e.prototype.fireTickMarksRangeChanged=function(e){this._tickMarksRangeChanged.fire(e)},e.prototype.fireBarReceived=function(e){this._barReceived.fire(e)},e.prototype.fireMessageReceived=function(e){this._messageReceived.fire(e)},e}()},function(e,t,i){"use strict";function n(e){function t(e,t){var i=e.font;return a.hasOwnProperty(i)||(a[i]={}),a[i].hasOwnProperty(t)||(a[i][t]=e.measureText(t).width),a[i][t]}function i(){var i=n.width(),a=n.height();return{draw:function(n){var c,h,u,d,p,_,f,m,y,g=e.symbolInfo();if(g){for(n.fillStyle=o.generateColor(l.color.value(),l.transparency.value()),c=g.name,/QUANDL/.test(g.exchange)&&(h=c.split(/\//),h.length&&(c=h[h.length-1])),u={description:g.description,pro_name:g.pro_name,short_name:g.name},d=[{text:c?c+", "+r(e.interval()):"",font:"96px Verdana, Arial, sans-serif",lineHeight:117,vertOffset:0},{text:s(u)||"",font:"48px Verdana, Arial, sans-serif",lineHeight:58,vertOffset:5}],p=0,_=0;_<d.length;_++)f=d[_],f.text&&(n.font=f.font,m=t(n,f.text),f.zoom=m>i?i/m:1,p+=f.lineHeight*f.zoom);for(y=Math.max((a-p)/2,0),_=0;_<d.length;_++)f=d[_],f.text&&(n.save(),n.translate(i/2,y),n.textBaseline="top",n.textAlign="center",n.font=f.font,n.scale(f.zoom,f.zoom),n.fillText(f.text,0,f.vertOffset),n.restore(),y+=f.lineHeight*f.zoom)}}}}var n=null,a={},l=e.model().properties().symbolWatermarkProperties,c={renderer:i,update:function(){}};this.paneViews=function(e){return e.containsMainSeries()?(n=e,[c]):[]}}var o=i(29),r=i(123).translatedIntervalString,s=i(278).getTranslatedSymbolDescription;t.Watermark=n},function(e,t,i){"use strict";function n(){this.visible=!0,this.horzLinesVisible=!0,this.horzLinesColor="white",this.horzLinesStyle="",this.vertLinesVisible=!0,this.vertLinesColor="white",
@@ -482,11 +482,11 @@ o.prototype.isValidBarSpacing=function(e){return e>=v&&e<=g},o.prototype.endScal
this.setBarSpacing(this.width()/(t-e+1)),this._visibleBarsInvalidated=!0}},o.prototype.canZoomIn=function(){return this.m_barSpacing<g},o.prototype.canZoomOut=function(){return this.m_barSpacing>v},o.prototype.minBarSpacing=function(){return v},o.prototype.maxBarSpacing=function(){return g},o.prototype.onScroll=function(){return this._onScroll},o.prototype.preserveBarSpacing=function(){return this._options.preserveBarSpacing},o.prototype.visibleBarsChanged=function(){return this._visibleBarsChanged},t.TimeScale=o}).call(t,i(8))},function(e,t,i){"use strict";function n(e,t){this._formatter=e,this._maxSize=t||50,this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}}n.prototype.format=function(e){var t,i;return this._cache[e]?this._cache[e].string:(this._actualSize===this._maxSize&&(t=this._tick2Labels[this._oldestTick],delete this._tick2Labels[this._oldestTick],delete this._cache[t],this._oldestTick++,this._actualSize--),i=this._formatter(e),this._cache[e]={string:i,tick:this._usageTick},this._tick2Labels[this._usageTick]=e,this._actualSize++,this._usageTick++,i)},e.exports=n},function(e,t,i){"use strict";(function(t){function i(){this._marksByIndex={},this._marksBySpan=[],this.changed=new t}i.prototype.reset=function(){this._marksByIndex={},this._marksBySpan=[],delete this.minIndex,delete this.maxIndex,delete this._cache,this.changed.fire()},i.prototype.minIndex=void 0,i.prototype.maxIndex=void 0,i.prototype.merge=function(e){var t,i,n,o,r,s=this._marksBySpan,a={};for(t=0;t<e.length;t++){if(i=e[t],n=i.index,o=i.span,r=this._marksByIndex[i.index]){if(r.index===i.index&&r.span===i.span){r.time=i.time;continue}this._removeTickmark(r)}this._marksByIndex[n]=i,this.minIndex<=n||(this.minIndex=n),this.maxIndex>=n||(this.maxIndex=n),s[o]||(s[o]=[]),s[o].push(i),a[o]=!0}for(o=s.length;o--;)s[o]&&(s[o].length||delete s[o],a[o]&&s[o].sort(this._sortByIndexAsc));delete this._cache,this.changed.fire()},i.prototype._removeTickmark=function(e){var t,i,n=e.index;this._marksByIndex[n]===e&&(delete this._marksByIndex[n],n<=this.minIndex&&this.minIndex++,n>=this.maxIndex&&this.maxIndex--,this.maxIndex<this.minIndex&&(delete this.minIndex,delete this.maxIndex),t=this._marksBySpan[e.span],-1!==(i=t.indexOf(e))&&t.splice(i,1))},i.prototype._sortByIndexAsc=function(e,t){return e.index-t.index},i.prototype.removeTail=function(e){var t,i={};this.maxIndex=0;for(t in this._marksByIndex)this._marksByIndex[t].time<e&&(i[t]=this._marksByIndex[t],this.maxIndex=Math.max(this.maxIndex,t));this._marksByIndex=i},i.prototype.addTail=function(e){for(var t=0;t<e.length;t++)e[t].index=this.maxIndex+t+1;this.merge(e)},i.prototype.indexToTime=function(e){var t=this._marksByIndex[e];return t?new Date(1e3*t.time):null},i.prototype.density=function(){var e,t=this.maxIndex-this.minIndex;if(0!==t)return e=this._marksByIndex[this.maxIndex].time-this._marksByIndex[this.minIndex].time,1e3*e/t},i.prototype.estimateLeft=function(e){var t,i=this.density();if(i)return t=1e3*this._marksByIndex[this.minIndex].time-e,t/i},
i.prototype.nearestIndex=function(e){for(var t,i=this.minIndex,n=this.maxIndex;n-i>2;){if(1e3*this._marksByIndex[i].time===e)return i;if(1e3*this._marksByIndex[n].time===e)return n;t=Math.round((i+n)/2),1e3*this._marksByIndex[t].time>e?n=t:i=t}return i},i.prototype.build=function(e,t){var i,n,o,r,s,a,l,c,h,u,d,p,_,f,m=Math.ceil(t/e);if(this._maxbar===m&&this._cache)return this._cache;for(this._maxbar=m,i=[],n=this._marksBySpan.length;n--;)if(this._marksBySpan[n]){for(o=i,i=[],r=o.length,s=0,a=this._marksBySpan[n],l=a.length,c=1/0,h=-1/0,u=0;u<l;u++){for(d=a[u],p=d.index;s<r;){if(_=o[s],!((f=_.index)<p)){c=f;break}s++,i.push(_),h=f,c=1/0}c-p>=m&&p-h>=m&&(i.push(d),h=p)}for(;s<r;s++)i.push(o[s])}return this._cache=i,this._cache},i.prototype.state=function(){var e,t=[];for(e=this._marksBySpan.length;e--;)this._marksBySpan[e]&&(t=t.concat(this._marksBySpan[e]));return t=t.map(function(e){return[e.span,e.time,e.index]}),{marks:t,version:2}},i.prototype.restoreState=function(e){if(this._marksByIndex={},this._marksBySpan=[],delete this.maxIndex,delete this.minIndex,e&&e.marks&&e.marks.length)if(2===e.version){var t=e.marks.map(function(e){return{span:e[0],time:e[1],index:e[2]}});this.merge(t)}else this.merge(e.marks)},e.exports=i}).call(t,i(8))},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"TimePoints",function(){return r}),n=i(4),o=Object(n.getLogger)("Chart.TimePoints"),r=function(){function e(){this._zoffset=0,this._items=[]}return e.prototype.clear=function(){this._zoffset=0,this._items=[]},e.prototype.size=function(){return this._items.length},e.prototype.firstIndex=function(){return this._offsetToIndex(0)},e.prototype.lastIndex=function(){return this._offsetToIndex(this._items.length-1)},e.prototype.merge=function(e,t,i){var n,r,s,a,l,c,h,u;if(0===i.length)return o.logError("merge: 'values' does not contain any time points"),[];if(t>this._zoffset&&e+t>0)return o.logError("merge: when the first time point index is updated, we should fill the time points starting from the first one"),[];if(0===this._items.length)return this._items=i,this._zoffset=t,[{change:"rebuild",index:this._validOffsetToIndex(0)}];if((n=e+this._zoffset)<0){if(r=Math.abs(n),i.length<r)return o.logError("merge: 'values' does not contain enough time points to fill in the new items. 'index': "+e+", previous 'zoffset': "+this._zoffset+", new 'zoffset': "+t+", 'values.length': "+i.length),[];for(this._items=Array(r).concat(this._items),this._zoffset=t,s=0;s<i.length;++s)this._items[e+s+t]=i[s];return[{change:"rebuild",index:this._validOffsetToIndex(0)}]}for(a=[],l=n;l<this._items.length&&l-n<i.length;++l)this._items[l]=i[l-n],a.push({change:"update",index:this._validOffsetToIndex(l),value:i[l-n]});if((c=n+i.length)>this._items.length)for(r=c-this._items.length,h=l;h<l+r;++h)u=this._items.length,this._items.push(i[h-n]),a.push({change:"append",index:this._validOffsetToIndex(u),value:i[h-n]});return this._zoffset=t,a},e.prototype.addTail=function(e,t){for(var i=t?1:0;i<e.length;i++)this._items.push(e[i])},
e.prototype.remove=function(e){var t,i,n,o=this._indexToOffset(e);if(null===o)return[];for(t=this._items.splice(o),i=[],n=0;n<t.length;n++)i.push({change:"remove",index:e+n,value:t[n]});return i},e.prototype.valueAt=function(e){var t=this._indexToOffset(e);return null!==t?this._items[t]:null},e.prototype.indexOf=function(e,t){if(this._items.length<1)return null;if(e>this._items[this._items.length-1])return t?this._validOffsetToIndex(this._items.length-1):null;for(var i=0;i<this._items.length;++i){if(e===this._items[i])return this._validOffsetToIndex(i);if(e<this._items[i])return t?this._validOffsetToIndex(i):null}return null},e.prototype.state=function(){return{items:this._items,zoffset:this._zoffset}},e.prototype.restoreState=function(e){null!==e&&(this._items=e.items,this._zoffset=e.zoffset)},e.prototype.roughTime=function(e,t){var i,n,o,r,s,a,l,c,h,u,d,p;return void 0===t&&(t=null),null!==(i=this.valueAt(e))?i:(n=this._items,!n.length||n.length<2?null:(o=0,r=n.length-1,s=this._validOffsetToIndex(o),a=this._validOffsetToIndex(r),l=n[o],c=n[r],h=(c-l)/(a-s),e<s?(u=s-e,d=u*h,l-d):(p=500,e>a?(u=e-a)<p&&null!=t?t(c,u):(d=u*h,c+d):null)))},e.prototype.roughIndex=function(e,t){var i,n,o,r,s,a,l,c,h,u,d,p;return void 0===t&&(t=null),i=this._items,!i.length||i.length<2?null:(n=0,o=i.length-1,r=this._validOffsetToIndex(n),s=this._validOffsetToIndex(o),a=i[n],l=i[o],e>=a&&e<=l?this.closestIndexLeft(e):(c=(l-a)/(s-r),e<a?(h=a-e,u=Math.round(h/c),r-u):(d=500,e>l?(h=e-l,u=Math.trunc(h/c),u<d&&null!==t&&(p=t(l,e),p.success&&(u=p.result)),s+u):null)))},e.prototype.closestIndexLeft=function(e){var t,i,n,o,r,s,a=this._items;if(!a.length)return null;if(Number.isNaN(e))return null;if(t=a.length-1,i=a[t],e>=i)return this._validOffsetToIndex(t);if(n=0,o=a[n],e<o)return null;if(e===o)return this._validOffsetToIndex(n);for(;t>n+1;)if(r=n+t>>1,(s=a[r])>e)t=r;else{if(!(s<e))return s===e?this._validOffsetToIndex(r):null;n=r}return this._validOffsetToIndex(n)},e.prototype._validOffsetToIndex=function(e){return e-this._zoffset},e.prototype._offsetToIndex=function(e){return 0<=e&&e<this.size()?this._validOffsetToIndex(e):null},e.prototype._indexToOffset=function(e){var t=e+this._zoffset;return 0<=t&&t<this.size()?t:null},e}()},function(e,t,i){"use strict";function n(e,t){this.tooltips={},this.tooltipFactory=e,this.source=t}function o(e,t){this.renderer=e,this._tooltip=t,this.visible=!1}n.prototype.findOrCreateTooltip=function(e){var t=this.tooltips[e.id];return null==t&&(e.hovered||e.pinned)&&(t=this._createTooltip(),this.tooltips[e.id]=t),t},n.prototype.showPlate=function(e,t){var i=this.findOrCreateTooltip(e);null!=i&&(i._drawPlate(e,t),i.plateData=e)},n.prototype.draw=function(e,t){this.hoveredId=null;for(var i=0;i<e.length;i++)e[i].hovered&&(this.hoveredId=e[i].id);e.forEach(function(e){this.showPlate(e,t)}.bind(this))},n.prototype.endDraw=function(){var e,t,i=this;for(e in this.tooltips)this.tooltips.hasOwnProperty(e)&&(t=this.tooltips[e],t.toggleVisibility(),i.hoveredId&&t.plateData.id!==i.hoveredId&&!t.plateData.pinned&&(t.remove(),
delete this.tooltips[e]))},n.prototype.removeAll=function(){var e,t;for(e in this.tooltips)this.tooltips.hasOwnProperty(e)&&(t=this.tooltips[e],t.remove());this.tooltips={}},n.prototype.removeTooltip=function(e){delete this.tooltips[e]},n.prototype._createTooltip=function(){return new o(this,this.tooltipFactory())},o.prototype._drawPlate=function(e,t){var i=this;this.visible=!0,this._tooltip.setSource(this.renderer.source),this._tooltip.showPlate(e,t),e.hovered||e.pinned||this._tooltip.hide(function(){i.renderer.removeTooltip(e.id)})},o.prototype.remove=function(){this._tooltip._removeLayout()},o.prototype.toggleVisibility=function(){this._tooltip._toggleLayout(this.visible),this.visible=!1},t.TooltipRenderer=n},function(e,t,i){"use strict";function n(e){var t,i;if(e&&e.__esModule)return e;if(t={},null!=e)for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,i){var n,o=2*J,r=document.createElement("canvas");return r.width=t*o,r.height=i*o,r.style.width=t+"px",r.style.height=i+"px",n=r.getContext("2d"),n.setTransform(o,0,0,o,0,0),n.drawImage(e,0,0,t,i),r}function s(e,t){return function(){i.e(11).then(function(){X=i(811),e.call(t)}.bind(null,i)).catch(i.oe)}}function a(e){return!x||e>L}function l(e){return!T||e>C}var c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,N,F,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee;Object.defineProperty(t,"__esModule",{value:!0}),t.Branding=void 0,c=function(){function e(e,t){var i,n,o=[],r=!0,s=!1,a=void 0;try{for(i=e[Symbol.iterator]();!(r=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);r=!0);}catch(e){s=!0,a=e}finally{try{!r&&i.return&&i.return()}finally{if(s)throw a}}return o}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function e(e,t){var i,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=i(6),d=i(60),p=i(5),_=n(p),f=i(9),m=i(184),y=i(29),g=i(194),v=i(46),S=i(24),b=i(257).debounce,w=i(623),P=!1,T=_.enabled("adaptive_logo"),x=_.enabled("small_no_display"),P=_.enabled("38914"),C=500,L=480,I="TradingView",A="Ch{0}ar{1}t{2}by{3}{4}".format("",""," "," ",I),k="po{0}wer{1}ed{2}by{3}{4}".format("",""," "," ",I),E="by{3}{4}".format("",""," "," ",I),M=P?E:k,V="site_branding",D="widget_branding",O="widget_referral_branding",R="widget_custom_branding",B="widget_custom_no_powered_branding",N="fundamental_branding",F="fundamental_custom_branding",W="fundamental_custom_no_powered_branding",H="library_branding",j="library_custom_branding",z="library_custom_no_powered_branding",U=.2,q=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Y=q&&navigator.userAgent.toLowerCase().indexOf("windows")>-1,
delete this.tooltips[e]))},n.prototype.removeAll=function(){var e,t;for(e in this.tooltips)this.tooltips.hasOwnProperty(e)&&(t=this.tooltips[e],t.remove());this.tooltips={}},n.prototype.removeTooltip=function(e){delete this.tooltips[e]},n.prototype._createTooltip=function(){return new o(this,this.tooltipFactory())},o.prototype._drawPlate=function(e,t){var i=this;this.visible=!0,this._tooltip.setSource(this.renderer.source),this._tooltip.showPlate(e,t),e.hovered||e.pinned||this._tooltip.hide(function(){i.renderer.removeTooltip(e.id)})},o.prototype.remove=function(){this._tooltip._removeLayout()},o.prototype.toggleVisibility=function(){this._tooltip._toggleLayout(this.visible),this.visible=!1},t.TooltipRenderer=n},function(e,t,i){"use strict";function n(e){var t,i;if(e&&e.__esModule)return e;if(t={},null!=e)for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,i){var n,o=2*J,r=document.createElement("canvas");return r.width=t*o,r.height=i*o,r.style.width=t+"px",r.style.height=i+"px",n=r.getContext("2d"),n.setTransform(o,0,0,o,0,0),n.drawImage(e,0,0,t,i),r}function s(e,t){return function(){i.e(11).then(function(){X=i(811),e.call(t)}.bind(null,i)).catch(i.oe)}}function a(e){return!x||e>L}function l(e){return!T||e>C}var c,h,u,d,p,_,f,m,y,g,v,S,b,w,P,T,x,C,L,I,A,k,E,M,V,D,O,R,B,F,N,W,H,j,z,U,q,Y,G,K,Z,J,X,Q,ee;Object.defineProperty(t,"__esModule",{value:!0}),t.Branding=void 0,c=function(){function e(e,t){var i,n,o=[],r=!0,s=!1,a=void 0;try{for(i=e[Symbol.iterator]();!(r=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);r=!0);}catch(e){s=!0,a=e}finally{try{!r&&i.return&&i.return()}finally{if(s)throw a}}return o}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function e(e,t){var i,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),u=i(6),d=i(60),p=i(5),_=n(p),f=i(9),m=i(184),y=i(29),g=i(194),v=i(46),S=i(24),b=i(257).debounce,w=i(623),P=!1,T=_.enabled("adaptive_logo"),x=_.enabled("small_no_display"),P=_.enabled("38914"),C=500,L=480,I="TradingView",A="Ch{0}ar{1}t{2}by{3}{4}".format("",""," "," ",I),k="po{0}wer{1}ed{2}by{3}{4}".format("",""," "," ",I),E="by{3}{4}".format("",""," "," ",I),M=P?E:k,V="site_branding",D="widget_branding",O="widget_referral_branding",R="widget_custom_branding",B="widget_custom_no_powered_branding",F="fundamental_branding",N="fundamental_custom_branding",W="fundamental_custom_no_powered_branding",H="library_branding",j="library_custom_branding",z="library_custom_no_powered_branding",U=.2,q=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Y=q&&navigator.userAgent.toLowerCase().indexOf("windows")>-1,
G=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),K=function(){var e,t=window.navigator.userAgent,i=t.indexOf("MSIE ");return i>0?parseInt(t.substring(i+5,t.indexOf(".",i)),10):t.indexOf("Trident/")>0&&(e=t.indexOf("rv:"),parseInt(t.substring(e+3,t.indexOf(".",e)),10))}(),Z=window.urlParams||{},window.initData,J=window.hidpiCanvasRatio||1,X=null,Q=function(){function e(t){var i=t.layout,n=void 0===i?V:i,r=t.symbol,a=void 0===r?"":r,l=t.model,c=t.onReadyCallback;o(this,e),this._model=l,this._image=null,this._imageReady=!1,this._needDisplayImage=!1,this._imageWidth=22,this._imageHeight=13,this._layout=n,this._symbol=a,this.showAnimatedBranding=_.enabled("show_animated_logo"),this.show=!0,this.width=100,this.height=14,this._bottomShift=0,this._brandCircleSize=32,this._animatedWidth=this._brandCircleSize,this._animatedOpacity=0,this.width=this.showAnimatedBranding?this._brandCircleSize:100,this.height=14,this._fillColor=m.color.brandNew,this._colorOldBlue=m.color.brandDown,this._colorOldGray=m.color.black30,this._strokeColor=m.color.black255,this._brandCircleShadowColor=m.color.black0,this._strokeWidth=4,this._fontSize=this.showAnimatedBranding?11:14,this._font='px "Trebuchet MS", Tahoma, Arial, sans-serif',this._txt="TradingView",this._onReadyCallback=c,this._upscaleRatio=G?1:2,this._verticalTextShift=q?this.showAnimatedBranding?2:4:0,this._strokeCanv=null,this._fillCanv=null,K&&(this._init=s(this._init,this)),this._init()}return h(e,[{key:"_init",value:function(){this._checkLayout(),this.show&&(this._updateStrokeColor(),this.showAnimatedBranding?(this._loadImage(w,"tvLogo"),this._createFillText()):this._loadImage(w,"tvLogo"),this._model.properties().paneProperties.background.subscribe(this,this._updateStrokeColor),this._model.onChartThemeLoaded().subscribe(this,this._updateStrokeColor))}},{key:"_updateStrokeColor",value:function(){var e=(0,y.getLuminance)(this._model.properties().paneProperties.background.value());this._strokeCanv=null,this._fillCanv=null,e>U?(this._brandCircleColor=m.color.black255,this._animatedColorBg=m.color.black255,this._brandCircleShadowOpacity=.09,this._strokeOpacity=.8):(this._brandCircleColor=m.color.black27,this._animatedColorBg=m.color.black27,this._brandCircleShadowOpacity=.09,this._strokeOpacity=.1)}},{key:"_loadImage",value:function(e,t){var i,n=this;this._needDisplayImage&&(this._image=new Image,this.showAnimatedBranding&&(this._imageWhite=new Image),K?(this._image.src=X.fallbackImages[t+"Blue"],this.showAnimatedBranding&&(this._imageWhite.src=X.fallbackImages[t+"White"])):(i=e.replace(/fill="#[\da-f]{6}"/i,'fill="#FFFFFF"'),this._image.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e),this.showAnimatedBranding&&(this._imageWhite.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(i))),this._image.addEventListener("load",function(){Y&&(n._image=r(n._image,n._imageWidth,n._imageHeight)),n._imageReady=!0,"function"==typeof n._onReadyCallback&&n._onReadyCallback()}))}},{key:"_checkLayout",value:function(){
switch(this._layout){case D:case O:case R:case N:case F:case j:case H:this.show=!0;break;case V:case B:case W:case z:this.show=!1}switch(this._layout){case H:this._needDisplayImage=!0,this._txt=$.t(A);break;case j:this._txt=$.t(M)}}},{key:"_drawTextStroke",value:function(e){var t,i;this._strokeCanv||(this._strokeCanv=document.createElement("canvas"),t=this._strokeCanv.getContext("2d"),i=Math.round(this._strokeWidth*this._upscaleRatio),t.font=this._fontSize*this._upscaleRatio+this._font,this._textWidth=t.measureText(this._txt).width,this._strokeCanv.width=(this._textWidth+2*i)*J,this._strokeCanv.height=(this._fontSize+2*i)*this._upscaleRatio*J,this._strokeCanv.width%2==0&&(this._strokeCanv.width+=1,this._strokeCanv.height+=1),t.textBaseline="top",t.textAlign="start",t.font=this._fontSize*this._upscaleRatio+this._font,t.strokeStyle=this._strokeColor,t.lineWidth=this._strokeWidth*this._upscaleRatio*J,t.lineJoin="round",t.strokeText(this._txt,i,this._verticalTextShift)),e.save(),e.globalAlpha=this._strokeOpacity,e.drawImage(this._strokeCanv,0,0,this._strokeCanv.width,this._strokeCanv.height,0,0,this._strokeCanv.width/this._upscaleRatio/J,this._strokeCanv.height/this._upscaleRatio/J),e.restore()}},{key:"_drawTextFill",value:function(e){this._createFillText(),e.save(),e.drawImage(this._fillCanv,0,0,this._fillCanv.width,this._fillCanv.height,0,0,this._fillCanv.width/this._upscaleRatio/J,this._fillCanv.height/this._upscaleRatio/J),e.restore()}},{key:"_createFillText",value:function(){var e,t;null===this._fillCanv&&(this._fillCanv=document.createElement("canvas"),e=this._fillCanv.getContext("2d"),t=Math.round(this._strokeWidth*this._upscaleRatio),e.font=this._fontSize*this._upscaleRatio+this._font,void 0===this._textWidth&&(this._textWidth=Math.round(e.measureText(this._txt).width)),this._setSizeFillTextCanvas(t),e.textBaseline="top",e.textAlign="start",e.font=this._fontSize*this._upscaleRatio+this._font,e.fillStyle=this._fillColor,e.fillText(this._txt,t,this._verticalTextShift))}},{key:"_updateFillTextWithColor",value:function(e){var t=Math.round(this._strokeWidth*this._upscaleRatio),i=this._fillCanv.getContext("2d");this._setSizeFillTextCanvas(t),i.clearRect(0,0,this._fillCanv.width,this._fillCanv.height),i.textBaseline="top",i.textAlign="start",i.font=this._fontSize*this._upscaleRatio+this._font,i.fillStyle=e,i.fillText(this._txt,t,this._verticalTextShift)}},{key:"_setSizeFillTextCanvas",value:function(e){this._fillCanv.width=(this._textWidth+2*e)*J,this._fillCanv.height=(this._fontSize+2*e)*this._upscaleRatio*J,this._fillCanv.width%2==0&&(this._fillCanv.width+=1,this._fillCanv.height+=1)}},{key:"_drawFillTextCropWidth",value:function(e,t,i){this._fillCanv?this._updateFillTextWithColor(i):this._createFillText(),e.save(),e.drawImage(this._fillCanv,0,0,t*this._upscaleRatio*J,this._fillCanv.height,0,0,t,this._fillCanv.height/this._upscaleRatio/J),e.restore()}},{key:"_drawBgCircle",value:function(e){e.save(),e.beginPath(),e.fillStyle=this._brandCircleShadowColor,e.globalAlpha=this._brandCircleShadowOpacity,
e.arc(this._imageWidth/2,this._imageHeight/2,this._brandCircleSize/2+1,0,2*Math.PI),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._brandCircleColor,e.arc(this._imageWidth/2,this._imageHeight/2,this._brandCircleSize/2,0,2*Math.PI,!1),e.fill(),e.closePath(),e.restore()}},{key:"_drawFillRectWithRoundedCorner",value:function(e,t,i,n,o,r,s){e.save(),(0,v.drawRoundRect)(e,t-1,i-1,n+2,o+2,r),e.globalAlpha=this._brandCircleShadowOpacity,e.fillStyle=this._brandCircleShadowColor,e.fill(),e.closePath(),e.restore(),e.save(),(0,v.drawRoundRect)(e,t,i,n,o,r),e.fillStyle=s,e.fill(),e.closePath(),e.restore()}},{key:"_drawImageWithColor",value:function(e){e.save(),e.globalAlpha=this._animatedOpacity,e.drawImage(this._imageWhite,0,-.5,this._imageWidth,this._imageHeight),e.restore(),e.save(),e.globalAlpha=1-this._animatedOpacity,e.drawImage(this._image,0,-.5,this._imageWidth,this._imageHeight),e.restore()}},{key:"bottomShift",value:function(){return this._bottomShift}},{key:"minimizedAnimationWidth",value:function(){return this._brandCircleSize}},{key:"maximizedAnimationWidth",value:function(){return this._fillCanv.width/this._upscaleRatio/J+this._brandCircleSize-3}},{key:"animatedDrawStep",value:function(e,t){var i,n,o,r,s,a,l,h,u,d,p,_,f,m,y,g;this._animatedWidth=t,i=this._animatedWidth<this._brandCircleSize+20?0:this._animatedWidth/this.maximizedAnimationWidth(),n=(0,S.parseRgb)(this._brandCircleColor),o=c(n,3),r=o[0],s=o[1],a=o[2],l=(0,S.parseRgb)(this._fillColor),h=c(l,3),u=h[0],d=h[1],p=h[2],_=(0,S.parseRgb)(this._strokeColor),f=c(_,3),m=f[0],y=f[1],g=f[2],this._animatedColorBg=(0,S.rgbaToString)((0,S.blendRgba)([r,s,a,(0,S.normalizeAlphaComponent)(1)],[u,d,p,(0,S.normalizeAlphaComponent)(i)])),this._animatedColorText=(0,S.rgbaToString)((0,S.blendRgba)([u,d,p,(0,S.normalizeAlphaComponent)(1)],[m,y,g,(0,S.normalizeAlphaComponent)(i)])),this._animatedOpacity=i}},{key:"draw",value:function(e,t){var i,n,o,r,s,c,h,u,d,p;this.showAnimatedBranding?this._needDisplayImage&&this._imageReady&&(e.save(),i=(this._brandCircleSize-this._imageWidth)/2,n=(this._brandCircleSize-this._imageHeight)/2,e.translate(-i,-n),this._drawFillRectWithRoundedCorner(e,0,0,this._animatedWidth,this._brandCircleSize,this._brandCircleSize/2,this._animatedColorBg),e.translate(i,n),this._drawImageWithColor(e),o=12+(G?-.5:0),r=this._imageWidth+o,this._animatedWidth>r&&(e.translate(this._imageWidth/2+o,.5),this._drawFillTextCropWidth(e,this._animatedWidth-r,this._animatedColorText)),e.restore(),this.width=this._animatedWidth,this.height=this._brandCircleSize,this._bottomShift=this._brandCircleSize-this._imageHeight):this._layout===R||this._layout===F?(s='12px "Trebuchet MS", Tahoma, Arial, sans-serif',e.font=s,c=e.measureText(this._txt).width,this.width=c+e.measureText("TradingView").width,e.save(),e.globalAlpha=.7,e.fillStyle=this._colorOldGray,e.fillText(this._txt,0,12),e.fillStyle=this._colorOldBlue,e.fillText("TradingView",c,12),e.restore()):a(t)&&(this._needDisplayImage&&this._imageReady?(e.save(),
h=(this._brandCircleSize-this._imageWidth)/2,e.translate(h,0),this._drawBgCircle(e),e.drawImage(this._image,0,-.5,this._imageWidth,this._imageHeight),u=12+(G?-.5:0),e.translate(this._imageWidth+u,-.5),d=l(t),d&&(this._drawTextStroke(e),this._drawTextFill(e)),e.restore(),this.width=this._imageWidth+h,this.width+=d?u+this._strokeCanv.width/this._upscaleRatio/J:h,this.height=this._brandCircleSize,this._bottomShift=this._brandCircleSize-this._imageHeight):(e.save(),e.translate(G?-.5:0,-.5),p=l(t),p&&(this._drawTextStroke(e),this._drawTextFill(e)),e.restore(),p&&(this.width=this._strokeCanv.width/this._upscaleRatio/J)))}}]),e}(),ee=function(){function e(t){var i=t.layout,n=void 0===i?V:i,r=t.src,a=t.onReadyCallback;o(this,e),this._img=new Image,this._ready=!1,this.show=!1,this.width=0,this.height=0,this._layout=n,this._src=r,this._onReadyCallback=a,K&&(this._init=s(this._init,this)),this._init()}return h(e,[{key:"_init",value:function(){var e,t,i=this;this._checkLayout(),this.show&&(e=this._src.match(/(\w+)\.svg/),K&&e&&2===e.length?(t=e[1],this._img.src=X.fallbackImages[t],this._img.addEventListener("load",function(){var e=X.logoSizes;t in e?(i.width=e[t].width,i.height=e[t].height):(i.width=135,i.height=25),i._ready=!0,"function"==typeof i._onReadyCallback&&i._onReadyCallback()})):(this._img.src=this._src,this._img.addEventListener("load",function(){i.width=Math.round(i._img.width),i.height=Math.round(i._img.height),Y&&(i._img=r(i._img,i.width,i.height)),i._ready=!0,"function"==typeof i._onReadyCallback&&i._onReadyCallback()})))}},{key:"_checkLayout",value:function(){switch(this._layout){case R:case B:case F:case W:case j:case z:this.show=!0;break;case V:case D:case O:case N:case H:this.show=!1}}},{key:"draw",value:function(e){this._ready&&e.drawImage(this._img,0,0,this.width,this.height)}}]),e}(),t.Branding=function(){function e(t){var i,n=this;o(this,e),this._model=t,this._mainSeries=this._model.mainSeries(),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=24,this._layout=V,this._needToShow=!0,this._customLogoSrc="",this._customLogoLink="",this._checkLayout(),this._layout!==R&&this._layout!==F||(this._left=8,this._bottom=5),i=function(){n._needToShow?n._layout===V?n._showBranding=window.innerWidth>=768:n._showBranding=!0:n._showBranding=!1},this._resizeHandlerDelayed=b(i,200),i(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),this._cubicBezier=new m.CubicBezier(.4,.01,.22,1)}return h(e,[{key:"destroy",value:function(){window.removeEventListener("resize",this._resizeHandlerDelayed)}},{key:"_init",value:function(){var e=this,t=this._mainSeries.symbolInfo()||{};this._powBy=new Q({layout:this._layout,symbol:t.name,model:this._model,onReadyCallback:function(){return e._model.fullUpdate()}}),this._custom=new ee({layout:this._layout,src:this._customLogoSrc,onReadyCallback:function(){return e._model.fullUpdate()}}),this._openAnimation=null,this._closeAnimation=null}},{
switch(this._layout){case D:case O:case R:case F:case N:case j:case H:this.show=!0;break;case V:case B:case W:case z:this.show=!1}switch(this._layout){case H:this._needDisplayImage=!0,this._txt=$.t(A);break;case j:this._txt=$.t(M)}}},{key:"_drawTextStroke",value:function(e){var t,i;this._strokeCanv||(this._strokeCanv=document.createElement("canvas"),t=this._strokeCanv.getContext("2d"),i=Math.round(this._strokeWidth*this._upscaleRatio),t.font=this._fontSize*this._upscaleRatio+this._font,this._textWidth=t.measureText(this._txt).width,this._strokeCanv.width=(this._textWidth+2*i)*J,this._strokeCanv.height=(this._fontSize+2*i)*this._upscaleRatio*J,this._strokeCanv.width%2==0&&(this._strokeCanv.width+=1,this._strokeCanv.height+=1),t.textBaseline="top",t.textAlign="start",t.font=this._fontSize*this._upscaleRatio+this._font,t.strokeStyle=this._strokeColor,t.lineWidth=this._strokeWidth*this._upscaleRatio*J,t.lineJoin="round",t.strokeText(this._txt,i,this._verticalTextShift)),e.save(),e.globalAlpha=this._strokeOpacity,e.drawImage(this._strokeCanv,0,0,this._strokeCanv.width,this._strokeCanv.height,0,0,this._strokeCanv.width/this._upscaleRatio/J,this._strokeCanv.height/this._upscaleRatio/J),e.restore()}},{key:"_drawTextFill",value:function(e){this._createFillText(),e.save(),e.drawImage(this._fillCanv,0,0,this._fillCanv.width,this._fillCanv.height,0,0,this._fillCanv.width/this._upscaleRatio/J,this._fillCanv.height/this._upscaleRatio/J),e.restore()}},{key:"_createFillText",value:function(){var e,t;null===this._fillCanv&&(this._fillCanv=document.createElement("canvas"),e=this._fillCanv.getContext("2d"),t=Math.round(this._strokeWidth*this._upscaleRatio),e.font=this._fontSize*this._upscaleRatio+this._font,void 0===this._textWidth&&(this._textWidth=Math.round(e.measureText(this._txt).width)),this._setSizeFillTextCanvas(t),e.textBaseline="top",e.textAlign="start",e.font=this._fontSize*this._upscaleRatio+this._font,e.fillStyle=this._fillColor,e.fillText(this._txt,t,this._verticalTextShift))}},{key:"_updateFillTextWithColor",value:function(e){var t=Math.round(this._strokeWidth*this._upscaleRatio),i=this._fillCanv.getContext("2d");this._setSizeFillTextCanvas(t),i.clearRect(0,0,this._fillCanv.width,this._fillCanv.height),i.textBaseline="top",i.textAlign="start",i.font=this._fontSize*this._upscaleRatio+this._font,i.fillStyle=e,i.fillText(this._txt,t,this._verticalTextShift)}},{key:"_setSizeFillTextCanvas",value:function(e){this._fillCanv.width=(this._textWidth+2*e)*J,this._fillCanv.height=(this._fontSize+2*e)*this._upscaleRatio*J,this._fillCanv.width%2==0&&(this._fillCanv.width+=1,this._fillCanv.height+=1)}},{key:"_drawFillTextCropWidth",value:function(e,t,i){this._fillCanv?this._updateFillTextWithColor(i):this._createFillText(),e.save(),e.drawImage(this._fillCanv,0,0,t*this._upscaleRatio*J,this._fillCanv.height,0,0,t,this._fillCanv.height/this._upscaleRatio/J),e.restore()}},{key:"_drawBgCircle",value:function(e){e.save(),e.beginPath(),e.fillStyle=this._brandCircleShadowColor,e.globalAlpha=this._brandCircleShadowOpacity,
e.arc(this._imageWidth/2,this._imageHeight/2,this._brandCircleSize/2+1,0,2*Math.PI),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._brandCircleColor,e.arc(this._imageWidth/2,this._imageHeight/2,this._brandCircleSize/2,0,2*Math.PI,!1),e.fill(),e.closePath(),e.restore()}},{key:"_drawFillRectWithRoundedCorner",value:function(e,t,i,n,o,r,s){e.save(),(0,v.drawRoundRect)(e,t-1,i-1,n+2,o+2,r),e.globalAlpha=this._brandCircleShadowOpacity,e.fillStyle=this._brandCircleShadowColor,e.fill(),e.closePath(),e.restore(),e.save(),(0,v.drawRoundRect)(e,t,i,n,o,r),e.fillStyle=s,e.fill(),e.closePath(),e.restore()}},{key:"_drawImageWithColor",value:function(e){e.save(),e.globalAlpha=this._animatedOpacity,e.drawImage(this._imageWhite,0,-.5,this._imageWidth,this._imageHeight),e.restore(),e.save(),e.globalAlpha=1-this._animatedOpacity,e.drawImage(this._image,0,-.5,this._imageWidth,this._imageHeight),e.restore()}},{key:"bottomShift",value:function(){return this._bottomShift}},{key:"minimizedAnimationWidth",value:function(){return this._brandCircleSize}},{key:"maximizedAnimationWidth",value:function(){return this._fillCanv.width/this._upscaleRatio/J+this._brandCircleSize-3}},{key:"animatedDrawStep",value:function(e,t){var i,n,o,r,s,a,l,h,u,d,p,_,f,m,y,g;this._animatedWidth=t,i=this._animatedWidth<this._brandCircleSize+20?0:this._animatedWidth/this.maximizedAnimationWidth(),n=(0,S.parseRgb)(this._brandCircleColor),o=c(n,3),r=o[0],s=o[1],a=o[2],l=(0,S.parseRgb)(this._fillColor),h=c(l,3),u=h[0],d=h[1],p=h[2],_=(0,S.parseRgb)(this._strokeColor),f=c(_,3),m=f[0],y=f[1],g=f[2],this._animatedColorBg=(0,S.rgbaToString)((0,S.blendRgba)([r,s,a,(0,S.normalizeAlphaComponent)(1)],[u,d,p,(0,S.normalizeAlphaComponent)(i)])),this._animatedColorText=(0,S.rgbaToString)((0,S.blendRgba)([u,d,p,(0,S.normalizeAlphaComponent)(1)],[m,y,g,(0,S.normalizeAlphaComponent)(i)])),this._animatedOpacity=i}},{key:"draw",value:function(e,t){var i,n,o,r,s,c,h,u,d,p;this.showAnimatedBranding?this._needDisplayImage&&this._imageReady&&(e.save(),i=(this._brandCircleSize-this._imageWidth)/2,n=(this._brandCircleSize-this._imageHeight)/2,e.translate(-i,-n),this._drawFillRectWithRoundedCorner(e,0,0,this._animatedWidth,this._brandCircleSize,this._brandCircleSize/2,this._animatedColorBg),e.translate(i,n),this._drawImageWithColor(e),o=12+(G?-.5:0),r=this._imageWidth+o,this._animatedWidth>r&&(e.translate(this._imageWidth/2+o,.5),this._drawFillTextCropWidth(e,this._animatedWidth-r,this._animatedColorText)),e.restore(),this.width=this._animatedWidth,this.height=this._brandCircleSize,this._bottomShift=this._brandCircleSize-this._imageHeight):this._layout===R||this._layout===N?(s='12px "Trebuchet MS", Tahoma, Arial, sans-serif',e.font=s,c=e.measureText(this._txt).width,this.width=c+e.measureText("TradingView").width,e.save(),e.globalAlpha=.7,e.fillStyle=this._colorOldGray,e.fillText(this._txt,0,12),e.fillStyle=this._colorOldBlue,e.fillText("TradingView",c,12),e.restore()):a(t)&&(this._needDisplayImage&&this._imageReady?(e.save(),
h=(this._brandCircleSize-this._imageWidth)/2,e.translate(h,0),this._drawBgCircle(e),e.drawImage(this._image,0,-.5,this._imageWidth,this._imageHeight),u=12+(G?-.5:0),e.translate(this._imageWidth+u,-.5),d=l(t),d&&(this._drawTextStroke(e),this._drawTextFill(e)),e.restore(),this.width=this._imageWidth+h,this.width+=d?u+this._strokeCanv.width/this._upscaleRatio/J:h,this.height=this._brandCircleSize,this._bottomShift=this._brandCircleSize-this._imageHeight):(e.save(),e.translate(G?-.5:0,-.5),p=l(t),p&&(this._drawTextStroke(e),this._drawTextFill(e)),e.restore(),p&&(this.width=this._strokeCanv.width/this._upscaleRatio/J)))}}]),e}(),ee=function(){function e(t){var i=t.layout,n=void 0===i?V:i,r=t.src,a=t.onReadyCallback;o(this,e),this._img=new Image,this._ready=!1,this.show=!1,this.width=0,this.height=0,this._layout=n,this._src=r,this._onReadyCallback=a,K&&(this._init=s(this._init,this)),this._init()}return h(e,[{key:"_init",value:function(){var e,t,i=this;this._checkLayout(),this.show&&(e=this._src.match(/(\w+)\.svg/),K&&e&&2===e.length?(t=e[1],this._img.src=X.fallbackImages[t],this._img.addEventListener("load",function(){var e=X.logoSizes;t in e?(i.width=e[t].width,i.height=e[t].height):(i.width=135,i.height=25),i._ready=!0,"function"==typeof i._onReadyCallback&&i._onReadyCallback()})):(this._img.src=this._src,this._img.addEventListener("load",function(){i.width=Math.round(i._img.width),i.height=Math.round(i._img.height),Y&&(i._img=r(i._img,i.width,i.height)),i._ready=!0,"function"==typeof i._onReadyCallback&&i._onReadyCallback()})))}},{key:"_checkLayout",value:function(){switch(this._layout){case R:case B:case N:case W:case j:case z:this.show=!0;break;case V:case D:case O:case F:case H:this.show=!1}}},{key:"draw",value:function(e){this._ready&&e.drawImage(this._img,0,0,this.width,this.height)}}]),e}(),t.Branding=function(){function e(t){var i,n=this;o(this,e),this._model=t,this._mainSeries=this._model.mainSeries(),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=24,this._layout=V,this._needToShow=!0,this._customLogoSrc="",this._customLogoLink="",this._checkLayout(),this._layout!==R&&this._layout!==N||(this._left=8,this._bottom=5),i=function(){n._needToShow?n._layout===V?n._showBranding=window.innerWidth>=768:n._showBranding=!0:n._showBranding=!1},this._resizeHandlerDelayed=b(i,200),i(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),this._cubicBezier=new m.CubicBezier(.4,.01,.22,1)}return h(e,[{key:"destroy",value:function(){window.removeEventListener("resize",this._resizeHandlerDelayed)}},{key:"_init",value:function(){var e=this,t=this._mainSeries.symbolInfo()||{};this._powBy=new Q({layout:this._layout,symbol:t.name,model:this._model,onReadyCallback:function(){return e._model.fullUpdate()}}),this._custom=new ee({layout:this._layout,src:this._customLogoSrc,onReadyCallback:function(){return e._model.fullUpdate()}}),this._openAnimation=null,this._closeAnimation=null}},{
key:"_checkLayout",value:function(){if(_.enabled("widget"));else if(_.enabled("charting_library")||_.enabled("amp_terminal")||_.enabled("cqg_terminal")||_.enabled("trading_terminal")){var e=JSON.parse(Z.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=_.enabled("widget_logo"),_.enabled("link_to_tradingview")?this._layout=j:this._layout=z):(this._layout=H,this._needToShow=_.enabled("widget_logo"))}else this._layout=V}},{key:"_startOpenAnimation",value:function(){null===this._openAnimation&&(null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null),this._openAnimation=(0,g.doAnimate)({from:this._currentStateForAnimation(),to:this._openedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}},{key:"_startCloseAnimation",value:function(){null===this._closeAnimation&&(null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null),this._closeAnimation=(0,g.doAnimate)({from:this._currentStateForAnimation(),to:this._closedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}},{key:"_currentStateForAnimation",value:function(){return this._powBy.width}},{key:"_closedStateForAnimation",value:function(){return this._powBy.minimizedAnimationWidth()}},{key:"_openedStateForAnimation",value:function(){return this._powBy.maximizedAnimationWidth()}},{key:"_animatedDrawStep",value:function(e,t){this._powBy.animatedDrawStep(e,t),this._model.lightUpdate()}},{key:"updateAllViews",value:function(){}},{key:"priceScale",value:function(){}},{key:"priceAxisViews",value:function(){}},{key:"onClickOutside",value:function(){}},{key:"hasContextMenu",value:function(){return!1}},{key:"hitTest",value:function(e){var t=this;return!this._showBranding||_.enabled("logo_without_link")?null:this._powBy&&this._layout!==V&&this._layout!==B&&this._layout!==W&&(0,d.pointInRectangle)(e,new u.Point(this._left,this._paneHeight-this._bottom+this._powBy.bottomShift()/2-Math.max(this._powBy.height,void 0!==this._custom?this._custom.height:0)),new u.Point(this._left+Math.max(this._powBy.width,void 0!==this._custom?this._custom.width:0),this._paneHeight-this._bottom+this._powBy.bottomShift()/2))?new f.HitTestResult(f.HitTestResult.CUSTOM,{mouseUpHandler:function(){window.open(t.tvUrl(),"_blank").opener=null},mouseEnterHandler:function(){t._startOpenAnimation()},mouseLeaveHandler:function(){t._startCloseAnimation()}}):void 0}},{key:"tvUrl",value:function(){var e,t="https://www.tradingview.com/";if(this._customLogoLink)return this._customLogoLink;if(this._layout===H||this._layout===j){switch(e=void 0,!0){case _.enabled("charting_library"):e="library";break;case _.enabled("trading_terminal"):case _.enabled("amp_terminal"):case _.enabled("cqg_terminal"):e="trading-terminal"}return t+="/"===t[t.length-1]?"?":"&",t+="utm_source="+window.location.origin+"&utm_medium=library"+(e?"&utm_campaign="+e:"")}return t}},{key:"draw",value:function(e){if(this._showBranding){var t=0
;this._powBy&&this._powBy.show&&(t=this._powBy.height-this._powBy.bottomShift(),e.save(),e.translate(this._left,this._paneHeight-this._bottom-t),this._powBy.draw(e,this._canvasWidth),e.restore()),this._custom&&this._custom.show&&(e.save(),e.translate(this._left,this._paneHeight-this._bottom-t-this._custom.height),this._custom.draw(e),e.restore())}}},{key:"renderer",value:function(e,t){return this._paneHeight=this._pane.height(),this._canvasWidth=t,{draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)}}},{key:"paneViews",value:function(e){var t=_.enabled("move_logo_to_main_pane");return t&&e.isMainPane()||!t&&e.isLast()||e.isMaximized()?(this._pane=e,[{renderer:this.renderer.bind(this)}]):[]}}]),e}()},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 13" width="22" height="13"><path fill="#37A6EF" fill-rule="nonzero" d="M19.354 4.932c.379.55.611 1.207.642 1.918A3.007 3.007 0 0 1 22 9.686a3.003 3.003 0 0 1-3 3.006H4a3.983 3.983 0 0 1-2.814-1.16l6.363-5.048a1.657 1.657 0 0 0 1.495.037l3.034 2.66a1.672 1.672 0 0 0 1.589 2.175 1.668 1.668 0 0 0 1.552-2.28l4.135-4.144zm-.942-.945L14.276 8.13a1.66 1.66 0 0 0-1.32.044l-3.034-2.66A1.672 1.672 0 0 0 8.333 3.34a1.668 1.668 0 0 0-1.611 2.097l-6.316 5.01A3.999 3.999 0 0 1 0 8.683a4.004 4.004 0 0 1 4.041-4.008A5.338 5.338 0 0 1 9.333 0a5.337 5.337 0 0 1 5.124 3.857 3.644 3.644 0 0 1 1.876-.517c.772 0 1.488.239 2.079.647z"/></svg>'},function(e,t,i){"use strict";(function(e){function n(e,t,i,n){this._prices=[],this._canvas=$("<canvas>"),this._cache=this._canvas.get(0).getContext("2d"),this.reset({font:e,fontSize:t,backColors:i,colors:n}),this._priceAxisFontSize=11}function o(e,t){this._model=e,this._source=t,this._pivots=[],this._textCache={}}function r(e,t){this._source=e,this._model=e._model,this._prices=[],this._invidated=!0,this._cache=t}function s(e,t,i,n){var o,r,s;for(p.call(this,e,t,i,n),o=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],r=this.properties().levelsStyle.visibility,s=0;s<o.length;s++)r[o[s]].listeners().subscribe(this,TradingView.Study.prototype.processHibernate)}var a=i(6).Point,l=i(24),c=l.parseRgb,h=l.rgbToBlackWhiteString,u=i(119),d=i(117).StudyDataWindowView,p=i(180).NonSeriesStudy,_=i(625).StandardPivotPointsPriceAxisView,f=i(185).TrendLineRenderer,m=i(100),y=i(312),g=i(9).HitTestResult,v=i(69).CompositeRenderer,S=i(17).PlotRowSearchMode,b=i(2).propertyPages,w=i(104).LineEnd;n.prototype.destroy=function(){this._canvas.remove()},n.prototype.reset=function(e){this._prices=[],this._params=e,this._cache.setFont(e.fontSize+"px "+e.font);var t=this;this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce(function(e,i){var n=t._cache.measureText(i).width;return Math.max(n,e)},0)},n.prototype.rowHeight=function(){return this._priceAxisFontSize+4},n.prototype._labelRectByIndex=function(e){return{left:0,top:Math.round(this._topByIndex(e)),width:Math.round(this._labelWidth+4),height:this._params.fontSize+8}},n.prototype.params=function(){return this._params},n.prototype._centerByIndex=function(e){
return Math.round((e+.5)*(this._params.fontSize+8))},n.prototype._topByIndex=function(e){return Math.round(e*(this._params.fontSize+8))},n.prototype.setPrices=function(e){var t,i,n,o,r,s,a=8,l=!1,c=function(e,t){return void 0===e&&void 0===t||e.formatted===t.formatted};if(e.length!==this._prices.length)l=!0;else for(t=0;t<this._prices.length;t++)if(!c(this._prices[t],e[t])){l=!0;break}if(l){for(i=this,i._cache.save(),i._cache.font=this._priceAxisFontSize+"px Arial",i._cache.restore(),n=this._labelWidth+6,o=window.hidpiCanvasRatio||1,n*=o,this._canvas.prop("width",n),r=Math.max(e.length,22)*(this._params.fontSize+a),r*=o,this._canvas.prop("height",r),this._canvas.css("width",n).css("height",r),this._prices=e,this._cache.clearRect(0,0,n,r),this._cache.save(),this._cache.translate(.5,.5),this._cache.font=this._params.fontSize+"px "+this._params.font,this._cache.textBaseline="middle",t=0;t<this._prices.length;t++)this._prices[t]&&(s=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"][t],this._cache.fillStyle=this._params.backColors[t],this._cache.fillText(s,0,this._centerByIndex(t)),this._cache.fillText("/",0,this._centerByIndex(t+11)));this._prices=e,this._cache.restore()}},o.prototype.setCache=function(e){this._cache=e},o.prototype.priceAxisViews=function(e,t){return this._priceAxisViews},o.prototype.mergeLabel=function(e,t,i){var n=""+t;void 0===e[n]?(e[n]={},e[n].text=i,e[n].ids=[this.complete(i)]):(e[n].text+="/"+i,e[n].ids.push(this.complete(i)))},o.prototype.complete=function(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]},o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){var e,t,i,n,o,r,s,a,l,c,h,u,d,p,_,f,m,y;if(this._source.pricesView().prices(),this._pivots=[],this._source.customData()&&this._source.customData().pivots&&this._source.properties().visible.value()&&(e=this._source.customData().pivots,t=this._source._indexes,i=this._model.timeScale(),(n=this._source.priceScale())&&!n.isEmpty()&&!i.isEmpty()&&e&&(o=i.visibleBars(),r=o.firstBar(),s=o.lastBar(),this._source.ownerSource())))for(a=this._source.ownerSource().firstValue(),l=0;l<e.length;l++)if(e[l]&&(c=t[e[l].startIndex],!((h=t[e[l].endIndex])<r||c>s))){u={},d=this._source.properties().levelsStyle.visibility,d.P.value()&&this.mergeLabel(u,e[l].p,"P"),d["S1/R1"].value()&&(this.mergeLabel(u,e[l].s1,"S1"),this.mergeLabel(u,e[l].r1,"R1")),d["S2/R2"].value()&&(this.mergeLabel(u,e[l].s2,"S2"),this.mergeLabel(u,e[l].r2,"R2")),d["S3/R3"].value()&&(this.mergeLabel(u,e[l].s3,"S3"),this.mergeLabel(u,e[l].r3,"R3")),d["S4/R4"].value()&&(this.mergeLabel(u,e[l].s4,"S4"),this.mergeLabel(u,e[l].r4,"R4")),d["S5/R5"].value()&&(this.mergeLabel(u,e[l].s5,"S5"),this.mergeLabel(u,e[l].r5,"R5")),p=i.indexToCoordinate(c),_=i.indexToCoordinate(h);for(f in u)m=parseFloat(f),y=n.priceToCoordinate(m,a),this._pivots.push({x1:p,x2:_,y:y,label:u[f].text,labelIds:u[f].ids})}},o.prototype.renderer=function(){var e,t,i,n,o,r,s,l,c,h,u,d,p,_,m,S,b;for(this._invalidated&&(this._updateImpl(),this._invalidated=!1),e=new v,
@@ -503,21 +503,21 @@ this.jqIcon.addClass("context-menu"),this.jqIcon},r.prototype._createDeleteButto
e.pageX=this._parentMenu.jqMenu.width()-2,e.pageY=this.jqSubmenu.offset().top-this._parentMenu.jqMenu.offset().top-1,this._menu.show(e,this._parentMenu.jqMenu))},r.prototype._rowTagAttributes=function(){var e=[];return this.action&&(!1===this.action.enabled&&e.push("disabled"),!1===this.action.visible&&e.push("hidden"),this.action.font&&e.push("font_"+this.action.font),this.action.hasSubActions()&&e.push("has_submenu"),this.action.htmlclass&&e.push(this.action.htmlclass)),{class:e.join(" ")}},r.prototype.appendCallback=function(){var e=this;this.jqRow.click(function(t){e.action.enabled&&e.action.executeCallback(t)})},r.prototype.getTopLevelMenu=function(){return n(this)},s.prototype.render=function(e){this._createRow();var t=this;return this.action.deferred.then(function(n){var o,r,s,a=i(288);for(o in n)r=n[o],s=t._parentMenu.addItem(r),a.renderItem(e,s)}).always(function(){t.jqRow.hide()}),this.jqRow},s.prototype._createIconTag=function(){var e=this._iconTagAttributes();return this.jqIcon=l.create(a.ICON_CELL_TAG,e),this.jqIcon.addClass("context-menu"),this.jqIcon},s.prototype._createRow=function(){var e=this._rowTagAttributes();this.jqRow=l.create(a.ITEM_ROW_TAG,e),this.jqRow.append(this._createIconTag()),this.jqRow.addClass("context-menu")},s.prototype._rowTagAttributes=function(){var e=[];return this.action&&e.push("spinner"),{class:e.join(" ")}},s.prototype.highlight=function(e){},s.prototype._iconTagAttributes=function(){var e={},t=[];return t.push("spacer"),e.class=t.join(" "),e.colspan="10",e},t.Item=r,t.ItemPlaceholder=s},function(e,t,i){"use strict";function n(e){var t,i;return e.getClientRects().length?(t=e.getBoundingClientRect(),"fixed"===getComputedStyle(e).position?{top:t.top,left:t.left}:(i=e.ownerDocument.defaultView,{top:t.top+i.pageYOffset,left:t.left+i.pageXOffset})):{top:0,left:0}}function o(e,t){var i,o,a,l,c,h,u=getComputedStyle(e),d=u.position;"static"===d&&(e.style.position="relative"),i=n(e),o=u.top,a=u.left,l=0,c=0,"absolute"!==d&&"fixed"!==d||"auto"!==o&&"auto"!==a?(o&&(l=parseFloat(o)),a&&(c=parseFloat(a))):(h=r(e),l=h.top,c=h.left),Object(s.isNumber)(t.top)&&(e.style.top=t.top-i.top+l+"px"),Object(s.isNumber)(t.left)&&(e.style.left=t.left-i.left+c+"px")}function r(e){var t=e.ownerDocument,i=e.offsetParent||t.documentElement,o=n(e),r=n(i);return{top:o.top-r.top,left:o.left-r.left}}var s;Object.defineProperty(t,"__esModule",{value:!0}),t.getOffset=n,t.setOffset=o,t.getPosition=r,s=i(84),i.n(s)},function(e,t,i){"use strict";(function(t){function n(e,t,i,n){this.reset(e,t,i,n)}var o=i(79).makeFont,r=i(116),s=t.enabled("charting_library_debug_mode");n.prototype.maxCount=200,n.prototype.reset=function(e,t,i,n){this._textWidthCache=new r(this.maxCount),this._fontSize=e,this._color=n,this._font=o(e,t,i),this._keys=[],this._hash={}},n.prototype.paintTo=function(e,t,i,n,o){var r=this.getLabelImage(e,t);"left"!==o&&(i-=r.textWidth),n-=Math.floor(r.height/2),e.drawImage(r.canvas,i,n)},n.prototype.getLabelImage=function(e,t){var i,n,o,r,a
;return Object.prototype.hasOwnProperty.call(this._hash,t)?i=this._hash[t]:(this._keys.length>=this.maxCount&&(n=this._keys.shift(),delete this._hash[n]),i={text:t,textWidth:0,width:0,height:0,canvas:document.createElement("canvas")},o=Math.ceil(this._fontSize/4.5),r=Math.round(this._fontSize/10),a=Math.ceil(this._textWidthCache.measureText(e,t)),i.textWidth=Math.round(Math.max(1,a)),i.width=Math.round(a+2*o),i.height=this._fontSize+2*o,0!==a?(this._keys.push(i.text),this._hash[i.text]=i):s&&console.log('Canvas 2d context measureText return zero width for "'+t+'" text'),i.canvas.width=i.width,i.canvas.height=i.height,e=i.canvas.getContext("2d"),e.font=this._font,e.fillStyle=this._color,e.fillText(t,0,i.height-o-r)),i},e.exports=n}).call(t,i(5))},function(e,t,i){"use strict";function n(e,t,i){return void 0===i&&(i="promise rejected by time-out"),new Promise(function(n,o){var r=setTimeout(function(){return o(i)},t);e.then(function(e){clearTimeout(r),n(e)}),e.catch(function(e){clearTimeout(r),o(e)})})}Object.defineProperty(t,"__esModule",{value:!0}),t.makeTimeLimited=n},function(e,t,i){"use strict";function n(e,t,i){this.chart=e,this.paneA=e.paneWidgets()[t],this.paneB=e.paneWidgets()[i],this.jqRow=$(document.createElement("tr")),this.jqRow.height(n.HEIGHT),this.jqCell=$(document.createElement("td")),this.jqCell.appendTo(this.jqRow),this.jqCell.addClass("pane-separator"),this.jqCell.attr("colspan","3"),this.jqCell.css("background",this.chart.properties().scalesProperties.lineColor.value()),this.jqCell.click(function(){}),this.handle=$('<div class="handle">').appendTo(this.jqCell),this._mouseEventHandler=new r(this.handle,this,!0)}var o,r;i(642),o=i(50).clamp,r=i(111).MouseEventHandler,n.prototype.destroy=function(){this._mouseEventHandler.destroy(),this.jqRow.remove()},n.HEIGHT=1,n.prototype.hide=function(){this.jqRow.addClass("js-hidden")},n.prototype.show=function(){this.jqRow.removeClass("js-hidden")},n.prototype.mouseDownEvent=function(e){(0===e.button||Modernizr.touch)&&(this.startY=e.pageY,this.deltaY=0,this.totalHeight=this.paneA.size.h+this.paneB.size.h,this.totalStretch=this.paneA.stretchFactor()+this.paneB.stretchFactor(),this.prevStretchA=this.paneA.stretchFactor(),this.minPaneHeight=30,this.maxPaneHeight=this.totalHeight-this.minPaneHeight,this.pixelStretchFactor=this.totalStretch/this.totalHeight)},n.prototype.pressedMouseMoveEvent=function(e){var t,i,n,r;(0===e.button||Modernizr.touch)&&(e.preventDefault(),this.deltaY=e.pageY-this.startY,t=this.paneA.size.h,i=o(t+this.deltaY,this.minPaneHeight,this.maxPaneHeight),n=i*this.pixelStretchFactor,r=this.totalStretch-n,this.paneA.setStretchFactor(n),this.paneB.setStretchFactor(r),this.chart._adjustSize(),this.paneA.size.h!==t&&(this.startY=e.pageY),this.chart.paint())},n.prototype.mouseUpEvent=function(e){(0===e.button||Modernizr.touch)&&(this.chart._model.addPaneStretchFactorUndoCommand(this.paneA._state,this.paneB._state,this.prevStretchA,this.paneA.stretchFactor()),this.startY=0,this.deltaY=0,this.totalHeight=0,this.totalStretch=0,this.minPaneHeight=0,
this.maxPaneHeight=0,this.pixelStretchFactor=0)},n.prototype.update=function(){this.jqCell.css("background",this.chart.properties().scalesProperties.lineColor.value())},n.prototype.paint=function(){},n.prototype.image=function(){var e={},t=n.HEIGHT,i=this.paneA.lhsPriceAxisWidget.size.w,o=this.paneA.size.w,r=this.paneA.rhsPriceAxisWidget.size.w,s=$('<canvas width="'+i+'" height="'+t+'">')[0],a=s.getContext("2d");return a.fillStyle=this.chart.properties().scalesProperties.lineColor.value(),a.fillRect(0,0,i,t),e.leftAxis={content:s.toDataURL(),contentWidth:i,contentHeight:t},s=$('<canvas width="'+o+'" height="'+t+'">')[0],a=s.getContext("2d"),a.fillStyle=this.chart.properties().scalesProperties.lineColor.value(),a.fillRect(0,0,o,t),e.content=s.toDataURL(),e.contentWidth=o,e.contentHeight=t,s=$('<canvas width="'+r+'" height="'+t+'">')[0],a=s.getContext("2d"),a.fillStyle=this.chart.properties().scalesProperties.lineColor.value(),a.fillRect(0,0,r,t),e.rightAxis={content:s.toDataURL(),contentWidth:r,contentHeight:t},e},e.exports=n},function(e,t){},function(e,t,i){"use strict";function n(e,t,n,r,s,a,l,c,h){var u=i(644).ChartUndoModel,d=new u(e,t,n,r,s,a,l,c,h);return d.model().invalidate(new o(o.FULL_UPDATE)),d}var o=i(18),r=i(26);TradingView.MAMetaInfo=function(){return new r({id:"MASimple",inputs:[{id:"length",type:"integer",defval:10},{id:"source",type:"text",defval:"close"}],plots:[{id:"MovAvg",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"true"}],palettes:{}})},TradingView.VolumeMetaInfo=function(){var e={id:"Volume",inputs:[],plots:[{id:"Volume",type:"histogram"},{id:"Color",type:"colorer",palette:"volumePalette",target:"Volume"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{volumePalette:{colors:{0:{color:"#007F0E",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Up Volume"},1:{color:"#872323",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Down Volume"}}}}};return new r(e)},TradingView.DMMetaInfo=function(){return new r({id:"DM",inputs:[{id:"ADX smoothing",max:50,min:1,type:"integer",defval:14},{id:"DI Length",max:500,min:1,type:"integer",defval:14}],plots:[{id:"ADX",type:"line"},{id:"DI_P",type:"line"},{id:"DI_N",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}})},TradingView.RSIMetaInfo=function(){return new r({id:"RSI",inputs:[{id:"length",type:"integer",defval:14}],plots:[{id:"RelativeStrengthIndex",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}})},e.exports=n},function(e,t,i){"use strict";(function(e){function n(t,i,n,o,r,s,a,l,c){this._chartWidget=s,this.m_model=new z(t,i,n,o,r,this,l,c),this.m_zoomStack=new oe,this.undoHistory=a,this._onRearrangePanes=new e,this._onSimpleZoomIn=new e,this._onSimpleZoomOut=new e,this._currentCustomMoveSource=null,this._currentLineMoveCommand=null,this.beginUndoMacro=a.beginUndoMacro.bind(a),this.endUndoMacro=a.endUndoMacro.bind(a),this.createUndoCheckpoint=a.createUndoCheckpoint.bind(a),this.undoToCheckpoint=a.undoToCheckpoint.bind(a)}function o(e,t,i,n){
re.call(this,i),this._targetObj=e,this._newValue=t,this._model=n}function r(e,t,i,n){re.call(this,i),this._priceScale=t,this._newMode=e,this._model=n}function s(e,t,i,n){re.call(this,i),this._property=e,this._newValue=t,this._model=n,this._priceScale=this._model.mainSeries().priceScale()}function a(e,t,i,n){re.call(this,"scale price",!1),this.m_model=e,this.m_pane=t,this.m_priceScale=i,this.m_state=n,this.m_newPriceScaleState=null}function l(e,t,i){re.call(this,i,!1),this.setCustomFlag("doesnt_affect_save",!0),this.m_model=e,this.m_state=t,this.m_newTimeScaleState=null}function c(e,t,i,n){this._model=e,this._series=t,this._oldSymbol=t.symbol(),this._oldInterval=t.interval(),this._symbol=i,this._interval=n}function h(e,t,i,n,o){re.call(this,"Insert "+t.id),this._model=e,this._studyMetaInfo=t,this._props=i,this._isOverlay=n,this._parentSource=o,this._oldShowLeftScale=e.isLeftPriceScaleVisible(),this._oldShowRightScale=e.isRightPriceScaleVisible()}function u(e,t){re.call(this,"Remove Source"),this._model=e,this._sourceId=t.id()}function d(e,t){re.call(this,"Remove Drawing(s)"),this._model=e,this._linetools=t,this._statesByPaneIndexes={}}function p(e,t,i,n){this._model=e,this._oldPane=this._model.paneForSource(t),re.call(this,this._oldPane===i?"Change Price Scale":"Move Source"),this._sourceId=t.id(),this._oldPaneIndex=e.panes().indexOf(this._oldPane),this._oldScaleName=this._oldPane.priceScaleName(t.priceScale()),this._oldShowLeftScale=e.isLeftPriceScaleVisible(),this._oldShowRightScale=e.isRightPriceScaleVisible(),this._pane=i,this._paneIndex=e.panes().indexOf(i),this._pane?this._scaleName=this._pane.priceScaleName(n):this._paneIndex=e.panes().length}function _(e,t,i){this._model=e,this._sourceId=t.id(),this._oldShowLeftScale=e.isLeftPriceScaleVisible(),this._oldShowRightScale=e.isRightPriceScaleVisible(),re.call(this,i)}function f(e,t){_.call(this,e,t,"Merge Up"),this._mergeRedoFn=this._model.mergeSourceUp,this._mergeUndoFn=this._model.unmergeSourceDown}function m(e,t){_.call(this,e,t,"Merge Down"),this._mergeRedoFn=this._model.mergeSourceDown,this._mergeUndoFn=this._model.unmergeSourceUp}function y(e,t){_.call(this,e,t,"Unmerge Up"),this._mergeRedoFn=this._model.unmergeSourceUp,this._mergeUndoFn=this._model.mergeSourceDown}function g(e,t){_.call(this,e,t,"Unmerge Down"),this._mergeRedoFn=this._model.unmergeSourceDown,this._mergeUndoFn=this._model.mergeSourceUp}function v(e,t,i){re.call(this,"Create line "+i,!1),this._model=e,this._paneIndex=e.panes().indexOf(t),this._lineTool=i}function S(e,t,i,n){re.call(this,"Move Drawing",!1),this._model=e,this._sourceId=t.id(),this._origPoint=i instanceof F?i.clone():TradingView.clone(i),this._pointIndex=n}function b(e,t,i){re.call(this,"Change %1 Z order (%2)".format(t.title(),i>0?"Forward":"Backward")),this._model=e,this._sourceId=t.id(),this._shift=i}function w(e,t){re.call(this,"Send "+t.title()+" to back"),this._model=e,this._sourceId=t.id()}function P(e,t){re.call(this,"Bring "+t.title()+" to front"),this._model=e,this._sourceId=t.id()}function T(e,t,i){
re.call(this,i),this._targetObj=e,this._newValue=t,this._model=n}function r(e,t,i,n){re.call(this,i),this._priceScale=t,this._newMode=e,this._model=n}function s(e,t,i,n){re.call(this,i),this._property=e,this._newValue=t,this._model=n,this._priceScale=this._model.mainSeries().priceScale()}function a(e,t,i,n){re.call(this,"scale price",!1),this.m_model=e,this.m_pane=t,this.m_priceScale=i,this.m_state=n,this.m_newPriceScaleState=null}function l(e,t,i){re.call(this,i,!1),this.setCustomFlag("doesnt_affect_save",!0),this.m_model=e,this.m_state=t,this.m_newTimeScaleState=null}function c(e,t,i,n){this._model=e,this._series=t,this._oldSymbol=t.symbol(),this._oldInterval=t.interval(),this._symbol=i,this._interval=n}function h(e,t,i,n,o){re.call(this,"Insert "+t.id),this._model=e,this._studyMetaInfo=t,this._props=i,this._isOverlay=n,this._parentSource=o,this._oldShowLeftScale=e.isLeftPriceScaleVisible(),this._oldShowRightScale=e.isRightPriceScaleVisible()}function u(e,t){re.call(this,"Remove Source"),this._model=e,this._sourceId=t.id()}function d(e,t){re.call(this,"Remove Drawing(s)"),this._model=e,this._linetools=t,this._statesByPaneIndexes={}}function p(e,t,i,n){this._model=e,this._oldPane=this._model.paneForSource(t),re.call(this,this._oldPane===i?"Change Price Scale":"Move Source"),this._sourceId=t.id(),this._oldPaneIndex=e.panes().indexOf(this._oldPane),this._oldScaleName=this._oldPane.priceScaleName(t.priceScale()),this._oldShowLeftScale=e.isLeftPriceScaleVisible(),this._oldShowRightScale=e.isRightPriceScaleVisible(),this._pane=i,this._paneIndex=e.panes().indexOf(i),this._pane?this._scaleName=this._pane.priceScaleName(n):this._paneIndex=e.panes().length}function _(e,t,i){this._model=e,this._sourceId=t.id(),this._oldShowLeftScale=e.isLeftPriceScaleVisible(),this._oldShowRightScale=e.isRightPriceScaleVisible(),re.call(this,i)}function f(e,t){_.call(this,e,t,"Merge Up"),this._mergeRedoFn=this._model.mergeSourceUp,this._mergeUndoFn=this._model.unmergeSourceDown}function m(e,t){_.call(this,e,t,"Merge Down"),this._mergeRedoFn=this._model.mergeSourceDown,this._mergeUndoFn=this._model.unmergeSourceUp}function y(e,t){_.call(this,e,t,"Unmerge Up"),this._mergeRedoFn=this._model.unmergeSourceUp,this._mergeUndoFn=this._model.mergeSourceDown}function g(e,t){_.call(this,e,t,"Unmerge Down"),this._mergeRedoFn=this._model.unmergeSourceDown,this._mergeUndoFn=this._model.mergeSourceUp}function v(e,t,i){re.call(this,"Create line "+i,!1),this._model=e,this._paneIndex=e.panes().indexOf(t),this._lineTool=i}function S(e,t,i,n){re.call(this,"Move Drawing",!1),this._model=e,this._sourceId=t.id(),this._origPoint=i instanceof N?i.clone():TradingView.clone(i),this._pointIndex=n}function b(e,t,i){re.call(this,"Change %1 Z order (%2)".format(t.title(),i>0?"Forward":"Backward")),this._model=e,this._sourceId=t.id(),this._shift=i}function w(e,t){re.call(this,"Send "+t.title()+" to back"),this._model=e,this._sourceId=t.id()}function P(e,t){re.call(this,"Bring "+t.title()+" to front"),this._model=e,this._sourceId=t.id()}function T(e,t,i){
re.call(this,"Remove pane"),this._model=e,this._index=t,this._pane=this._model.panes()[t],this._chart=i}function x(e,t,i,n){re.call(this,"Rearrange panes"),this._model=e,this._index=t,this._direction=i,this._chart=n}function C(e,t,i,n,o,r){re.call(this,"Zoom"),this._model=e,this._startBar=t,this._endBar=i,this._startPrice=n,this._endPrice=o,this._pane=r}function L(e,t,i){re.call(this,"Zoom"),this._baseCmd=e,this._zoomStack=t,this._inOut=i}function I(e,t,i,n,o){re.call(this,"",!1),this._model=e,this._paneA=t,this._paneB=i,this._prevStretchA=n,this._currStretchA=o}function A(e,t){re.call(this,"Restore Defaults"),this._model=e,this._defaultProperty=t,this._state=t.state(t._exclusions),this._chartWidget=e._undoModel._chartWidget}function k(e,t){re.call(this,"Apply Chart Theme"),this._model=e,this._newChartProps=TradingView.factoryDefaults("chartproperties"),this._newSeriesProps=TradingView.factoryDefaults("chartproperties.mainSeriesProperties"),["candleStyle","hollowCandleStyle","haStyle"].forEach(function(e){t.mainSourceProperties[e].wickUpColor=t.mainSourceProperties[e].wickUpColor||t.mainSourceProperties[e].wickColor,t.mainSourceProperties[e].wickDownColor=t.mainSourceProperties[e].wickDownColor||t.mainSourceProperties[e].wickColor}),t.chartProperties.paneProperties.vertGridProperties=t.chartProperties.paneProperties.vertGridProperties||t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.horzGridProperties=t.chartProperties.paneProperties.horzGridProperties||t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.legendProperties=this._model.properties().state().paneProperties.legendProperties,this._newChartProps=$.extend(!0,{},this._newChartProps,t.chartProperties),delete this._newChartProps.scalesProperties.showLeftScale,delete this._newChartProps.scalesProperties.showRightScale,delete this._newChartProps.scalesProperties.scaleSeriesOnly,delete this._newChartProps.scalesProperties.showSeriesLastValue,delete this._newChartProps.scalesProperties.showStudyLastValue,delete this._newChartProps.scalesProperties.showSymbolLabels,delete this._newChartProps.scalesProperties.showStudyPlotLabels,e.timeScale().preserveBarSpacing()&&delete this._newChartProps.scalesProperties.barSpacing,this._newSeriesProps=$.extend(!0,{},this._newSeriesProps,t.mainSourceProperties),this._newChartProps.symbolWatermarkProperties||(this._newChartProps.symbolWatermarkProperties=defaults("chartproperties.symbolWatermarkProperties"),this._newChartProps.symbolWatermarkProperties.color=this._newChartProps.scalesProperties.textColor),this._oldChartProps=e.properties().state(),delete this._oldChartProps.paneProperties.topMargin,delete this._oldChartProps.paneProperties.bottomMargin,this._oldSeriesProps=e.properties().state().mainSeriesProperties}function E(e,t,i,n){var o;n=n||"",o=n+" Study template",re.call(this,o),this._model=e,this._oldProps=t,this._newProps=i,this._oldShowLeftScale=e.model().isLeftPriceScaleVisible(),this._oldShowRightScale=e.model().isRightPriceScaleVisible(),
this._newSourcesPriceScalesNames=[]}function M(e,t,i,n,o){re.call(this,e),this._property=t,this._value=i,this._forceSetProperty=o,this._prevValue=t.value(),this._cw=n}function V(e,t){var i,n,o,r,s=t.priceScale(),a=[],l=t.firstValue();for(i=0;i<e.length;i++)n={offset:e[i].offset,time_t:e[i].time_t},o=e[i].price,r=s.priceToCoordinate(o,l),r-=40,o=s.coordinateToPrice(r,l),n.price=o,a.push(n);return a}function D(e,t,i){re.call(this,"clone "+t.title()),this._model=e,this._originalSource=t,this._withoutShift=i}function O(e,t){re.call(this,"Stop Sincing Drawing"),this._model=e,this._sourceId=t.id(),this._linkKey=t.linkKey}function R(e,t,i){re.call(this,"Paste Drawing"),this._model=e,this._clipboardData=t,this._paneIndex=this._model.panes().indexOf(i||this._model.paneForSource(this._model.mainSeries()))}function B(e,t){re.call(this,"Paste Indicator"),this._model=e,this._clipboardData=t}function N(e,t){re.call(this,"Move",!1),this._origPoint=e.clone(),this._point=null,this._handler=t}var F=i(6).Point,W=i(73).createLineTool,H=i(0).LineDataSource,j=i(5),z=i(120),U=i(32),q=i(18),Y=i(194).doAnimate,G=i(301),K=i(3),Z=K.saveDefaultProperties,J=i(182),X=i(63).Series,Q=i(34),ee=Q.Study,te=i(124),ie=i(33),ne=i(292).showTooManyStudiesNotice,oe=i(293).UndoStack,re=i(43).UndoCommand,se=i(645).SaveLineToolStateUndoCommand,ae=i(646).ApplyLineToolTemplateUndoCommand,le=i(647).SetChartStyleCommand,ce=i(648).SetResolutionUndoCommand,he=i(42).preparePriceAxisProperties,ue=i(294).RestoreFactoryDefaultsUndoCommand,de=i(294).RestoreUserDefaultsUndoCommand,pe=i(42).getChartStyleByResolution,_e=i(4).getLogger("Chart.ChartUndoModel");inherit(n,G),n.prototype.version=function(){return this.m_model._version},n.prototype.onData=function(e){switch(e.method){case"timescale_update":var t=e.params;this.m_model.updateTimeScale(t.index,t.zoffset,t.changes,t.index_diff,t.marks,t.clear)}},n.prototype.paneForSource=function(e){return this.m_model.paneForSource(e)},n.prototype.createPane=function(e){return this.m_model.createPane(e)},n.prototype.dumpViews=function(){return this.m_model.dumpViews()},n.prototype.readOnly=function(){return this.m_model.readOnly()},n.prototype.restart=function(){this.m_model.restart()},n.prototype.disconnect=function(){this.m_model.disconnect()},n.prototype.studiesMetaData=function(){return this.m_model.studiesMetaData()},n.prototype.studyVersioning=function(){return this.m_model.studyVersioning()},n.prototype.chartModel=function(){return this.m_model},n.prototype.pushUndoCommand=function(e){this.undoHistory.pushUndoCommand(e)},n.prototype.startScalePrice=function(e,t,i){this.pushUndoCommand(new a(this.m_model,e,t,t.state())),this.chartModel().startScalePrice(e,t,i)},n.prototype.scalePriceTo=function(e,t,i){this.chartModel().scalePriceTo(e,t,i)},n.prototype.endScalePrice=function(e,t){this.chartModel().endScalePrice(e,t)},n.prototype.startScrollPrice=function(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this.chartModel().startScrollPrice(e,t,i))},
this._newSourcesPriceScalesNames=[]}function M(e,t,i,n,o){re.call(this,e),this._property=t,this._value=i,this._forceSetProperty=o,this._prevValue=t.value(),this._cw=n}function V(e,t){var i,n,o,r,s=t.priceScale(),a=[],l=t.firstValue();for(i=0;i<e.length;i++)n={offset:e[i].offset,time_t:e[i].time_t},o=e[i].price,r=s.priceToCoordinate(o,l),r-=40,o=s.coordinateToPrice(r,l),n.price=o,a.push(n);return a}function D(e,t,i){re.call(this,"clone "+t.title()),this._model=e,this._originalSource=t,this._withoutShift=i}function O(e,t){re.call(this,"Stop Sincing Drawing"),this._model=e,this._sourceId=t.id(),this._linkKey=t.linkKey}function R(e,t,i){re.call(this,"Paste Drawing"),this._model=e,this._clipboardData=t,this._paneIndex=this._model.panes().indexOf(i||this._model.paneForSource(this._model.mainSeries()))}function B(e,t){re.call(this,"Paste Indicator"),this._model=e,this._clipboardData=t}function F(e,t){re.call(this,"Move",!1),this._origPoint=e.clone(),this._point=null,this._handler=t}var N=i(6).Point,W=i(73).createLineTool,H=i(0).LineDataSource,j=i(5),z=i(120),U=i(32),q=i(18),Y=i(194).doAnimate,G=i(301),K=i(3),Z=K.saveDefaultProperties,J=i(182),X=i(63).Series,Q=i(34),ee=Q.Study,te=i(124),ie=i(33),ne=i(292).showTooManyStudiesNotice,oe=i(293).UndoStack,re=i(43).UndoCommand,se=i(645).SaveLineToolStateUndoCommand,ae=i(646).ApplyLineToolTemplateUndoCommand,le=i(647).SetChartStyleCommand,ce=i(648).SetResolutionUndoCommand,he=i(42).preparePriceAxisProperties,ue=i(294).RestoreFactoryDefaultsUndoCommand,de=i(294).RestoreUserDefaultsUndoCommand,pe=i(42).getChartStyleByResolution,_e=i(4).getLogger("Chart.ChartUndoModel");inherit(n,G),n.prototype.version=function(){return this.m_model._version},n.prototype.onData=function(e){switch(e.method){case"timescale_update":var t=e.params;this.m_model.updateTimeScale(t.index,t.zoffset,t.changes,t.index_diff,t.marks,t.clear)}},n.prototype.paneForSource=function(e){return this.m_model.paneForSource(e)},n.prototype.createPane=function(e){return this.m_model.createPane(e)},n.prototype.dumpViews=function(){return this.m_model.dumpViews()},n.prototype.readOnly=function(){return this.m_model.readOnly()},n.prototype.restart=function(){this.m_model.restart()},n.prototype.disconnect=function(){this.m_model.disconnect()},n.prototype.studiesMetaData=function(){return this.m_model.studiesMetaData()},n.prototype.studyVersioning=function(){return this.m_model.studyVersioning()},n.prototype.chartModel=function(){return this.m_model},n.prototype.pushUndoCommand=function(e){this.undoHistory.pushUndoCommand(e)},n.prototype.startScalePrice=function(e,t,i){this.pushUndoCommand(new a(this.m_model,e,t,t.state())),this.chartModel().startScalePrice(e,t,i)},n.prototype.scalePriceTo=function(e,t,i){this.chartModel().scalePriceTo(e,t,i)},n.prototype.endScalePrice=function(e,t){this.chartModel().endScalePrice(e,t)},n.prototype.startScrollPrice=function(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this.chartModel().startScrollPrice(e,t,i))},
n.prototype.scrollPriceTo=function(e,t,i){t.isAutoScale()||(this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this.pushUndoCommand(new a(this.m_model,e,t,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(e,t,i))},n.prototype.endScrollPrice=function(e,t){t.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(e,t))},n.prototype.setPriceAutoScale=function(e,t,i){this.pushUndoCommand(new a(this.m_model,e,t,t.state())),this.chartModel().setPriceAutoScale(e,t,i)},n.prototype.resetPriceScale=function(e,t){this.pushUndoCommand(new a(this.m_model,e,t,t.state())),this.chartModel().resetPriceScale(e,t)},n.prototype.startScaleTime=function(e){this.pushUndoCommand(new l(this.m_model,this.m_model.timeScale().state(),"scale time")),this.chartModel().startScaleTime(e)},n.prototype.scaleTimeTo=function(e){this.chartModel().scaleTimeTo(e)},n.prototype.endScaleTime=function(){this.chartModel().endScaleTime()},n.prototype.startScrollTime=function(e){this._initialTimeScrollState=this.m_model.timeScale().state(),this._initialTimeScrollPos=e,this.chartModel().startScrollTime(e)},n.prototype.scrollTimeTo=function(e){this._initialTimeScrollPos&&Math.abs(e-this._initialTimeScrollPos)>20&&(this.pushUndoCommand(new l(this.m_model,this._initialTimeScrollState,"scroll time")),delete this._initialTimeScrollPos,delete this._initialTimeScrollState),this.chartModel().scrollTimeTo(e)},n.prototype.gotoTime=function(e,t){var i,n,o=this.timeScale().visibleBars();if(null===o)return $.Deferred().reject().promise();i=o.firstBar(),n=this.m_model.timeScale().state(),this.chartModel().gotoTime(e,t),i!==this.timeScale().visibleBars().firstBar()&&this.pushUndoCommand(new l(this.m_model,n,"scroll time"))},n.prototype.endScrollTime=function(){this.chartModel().endScrollTime(),delete this._initialTimeScrollPos,delete this._initialTimeScrollState},n.prototype.resetTimeScale=function(){this.pushUndoCommand(new l(this.m_model,this.m_model.timeScale().state())),this.chartModel().resetTimeScale()},n.prototype.canZoomIn=function(){return this.chartModel().canZoomIn()},n.prototype.canZoomOut=function(){return this.chartModel().canZoomOut()},n.prototype.setWidth=function(e){this.m_model.setWidth(e)},n.prototype.setPaneHeight=function(e,t){this.m_model.setPaneHeight(e,t)},n.prototype.gridSource=function(){return this.m_model.gridSource()},n.prototype.watermarkSource=function(){return this.m_model.watermarkSource()},n.prototype.brandingSource=function(){return this.m_model.brandingSource()},n.prototype.addAlertsSource=function(e){return this.m_model.addAlertsSource(e)},n.prototype.alertsSources=function(){return this.m_model.alertsSources()},n.prototype.publishedChartsTimelineSource=function(){return this.m_model.publishedChartsTimelineSource()},n.prototype.barsMarksSources=function(){return this.m_model.barsMarksSources()},n.prototype.crossHairSource=function(){return this.m_model.crossHairSource()
},n.prototype.model=function(){return this.m_model},n.prototype.chartWidget=function(){return this._chartWidget},n.prototype.mainSeries=function(){return this.m_model.m_mainSeries},n.prototype.mainSeriesScaleRatioProperty=function(){return this.m_model.mainSeriesScaleRatioProperty()},n.prototype.mainSeriesPriceScaleNameProperty=function(){return this.m_model.mainSeriesPriceScaleNameProperty()},n.prototype.panes=function(){return this.m_model.m_panes},n.prototype.timeScale=function(){return this.m_model.timeScale()},n.prototype.setSelectedSource=function(e,t){this.m_model.setSelectedSource(e,t)},n.prototype.setHoveredSource=function(e,t){this.m_model.setHoveredSource(e,t)},n.prototype.selectedSource=function(){return this.m_model.selectedSource()},n.prototype.onSelectedSourceChanged=function(){return this.m_model.onSelectedSourceChanged()},n.prototype.hoveredSource=function(){return this.m_model.hoveredSource()},n.prototype.activeStrategySource=function(){return this.m_model.activeStrategySource()},n.prototype.invalidate=function(e){this.m_model.invalidate(e)},n.prototype.setCurrentPosition=function(e,t,i,n){this.m_model.setCurrentPosition(e,t,i,n)},n.prototype.setAndSaveCurrentPosition=function(e,t,i,n){this.m_model.setAndSaveCurrentPosition(e,t,i,n)},n.prototype.modifySeries=function(e,t,i){var n=new c(this.m_model,e,t,i);this.pushUndoCommand(n)},n.prototype.canCreateStudy=function(e){return this.model().chartApi().chartApi().isCanCreateStudy(e)},n.prototype.checkIfFeatureAvailable=function(e,t){var i=this.canCreateStudy(),n=t&&t instanceof ee;return!this.readOnly()&&n&&(i=this.canCreateStudy(!0)),!!i||void(n||ne())},n.prototype._insertStudy=function(e,t,i,n){var o=new h(this.m_model,e,t,i,n);return this.pushUndoCommand(o),o.insertedStudy()},n.prototype.insertStudyWithoutCheck=function(){return this._insertStudy.apply(this,arguments)},n.prototype.insertStudy=function(e,t,i,n){if(this.checkIfFeatureAvailable(e,n))return this._insertStudy(e,t,i,n)},n.prototype.setProperty=function(e,t,i){if(e&&e.value()!==t){var n=new o(e,t,i,this.m_model);this.pushUndoCommand(n),this.emitEvent("setProperty")}},n.prototype.setPriceScaleMode=function(e,t,i){var n,o,s=Object.keys(e),a=t.mode(),l=!1;for(n=0;n<s.length;n++)if(a[s[n]]!==e[s[n]]){l=!0;break}l&&(o=new r(e,t,i,this.m_model),this.pushUndoCommand(o))},n.prototype.setChartStyleProperty=function(e,t,i){if(e.value()!==t){var n=new le(e,t,this.mainSeries(),i,this.m_model,this._chartWidget);this.pushUndoCommand(n),this.emitEvent("setChartStyleProperty")}},n.prototype.setScaleRatioProperty=function(e,t,i){if(e.value()!==t){var n=new s(e,t,i,this.m_model);this.pushUndoCommand(n)}},n.prototype.setScreenChartProperty=function(e,t,i,n,o){if(o||e.value()!==t){var r=new M(n,e,t,i,o);this.pushUndoCommand(r)}},n.prototype.setResolutionProperty=function(e,t,i,n){if(e.value()!==t){var o=new ce(e,t,i,n);this.pushUndoCommand(o)}},n.prototype._getSourcesTree=function(e){var t,i=[],n=this.m_model.children(e);for(t=0;t<n.length;t++)i=i.concat(this._getSourcesTree(n[t]));return i.push(e),i},
n.prototype.removeSource=function(e,t){var i,n,o;if(e.isUserDeletable()){if(i=this._getSourcesTree(e),this.lineBeingCreated()===e)this.cancelCreatingLine();else{for(this.beginUndoMacro("Remove source"),n=0;n<i.length;++n)o=new u(this.m_model,i[n]),this.pushUndoCommand(o);this.endUndoMacro()}t||(1===i.length?this.emitEvent("removeSource",[i[0]]):this.emitEvent("removeSources",[i]))}},n.prototype.removeSelectedSource=function(){var e,t=this.m_model.selectedSource();t&&t.isUserDeletable()&&(this.setSelectedSource(null),e=new u(this.m_model,t),this.pushUndoCommand(e),this.emitEvent("removeSource",[t]))},n.prototype.removeLineTools=function(e){var t,i,n=this.lineBeingCreated();n&&-1!==(t=e.indexOf(n))&&(this.cancelCreatingLine(),e.splice(t,1)),i=new d(this.m_model,e),this.pushUndoCommand(i),this.emitEvent("removeSources",[e])},n.prototype.move=function(e,t,i){var n=new p(this.m_model,e,t,i);this.pushUndoCommand(n),this.emitEvent("moveSource",[e])},n.prototype.mergeSourceUp=function(e){var t=new f(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("mergeSourceUp",[e])},n.prototype.mergeSourceDown=function(e){var t=new m(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("mergeSourceDown",[e])},n.prototype.unmergeSourceUp=function(e){var t=new y(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("unmergeSourceUp",[e])},n.prototype.unmergeSourceDown=function(e){var t=new g(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("unmergeSourceDown",[e])},n.prototype.createLineTool=function(e,t,i,n,o){var r,s;return"LineToolRegressionTrend"!==i||this.canCreateStudy()?(this._createLineCommand=new v(this.m_model,e,i),r=this._createLineCommand.startCreatingLine(t,n,o),s=this._createLineCommand.line(),r&&(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),s):void ne()},n.prototype.lineBeingCreated=function(){return this.m_model.lineBeingCreated()},n.prototype.paneBeingCreatedLineOn=function(){return this.m_model.paneBeingCreatedLineOn()},n.prototype.coninueCreatingLine=function(e,t,i){var n=this._createLineCommand.continueCreatingLine(e,t,i);return n&&(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),n},n.prototype.finishLineTool=function(e){this.m_model.finishLineTool(e)},n.prototype.cancelCreatingLine=function(){this.m_model.cancelCreatingLine()},n.prototype.lineCancelled=function(){return this.m_model.lineCancelled()},n.prototype.startChangingLinetool=function(e,t,i,n){this._currentLineChangeCommand=new se(this.m_model,e,"Change "+i+"point",!1),this.m_model.startChangingLinetool(e,t,i,n)},n.prototype.lineBeingEdited=function(){return this.m_model.lineBeingEdited()},n.prototype.changeLinePoint=function(e,t){this.m_model.changeLinePoint(e,t)},n.prototype.endChangingLinetool=function(e){this.m_model.endChangingLinetool(e),this.pushUndoCommand(this._currentLineChangeCommand),this._currentLineChangeCommand=null},n.prototype.startMovingSource=function(e,t,i){e.doesMovingAffectsUndo()&&(this._currentLineMoveCommand=new S(this.m_model,e,t,i)),
this.m_model.startMovingSource(e,t,i)},n.prototype.sourceBeingMoved=function(){return this.m_model.sourceBeingMoved()},n.prototype.moveSource=function(e){null!==this._currentLineMoveCommand&&this._currentLineMoveCommand.setPoint(e),this.m_model.moveSource(e)},n.prototype.endMovingSource=function(e){this.m_model.endMovingSource(e),null!==this._currentLineMoveCommand&&this._currentLineMoveCommand._point&&(this.pushUndoCommand(this._currentLineMoveCommand),this._currentLineChangeCommand=null),this._currentLineMoveCommand=null},n.prototype.dataSources=function(){return this.m_model.dataSources()},n.prototype.orderedDataSources=function(e){return this.m_model.orderedDataSources(e)},n.prototype.dataSourceForId=function(e){return this.m_model.dataSourceForId(e)},n.prototype.state=function(e,t){return this.m_model.state(e,t)},n.prototype.asyncState=function(e){return this.m_model.asyncState(e)},n.prototype.restoreState=function(e,t){return this.m_model.restoreState(e,t)},n.prototype.calculateDefaultTags=function(){return this.m_model.calculateDefaultTags()},n.prototype.onTagsChanged=function(){return this.m_model.onTagsChanged()},n.prototype.changeZOrder=function(e,t){var i=new b(this.m_model,e,t);this.pushUndoCommand(i),this.emitEvent("changeZOrder",[e,t])},n.prototype.sendToBack=function(e){var t=new w(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("changeZOrder",[e])},n.prototype.bringToFront=function(e){var t=new P(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("changeZOrder",[e])},n.prototype.removeAllStudies=function(){var e,t,i;for(this.beginUndoMacro("remove all studies"),e=this.m_model.dataSources(),t=0;t<e.length;t++)i=e[t],(TradingView.isInherited(i.constructor,ee)&&!i.isChildStudy()&&i.removeByRemoveAllStudies()||TradingView.isInherited(i.constructor,te))&&this.removeSource(i);this.endUndoMacro()},n.prototype.removeAllDrawingTools=function(e){var t,i,n;for(this.beginUndoMacro("remove all drawing tools"),this.lineBeingCreated()&&this.cancelCreatingLine(),t=this.m_model.dataSources(),i=0;i<t.length;i++)n=t[i],TradingView.isInherited(n.constructor,H)&&n.isActualSymbol()&&n.isUserDeletable()&&(e&&e!==n._constructor||this.removeSource(n));this.endUndoMacro()},n.prototype.unlinkLine=function(e){var t=new O(this.m_model,e);this.pushUndoCommand(t)},n.prototype.copyToOtherCharts=function(e){this.m_model.copyToOtherCharts(e)},n.prototype.moveLeft=function(){var e,t;try{this.beginUndoMacro("Move Left")}catch(e){return}e=this.m_model.timeScale().width(),t=this,Y({to:e/5,onStep:function(e){t.startScrollTime(e),t.scrollTimeTo(0),t.endScrollTime()},onComplete:function(){t.endUndoMacro()}})},n.prototype.moveRight=function(){var e,t;try{this.beginUndoMacro("Move Right")}catch(e){return}e=this.m_model.timeScale().width(),t=this,Y({to:e/5,onStep:function(e){t.startScrollTime(0),t.scrollTimeTo(e),t.endScrollTime()},onComplete:function(){t.endUndoMacro()}})},n.prototype.scrollChart=function(e){j.enabled("chart_scroll")&&(this.startScrollTime(0),this.scrollTimeTo(e),this.endScrollTime())},
n.prototype.scrollChartByBar=function(e){if(j.enabled("chart_scroll")){var t=e*this.m_model.timeScale().barSpacing();this.startScrollTime(0),this.scrollTimeTo(t),this.endScrollTime()}},n.prototype.zoomIn=function(e,t){var i,n,o=this.m_model.timeScale().width(),r=this;if(t=t||1,this.canZoomIn())if(e)i=t*o/10,n=i*((e+1)/2),this.startScaleTime(i),this.scaleTimeTo(0),this.endScaleTime(),this.startScrollTime(0),this.scrollTimeTo(i-n),this.endScrollTime(),this._onSimpleZoomIn.fire();else{try{this.beginUndoMacro("Zoom In")}catch(e){return}Y({to:o/5,onStep:function(e){r.startScaleTime(e),r.scaleTimeTo(0),r.endScaleTime()},onComplete:function(){r.endUndoMacro(),r._onSimpleZoomIn.fire()}})}},n.prototype.zoomOut=function(e,t){var i=this.m_model.timeScale().width(),n=this;if(t=t||1,this.canZoomOut())if(e)this.startScaleTime(0),this.scaleTimeTo(t*i/10),this.endScaleTime(),this.startScrollTime(t*(i/20-i/20*e)),this.scrollTimeTo(0),this.endScrollTime(),this._onSimpleZoomOut.fire();else{try{this.beginUndoMacro("Zoom Out")}catch(e){return}Y({to:i/5,onStep:function(e){n.startScaleTime(0),n.scaleTimeTo(e),n.endScaleTime()},onComplete:function(){n.endUndoMacro(),n._onSimpleZoomOut.fire()}})}},n.prototype.resetScales=function(){var e,t;for(this.beginUndoMacro("Reset scales"),this.resetTimeScale(),e=0;e<this.panes().length;e++)t=this.panes()[e],this.resetPriceScale(t,t.leftPriceScale()),this.resetPriceScale(t,t.rightPriceScale());this.endUndoMacro(),this.m_model.recalculateAllPanes()},n.prototype.zoomToViewport=function(e,t,i,n,o){var r=new C(this.m_model,e,t,i,n,o),s=new L(r,this.m_zoomStack,!0);this.pushUndoCommand(s)},n.prototype.zoomFromViewport=function(){var e=new L(this.m_zoomStack.head(),this.m_zoomStack,!1);this.pushUndoCommand(e)},n.prototype.zoomStack=function(){return this.m_zoomStack},n.prototype.addPaneStretchFactorUndoCommand=function(e,t,i,n){var o=new I(this.m_model,e,t,i,n);this.pushUndoCommand(o)},n.prototype.restoreFactoryDefaults=function(e){var t=new ue(this.m_model,e);this.pushUndoCommand(t)},n.prototype.restoreDefaults=function(e){var t=new de(this.m_model,e);this.pushUndoCommand(t)},n.prototype.chartLoadTheme=function(e,t){var i=new k(e,t);this.pushUndoCommand(i)},n.prototype.applyLineToolTemplate=function(e,t,i){this.beginUndoMacro(i),this.saveLineToolState(e,i);var n=new ae(e,t,i);this.pushUndoCommand(n),this.saveLineToolState(e,i),this.endUndoMacro(),this.model().updateSource(e)},n.prototype.restoreLineToolFactoryDefaults=function(e,t){this.beginUndoMacro(t),this.saveLineToolState(e,t),e.restoreFactoryDefaults(),this.saveLineToolState(e,t),this.endUndoMacro()},n.prototype.studyLoadTemplate=function(e,t,i,n){var o=new E(e,t,i,n);this.pushUndoCommand(o)},n.prototype.onRearrangePanes=function(){return this._onRearrangePanes},n.prototype.onSimpleZoomIn=function(){return this._onSimpleZoomIn},n.prototype.onSimpleZoomOut=function(){return this._onSimpleZoomOut},n.prototype.loadRange=function(e){e.res!==this.m_model.mainSeries().properties().interval.value()?(this.m_model.mainSeries().setDefaultTimeframe(e.val),
this.setProperty(this.m_model.mainSeries().properties().interval,e.res,"Change date range")):this.m_model.mainSeries().loadDataTo(e.val)},n.prototype.cloneLineTool=function(e,t){var i=new D(this.m_model,e,t);return this.pushUndoCommand(i),this.emitEvent("cloneLineTool"),i.clonedLineToolId()},n.prototype.alertsList=function(){return this.m_model.alertsList()},n.prototype.alertsListChanged=function(){return this.m_model.alertsListChanged()},n.prototype.insertStudyStub=function(e){return this.m_model.insertStudyStub(e)},n.prototype.removeStudyStub=function(e){return this.m_model.removeStudyStub(e)},n.prototype.isJustClonedChart=function(){return this._chartWidget.isJustClonedChart()},n.prototype.copySourceToClip=function(e){if(e&&!e.properties().blockCopying){var t={};if(e instanceof H)t.type="drawing",t.geometry=e.geometry();else{if(!(e instanceof ee))return!1;t.type="study"}return t.source=e.state&&e.state(),(delete t.source.alertId,delete t.source.linkKey,t.source)?(t.title=e.title&&e.title(),t.modelId=this.m_model._id,J.set(t),!0):!1}},n.prototype.cutSourceToClip=function(e){if(!this.copySourceToClip(e))return!1;this.removeSource(e)},n.prototype.pasteLineTool=function(e,t){var i=new R(this.m_model,t,e);this.pushUndoCommand(i)},n.prototype.pasteStudy=function(e){var t=new B(this.m_model,e);this.pushUndoCommand(t)},n.prototype.pasteSourceFromClip=function(e,t){var i=J.get();if(!i)return!1;"drawing"===i.type&&this.pasteLineTool(e,i),"study"===i.type&&this.checkIfFeatureAvailable(i.state)&&this.pasteStudy(i)},n.prototype.trackTime=function(){return this._chartWidget.trackTime()},n.prototype.isInReplay=function(){return this.m_model.isInReplay()},n.prototype.switchToReplay=function(e){},n.prototype.switchToRealtime=function(){},n.prototype.startCustomMoving=function(e,t,i){this._currentCustomMoveCommand=new N(t,i),this._currentCustomMoveSource=e},n.prototype.customMoveBeingProcessed=function(){return null!==this._currentCustomMoveSource},n.prototype.processCustomMove=function(e){this._currentCustomMoveCommand.setPoint(e)},n.prototype.endCustomMoving=function(){null!==this._currentCustomMoveCommand.point()&&(this.pushUndoCommand(this._currentCustomMoveCommand),this._currentCustomMoveCommand=null,this._currentCustomMoveSource=null)},n.prototype.saveLineToolState=function(e,t){this.pushUndoCommand(new se(this.m_model,e,t))},inherit(o,re),o.prototype.redo=function(){this._oldValue=this._targetObj.value(),Z(!0),this._targetObj.setValue(this._newValue),Z(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},o.prototype.undo=function(){Z(!0),this._targetObj.setValue(this._oldValue),Z(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},inherit(r,re),r.prototype.redo=function(){this._oldMode=this._priceScale.mode(),Z(!0),this._priceScale.setMode(this._newMode),Z(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},r.prototype.undo=function(){Z(!0),
this.setProperty(this.m_model.mainSeries().properties().interval,e.res,"Change date range")):this.m_model.mainSeries().loadDataTo(e.val)},n.prototype.cloneLineTool=function(e,t){var i=new D(this.m_model,e,t);return this.pushUndoCommand(i),this.emitEvent("cloneLineTool"),i.clonedLineToolId()},n.prototype.alertsList=function(){return this.m_model.alertsList()},n.prototype.alertsListChanged=function(){return this.m_model.alertsListChanged()},n.prototype.insertStudyStub=function(e){return this.m_model.insertStudyStub(e)},n.prototype.removeStudyStub=function(e){return this.m_model.removeStudyStub(e)},n.prototype.isJustClonedChart=function(){return this._chartWidget.isJustClonedChart()},n.prototype.copySourceToClip=function(e){if(e&&!e.properties().blockCopying){var t={};if(e instanceof H)t.type="drawing",t.geometry=e.geometry();else{if(!(e instanceof ee))return!1;t.type="study"}return t.source=e.state&&e.state(),(delete t.source.alertId,delete t.source.linkKey,t.source)?(t.title=e.title&&e.title(),t.modelId=this.m_model._id,J.set(t),!0):!1}},n.prototype.cutSourceToClip=function(e){if(!this.copySourceToClip(e))return!1;this.removeSource(e)},n.prototype.pasteLineTool=function(e,t){var i=new R(this.m_model,t,e);this.pushUndoCommand(i)},n.prototype.pasteStudy=function(e){var t=new B(this.m_model,e);this.pushUndoCommand(t)},n.prototype.pasteSourceFromClip=function(e,t){var i=J.get();if(!i)return!1;"drawing"===i.type&&this.pasteLineTool(e,i),"study"===i.type&&this.checkIfFeatureAvailable(i.state)&&this.pasteStudy(i)},n.prototype.trackTime=function(){return this._chartWidget.trackTime()},n.prototype.isInReplay=function(){return this.m_model.isInReplay()},n.prototype.switchToReplay=function(e){},n.prototype.switchToRealtime=function(){},n.prototype.startCustomMoving=function(e,t,i){this._currentCustomMoveCommand=new F(t,i),this._currentCustomMoveSource=e},n.prototype.customMoveBeingProcessed=function(){return null!==this._currentCustomMoveSource},n.prototype.processCustomMove=function(e){this._currentCustomMoveCommand.setPoint(e)},n.prototype.endCustomMoving=function(){null!==this._currentCustomMoveCommand.point()&&(this.pushUndoCommand(this._currentCustomMoveCommand),this._currentCustomMoveCommand=null,this._currentCustomMoveSource=null)},n.prototype.saveLineToolState=function(e,t){this.pushUndoCommand(new se(this.m_model,e,t))},inherit(o,re),o.prototype.redo=function(){this._oldValue=this._targetObj.value(),Z(!0),this._targetObj.setValue(this._newValue),Z(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},o.prototype.undo=function(){Z(!0),this._targetObj.setValue(this._oldValue),Z(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},inherit(r,re),r.prototype.redo=function(){this._oldMode=this._priceScale.mode(),Z(!0),this._priceScale.setMode(this._newMode),Z(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},r.prototype.undo=function(){Z(!0),
this._priceScale.setMode(this._oldMode),Z(!1),this._oldMode=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},inherit(s,re),s.prototype.redo=function(){this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode(),Z(!0),this._priceScale.setMode({autoScale:!1,percentage:!1,log:!1}),this._property.setValue(this._newValue),Z(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},s.prototype.undo=function(){Z(!0),this._property.setValue(this._oldValue),this._priceScale.setMode(this._oldMode),Z(!1),this._oldMode=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE)))},inherit(a,re),a.prototype.undo=function(){if(null!==this.m_newPriceScaleState)return void _e.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone");this.m_newPriceScaleState=this.m_priceScale.state(),this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_state)},a.prototype.redo=function(){if(null===this.m_newPriceScaleState)return void _e.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone");this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_newPriceScaleState),this.m_newPriceScaleState=null},inherit(l,re),l.prototype.undo=function(){if(null!==this.m_newTimeScaleState)return void _e.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone");this.m_newTimeScaleState=this.m_model.timeScale().state(),this.m_model.restoreTimeScaleState(this.m_state)},l.prototype.redo=function(){if(null===this.m_newTimeScaleState)return void _e.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone");this.m_model.restoreTimeScaleState(this.m_newTimeScaleState),this.m_newTimeScaleState=null},inherit(c,re),c.prototype.redo=function(){this._model.modifySeries(this._series,this._symbol,this._interval)},c.prototype.undo=function(){this._model.modifySeries(this._series,this._oldSymbol,this._oldInterval)},inherit(h,re),h.prototype.redo=function(){var e,t,i=null;return this._studyState?(i=this._model.restoreSource(this._restorePane,this._paneIndex,this._paneState,this._studyState,this._priceScaleName),this._studyId!==i.id()&&_e.logError("Study was restored improperly - study ids does not match"),delete this._studyState):(i=this._model.insertStudy(this._studyMetaInfo,this._props,this._isOverlay,this._parentSource),this._studyId=i.id()),e=this._model.paneForSource(i),t=e.priceScaleName(i.priceScale()),this._model.setPriceScaleVisibility(t,!0),i},h.prototype.insertedStudy=function(){return this._model.dataSourceForId(this._studyId)},h.prototype.undo=function(){var e,t=this.insertedStudy();this._studyState=t.state(),e=this._model.paneForSource(t),this._paneIndex=this._model.panes().indexOf(e),this._paneState=e.state(),this._restorePane=this._model.removeSource(t),this._model.setLeftPriceScaleVisible(this._oldShowLeftScale),this._model.setRightPriceScaleVisible(this._oldShowRightScale)},inherit(u,re),u.prototype.redo=function(){
var e,t=this._model.dataSourceForId(this._sourceId);this._sourceState=t.state(),e=this._model.paneForSource(t),this._paneIndex=this._model.panes().indexOf(e),this._priceScaleName=e.priceScaleName(t.priceScale()),this._paneState=e.state(),this._restorePane=this._model.removeSource(t)},u.prototype.undo=function(){var e=this._model.restoreSource(this._restorePane,this._paneIndex,this._paneState,this._sourceState,this._priceScaleName);this._sourceId!==e.id()&&_e.logError("Source was restored improperly - source ids does not match")},inherit(d,re),d.prototype.redo=function(){var e,t,i;for(e=0;e<this._linetools.length;e++)t=this._model.paneForSource(this._linetools[e]),i=this._model.panes().indexOf(t),this._statesByPaneIndexes[i]=this._statesByPaneIndexes[i]||[],this._statesByPaneIndexes[i].push({state:this._linetools[e].state(),owner:this._linetools[e].ownerSource().id()}),t.removeDataSource(this._linetools[e]);delete this._linetools},d.prototype.undo=function(){var e,t,i,n,o,r,s;this._linetools=[];for(e in this._statesByPaneIndexes)for(t=this._model.panes()[e],i=this._statesByPaneIndexes[e],n=0;n<i.length;n++)o=i[n],r=this._model.dataSourceForId(o.owner),s=t._restoreLineTool(o.state),s.setOwnerSource(r),s.updateAllViews(),this._linetools.push(s);this._model.invalidate(new q(q.LIGHT_UPDATE))},inherit(p,re),p.prototype.redo=function(){var e,t;-1===this._model.panes().indexOf(this._pane)&&(this._pane=this._model.createPane(this._paneIndex)),e=this._model.dataSourceForId(this._sourceId),this._model.move(e,this._pane,this._pane.priceScaleByName(this._scaleName)),t=this._pane.priceScaleName(e.priceScale()),this._model.setPriceScaleVisibility(t,!0)},p.prototype.undo=function(){-1===this._model.panes().indexOf(this._oldPane)&&(this._oldPane=this._model.createPane(this._oldPaneIndex)),this._model.move(this._model.dataSourceForId(this._sourceId),this._oldPane,this._oldPane.priceScaleByName(this._oldScaleName)),this._model.setLeftPriceScaleVisible(this._oldShowLeftScale),this._model.setRightPriceScaleVisible(this._oldShowRightScale)},inherit(_,re),_.prototype.redo=function(){var e,t,i=this._model.dataSourceForId(this._sourceId);this._mergeRedoFn.call(this._model,i),e=this._model.paneForSource(i),t=e.priceScaleName(i.priceScale()),this._model.setPriceScaleVisibility(t,!0)},_.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._mergeUndoFn.call(this._model,e),this._model.setLeftPriceScaleVisible(this._oldShowLeftScale),this._model.setRightPriceScaleVisible(this._oldShowRightScale)},inherit(f,_),inherit(m,_),inherit(y,_),inherit(g,_),inherit(v,re),v.prototype.startCreatingLine=function(e,t,i){var n,o;return this._points=[{point:e}],n=this._model.panes()[this._paneIndex],o=this._model.createLineTool(n,e,this._lineTool,t,i),this._lineId=o.id(),!this._model.lineBeingCreated()},v.prototype.continueCreatingLine=function(e,t,i){return this._points||_e.logError("continueCreatingLine is called before startCreatingLine"),this._points.push({point:e,envState:t}),this._model.coninueCreatingLine(e,t,i)},
v.prototype.line=function(){return this._lineId?this._model.dataSourceForId(this._lineId):null},v.prototype.undo=function(){var e=this.line();e&&(this._lineState=e.state(),this._model.removeSource(e),delete this._lineId)},v.prototype.redo=function(){this._lineState||_e.logError("This command was never undone - nothing to redo");var e=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);this._lineId=e.id(),delete this._lineState},inherit(S,re),S.prototype.setPoint=function(e){this._point=e instanceof F?e.clone():TradingView.clone(e)},S.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.startMovingSource(e,this._point,this._pointIndex),this._model.moveSource(this._origPoint),this._model.endMovingSource()},S.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.startMovingSource(e,this._origPoint,this._pointIndex),this._model.moveSource(this._point),this._model.endMovingSource()},inherit(b,re),b.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,-this._shift)},b.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,this._shift)};inherit(w,re),w.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},w.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},inherit(P,re),P.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},P.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},n.prototype.removePane=function(e,t){var i=new T(this,t,e);this.pushUndoCommand(i)},inherit(T,re),T.prototype.redo=function(){this._model.panes().splice(this._index,1),this._chart._updateGui()},T.prototype.undo=function(){this._model.panes().splice(this._index,0,this._pane),this._chart._updateGui()},n.prototype.rearrangePanes=function(e,t,i){var n=new x(this,t,i,e);this.pushUndoCommand(n),this._onRearrangePanes.fire()},inherit(x,re),x.prototype.redo=function(){var e=this._model.panes()[this._index];"up"===this._direction&&this._index>0&&(this._model.panes().splice(this._index,1),this._model.panes().splice(this._index-1,0,e)),"down"===this._direction&&this._index<this._model.panes().length-1&&(this._model.panes().splice(this._index,1),this._model.panes().splice(this._index+1,0,e)),this._model.invalidate(new q(q.FULL_UPDATE))},x.prototype.undo=function(){var e;"up"===this._direction&&(e=this._model.panes()[this._index-1],this._model.panes().splice(this._index-1,1),this._model.panes().splice(this._index,0,e)),"down"===this._direction&&(e=this._model.panes()[this._index+1],this._model.panes().splice(this._index+1,1),this._model.panes().splice(this._index,0,e)),this._model.invalidate(new q(q.FULL_UPDATE))},inherit(C,re),C.prototype.redo=function(){this._timeScaleState=this._model.timeScale().state(),this._priceScaleState=this._pane.defaultPriceScale().state(),
v.prototype.line=function(){return this._lineId?this._model.dataSourceForId(this._lineId):null},v.prototype.undo=function(){var e=this.line();e&&(this._lineState=e.state(),this._model.removeSource(e),delete this._lineId)},v.prototype.redo=function(){this._lineState||_e.logError("This command was never undone - nothing to redo");var e=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);this._lineId=e.id(),delete this._lineState},inherit(S,re),S.prototype.setPoint=function(e){this._point=e instanceof N?e.clone():TradingView.clone(e)},S.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.startMovingSource(e,this._point,this._pointIndex),this._model.moveSource(this._origPoint),this._model.endMovingSource()},S.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.startMovingSource(e,this._origPoint,this._pointIndex),this._model.moveSource(this._point),this._model.endMovingSource()},inherit(b,re),b.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,-this._shift)},b.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,this._shift)};inherit(w,re),w.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},w.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},inherit(P,re),P.prototype.undo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},P.prototype.redo=function(){var e=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},n.prototype.removePane=function(e,t){var i=new T(this,t,e);this.pushUndoCommand(i)},inherit(T,re),T.prototype.redo=function(){this._model.panes().splice(this._index,1),this._chart._updateGui()},T.prototype.undo=function(){this._model.panes().splice(this._index,0,this._pane),this._chart._updateGui()},n.prototype.rearrangePanes=function(e,t,i){var n=new x(this,t,i,e);this.pushUndoCommand(n),this._onRearrangePanes.fire()},inherit(x,re),x.prototype.redo=function(){var e=this._model.panes()[this._index];"up"===this._direction&&this._index>0&&(this._model.panes().splice(this._index,1),this._model.panes().splice(this._index-1,0,e)),"down"===this._direction&&this._index<this._model.panes().length-1&&(this._model.panes().splice(this._index,1),this._model.panes().splice(this._index+1,0,e)),this._model.invalidate(new q(q.FULL_UPDATE))},x.prototype.undo=function(){var e;"up"===this._direction&&(e=this._model.panes()[this._index-1],this._model.panes().splice(this._index-1,1),this._model.panes().splice(this._index,0,e)),"down"===this._direction&&(e=this._model.panes()[this._index+1],this._model.panes().splice(this._index+1,1),this._model.panes().splice(this._index,0,e)),this._model.invalidate(new q(q.FULL_UPDATE))},inherit(C,re),C.prototype.redo=function(){this._timeScaleState=this._model.timeScale().state(),this._priceScaleState=this._pane.defaultPriceScale().state(),
this._model.zoomToViewport(this._startBar,this._endBar,this._startPrice,this._endPrice,this._pane)},C.prototype.undo=function(){this._model.timeScale().restoreState(this._timeScaleState),this._pane.defaultPriceScale().restoreState(this._priceScaleState),this._model.recalculateAllPanes(),this._model.invalidate(new q(q.LIGHT_UPDATE))},inherit(L,re),L.prototype.undo=function(){if(this._inOut){if(this._baseCmd!==this._zoomStack.head())return void _e.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}else this._baseCmd.redo(),this._zoomStack.push(this._baseCmd)},L.prototype.redo=function(){if(this._inOut)this._baseCmd.redo(),this._zoomStack.push(this._baseCmd);else{if(this._baseCmd!==this._zoomStack.head())return void _e.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}},inherit(I,re),I.prototype.redo=function(){var e=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._currStretchA,this._paneB._stretchFactor=e-this._currStretchA,this._model.invalidate(new q(q.FULL_UPDATE))},I.prototype.undo=function(){var e=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._prevStretchA,this._paneB._stretchFactor=e-this._prevStretchA,this._model.invalidate(new q(q.FULL_UPDATE))},inherit(A,re),A.prototype.redo=function(){this._model.restoreFactoryDefaults(this._defaultProperty)},A.prototype.undo=function(){this._defaultProperty.merge(this._state),this._defaultProperty.listeners().fire(this._defaultProperty),this._model.mainSeries().onChartStyleChanged()},inherit(k,re),k.prototype._merge=function(e,t){var i=this._model;Z(!0),e&&(i.properties().paneProperties.mergeAndFire(e.paneProperties),i.properties().scalesProperties.mergeAndFire(e.scalesProperties),i.properties().symbolWatermarkProperties.mergeAndFire(e.symbolWatermarkProperties)),i.mainSeries().priceScale().setMode({autoScale:t.priceAxisProperties.autoScale,percentage:t.priceAxisProperties.percentage,log:t.priceAxisProperties.log,lockScale:t.priceAxisProperties.lockScale}),i.mainSeries().setChartStyleWithIntervalIfNeeded(t.style),delete t.style,delete t.interval,i.mainSeries().properties().mergeAndFire(t),i.mainSeries().properties().saveDefaults(),i.mainSeries().createPaneView(),i.mainSeries().invalidateBarStylesCache(),i._version=t.version,i.recalculateAllPanes(),i.invalidate(new q(q.FULL_UPDATE)),i.properties().saveDefaults(),Z(!1)},k.prototype.undo=function(){this._merge(this._oldChartProps,this._oldSeriesProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()},k.prototype.redo=function(){this._merge(this._newChartProps,this._newSeriesProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()},inherit(E,re),E.prototype._merge=function(e){var t,i,n,o,r,s,a,l,c,h,u,d,p,_=this._model.model(),f=_.mainSeries();for(f.priceScale().properties().lockScale.setValue(!1),e.interval&&(t=pe(e.interval,f.properties().style.value()),
f.setChartStyleWithIntervalIfNeeded(t,e.interval)),i=[],n=_.panes(),o=n.length;o--;)for(r=n[o],s=r.containsMainSeries(),a=r.dataSources(),l=a.length;l--;)c=a[l],(!s||c instanceof ee)&&(c.isRemovedByStudyTemplates()||i.push(c),_.removeSource(c));for(h=e.panes,function(e,t){return e.dataSources().some(function(e){return e.alert&&e.alert().id===t.alert.id})},o=0;o<h.length;o++){for(u=!1,d=h[o],l=0;l<d.sources.length;l++)c=d.sources[l],"MainSeries"===c.type&&(delete c.state,u=!0),-1!==d.leftAxisSources.indexOf(c.id)&&-1===this._newSourcesPriceScalesNames.indexOf("left")&&this._newSourcesPriceScalesNames.push("left"),-1!==d.rightAxisSources.indexOf(c.id)&&-1===this._newSourcesPriceScalesNames.indexOf("right")&&this._newSourcesPriceScalesNames.push("right");if(r=null,r=u?n[o]:_.createPane(o),r.restoreState(h[o],!1,e.version),u)for(p=0;p<i.length;p++)i[p].restore&&i[p].restore()}f.priceScale().setMode({autoScale:!0}),_._version=e.version,_.startNotStartedStudies(),_.recalculateAllPanes(),_.invalidate(new q(q.FULL_UPDATE))},E.prototype.redo=function(){var e,t,i;for(this._merge(this._newProps),e=this._model.model(),e.mainSeries().onChartStyleChanged(),t=this._model.model().mainSeries().properties(),he(t),e._recalcVisibleRangeStudy(e.dataSources(),!0),i=0;i<this._newSourcesPriceScalesNames.length;i++)e.setPriceScaleVisibility(this._newSourcesPriceScalesNames[i],!0)},E.prototype.undo=function(){this._merge(this._oldProps),this._model.model().mainSeries().onChartStyleChanged(),this._model.model().setLeftPriceScaleVisible(this._oldShowLeftScale),this._model.model().setRightPriceScaleVisible(this._oldShowRightScale)},inherit(M,re),M.prototype.redo=function(){this._cw.screen.show(),this._property.setValue(this._value,this._forceSetProperty)},M.prototype.undo=function(){this._cw.screen.show(),this._property.setValue(this._prevValue,this._forceSetProperty)},inherit(D,re),D.prototype.redo=function(){var e,t,i,n,o,r,s,a,l,c,h;if(this._lineState)r=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);else{for(e=this._originalSource,t=e.priceScale(),i=this._model.paneForSource(e),n=TradingView.className(e.constructor),o=e.properties().clone(),r=W(n,this._model,o,null,e.ownerSource()),r.setOwnerSource(e.ownerSource()),r.properties().visible._value=!0,r._fixedPoints=r._fixedPoints.concat(e._fixedPoints),s=0;s<r._fixedPoints.length;s++)r._fixedPoints[s]=r._fixedPoints[s].add(new F(20,20));a=e._timePoint,l=this._withoutShift?TradingView.clone(a):V(a,e.ownerSource()),c=e._points,h=c,r.restorePoints(l,h),r.cloneData&&r.cloneData(e),i.addDataSource(r,t),this._model.updateSource(r),r.checkAlert&&r.checkAlert(),this._paneIndex=this._model.panes().indexOf(i),U.drawOnAllCharts().value()&&this._model.copyToOtherCharts(r),this._lineState=r.state()}},D.prototype.undo=function(){this._lineState||_e.logError("This command was never executed - nothing to undo");var e=this._model.dataSourceForId(this._lineState.id);this._model.removeSource(e)},D.prototype.clonedLineToolId=function(){return this._lineState.id},inherit(O,re),
O.prototype.redo=function(){delete this._model.dataSourceForId(this._sourceId).linkKey},O.prototype.undo=function(){this._model.dataSourceForId(this._sourceId).linkKey=this._linkKey},inherit(R,re),R.prototype.redo=function(){var e,t,i,n,o,r,s,a,l,c,h=this._model.panes()[this._paneIndex],u=h.dataSourceForId(this._clipboardData.source.ownerSource)||h.mainDataSource();this._sourceState||(e=!0,t=this._clipboardData.source.state.symbol,i=h.mainDataSource(),n=i.symbol?i.symbol():"",o=t===n,o&&(u instanceof X&&(e=!1),u instanceof ee&&(e=!u.metaInfo().is_price_study)),r=TradingView.clone(this._clipboardData.source),delete r.state.symbol,e?(s=this._model,a=function(e){var t=e.x*s.timeScale().width(),i=e.y*u.priceScale().height();return new F(t,i)},l=u.firstValue(),r.points=this._clipboardData.geometry.map(function(e){var t=a(e),i=s.timeScale().coordinateToIndex(t.x),n=s.timeScale().normalizeBarIndex(i);return n.price=u.priceScale().coordinateToPrice(t.y,l),n})):this._model._id===this._clipboardData.modelId&&u.id()===this._clipboardData.source.ownerSource&&(r.points=V(this._clipboardData.source.points,u)),r.id=ie.guid(),this._sourceState=r),c=h._restoreLineTool(this._sourceState,null,!1),c.calcIsActualSymbol(),c.setOwnerSource(u),c.setPriceScale(u.priceScale()),u.priceScale().addDataSource(c),c.createServerPoints(),this._model.invalidate(new q(q.LIGHT_UPDATE,!0))},R.prototype.undo=function(){var e,t;this._sourceState||_e.logError("This command was never executed - nothing to undo"),e=this._model.panes()[this._paneIndex],t=e.dataSourceForId(this._sourceState.id),this._model.removeSource(t)},inherit(B,re),B.prototype.redo=function(){var e,t,i,n;this._sourceState||(e=TradingView.clone(this._clipboardData.source),e.id=ie.guid(),this._sourceState=e),t=null,i=null,this._sourceState.metaInfo.is_price_study?(t=this._model.paneForSource(this._model.mainSeries()),i=this._model.mainSeries().priceScale()):(t=this._model.createPane(),i=t.defaultPriceScale()),n=t._restoreStudy(this._sourceState),n.start(),n.setPriceScale(i),t.move(n,i)},B.prototype.undo=function(){this._sourceState||_e.logError("This command was never executed - nothing to undo");var e=this._model.dataSourceForId(this._sourceState.id);this._model.removeSource(e)},inherit(N,re),N.prototype.setPoint=function(e){this._point=e.clone(),this._handler(e)},N.prototype.point=function(){return this._point},N.prototype.undo=function(){this._handler(this._origPoint)},N.prototype.redo=function(){this._handler(this._point)},t.ChartUndoModel=n}).call(t,i(8))},function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SaveLineToolStateUndoCommand",function(){return s}),n=i(1),o=i(7),i.n(o),r=i(43),s=function(e){function t(t,i,n,o){void 0===o&&(o=!0);var r=e.call(this,n,o)||this;return r._model=t,r._savedState=i.state(!0),r}return n.c(t,e),t.prototype.redo=function(){this._toggleState()},t.prototype.undo=function(){this._toggleState()},t.prototype._getSource=function(){return Object(o.ensureNotNull)(this._model.dataSourceForId(this._savedState.id))},
f.setChartStyleWithIntervalIfNeeded(t,e.interval)),i=[],n=_.panes(),o=n.length;o--;)for(r=n[o],s=r.containsMainSeries(),a=r.dataSources(),l=a.length;l--;)c=a[l],(!s||c instanceof ee)&&(c.isRemovedByStudyTemplates()||i.push(c),_.removeSource(c));for(h=e.panes,function(e,t){return e.dataSources().some(function(e){return e.alert&&e.alert().id===t.alert.id})},o=0;o<h.length;o++){for(u=!1,d=h[o],l=0;l<d.sources.length;l++)c=d.sources[l],"MainSeries"===c.type&&(delete c.state,u=!0),-1!==d.leftAxisSources.indexOf(c.id)&&-1===this._newSourcesPriceScalesNames.indexOf("left")&&this._newSourcesPriceScalesNames.push("left"),-1!==d.rightAxisSources.indexOf(c.id)&&-1===this._newSourcesPriceScalesNames.indexOf("right")&&this._newSourcesPriceScalesNames.push("right");if(r=null,r=u?n[o]:_.createPane(o),r.restoreState(h[o],!1,e.version),u)for(p=0;p<i.length;p++)i[p].restore&&i[p].restore()}f.priceScale().setMode({autoScale:!0}),_._version=e.version,_.startNotStartedStudies(),_.recalculateAllPanes(),_.invalidate(new q(q.FULL_UPDATE))},E.prototype.redo=function(){var e,t,i;for(this._merge(this._newProps),e=this._model.model(),e.mainSeries().onChartStyleChanged(),t=this._model.model().mainSeries().properties(),he(t),e._recalcVisibleRangeStudy(e.dataSources(),!0),i=0;i<this._newSourcesPriceScalesNames.length;i++)e.setPriceScaleVisibility(this._newSourcesPriceScalesNames[i],!0)},E.prototype.undo=function(){this._merge(this._oldProps),this._model.model().mainSeries().onChartStyleChanged(),this._model.model().setLeftPriceScaleVisible(this._oldShowLeftScale),this._model.model().setRightPriceScaleVisible(this._oldShowRightScale)},inherit(M,re),M.prototype.redo=function(){this._cw.screen.show(),this._property.setValue(this._value,this._forceSetProperty)},M.prototype.undo=function(){this._cw.screen.show(),this._property.setValue(this._prevValue,this._forceSetProperty)},inherit(D,re),D.prototype.redo=function(){var e,t,i,n,o,r,s,a,l,c,h;if(this._lineState)r=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);else{for(e=this._originalSource,t=e.priceScale(),i=this._model.paneForSource(e),n=TradingView.className(e.constructor),o=e.properties().clone(),r=W(n,this._model,o,null,e.ownerSource()),r.setOwnerSource(e.ownerSource()),r.properties().visible._value=!0,r._fixedPoints=r._fixedPoints.concat(e._fixedPoints),s=0;s<r._fixedPoints.length;s++)r._fixedPoints[s]=r._fixedPoints[s].add(new N(20,20));a=e._timePoint,l=this._withoutShift?TradingView.clone(a):V(a,e.ownerSource()),c=e._points,h=c,r.restorePoints(l,h),r.cloneData&&r.cloneData(e),i.addDataSource(r,t),this._model.updateSource(r),r.checkAlert&&r.checkAlert(),this._paneIndex=this._model.panes().indexOf(i),U.drawOnAllCharts().value()&&this._model.copyToOtherCharts(r),this._lineState=r.state()}},D.prototype.undo=function(){this._lineState||_e.logError("This command was never executed - nothing to undo");var e=this._model.dataSourceForId(this._lineState.id);this._model.removeSource(e)},D.prototype.clonedLineToolId=function(){return this._lineState.id},inherit(O,re),
O.prototype.redo=function(){delete this._model.dataSourceForId(this._sourceId).linkKey},O.prototype.undo=function(){this._model.dataSourceForId(this._sourceId).linkKey=this._linkKey},inherit(R,re),R.prototype.redo=function(){var e,t,i,n,o,r,s,a,l,c,h=this._model.panes()[this._paneIndex],u=h.dataSourceForId(this._clipboardData.source.ownerSource)||h.mainDataSource();this._sourceState||(e=!0,t=this._clipboardData.source.state.symbol,i=h.mainDataSource(),n=i.symbol?i.symbol():"",o=t===n,o&&(u instanceof X&&(e=!1),u instanceof ee&&(e=!u.metaInfo().is_price_study)),r=TradingView.clone(this._clipboardData.source),delete r.state.symbol,e?(s=this._model,a=function(e){var t=e.x*s.timeScale().width(),i=e.y*u.priceScale().height();return new N(t,i)},l=u.firstValue(),r.points=this._clipboardData.geometry.map(function(e){var t=a(e),i=s.timeScale().coordinateToIndex(t.x),n=s.timeScale().normalizeBarIndex(i);return n.price=u.priceScale().coordinateToPrice(t.y,l),n})):this._model._id===this._clipboardData.modelId&&u.id()===this._clipboardData.source.ownerSource&&(r.points=V(this._clipboardData.source.points,u)),r.id=ie.guid(),this._sourceState=r),c=h._restoreLineTool(this._sourceState,null,!1),c.calcIsActualSymbol(),c.setOwnerSource(u),c.setPriceScale(u.priceScale()),u.priceScale().addDataSource(c),c.createServerPoints(),this._model.invalidate(new q(q.LIGHT_UPDATE,!0))},R.prototype.undo=function(){var e,t;this._sourceState||_e.logError("This command was never executed - nothing to undo"),e=this._model.panes()[this._paneIndex],t=e.dataSourceForId(this._sourceState.id),this._model.removeSource(t)},inherit(B,re),B.prototype.redo=function(){var e,t,i,n;this._sourceState||(e=TradingView.clone(this._clipboardData.source),e.id=ie.guid(),this._sourceState=e),t=null,i=null,this._sourceState.metaInfo.is_price_study?(t=this._model.paneForSource(this._model.mainSeries()),i=this._model.mainSeries().priceScale()):(t=this._model.createPane(),i=t.defaultPriceScale()),n=t._restoreStudy(this._sourceState),n.start(),n.setPriceScale(i),t.move(n,i)},B.prototype.undo=function(){this._sourceState||_e.logError("This command was never executed - nothing to undo");var e=this._model.dataSourceForId(this._sourceState.id);this._model.removeSource(e)},inherit(F,re),F.prototype.setPoint=function(e){this._point=e.clone(),this._handler(e)},F.prototype.point=function(){return this._point},F.prototype.undo=function(){this._handler(this._origPoint)},F.prototype.redo=function(){this._handler(this._point)},t.ChartUndoModel=n}).call(t,i(8))},function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SaveLineToolStateUndoCommand",function(){return s}),n=i(1),o=i(7),i.n(o),r=i(43),s=function(e){function t(t,i,n,o){void 0===o&&(o=!0);var r=e.call(this,n,o)||this;return r._model=t,r._savedState=i.state(!0),r}return n.c(t,e),t.prototype.redo=function(){this._toggleState()},t.prototype.undo=function(){this._toggleState()},t.prototype._getSource=function(){return Object(o.ensureNotNull)(this._model.dataSourceForId(this._savedState.id))},
t.prototype._toggleState=function(){var e=this._getSource(),t=this._savedState;this._savedState=e.state(!0),this._model.restoreLineToolState(e,t)},t}(r.UndoCommand)},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"ApplyLineToolTemplateUndoCommand",function(){return r}),n=i(1),o=i(43),r=function(e){function t(t,i,n){var o=e.call(this,n)||this;return o._source=t,o._newState=i,o._oldState=t.properties().state(),o}return n.c(t,e),t.prototype.redo=function(){this._source.applyTemplate(this._newState)},t.prototype.undo=function(){this._source.applyTemplate(this._oldState)},t}(o.UndoCommand)},function(e,t,i){"use strict";var n,o,r,s,a,l,c,h,u;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SetChartStyleCommand",function(){return u}),n=i(1),o=i(43),r=i(3),i.n(r),s=i(42),a=i(62),l=i(18),c=i.n(l),h=i(61),u=function(e){function t(t,i,n,o,r,s){var a=e.call(this,o)||this;return a._prevPriceAxisProps={},a._property=t,a._mainSeries=n,a._value=i,a._model=r,a._chartWidget=s,a}return n.c(t,e),t.prototype.redo=function(){var e,t,i,n=this._mainSeries,o=n.properties();o.style===this._property&&n.isNeedRestart(this._value)&&this._chartWidget.screen.show(),this._prevResolution=o.interval.value(),this._prevValue=this._property.value(),this._storePriceAxisProps(),Object(r.saveDefaultProperties)(!0),e=o.interval.value(),t=this._model.defaultResolutions(),i=Object(h.getResolutionByChartStyle)(this._value,e,t),a.linking.interval.setValue(i),n.setChartStyleWithIntervalIfNeeded(this._value,i),Object(s.setLastUsedStyle)(this._value),Object(s.preparePriceAxisProperties)(o),Object(r.saveDefaultProperties)(!1),this._invalidateModel()},t.prototype.undo=function(){var e=this._mainSeries;e.properties().style===this._property&&e.isNeedRestart(this._value)&&this._chartWidget.screen.show(),Object(r.saveDefaultProperties)(!0),e.setChartStyleWithIntervalIfNeeded(this._prevValue,this._prevResolution),this._restorePriceAxisProps(),a.linking.interval.setValue(this._prevResolution),Object(r.saveDefaultProperties)(!1),this._invalidateModel()},t.prototype._storePriceAxisProps=function(){var e=this._mainSeries.priceScale();this._prevPriceAxisProps=e.mode()},t.prototype._restorePriceAxisProps=function(){this._mainSeries.priceScale().setMode(this._prevPriceAxisProps)},t.prototype._invalidateModel=function(){this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new c.a(c.a.LIGHT_UPDATE)))},t}(o.UndoCommand)},function(e,t,i){"use strict";var n,o,r,s,a,l;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SetResolutionUndoCommand",function(){return l}),n=i(1),o=i(43),r=i(15),s=i(42),a=i(40),l=function(e){function t(t,i,n,o){var r=e.call(this,o)||this;return r._property=t,r._value=i,r._prevValue=t.value(),r._chartWidget=n,r}return n.c(t,e),t.prototype.redo=function(){this._chartWidget.screen.show(),this._property.setValue(this._value),this._handleResolution(this._value)},t.prototype.undo=function(){this._chartWidget.screen.show(),this._property.setValue(this._prevValue),
this._handleResolution(this._prevValue)},t.prototype._handleResolution=function(e){var t=this._chartWidget.model().mainSeries().properties(),i=t.style.value(),n=Object(s.isRangeStyle)(i),o=r.Interval.isRange(e);!n&&o?t.style.setValue(a.STYLE_RANGE):n&&!o&&t.style.setValue(Object(s.getLastUsedStyle)())},t}(o.UndoCommand)},function(e,t,i){"use strict";(function(e){function n(e,t){this._options=Object.assign({},b,t),this.chart=e,this._properties=e.properties().scalesProperties,this.contextMenu=null,this.jqRow=$(document.createElement("tr")),this.jqLhsTimeAxisStub=$(document.createElement("td")),this.jqLhsTimeAxisStub.addClass("chart-markup-table"),this.jqLhsTimeAxisStub.appendTo(this.jqRow),this.jqLhsStub=$("<div>"),this.jqLhsStub.css("width","100%"),this.jqLhsStub.css("height","100%"),this.jqLhsStub.css("position","relative"),this.jqLhsStub.css("overflow","hidden"),this.jqLhsStub.appendTo(this.jqLhsTimeAxisStub),this.lhsCanvas=f(this.jqLhsStub,new m(16,16)),$(this.lhsCanvas).css("position","absolute"),$(this.lhsCanvas).css("z-order","2"),$(this.lhsCanvas).css("left",0),$(this.lhsCanvas).css("top",0),this.lhsCtx=this.lhsCanvas.getContext("2d"),this.jqCell=$(document.createElement("td")),this.jqCell.appendTo(this.jqRow),this.jqCell.addClass("chart-markup-table"),this.jqCell.addClass("time-axis"),this.jqCell.height(25),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqCell),this.canvas=f(this._dv,new m(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=f(this._dv,new m(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this.jqRhsTimeAxisStub=$(document.createElement("td")),this.jqRhsTimeAxisStub.addClass("chart-markup-table"),this.jqRhsTimeAxisStub.appendTo(this.jqRow),this.jqRhsStub=$("<div>"),this.jqRhsStub.css("width","100%"),this.jqRhsStub.css("height","100%"),this.jqRhsStub.css("position","relative"),this.jqRhsStub.css("overflow","hidden"),this.jqRhsStub.appendTo(this.jqRhsTimeAxisStub),this.rhsCanvas=f(this.jqRhsStub,new m(16,16)),$(this.rhsCanvas).css("position","absolute"),$(this.rhsCanvas).css("z-order","2"),$(this.rhsCanvas).css("left",0),$(this.rhsCanvas).css("top",0),this.rhsCtx=this.rhsCanvas.getContext("2d"),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=S.MINUTE_SPAN,this._mouseEventHandler=new y(this.jqCell,this,!0),this.updatePriceScalesVisibility()}var o,r,s,a,l,c,h,u,d,p,_,f,m,y,g,v,S,b;i(650),o=i(125).PriceAxisWidget,r=i(0).LineDataSource,s=i(116),a=i(41),l=a.ActionSeparator,c=i(89),h=i(18),u=i(82),d=u.resizeCanvas,p=u.hardResizeCanvas,_=u.clearRect,f=u.addCanvasTo,m=u.Size,y=i(111).MouseEventHandler,g=i(39).trackEvent,v=i(79).makeFont,S=i(161),b={contextMenuEnabled:!0,
timezoneMenuEnabled:!0},n.prototype.destroy=function(){this._mouseEventHandler.destroy()},n.prototype._BORDER_SIZE=1,n.prototype._OFFSET_SIZE=1,n.prototype._TICK_LENGTH=3,n.prototype.backgroundColor=function(){return this.chart.properties().paneProperties.background.value()},n.prototype.lineColor=function(){return this._properties.lineColor.value()},n.prototype.textColor=function(){return this._properties.textColor.value()},n.prototype.fontSize=function(){return this._properties.fontSize.value()},n.prototype.baseFont=function(){return v(this.fontSize(),"Arial","")},n.prototype.baseBoldFont=function(){return v(this.fontSize(),"Arial","bold")},n.prototype.rendererOptions=function(){var e,t;return this._rendererOptions||(this._rendererOptions={borderSize:this._BORDER_SIZE,offsetSize:this._OFFSET_SIZE,tickLength:this._TICK_LENGTH,fontSize:NaN,font:"",widthCache:new s}),e=this._rendererOptions,e.fontSize!==this.fontSize()&&(t=this.fontSize(),e.fontSize=t,e.font=this.baseFont(),e.font=v(this.fontSize(),"'Trebuchet MS', Tahoma, Arial, sans-serif",""),e.paddingTop=Math.ceil(t/2.5),e.paddingBottom=e.paddingTop,e.paddingHorizontal=Math.ceil(t/2),e.baselineOffset=Math.round(this.fontSize()/5),e.widthCache.reset()),this._rendererOptions},n.prototype.updatePriceScalesVisibility=function(){var e=this.chart.properties().scalesProperties;e.showLeftScale.value()?this.jqLhsTimeAxisStub.css("display","table-cell"):this.jqLhsTimeAxisStub.css("display","none"),e.showRightScale.value()?this.jqRhsTimeAxisStub.css("display","table-cell"):this.jqRhsTimeAxisStub.css("display","none")},n.prototype.mouseDownEvent=function(t){if(this._mousedown||!e.enabled("chart_zoom"))return!0;this._mousedown=!0;var i=this.chart.model();i.timeScale().isEmpty()||(this.setCursor("ew-resize"),i.startScaleTime(t.localX))},n.prototype.mouseDownOutsideEvent=function(e){var t=this.chart.model();!t.timeScale().isEmpty()&&this._mousedown&&(this._mousedown=!1,t.endScaleTime(),this.restoreDefaultCursor())},n.prototype.pressedMouseMoveEvent=function(e){var t,i,n=this.chart.model();n.timeScale().isEmpty()||(t=!1,i=(new Date).valueOf(),this._lastScrollScaleTime&&i-this._lastScrollScaleTime<100&&(t=!0),t||(n.scaleTimeTo(e.localX),this._lastScrollScaleTime=i))},n.prototype.mouseUpEvent=function(e){this._mousedown=!1;var t=this.chart.model();t.timeScale().isEmpty()||(t.endScaleTime(),this.restoreDefaultCursor())},n.prototype.contextMenuEvent=function(e,t){this._options.contextMenuEnabled&&this._createContextMenu().show(e)},n.prototype._createContextMenu=function(){return c.createMenu(this.getContextMenuActions(),{statName:"TimeScaleContextMenu"})},n.prototype.getContextMenuActions=function(){var t,i,n=this.chart;return n.model().mainSeries().createSessStudy(),n.updateActions(),t=n.actions(),i=e.enabled("charting_library_base")?[t.timeScaleReset,new l,t.applyTimeZone,t.sessionBreaks]:[t.timeScaleReset,new l,t.applyTimeZone,t.sessionBreaks,t.extendedHours],this._options.timezoneMenuEnabled||i.splice(2,1),
@@ -547,20 +547,20 @@ var t=e.split("@")[0],i=JSServer.studyLibrary.filter(function(i){return i.metain
this._createStudy(e,t,l,i,n,o,s)},f.prototype.purgeRangeExtensionData=function(e){e?this._rangeExtensionData[e]={summary:0,realtimeBarsCount:0}:this._rangeExtensionData={}},f.prototype.ensureExtendedTo=function(e,t,i){var n,o=this._studiesCache[t][e];if(!o)throw Error("This should never happen");this.purgeRangeExtensionData(t),this._rangeExtensionData[t]||(this._rangeExtensionData[t]={}),this._rangeExtensionData[t].time=i,n=this,setTimeout(function(){n.recreateSources(o.symbol,o.resolution,t,!0)},0)},f.prototype.extendSeriesRange=function(e,t,i){var n,o,r,s,a=this._studiesCache[t][e];if(!a)throw Error("This should never happen");if(this._isEndOfData(t,e,a.turnaround))return n=a.engine.runner.host.symbolInfo.data_status,void setTimeout(function(){TradingView.ChartapiMessagerInstances[t].onSeriesCompleted(e,a.turnaround,n)},0);i+=10,o=this._barsCoefficients(a.symbol,a.resolution),r=o.barsCoefficient||1,this._extendRange(t,i*r),o.barsCoefficient||(o.expectedBarsCount=this._extendedRange(t)),s=this,setTimeout(function(){s.recreateSources(a.symbol,a.resolution,t,!0)},0)},f.prototype._updateProjectionData=function(e,t,i,n){var o=n.barsetSize?this._convertBarsTimeToUnix([{index:n.barsetSize-1,exTime:n.lastBar?n.lastBar[0]/1e3:0,value:n.lastBar}]):null;TradingView.ChartapiMessagerInstances[e].onProjectionUpdate(t,i,n,o)},f.prototype.updateSeriesTurnaround=function(e,t,i){this._studiesCache[e]||(this._studiesCache[e]={}),this._studiesCache[e][t]||(this._studiesCache[e][t]={}),this._studiesCache[e][t].type="series",this._studiesCache[e][t].turnaround=i},f.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},f.prototype.createSeries=function(e,t,i,o,r,s){function a(e,n,o){l._extrapolationManager.storage(i,e.full_name,t).setLastBarTime(n,o)}var l,c=e,h=new y.OHLCV;this._studiesCache[i]=this._studiesCache[i]||{},this._sessionsLastDataCache[i]=null,this._studiesCache[i][o]={symbol:e,resolution:t,studyObject:h,guid:o,type:"series",turnaround:r},TradingView.ChartapiMessagerInstances[i].onSeriesLoading(o,r),l=this,this._computeStudy(i,h,c,t,o,[],{getRangeExtensionCount:l._extendedRange.bind(this,i),getRangeExtensionTime:l._extendedTime.bind(this,i)},function(){return-1/0},function(n,c,h,u){var d,p,_,f,m,y;if(!l._studiesCache[i][o])throw Error("This should never happen");if(l._sessionsLastDataCache[i]=n,d=l._convertBarsTimeToUnix(n),p=d.length>0?1e3*d[0].value[0]:void 0,u.nextTime&&(!p||u.nextTime<p/1e3))return void l.ensureExtendedTo(o,i,u.nextTime);0!==d.length&&(_=l._barsCoefficients(e,t),_.expectedBarsCount&&_.barsCount&&(_.barsCoefficient=Math.min(Math.max(_.barsCoefficient||1,parseInt(_.expectedBarsCount/(d.length-_.barsCount)+.5)),100)),_.barsCount=d.length,f=d[d.length-1],a(h,d.length-1,1e3*f.value[0]),l.rebuildExtrapolatedData(i,e.name,t,h,1e3*f.value[0]),s&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r),TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,d,h,0),m=l._extrapolationManager.storage(i,h.full_name,t),
Promise.resolve().then(function(){l._pointsetsManager.broadcastPointsetsUpdates(h.full_name,t,n,m,h,function(e,t){TradingView.ChartapiMessagerInstances[i].onPointsetDataUpdate(e,r,t,h)})})),y=0===d.length||u&&u.endOfData,y&&(l._logMessage("Series has no more data on server: {0}".format(h.full_name)),l._setEndOfData(i,o,r),0===d.length&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r)),TradingView.ChartapiMessagerInstances[i].onSeriesCompleted(o,r,h.data_status)},function(e,n,s,c,h){var u,d=l._convertBarsTimeToUnix(e),p=d[d.length-1];if(n){if(l._rangeExtensionData[i]||l.purgeRangeExtensionData(i),void 0===l._rangeExtensionData[i].realtimeBarsCount&&(l._rangeExtensionData[i].realtimeBarsCount=0),l._rangeExtensionData[i].realtimeBarsCount+=1,!l._studiesCache[i][o])throw Error("This should never happen");u=s-1,l._logMessage("New bar arrived: symbol {0}, bar {1}".format(h.full_name,JSON.stringify(p))),TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,[p],h,u),a(h,u,1e3*p.value[0]),l.rebuildExtrapolatedData(i,h.full_name,t,h,1e3*p.value[0])}else l._logMessage("Last bar update: symbol {0}, bar {1}".format(h.full_name,JSON.stringify(p))),TradingView.ChartapiMessagerInstances[i].onDataUpdate(o,r,d,null,h);l._fireEvent("realtime_tick",e[e.length-1],!0)},function(e){l._logMessage("Series error: {0}".format(e)),TradingView.ChartapiMessagerInstances[i].onSeriesError(o,e),n.enabled("clear_bars_on_series_error")&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r)},function(e,n){var s,c,h,u,d,p,_,f;if("projection"!==e.type)throw Error("unexpected non-series data type for series "+e.type);if(s=e.projectionTime/1e3,c=-1,(e.data||[]).forEach(function(e){c=Math.max(c,e[0]||0)}),c=Math.min(c,100),h=e.barsetSize,s&&c>=0&&h&&e.lastBar){for(u=[],d=0;d<=c;d++)u.push(s+.001*d);p=e.lastBar.slice(0),p[0]=p[0]/1e3,TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,[{index:h-1,value:p}],n,h-1,u),_=h+c,f=1e3*Math.trunc(u[c]),a(n,_,f),l.rebuildExtrapolatedData(i,n.full_name,t,n,f)}l._updateProjectionData(i,o,r,e)})},f.prototype.onMoreTickmarksRequested=function(e,t,i,n,o){this._extrapolationManager.storage(e,i.full_name,n).onTickmarksNeeded(i,o)},f.prototype.removePointset=function(e){this._pointsetsManager.removePointset(e)},f.prototype.rebuildExtrapolatedData=function(e,t,i,n,o){this._extrapolationManager.storage(e,n.full_name,i).rebuild(o,n)},f.prototype.createPointset=function(e,t,i,n,o,r){var s=this._extrapolationManager.storage(e,n.full_name,o);this._pointsetsManager.createPointset(t,i,o,r,s,n)},f.prototype.studiesMetadata=function(){return 0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map(function(e){return e.metainfo})),this._metainfoCache},f.prototype.searchSymbols=function(e,t,i,n){function o(e){r._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),n(e)}this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));var r=this;this._externalDatafeed.searchSymbols(e,t,i,o)},
f.prototype.resolveSymbol=function(e,t,i){var n,o=g.parseSymbol(e).symbol;this._resolveRequests[o]?n=this._resolveRequests[o]:(n=this.resolveSymbolInternal(o),this._resolveRequests[o]=n),n.done(t).fail(i)},f.prototype.resolveSymbolInternal=function(e){var t,i=this,n=$.Deferred();return this._logMessage("Symbol resolve requested: `{0}` ".format(e)),t=!0,this._externalDatafeed.resolveSymbol(e,function(o){t&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),i._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(e,JSON.stringify(o))),a(o),s(o),i._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(e,JSON.stringify(o))),i._fullNameSymbolInfoMap[o.full_name]=o,n.resolve(o)},function(t){i._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(e,t)),n.reject(t)}),t=!1,n.promise()},f.prototype._createMarketStatusWatchers=function(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});var i=this;t.forEach(function(t){void 0===i._marketStatusWatchers[e][t]&&(i._marketStatusWatchers[e][t]=new m(i,e,t))})},f.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach(function(i){t._marketStatusWatchers[e][i].stop()}),this._marketStatusWatchers[e]={}},f.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},f.prototype._startQuotesSubscription=function(e){function t(t,i){var n=r._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||n&&n.marketStatus(),t.values.pricescale=i.pricescale,t.values.minmov=i.minmov,t.values.minmove2=i.minmove2||0,t.values.fractional=i.fractional||!1,n&&t.v.cs&&n.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function i(e){e.forEach(function(e){void 0!==o[e.n]?null!==o[e.n]&&t(e,o[e.n]):r.resolveSymbol(e.n,function(i){o[e.n]=i,t(e,i)},function(){o[e.n]=null})})}var o={},r=this,s=this._quotesInfo[e].symbols;0!==s.length&&(this._externalDatafeed.getQuotes&&!n.enabled("charting_library")?this._externalDatafeed.getQuotes(s,function(t){r._quotesInfo[e]&&(i(t),r._quotesInfo[e].listenerGUID=e,r._externalDatafeed.subscribeQuotes(s,r._quotesInfo[e].fastSymbols,i,r._quotesInfo[e].listenerGUID))},function(e){}):!this._externalDatafeed.getQuotes&&n.enabled("trading_terminal")&&setTimeout(function(){i(s.map(function(e){return{n:e,s:"ok",v:{}}}))}),this._createMarketStatusWatchers(e,s))},f.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},f.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},f.prototype.quoteDeleteSession=function(e){
this._stopQuotesSubscription(e),this._quotesInfo[e]=null},f.prototype.quoteSetFields=function(e,t){},f.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},f.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter(function(e){return t.indexOf(e)<0}),this._restartQuotesSubscription(e)},f.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},f.prototype.quoteHibernateAll=function(e){},f.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},f.prototype._startDepthSubscription=function(e){function t(e){return e.map(function(e){return{p:e.price,v:e.volume}})}function i(e){var i={};return i.s=r,i.bids=t(e.bids),i.asks=t(e.asks),i}function n(t){t.snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([i(t)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([i(t)]))}var o=this,r=this._depthInfo[e].symbol;r&&this._fullNameSymbolInfoMap[r]&&this._externalDatafeed.subscribeDepth&&(o._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(r,function(t){o._depthInfo[e]&&n(t)}))},f.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},f.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},f.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},f.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},f.prototype._filteredSymbols=function(e){var t=[];return e.forEach(function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)}),t},f.prototype._isEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;return!!this._endOfData[n]},f.prototype._setEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;this._endOfData[n]=!0},f.prototype.alignTimePoint=function(e,t,i){return n.enabled("disable_resolution_rebuild")?e:r(t,i).alignTimeIfPossible(1e3*e)/1e3},f.prototype.serverTimeOffset=function(){return this._serverTimeOffset},f.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},e.exports=f}).call(t,i(35),i(5))},function(e,t,i){"use strict";(function(t){var n=i(37),o={},r=function(e,i,r){function s(){var e={};e.symbolname=_,e.status="ok",e.values={},e.values.current_session=d,o[_]=d,TradingView.ChartapiMessagerInstances[f].onQuotesData([f].concat([e]))}function a(e,i,o){var r=t.get_timezone(i);c=(new n.Session).init(r,e),h=o,m=setInterval(l,6e4),l(),s()}function l(){var e,t;if(c){if(h)return void(d="out_of_session");e=n.isTradingNow(new Date,c),t=e?"market":"out_of_session",t!==d&&(d=t,s())}}var c,h,u={},d=o[r]||"out_of_session",p=!1,_=r,f=i,m=null
;return e.resolveSymbol(r,function(e){p||a(e.session,e.timezone,e.expired)},function(){}),u.stop=function(){p=!0,m&&clearInterval(m)},u.marketStatus=function(){return d},u};e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";(function(t){var n=i(673).HeikenAshi,o=i(15).Interval,r=function(){function e(e){this.host=e,this.cache={}}function r(e){var t=e.indexOf(",");return-1===t?e:e.slice(0,t)}function s(e,t,i,n,o,r,s){return o+e+t+i+(a(n)?"_":"")+r+"_"+s}function a(e){return e.has_empty_bars||e.force_session_rebuild}function l(e){if(0!==e.indexOf("="))return{symbol:e};var t;try{t=JSON.parse(e.slice(1))}catch(t){return{symbol:e}}return t.type&&(0===t.type.indexOf("BarSetHeikenAshi@tv-basicstudies-")?t.builder=new n:console.error("unknown builder type: "+t.type)),"string"!=typeof t.symbol&&(t.session=t.symbol.session||t.session,t.symbol=t.symbol.symbol),t}function c(t){e.instance=new e(t),p.setupFeed(e.instance)}var h,u,d,p=i(25),_=i(37),f=p.Symbol,m=p.StudyEngine,y=p.BarBuilder,g=p.BarSet;return e.prototype.getCache=function(e){return this.cache[e]},e.prototype.putCache=function(e,t){this.cache[e]=t},e.prototype.subscribe=function(e,t,i,n,o,r,a,l,c,h){var u=s(e,t,i,a,l,n,h),d=this.getCache(u);return d||(d=this.createItem(e,t,i,a,c,l,n,h),this.putCache(u,d)),d.listeners.addListener(o,r),{key:u,listener:o}},e.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},e.prototype.removeUnused=function(){var e,t,i,n,o,r=[];for(e in this.cache)this.cache[e]&&(t=this.cache[e],0===t.listeners.listenersCount()&&r.push(e));if(0!==r.length){for(i=0;i<r.length;i++)n=r[i],o=this.cache[n],this.cache[n]=null,o.stop();this.removeUnused()}},e.prototype.rebuildFrom=function(e,t,i){var n,o,r,s,a=f.parsePeriod(e),l=f.parsePeriod(t);if(""!==a.resolution&&!a.isSeconds){if(i.has_weekly_and_monthly)return a.resolution;if(void 0===i.has_daily||i.has_daily)return"D";""!==l.resolution&&(l.resolution="",l.interval=i.intraday_multipliers?i.intraday_multipliers[0]:1)}if(a.isIntraday&&void 0!==i.has_intraday&&!i.has_intraday)return"";if(a.isSeconds&&!i.has_seconds)return"";if(n=""!==a.resolution?l.interval:""===l.resolution?Math.min(a.interval,l.interval):a.interval,(o=a.isIntraday?i.intraday_multipliers:i.seconds_multipliers)&&-1===o.indexOf(n)){for(r=o.length-1;r>=0;r--)if(s=+o[r],n%s==0)return s+(a.isSeconds?"S":"");return""}return n+(a.isSeconds?"S":"")},e.prototype.createItem=function(e,t,i,n,s,c,p,_){var f,m,g,v,S,b,w,P=new d,T=l(e);return T.builder?new u(P,T.symbol,t,i,T.builder,n,s,c):(f=r(t),m=this.rebuildFrom(f,r(i),n),g=a(n),!o.isEqual(f,m)||g?(v=n.has_empty_bars,S=$.extend({},n),g&&(S.has_empty_bars=!1,S.force_session_rebuild=!1),void 0!==_&&(b=o.parse(f).inMilliseconds()/o.parse(m).inMilliseconds(),_*=Math.ceil(b)),new u(P,T.symbol,t,m,new y(t,v),S,s,c,p,_)):(w=T.session&&"extended"!==T.session,new h(P,T.symbol,t,i,w,this.host,n,s,p,_)))},h=function(e,t,i,n,o,s,a,l,c,h){this.listeners=e,this.host=s;var u=this;this.host.resolve(t,function(e){
o&&e.regular_session&&(e.session=e.regular_session);var s=u.calculateFromTo(e,c||n||i,t,l,h);u.subs=u.host.subscribe(e,r(i),s,function(e){u.listeners.fire(e)},function(e){u.listeners.onError(e)})},function(e){u.listeners.onError(e)})},h.prototype._createDWMAligner=function(e,i){var n=t.get_timezone(i.timezone),o=new _.Session;return o.init(n,i.session),f.newBarBuilder(e,o,o)},h.prototype.stop=function(){this.subs&&this.host.unsubscribe(this.subs)},h.prototype.calculateFromTo=function(e,i,n,o,r){var s,a,l,c,h,u,d,p,m=f.parsePeriod(i),y=(new Date).valueOf(),g=e.expired?t.cal_to_utc(t.get_timezone(e.timezone),new Date(1e3*e.expiration_date))||y:y;return""===m.resolution?(a=m.interval,l="D"):"S"===m.resolution?(a=10*m.interval,l=""):(c="D"===m.resolution?1:"W"===m.resolution?5:30,a=12*c*m.interval,l="M"),m.range?(a=m.range.interval,l=m.range.resolution):this.host.calculateHistoryDepth&&(h=this.host.calculateHistoryDepth(i,l,a))&&(a=h.intervalBack||a,l=void 0===h.resolutionBack?l:h.resolutionBack),u=e.sessionString||e.session,s=_.alignPeriodsBack(u,l,a,1,g),o&&o.getRangeExtensionTime&&(d=o.getRangeExtensionTime())&&(s=Math.min(1e3*d,s)),p=Math.ceil(1.5*r),o&&o.getRangeExtensionCount&&(p+=o.getRangeExtensionCount()),p>0&&(s=_.alignPeriodsBack(u,m.resolution,m.interval,p,s)),{from:s,to:g+6e4}},u=function(e,t,i,n,o,r,s,a,l,c){if(this.listeners=e,this.isRecalculated=!1,""===n)return console.error("unsupported resolution for rebuild: "+i),void this.listeners.onError("unsupported resolution for rebuild: "+i);this.symbolInfo=r;var h=this;this.engine=new m({tickerid:t,period:n,periodBase:i,body:o,sessionId:a,symbolInfo:r,rangeExtension:s,periodForInitialRange:l,additionalBarsCount:c,recalc:function(e,t){h._recalc(t)},out:function(e,t){h._out(e,t)},nonseriesOut:function(e,t){h._nonseriesOut(e,t)},setNoMoreData:function(){h.barset&&(h.barset.endOfData=!0)},onErrorCallback:function(e){h.listeners.onError(e)}})},u.prototype.stop=function(){this.engine?this.engine.stop():console.error("Internal library error 0x1")},u.prototype._recalc=function(e){this.isRecalculated&&console.error("recalc called twice!"),this.barset||(this.barset=new g(this.symbolInfo)),e&&(this.barset.nextTime=e.nextTime,this.barset.endOfData=e.endOfData),this.listeners.fire(this.barset),this.isRecalculated=!0},u.prototype._nonseriesOut=function(e,t){var i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this.barset?this.barset.count():0,i.lastBar=this.barset?this.barset.bar(this.barset.count()-1):null,this.listeners.fire(i,!0)},u.prototype._out=function(e,t){var i,n,o,r,s,a,l,c=t[0];if(!isNaN(c)){if(i={time:c,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},n=t[7],this.barset||(this.barset=new g(e.info)),(o=t[8])instanceof Array)for(r=0;r<o.length;r++)s=t[9],a=o[r],l={time:a,open:s,high:s,low:s,close:s,volume:0,updatetime:a},this.barset.add(l,!0),this.isRecalculated&&this.listeners.fire(this.barset);this.barset.add(i,n),this.barset.isBarClosed=n,this.isRecalculated&&this.listeners.fire(this.barset)}},d=function(){
this.listeners=[]},d.prototype.listenersCount=function(){return this.listeners.reduce(function(e,t){return e+(t?1:0)},0)},d.prototype.addListener=function(e,t){this.listeners.push({dataListener:e,onErrorCallback:t}),this.barset&&e(this.barset),this.errorMsg&&t(this.errorMsg)},d.prototype.removeListener=function(e){var t,i=this.listeners.filter(function(t){return t.dataListener===e});0!==i.length&&(t=this.listeners.indexOf(i[0]),delete this.listeners[t])},d.prototype.onError=function(e){var t,i,n,o;for(this.errorMsg=e||"unspecified error",t=this.listeners,i=t.length,n=0;n<i;n++)(o=t[n])&&o.onErrorCallback&&o.onErrorCallback(e)},d.prototype.fire=function(e,t){var i,n,o,r;for(t||(this.barset=e),i=this.listeners,n=i.length,o=0;o<n;o++)(r=i[o])&&r.dataListener(e)},{setupFeed:c,parseSymbol:l,unsubscribeUnused:function(){e.instance.removeUnused()}}}();e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"HeikenAshi",function(){return o}),n=i(25),i.n(n),o=function(){function e(){}return e.prototype.main=function(e){var t,i,o,r,s=e.new_var(n.Std.open(e)),a=e.new_var(n.Std.close(e)),l=s.get(1),c=a.get(1),h=n.Std.ohlc4(e),u=n.Std.na(s.get(1))?(n.Std.open(e)+n.Std.close(e))/2:(l+c)/2;return s.set(u),a.set(h),t=n.Std.max(n.Std.high(e),n.Std.max(u,h)),i=n.Std.min(n.Std.low(e),n.Std.min(u,h)),o=n.Std.volume(e),r=e.symbol,[r.time,u,t,i,h,o,r.updatetime,r.isBarClosed]},e}()},function(e,t,i){"use strict";var n=function(){function e(e,t,i){return e+","+t+","+i}function t(t,i,n){delete o[e(t,i,n)]}function n(t,i,n){function s(e){return"undefined"!=typeof TradingView&&TradingView.ChartapiMessagerInstances?o[e]=new a(TradingView.ChartapiMessagerInstances[t],l.pureResolution):o[e]=new a(null,l.pureResolution),o[e]}var l=r.Symbol.parsePeriod(n),c=e(t,i,l.pureResolution);return o[c]?o[c]:s(c)}var o={},r=i(25),s=i(37),a=function(e,t,i){this._chartApiMessager=e,this._lastRealBarTime=null,this._lastRealBarIndex=null,this._resolution=t,this._extrapolatedBarsCache=[],this._onReadyCallbacks=[],this._requestedAmountOfBars=0,this._maxDepth=i||100};return a.prototype.ready=function(){return null!==this._lastRealBarIndex},a.prototype.rebuild=function(e,t){this._lastRealBarTime=e;var i=Math.max(this._extrapolatedBarsCache.length,this._requestedAmountOfBars);this._extrapolatedBarsCache=[],this.ensureExtrapolatedToBar(t,i)},a.prototype.historyExtrapolator=function(){return void 0===this._historyExtrapolator&&(this._historyExtrapolator=new a(null,this._resolution,Math.max(this._maxDepth,1500))),this._historyExtrapolator},a.prototype.getPointTimeUTC=function(e,t,i){var n,o;return 0===t?e:!this.ready()||e<this._lastRealBarTime/1e3?(this.historyExtrapolator().setLastBarTime(0,1e3*e),this.historyExtrapolator().getPointTimeUTC(e,t,i)):(n=0===this._extrapolatedBarsCache.length||e===this._lastRealBarTime/1e3,o=n?-1:this.indexOfBar(e,i)-this._lastRealBarIndex-1,this.ensureExtrapolatedToBar(i,o+t+1),this._extrapolatedBarsCache[o+t])},a.prototype.findDistanceInBars=function(e,t,i){
return e===t?0:(this.historyExtrapolator().setLastBarTime(0,1e3*e),this.historyExtrapolator().indexOfBar(t,i))},a.prototype.indexOfBar=function(e,t){this._ensureExtrapolatedToTime(t,1e3*e);var i=s.lower_bound(this._extrapolatedBarsCache,e,function(e,t){return e>t?1:e<t?-1:0});return-1===i?i:this._lastRealBarIndex+i+1},a.prototype._extrapolateData=function(e,t){var i,n,o;if(!this._lastRealBarTime)throw Error("No real bars known, so cannot extrapolate anything");if(!(i=t(this._lastRealBarTime))||0===i.length)return void(null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,this._extrapolatedBarsCache,e,this._resolution));for(n=0;n<i.length;++n)i[n]=i[n]/1e3;for(i[0]===this._lastRealBarTime/1e3&&(i=i.slice(1)),this._extrapolatedBarsCache=i,o=i.slice(0),o.sort(),n=0;n<o.length-1;++n)o[n]===o[n+1]&&console.error("Duplicating extrapolated bars: duplicated "+new Date(1e3*o[n]));null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,i,e,this._resolution)},a.prototype.onTickmarksNeeded=function(e,t){if(this.ready())this.ensureExtrapolatedToBar(e,t);else{var i=this;this._onReadyCallbacks.push(function(){i.ensureExtrapolatedToBar(e,t)})}},a.prototype.ensureExtrapolatedToBar=function(e,t){var i=this;return this._requestedAmountOfBars=t,this._extrapolateData(e,function(n){return i._extrapolatedBarsCache.length>=t||!i._shouldExtrapolateMore()?null:s.extrapolateBarsFrontByCount(i.newBarBuilder(e),n,t)})},a.prototype._ensureExtrapolatedToTime=function(e,t){var i=this;return this._extrapolateData(e,function(n){var o,r;return n>=t||!i._shouldExtrapolateMore()?null:(o=2e3,r=s.extrapolateBarsFrontToTime(i.newBarBuilder(e),n,t,o),r[r.length-1]<t&&console.warn("Extrapolation error: not enough data created"),r)})},a.prototype.newBarBuilder=function(e){var t=r.Symbol.newSession(e.timezone,e.session);return r.Symbol.newBarBuilder(this._resolution,t)},a.prototype._shouldExtrapolateMore=function(){return this._extrapolatedBarsCache.length<this._maxDepth},a.prototype.setLastBarTime=function(e,t){(null===this._lastRealBarIndex||this._lastRealBarIndex===e&&this._lastRealBarTime!==t)&&(this._extrapolatedBarsCache=[]),this._extrapolatedBarsCache&&this._extrapolatedBarsCache.length&&this._lastRealBarIndex!==e&&(this._lastRealBarIndex>e?this._extrapolatedBarsCache=[]:this._lastRealBarTime!==t&&this._extrapolatedBarsCache.shift(e-this._lastRealBarIndex)),this._lastRealBarIndex=e,this._lastRealBarTime=t;for(var i=0;i<this._onReadyCallbacks.length;++i)this._onReadyCallbacks[i]();this._onReadyCallbacks=[]},{remove:t,storage:n}}();e.exports=n},function(e,t,i){"use strict";(function(t){var n=i(37),o=i(15).Interval,r=function(){function e(e,t){return e}function r(e,t){var i=m.get_timezone(e.timezone),o=new n.Session;return o.init(i,e.session),f.Symbol.newBarBuilder(t,o,o)}function s(t,i,n,o,r,s){var a,l,c,h,u=e(i,n);for(p.hasOwnProperty(u)||(p[u]=[]),a=[],l=0;l<o.length;++l)o[l][1]<0&&(o[l][1]=0),
0!==o[l][1]?(c=r.getPointTimeUTC(o[l][0],o[l][1],s),a.push(c)):o[l][0]&&a.push(o[l][0]);h={guid:t,points:a},p[u].push(h)}function a(e){var t,i,n;for(t in p)for(i=p[t],n=0;n<i.length;++n)if(i[n].guid===e)return void i.splice(n,1)}function l(e,t,i,n,o){var r,s,a,l=[];for(r=0;r<e.points.length;++r){if(null==(s=e.points[r]))return null;if(null===(a=h(t,s,i,n,o)))return null;l.push({index:r,value:[a,s]})}return l}function c(t,i,n,o,r,s){var a,c,h,u,d=e(t,i);if(p.hasOwnProperty(d))for(a=p[d].length,c=0;c<a;++c)h=p[d][c],null!==(u=l(h,n,o,r,i))&&s(h.guid,u)}function h(e,t,i,o,s){var a,l;return 1e3*(t=r(o,s).alignTimeIfPossible(1e3*t)/1e3)<e[0].value[0]?-d(o,s,t,e[0].value[0]/1e3,i):(a=n.lower_bound(e,1e3*t,function(e,t){return e.value[0]>t?1:e.value[0]<t?-1:0}))>=0&&t<e[e.length-1].value[0]?(e[a].value[0]/1e3!==t&&0!==a&&a--,e[a].index):(l=i.indexOfBar(t,o),-1===l?null:l)}function u(e,t,i,n,o){function r(e,t){var i=new Date(1e3*e),n=new Date(1e3*t),o=12*(n.getFullYear()-i.getFullYear());return o-=i.getMonth()+1,o+=n.getMonth(),o<=0?0:o}var s,a,l,c,h,u,d,p,_,f,y,g,v,S,b;if(t.isMonths())s=r(n,o)/t.multiplier();else if(t.isWeeks())a=Math.ceil((o-n)/604800),s=Math.ceil(a/t.multiplier());else{if(l=m.utc_to_cal(i.timezone,+new Date(1e3*n)),c=m.utc_to_cal(i.timezone,+new Date(1e3*o)),(h=(o-n)/86400)>4*(7-i.spec.weekEndsCount()))d=h/7,u=d*(7-i.spec.weekEndsCount());else{for(p=0,_={},f=l;f.valueOf()<=c.valueOf();f=m.add_days_considering_dst(i.timezone,f,1))y=m.get_day_of_week(f),void 0===_[y]&&(_[y]=i.spec.isWeekEnd(y)),_[y]&&p++;u=h-p}if(t.isDays())s=Math.ceil(u/t.multiplier());else{if(g=t.isHours()?60*t.multiplier()*60:t.isSeconds()?t.multiplier():60*t.multiplier(),h<1&&(v=i.spec.findSessionEntry(m.get_day_of_week(l),m.get_minutes_from_midnight(l)),S=i.spec.findSessionEntry(m.get_day_of_week(c),m.get_minutes_from_midnight(c)),v===S))return Math.ceil((o-n)/g);y=i.spec.entries()[0].dayOfWeek(),b=60*i.spec.entries().reduce(function(e,t){return e+(t.dayOfWeek()===y?t.length():0)},0),s=Math.ceil(u*b/g)}}return s}function d(e,t,i,s,a){var l,c,h=new o(t),d=m.get_timezone(e.timezone),p=new n.Session;return p.init(d,e.session),l=r(e,t),i=l.alignTimeIfPossible(1e3*i)/1e3,s=l.alignTimeIfPossible(1e3*s)/1e3,i>=s?0:(c=u(e,h,p,i,s),c>=1e3?c:a.findDistanceInBars(i,s,e))}var p={},_="undefined"!=typeof window?window:t,f=i(25),m=_.PineJsCalendar?_.PineJsCalendar:i(35);return{createPointset:s,removePointset:a,broadcastPointsetsUpdates:c,tests:{approxBarsInterval:u,indexOfTime:h}}}();e.exports=r}).call(t,i(99))},function(e,t,i){"use strict";function n(e,t,i){return Object(a.isArray)(e)?o(e,t,i):Object(a.isObject)(e)&&(Object(a.isHashObject)(e)||i&&i.visitInstances)?r(e,t,i):e}function o(e,t,i){return e.map(function(e){var o=n(e,t,i),r=t(o);return void 0!==r?r:o})}function r(e,t,i){var o={};return Object.keys(e).forEach(function(r){var s=n(e[r],t,i),a=t(s);o[r]=void 0!==a?a:s}),o}function s(e,t,i){var o=n(e,t,i),r=t(o);return void 0!==r?r:o}var a;Object.defineProperty(t,"__esModule",{value:!0}),t.visitObject=s,a=i(12),i.n(a)},function(e,t,i){
"use strict";function n(e,t){return e.ticker+"_"+t}function o(e){return new Date(e).toISOString()}var r,s,a,l,c,h;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DatafeedRequestsCachedProcessor",function(){return h}),r=i(15),s=i(78),a=i(25),i.n(a),l=i(5),i.n(l),i(86),c=function(){function e(e,t,i,n){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._gaps=[],this._needPurgeCache=!1,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._datafeed=e,this._symbolInfo=t,this._resolution=i,this._dwmAligner=n}return e.prototype.destroy=function(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed},e.prototype.addSubscription=function(e,t,i){var n=this,o=this._getNextSubscriptionId(),r=Math.floor(e.from/1e3),s=Math.floor(e.to/1e3);return this._pendingSubscribers.push({key:o,range:{from:r,to:s},onHistoryCallback:t,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){return n._processPendingSubscribers()},0),o},e.prototype.removeSubscription=function(e){var t,i=this,n=this._pendingSubscribers.find(function(t){return t.key===e});return n?void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(n),1):(t=this._subscribers.find(function(t){return t.key===e}))?(this._subscribers.splice(this._subscribers.indexOf(t),1),void(this._subscribers.length||(this._symbolInfo.expired||this._symbolInfo.expiration_date?this._unsubscribeRealtime():this._resetCacheTimeout=setTimeout(function(){i._purgeCacheDelayed(),i._unsubscribeRealtime()})))):void console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._purgeCacheDelayed=function(){this._logMessage("Reset cache"),this._needPurgeCache=!0,this._clearResetCacheTimeout()},e.prototype._logMessage=function(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log("FEED [{0}|{1}]: {2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._clearResetCacheTimeout=function(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)},e.prototype._purgeCache=function(){this._cache={bars:[]},this._gaps=[],this._errorMessage=null,this._needPurgeCache=!1,this._leftDate=null,this._endOfData=!1},e.prototype._processPendingSubscribers=function(){var e,t,i,n,s,a,l=this,c=this._pendingSubscribers;if(c.length){if(this._requesting)return void this._logMessage("Processing is skipped due active request");if(this._logMessage("Processing pending subscribers, count="+c.length),this._needPurgeCache&&this._purgeCache(),this._errorMessage)return e=this._errorMessage,this._logMessage("Return error: "+e),this._pendingSubscribers=[],void c.forEach(function(t){t.onErrorCallback(e)});if(t=c.reduce(function(e,t){return Math.min(t.range.from,e)},1/0),
this._logMessage('Leftmost requested "from" is '+o(1e3*t)),(!this._leftDate||t<this._leftDate)&&(i=new r.Interval(this._resolution),n=(i.inMilliseconds(Date.now())||0)/1e3,s=!this._leftDate,a=!s&&!!this._cache.bars.length&&this._cache.bars[0].time/1e3-t<n,(s||!a)&&!this._endOfData))return void this._ensureRequestedTo(t);this._pendingSubscribers=[],c.forEach(function(e){var t=l._moveSubscriberToRealtime(e);l._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()}},e.prototype._moveSubscriberToRealtime=function(e){var t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t},e.prototype._subscribeRealtimeIfNeeded=function(){!this._subscribers.length||this._realtimeOn||this._symbolInfo.expired||this._symbolInfo.expiration_date||this._subscribeRealtime()},e.prototype._subscribeRealtime=function(){var e,t,i=this;this._symbolInfo.expired||this._realtimeOn||(e=function(e){i._dwmAligner&&(e.time=i._dwmAligner.tradingDayToSessionStart(e.time)),i._putToCacheNewBar(e),i._subscribers.forEach(function(t){var i=t.barset;if(null===i)throw Error("subscirber.barset is null");i.add(e),t.onHistoryCallback(i)})},t=function(){i._unsubscribeRealtime();var e=i._leftDate;i._purgeCache(),e&&i._ensureRequestedTo(e)},this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,e,n(this._symbolInfo,this._resolution),t),this._logMessage("Subscribed to realtime"))},e.prototype._unsubscribeRealtime=function(){!this._symbolInfo.expired&&this._realtimeOn&&(this._datafeed.unsubscribeBars(n(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)},e.prototype._returnHistoryDataToSubscriber=function(e,t){var i,n,r=e.range,s=l.enabled("cl_feed_return_all_data")?this._createBarset(this._leftDate||r.from):this._createBarset(r.from);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),o(s.bars[0].time),o(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,i=this._inGapNextTime(r.from),i?(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*i))),s.nextTime=i):0===s.count()&&(n=this._cache.bars.length&&this._cache.bars[this._cache.bars.length-1].time/1e3)&&r.from>n&&(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*n))),s.nextTime=n||void 0),this._endOfData&&null!==this._leftDate&&e.range.from<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)},e.prototype._createBarset=function(e){var t=Object(s.lowerbound)(this._cache.bars,1e3*e,function(e,t){return e.time<t});return new a.BarSet(this._symbolInfo,this._cache.bars.slice(t))},e.prototype._ensureRequestedTo=function(t){var i,n,r,s=this;if(this._leftDate&&this._leftDate<t)return void this._processPendingSubscribers();i=!this._leftDate,this._requesting=!0,n=t,r=this._leftDate?this._leftDate-1:this._symbolInfo.expiration_date||Math.floor(e._now()/1e3),this._leftDate=t,
this._logMessage("Requesting data: [{0} ... {1}] ".format(o(1e3*n),o(1e3*r))),this._datafeed.getBars(this._symbolInfo,this._resolution,n,r,function(e,t){s._requesting=!1,s._processBars(e,t)},function(e){s._requesting=!1,s._errorMessage=e||null,s._processPendingSubscribers()},i)},e.prototype._processBars=function(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?this._processFullBarset(e,t):this._processEmptyBarset(t),this._processPendingSubscribers()},e.prototype._processEmptyBarset=function(t){this._logMessage("Receiving bars: barset is empty"),t&&t.nextTime?(this._logMessage("Next time received: `{0}`".format(o(1e3*t.nextTime))),this._addGap(t.nextTime),this._leftDate=Math.min(this._leftDate||e._now()/1e3,t.nextTime+1)):t&&t.noData?(this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._cache.bars[0].time/1e3)):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned")},e.prototype._processFullBarset=function(e,t){var i=e[0].time,n=e[e.length-1].time;this._logMessage("Receiving bars: total {0} bars in [{1} ... {2}] ".format(e.length,o(i),o(n))),null!==this._leftDate&&i<1e3*this._leftDate&&!l.enabled("cl_feed_return_all_data")&&this._logMessage("Returned more data than needed"),this._putToCache(e)?null!==this._leftDate&&this._cache.bars.length&&this._leftDate>this._cache.bars[0].time/1e3&&(this._leftDate=this._cache.bars[0].time/1e3):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")},e.prototype._addGap=function(t){var i;this._gaps.find(function(e){return e.from===t})||(i=(this._cache.bars.length?this._cache.bars[0].time:e._now())/1e3,this._gaps.push({from:t,to:i}))},e.prototype._inGapNextTime=function(e){var t=this._gaps.find(function(t){return t.from<e&&t.to>e});return t?t.from:null},e.prototype._getNextSubscriptionId=function(){return this._nextSubscriptionId++},e.prototype._checkBars=function(e,t){var i,n;if(void 0===t&&(t=!1),l.enabled("charting_library_debug_mode"))for(i=1;i<e.length;i++)e[i].time<=e[i-1].time&&(n="Wrong bars time: time {0} of bar {1} should be more than time {2} of bar {3}".format(e[i].time,i,e[i-1].time,i-1),t&&this._dwmAligner&&(n+="\nCheck that you provide DWM bars without time part, i.e. 00:00 GMT"),console.error(n))},e.prototype._putToCache=function(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){
var t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=e.concat(this._cache.bars),this._checkBars(this._cache.bars,!0),!0},e.prototype._putToCacheNewBar=function(e){var t=this._cache.bars.length,i=e.time,n=0===t?NaN:this._cache.bars[t-1].time;0===t||n<i?this._cache.bars.push(e):n===i?this._cache.bars[t-1]=e:console.error("putToCacheNewBar: time violation, previous bar time: "+o(n)+" should be less or equal to new time: "+o(i))},e.prototype._alignBarsTime=function(e){if(this._dwmAligner)for(var t=0;t<e.length;t++)e[t].time=this._dwmAligner.tradingDayToSessionStart(e[t].time)},e._now=function(){return Date.now()+6e4},e}(),h=function(){function e(e,t){this._threads={},this._datafeed=e,this._dwmAlignerCreator=t}return e.prototype.destroy=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={},delete this._datafeed},e.prototype.purgeCache=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={}},e.prototype.subscribe=function(e,t,i,o,r){var s,a=n(e,t);return this._threads[a]||(this._threads[a]=this._createThread(e,t)),s=this._threads[a].addSubscription(i,o,r),a+'"'+s},e.prototype.unsubscribe=function(e){var t,i,n=e.split('"');if(2!==n.length)return void console.warn("Wrong guid format");t=n[0],i=parseInt(n[1]),this._threads.hasOwnProperty(t)?this._threads[t].removeSubscription(i):console.warn("Data thread doesnt exist: "+e)},e.prototype._createThread=function(e,t){return new c(this._datafeed,e,t,this._dwmAlignerCreator(t,e.timezone,e.session))},e.prototype._forEachThread=function(e){var t=this;Object.keys(this._threads).forEach(function(i){return e(i,t._threads[i])})},e}()},function(e,t,i){"use strict";(function(t,n){function o(e,i,n,o){this._chartWidgetCollection=e,this._chartApiInstance=i,this._saveChartService=n,this._loadChartService=o,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._activeChangedChangedDelegate=new t,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this)),this._chartWidgets=new WeakMap}var r=i(62).linking,s=i(679),a=i(109).layouts,l=i(31),c=i(89),h=i(32),u=i(61),d=i(67),p=i(4),_=i(209).createNoticeDialog,f=i(83).createConfirmDialog,m=i(298),y=i(685).ThemesApi;o.prototype.subscribe=function(e,t){l.subscribe(e,t)},o.prototype.unsubscribe=function(e,t){l.unsubscribe(e,t)},o.prototype.onContextMenu=function(e){l.subscribe("onContextMenu",function(t){t.callback(e(t.unixtime,t.price))})},o.prototype.onGrayedObjectClicked=function(e){l.subscribe("onGrayedObjectClicked",e)},o.prototype.activeChart=function(){return this._getChartWidgetApi(this._chartWidgetCollection.activeChartWidget.value())},o.prototype._getChartWidgetApi=function(e){var t=this._chartWidgets.get(e);return void 0===t&&(t=new s(e),
this._chartWidgets.set(e,t)),t},o.prototype.onActiveChartChanged=function(){return this._activeChangedChangedDelegate},o.prototype.changeSymbol=function(e,t,i){r.interval.setValue(t),r.symbol.setValue(e),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)},o.prototype.setLayout=function(e){this._chartWidgetCollection.layout.setValue(e)},o.prototype.layout=function(){return this._chartWidgetCollection.layout.value()},o.prototype.layoutName=function(){return this._chartWidgetCollection.metaInfo.name.value()},o.prototype.chartsCount=function(){return a[this.layout()].count},o.prototype.chart=function(e){if(void 0===e&&(e=0),e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])},o.prototype.getSymbolInterval=function(e){var t={symbol:r.symbol.value(),interval:r.interval.value()};return e&&e(t),t},o.prototype.saveChart=function(e){var t=this;this._saveChartService.whenReadyToSave(function(){var i=t._saveChartService.saveToJSON();return e&&e(JSON.parse(i.content))})},o.prototype.loadChart=function(e){this._chartApiInstance.purgeCache(),this._chartApiInstance._studyEngine.stopSources(),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),r.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")},o.prototype.getStudiesList=function(){return this._chartApiInstance.allStudiesMetadata().filter(function(e){return!e.is_hidden_study}).map(function(e){return e.name||e.description})},o.prototype.getSavedCharts=function(e){d.getCharts(e)},o.prototype.loadChartFromServer=function(e){d.loadChart(e)},o.prototype.saveChartToServer=function(e,t,i,n){this._saveChartService.saveChartSilently(e,i,t,n)},o.prototype.removeChartFromServer=function(e,t){d.removeChart(e,t)},o.prototype.getIntervals=function(){var e=[],t=u.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),u.mergeResolutions(e,t)},o.prototype.closePopupsAndDialogs=function(){var e,t,n=document.querySelectorAll("._tv-dialog-title-close");for(e=0;e<n.length;e++)n[e].click();t=i.c[690],t&&t.exports.closeAllDialogs(),c.hideAll()},o.prototype.selectLineTool=function(e){m.supportedLineTools[e]&&(e=m.supportedLineTools[e].name,h.tool.value()!==e&&h.tool.setValue(e))},o.prototype.selectedLineTool=function(){var e,t=Object.keys(m.supportedLineTools),i=h.tool.value();for(e=0;e<t.length;++e)if(m.supportedLineTools[t[e]].name===i)return t[e];return""},o.prototype.lockAllDrawingTools=function(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new n(h.lockDrawings().value()),this._lockDrawingsWatchedValue.subscribe(function(e){h.lockDrawings().setValue(e)}),h.lockDrawings().subscribe(this,function(){
this._lockDrawingsWatchedValue.setValue(h.lockDrawings().value())})),this._lockDrawingsWatchedValue},o.prototype.hideAllDrawingTools=function(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new n(h.hideAllDrawings().value()),this._hideDrawingsWatchedValue.subscribe(function(e){h.hideAllDrawings().setValue(e)}),h.hideAllDrawings().subscribe(this,function(){this._hideDrawingsWatchedValue.setValue(h.hideAllDrawings().value())})),this._hideDrawingsWatchedValue},o.prototype.mainSeriesPriceFormatter=function(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(e){function t(){i&&(i(),i=null)}e=e||{};var i=e.callback;_({title:e.title,content:e.body||""}).then(function(e){e.on("action:ok",t),e.on("afterClose",t),e.open()})},o.prototype.showConfirmDialog=function(e){function t(e){i&&(i(e),i=null)}if(e=e||{},!e.callback)throw Error("callback must be exist");var i=e.callback;f({title:e.title,content:e.body||""}).then(function(e){e.on("action:yes",t.bind(null,!0)),e.on("action:no",t.bind(null,!1)),e.on("afterClose",t.bind(null,!1)),e.open()})},o.prototype.logs=function(){return{getLogHistory:p.getLogHistory,enable:p.loggingOn,disable:p.loggingOff}},o.prototype.showLoadChartDialog=function(){var e=this._loadChartService;e&&e.showLoadDialog()},o.prototype.showSaveAsChartDialog=function(){var e=this._saveChartService;e&&window.runOrSignIn(function(){e.saveChartAs()})},o.prototype.themes=function(){return new y({chartWidgetCollection:this._chartWidgetCollection})},o.prototype.undoRedoState=function(){return this._chartWidgetCollection.undoHistory.state()},o.prototype.takeScreenshot=function(){this._chartWidgetCollection.takeScreenshot()},e.exports=o}).call(t,i(8),i(16))},function(e,t,i){"use strict";(function(t){function n(e){var t,i,n=Object.keys(y),o=n.length;for(t=0;t<o;++t)if(i=n[t],y[i].name===e)return i;return null}function o(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}var r=i(7).ensureNotNull,s=i(680),a=i(162).applyOverridesToStudy,l=i(26),c=i(681).LineDataSourceApi,h=i(682).StudyApi,u=i(683).PaneApi,d=i(3).DefaultProperty,p=i(335).availableIcons,_=i(37),f=i(15).Interval,m=i(35),y=i(298).supportedLineTools,g=i(292).showTooManyStudiesNotice,v=i(12).isNumber,S=i(684).onSeriesCompletedOrErrorReceived,b=function(e){this._chartWidget=e,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap};b.prototype._getPaneApi=function(e){var t=this._panes.get(e);return void 0===t&&(t=new u(e),this._panes.set(e,t)),t},b.prototype._getStudyApi=function(e){var t=this._studies.get(e);return void 0===t&&(t=new h(e,this._chartWidget.model().model()),this._studies.set(e,t)),t},b.prototype._getLineDataSourceApi=function(e){var t=this._lineDataSources.get(e);return void 0===t&&(t=new c(e,this._chartWidget.model().model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:function(e){
var t=this._chartWidget.model().mainSeries().syncModel(),i=this._chartWidget.model().timeScale();return e.map(function(e){var n=i.normalizeBarIndex(e.index);return{price:e.price,time:t.projectTime(n.time_t,n.offset)}})}.bind(this)}),this._lineDataSources.set(e,t)),t},b.prototype._makeSubscriptionFromDelegate=function(e){var t=$.extend({},e);return delete t.fire,t},b.prototype.executeActionById=function(e){this._chartWidget.executeActionById(e)},b.prototype.getCheckableActionState=function(e){return this._chartWidget.getCheckableActionState(e)},b.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},b.prototype.clearMarks=function(){this._chartWidget.clearMarks()},b.prototype.symbol=function(){return this._chartWidget.getSymbol()},b.prototype.symbolExt=function(){var e=this._chartWidget.model().mainSeries().symbolInfo();return e?{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type}:null},b.prototype.resolution=function(){return this._chartWidget.model().mainSeries().properties().interval.value()},b.prototype.setSymbol=function(e,i){function n(e){e||i()}if(e!==this.symbol()||t.enabled("same_data_requery")){var o=this._chartWidget.model().mainSeries().dataEvents();return i&&S(o,n),this._chartWidget.setSymbol(e)}},b.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},b.prototype.setResolution=function(e,t){function i(e){e||t()}if((e=e.toUpperCase())!==this.resolution()){var n=this._chartWidget.model().mainSeries().dataEvents();return t&&S(n,i),this._chartWidget.setResolution(e)}},b.prototype.setEntityVisibility=function(e,t){var i,n;console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead"),(i=this._chartWidget.model().model().dataSourceForId(e))&&(n=i.properties())&&n.visible&&n.visible.setValue(t)},b.prototype.getAllStudies=function(){return this._chartWidget.model().model().allStudies().map(function(e){return{id:e.id(),name:e._metaInfo.description}})},b.prototype.getAllShapes=function(){return this._chartWidget.model().model().allLineTools().map(function(e){return{id:e.id(),name:n(e.toolname)}}).filter(function(e){return null!==e.name})},b.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},b.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},b.prototype.removeEntity=function(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);if(!t)return void console.warn("Can't find a source with id: "+e);this._chartWidget.model().chartModel().removeSource(t,!0)},b.prototype.createStudyTemplate=function(e){return this._chartWidget.model().model().studyTemplate(e.saveInterval)},b.prototype.applyStudyTemplate=function(e){this._chartWidget.model().model().restoreStudyTemplate(e,""+1e3*Math.random())},b.prototype.setVisibleRange=function(e,i){var n,o,r,s;if(void 0===e||!e.from||!e.to||isNaN(e.from)||isNaN(e.to))return void console.warn("Wrong time range: "+JSON.stringify(e)+'. Expected an object with "from" and "to" numeric values.')
;n=this._chartWidget.model().model(),o=n.mainSeries(),r=[parseInt(e.from),parseInt(e.to)],s=f.isDWM(o.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(r):r,e.from=s[0],e.to=s[1],this._chartWidget.setVisibleTimeRange(e.from,e.to,i)},b.prototype.getVisibleRange=function(){var e,t,i,n,o,r,s={from:0,to:0},a=this._chartWidget.model().timeScale(),l=a.visibleBars();return null===l?s:(e=this._chartWidget.model().mainSeries(),null===(t=e.syncModel())?s:null===e.data().last()?s:(i=e.data().last(),n=l.lastBar()-i.index,o=n<=0,r=o?a.indexToTimePoint(l.lastBar()):t.projectTime(i.value[TradingView.TIME_PLOT],n),s.from=+a.indexToTimePoint(Math.max(0,l.firstBar()))||0,s.to=+r||0,s))},b.prototype.getVisiblePriceRange=function(){return this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null},b.prototype._createTradingPrimitive=function(e,t){function i(){var e=TradingView.CLOSE_PLOT,t=r(n._chartWidget.model().mainSeries().bars().last());return{index:t.index,price:t.value[e]}}var n=this,o=this._chartWidget.model().model(),s=o.paneForSource(o.mainSeries());return(t?o:this._chartWidget.model()).createLineTool(s,i(),e)._adapter},b.prototype.createOrderLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)},b.prototype.createPositionLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)},b.prototype.createExecutionShape=function(e){var e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)},b.prototype.createShape=function(e,t){return this.createMultipointShape([e],t)},b.prototype._alignPoints=function(e){var t,i,n=this._chartWidget.model().model(),o=n.mainSeries(),r=o.symbolInfo(),s=m.get_timezone(r.timezone);return n.timeScale().isEmpty()?e:(t=(new _.Session).init(s,r.session),i=_.createDWMAligner(o.interval(),t),null===i?e:e.map(function(e){return e?(i.moveTo(1e3*e),i.startOfBar(0)/1e3):e}))},b.prototype._convertUserPointsToDataSource=function(e){function i(e,t,i){var n,o,r,s=h.closestIndexLeft(e)||0,a={index:s},l=h.valueAt(s);return e>l&&(n=c.syncModel().distance(l,e),n.success&&(a.index=a.index+n.result)),v(t)?a.price=t:(o=["open","high","low","close"],r=i?o.indexOf(i)+1:1,r<=0&&(r=1),a.price=u.valueAt(s)[r]),a}var n,o,r,s,a,l=this._chartWidget.model().model(),c=l.mainSeries(),h=l.timeScale().points(),u=c.data();if(l.timeScale().isEmpty())return null;for(n=e.map(function(e){return e.time}),o=f.isDWM(c.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(n):n,r=[],s=0;s<e.length;s++)a=e[s],r.push(i(o[s],a.price,a.channel));return r},b.prototype.createMultipointShape=function(e,t,i){var n,r,s,a,l,c,h,u=t.disableUndo?this._chartWidget.model().model():this._chartWidget.model(),_=this._chartWidget.model().model(),f=_.mainSeries();if(!_.timeScale().isEmpty()){if(n=_.paneForSource(f),r=this._convertUserPointsToDataSource(e),s=y[t.shape]||y.flag,s.onlySelectable)throw Error('Cannot create "'+t.shape+'" shape')
this._stopQuotesSubscription(e),this._quotesInfo[e]=null},f.prototype.quoteSetFields=function(e,t){},f.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},f.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter(function(e){return t.indexOf(e)<0}),this._restartQuotesSubscription(e)},f.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},f.prototype.quoteHibernateAll=function(e){},f.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},f.prototype._startDepthSubscription=function(e){function t(e){return e.map(function(e){return{p:e.price,v:e.volume}})}function i(e){var i={};return i.s=r,i.bids=t(e.bids),i.asks=t(e.asks),i}function n(t){t.snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([i(t)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([i(t)]))}var o=this,r=this._depthInfo[e].symbol;r&&this._externalDatafeed.subscribeDepth&&(o._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(r,function(t){o._depthInfo[e]&&n(t)}))},f.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},f.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},f.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},f.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},f.prototype._filteredSymbols=function(e){var t=[];return e.forEach(function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)}),t},f.prototype._isEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;return!!this._endOfData[n]},f.prototype._setEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;this._endOfData[n]=!0},f.prototype.alignTimePoint=function(e,t,i){return n.enabled("disable_resolution_rebuild")?e:r(t,i).alignTimeIfPossible(1e3*e)/1e3},f.prototype.serverTimeOffset=function(){return this._serverTimeOffset},f.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},e.exports=f}).call(t,i(35),i(5))},function(e,t,i){"use strict";(function(t){var n=i(37),o={},r=function(e,i,r){function s(){var e={};e.symbolname=_,e.status="ok",e.values={},e.values.current_session=d,o[_]=d,TradingView.ChartapiMessagerInstances[f].onQuotesData([f].concat([e]))}function a(e,i,o){var r=t.get_timezone(i);c=(new n.Session).init(r,e),h=o,m=setInterval(l,6e4),l(),s()}function l(){var e,t;if(c){if(h)return void(d="out_of_session");e=n.isTradingNow(new Date,c),t=e?"market":"out_of_session",t!==d&&(d=t,s())}}var c,h,u={},d=o[r]||"out_of_session",p=!1,_=r,f=i,m=null;return e.resolveSymbol(r,function(e){
p||a(e.session,e.timezone,e.expired)},function(){}),u.stop=function(){p=!0,m&&clearInterval(m)},u.marketStatus=function(){return d},u};e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";(function(t){var n=i(673).HeikenAshi,o=i(15).Interval,r=function(){function e(e){this.host=e,this.cache={}}function r(e){var t=e.indexOf(",");return-1===t?e:e.slice(0,t)}function s(e,t,i,n,o,r,s){return o+e+t+i+(a(n)?"_":"")+r+"_"+s}function a(e){return e.has_empty_bars||e.force_session_rebuild}function l(e){if(0!==e.indexOf("="))return{symbol:e};var t;try{t=JSON.parse(e.slice(1))}catch(t){return{symbol:e}}return t.type&&(0===t.type.indexOf("BarSetHeikenAshi@tv-basicstudies-")?t.builder=new n:console.error("unknown builder type: "+t.type)),"string"!=typeof t.symbol&&(t.session=t.symbol.session||t.session,t.symbol=t.symbol.symbol),t}function c(t){e.instance=new e(t),p.setupFeed(e.instance)}var h,u,d,p=i(25),_=i(37),f=p.Symbol,m=p.StudyEngine,y=p.BarBuilder,g=p.BarSet;return e.prototype.getCache=function(e){return this.cache[e]},e.prototype.putCache=function(e,t){this.cache[e]=t},e.prototype.subscribe=function(e,t,i,n,o,r,a,l,c,h){var u=s(e,t,i,a,l,n,h),d=this.getCache(u);return d||(d=this.createItem(e,t,i,a,c,l,n,h),this.putCache(u,d)),d.listeners.addListener(o,r),{key:u,listener:o}},e.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},e.prototype.removeUnused=function(){var e,t,i,n,o,r=[];for(e in this.cache)this.cache[e]&&(t=this.cache[e],0===t.listeners.listenersCount()&&r.push(e));if(0!==r.length){for(i=0;i<r.length;i++)n=r[i],o=this.cache[n],this.cache[n]=null,o.stop();this.removeUnused()}},e.prototype.rebuildFrom=function(e,t,i){var n,o,r,s,a=f.parsePeriod(e),l=f.parsePeriod(t);if(""!==a.resolution&&!a.isSeconds){if(i.has_weekly_and_monthly)return a.resolution;if(void 0===i.has_daily||i.has_daily)return"D";""!==l.resolution&&(l.resolution="",l.interval=i.intraday_multipliers?i.intraday_multipliers[0]:1)}if(a.isIntraday&&void 0!==i.has_intraday&&!i.has_intraday)return"";if(a.isSeconds&&!i.has_seconds)return"";if(n=""!==a.resolution?l.interval:""===l.resolution?Math.min(a.interval,l.interval):a.interval,(o=a.isIntraday?i.intraday_multipliers:i.seconds_multipliers)&&-1===o.indexOf(n)){for(r=o.length-1;r>=0;r--)if(s=+o[r],n%s==0)return s+(a.isSeconds?"S":"");return""}return n+(a.isSeconds?"S":"")},e.prototype.createItem=function(e,t,i,n,s,c,p,_){var f,m,g,v,S,b,w,P=new d,T=l(e);return T.builder?new u(P,T.symbol,t,i,T.builder,n,s,c):(f=r(t),m=this.rebuildFrom(f,r(i),n),g=a(n),!o.isEqual(f,m)||g?(v=n.has_empty_bars,S=$.extend({},n),g&&(S.has_empty_bars=!1,S.force_session_rebuild=!1),void 0!==_&&(b=o.parse(f).inMilliseconds()/o.parse(m).inMilliseconds(),_*=Math.ceil(b)),new u(P,T.symbol,t,m,new y(t,v),S,s,c,p,_)):(w=T.session&&"extended"!==T.session,new h(P,T.symbol,t,i,w,this.host,n,s,p,_)))},h=function(e,t,i,n,o,s,a,l,c,h){this.listeners=e,this.host=s;var u=this;this.host.resolve(t,function(e){o&&e.regular_session&&(e.session=e.regular_session)
;var s=u.calculateFromTo(e,c||n||i,t,l,h);u.subs=u.host.subscribe(e,r(i),s,function(e){u.listeners.fire(e)},function(e){u.listeners.onError(e)})},function(e){u.listeners.onError(e)})},h.prototype._createDWMAligner=function(e,i){var n=t.get_timezone(i.timezone),o=new _.Session;return o.init(n,i.session),f.newBarBuilder(e,o,o)},h.prototype.stop=function(){this.subs&&this.host.unsubscribe(this.subs)},h.prototype.calculateFromTo=function(e,i,n,o,r){var s,a,l,c,h,u,d,p,m=f.parsePeriod(i),y=(new Date).valueOf(),g=e.expired?t.cal_to_utc(t.get_timezone(e.timezone),new Date(1e3*e.expiration_date))||y:y;return""===m.resolution?(a=m.interval,l="D"):"S"===m.resolution?(a=10*m.interval,l=""):(c="D"===m.resolution?1:"W"===m.resolution?5:30,a=12*c*m.interval,l="M"),m.range?(a=m.range.interval,l=m.range.resolution):this.host.calculateHistoryDepth&&(h=this.host.calculateHistoryDepth(i,l,a))&&(a=h.intervalBack||a,l=void 0===h.resolutionBack?l:h.resolutionBack),u=e.sessionString||e.session,s=_.alignPeriodsBack(u,l,a,1,g),o&&o.getRangeExtensionTime&&(d=o.getRangeExtensionTime())&&(s=Math.min(1e3*d,s)),p=Math.ceil(1.5*r),o&&o.getRangeExtensionCount&&(p+=o.getRangeExtensionCount()),p>0&&(s=_.alignPeriodsBack(u,m.resolution,m.interval,p,s)),{from:s,to:g+6e4}},u=function(e,t,i,n,o,r,s,a,l,c){if(this.listeners=e,this.isRecalculated=!1,""===n)return console.error("unsupported resolution for rebuild: "+i),void this.listeners.onError("unsupported resolution for rebuild: "+i);this.symbolInfo=r;var h=this;this.engine=new m({tickerid:t,period:n,periodBase:i,body:o,sessionId:a,symbolInfo:r,rangeExtension:s,periodForInitialRange:l,additionalBarsCount:c,recalc:function(e,t){h._recalc(t)},out:function(e,t){h._out(e,t)},nonseriesOut:function(e,t){h._nonseriesOut(e,t)},setNoMoreData:function(){h.barset&&(h.barset.endOfData=!0)},onErrorCallback:function(e){h.listeners.onError(e)}})},u.prototype.stop=function(){this.engine?this.engine.stop():console.error("Internal library error 0x1")},u.prototype._recalc=function(e){this.isRecalculated&&console.error("recalc called twice!"),this.barset||(this.barset=new g(this.symbolInfo)),e&&(this.barset.nextTime=e.nextTime,this.barset.endOfData=e.endOfData),this.listeners.fire(this.barset),this.isRecalculated=!0},u.prototype._nonseriesOut=function(e,t){var i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this.barset?this.barset.count():0,i.lastBar=this.barset?this.barset.bar(this.barset.count()-1):null,this.listeners.fire(i,!0)},u.prototype._out=function(e,t){var i,n,o,r,s,a,l,c=t[0];if(!isNaN(c)){if(i={time:c,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},n=t[7],this.barset||(this.barset=new g(e.info)),(o=t[8])instanceof Array)for(r=0;r<o.length;r++)s=t[9],a=o[r],l={time:a,open:s,high:s,low:s,close:s,volume:0,updatetime:a},this.barset.add(l,!0),this.isRecalculated&&this.listeners.fire(this.barset);this.barset.add(i,n),this.barset.isBarClosed=n,this.isRecalculated&&this.listeners.fire(this.barset)}},d=function(){this.listeners=[]},d.prototype.listenersCount=function(){
return this.listeners.reduce(function(e,t){return e+(t?1:0)},0)},d.prototype.addListener=function(e,t){this.listeners.push({dataListener:e,onErrorCallback:t}),this.barset&&e(this.barset),this.errorMsg&&t(this.errorMsg)},d.prototype.removeListener=function(e){var t,i=this.listeners.filter(function(t){return t.dataListener===e});0!==i.length&&(t=this.listeners.indexOf(i[0]),delete this.listeners[t])},d.prototype.onError=function(e){var t,i,n,o;for(this.errorMsg=e||"unspecified error",t=this.listeners,i=t.length,n=0;n<i;n++)(o=t[n])&&o.onErrorCallback&&o.onErrorCallback(e)},d.prototype.fire=function(e,t){var i,n,o,r;for(t||(this.barset=e),i=this.listeners,n=i.length,o=0;o<n;o++)(r=i[o])&&r.dataListener(e)},{setupFeed:c,parseSymbol:l,unsubscribeUnused:function(){e.instance.removeUnused()}}}();e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"HeikenAshi",function(){return o}),n=i(25),i.n(n),o=function(){function e(){}return e.prototype.main=function(e){var t,i,o,r,s=e.new_var(n.Std.open(e)),a=e.new_var(n.Std.close(e)),l=s.get(1),c=a.get(1),h=n.Std.ohlc4(e),u=n.Std.na(s.get(1))?(n.Std.open(e)+n.Std.close(e))/2:(l+c)/2;return s.set(u),a.set(h),t=n.Std.max(n.Std.high(e),n.Std.max(u,h)),i=n.Std.min(n.Std.low(e),n.Std.min(u,h)),o=n.Std.volume(e),r=e.symbol,[r.time,u,t,i,h,o,r.updatetime,r.isBarClosed]},e}()},function(e,t,i){"use strict";var n=function(){function e(e,t,i){return e+","+t+","+i}function t(t,i,n){delete o[e(t,i,n)]}function n(t,i,n){function s(e){return"undefined"!=typeof TradingView&&TradingView.ChartapiMessagerInstances?o[e]=new a(TradingView.ChartapiMessagerInstances[t],l.pureResolution):o[e]=new a(null,l.pureResolution),o[e]}var l=r.Symbol.parsePeriod(n),c=e(t,i,l.pureResolution);return o[c]?o[c]:s(c)}var o={},r=i(25),s=i(37),a=function(e,t,i){this._chartApiMessager=e,this._lastRealBarTime=null,this._lastRealBarIndex=null,this._resolution=t,this._extrapolatedBarsCache=[],this._onReadyCallbacks=[],this._requestedAmountOfBars=0,this._maxDepth=i||100};return a.prototype.ready=function(){return null!==this._lastRealBarIndex},a.prototype.rebuild=function(e,t){this._lastRealBarTime=e;var i=Math.max(this._extrapolatedBarsCache.length,this._requestedAmountOfBars);this._extrapolatedBarsCache=[],this.ensureExtrapolatedToBar(t,i)},a.prototype.historyExtrapolator=function(){return void 0===this._historyExtrapolator&&(this._historyExtrapolator=new a(null,this._resolution,Math.max(this._maxDepth,1500))),this._historyExtrapolator},a.prototype.getPointTimeUTC=function(e,t,i){var n,o;return 0===t?e:!this.ready()||e<this._lastRealBarTime/1e3?(this.historyExtrapolator().setLastBarTime(0,1e3*e),this.historyExtrapolator().getPointTimeUTC(e,t,i)):(n=0===this._extrapolatedBarsCache.length||e===this._lastRealBarTime/1e3,o=n?-1:this.indexOfBar(e,i)-this._lastRealBarIndex-1,this.ensureExtrapolatedToBar(i,o+t+1),this._extrapolatedBarsCache[o+t])},a.prototype.findDistanceInBars=function(e,t,i){return e===t?0:(this.historyExtrapolator().setLastBarTime(0,1e3*e),
this.historyExtrapolator().indexOfBar(t,i))},a.prototype.indexOfBar=function(e,t){this._ensureExtrapolatedToTime(t,1e3*e);var i=s.lower_bound(this._extrapolatedBarsCache,e,function(e,t){return e>t?1:e<t?-1:0});return-1===i?i:this._lastRealBarIndex+i+1},a.prototype._extrapolateData=function(e,t){var i,n,o;if(!this._lastRealBarTime)throw Error("No real bars known, so cannot extrapolate anything");if(!(i=t(this._lastRealBarTime))||0===i.length)return void(null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,this._extrapolatedBarsCache,e,this._resolution));for(n=0;n<i.length;++n)i[n]=i[n]/1e3;for(i[0]===this._lastRealBarTime/1e3&&(i=i.slice(1)),this._extrapolatedBarsCache=i,o=i.slice(0),o.sort(),n=0;n<o.length-1;++n)o[n]===o[n+1]&&console.error("Duplicating extrapolated bars: duplicated "+new Date(1e3*o[n]));null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,i,e,this._resolution)},a.prototype.onTickmarksNeeded=function(e,t){if(this.ready())this.ensureExtrapolatedToBar(e,t);else{var i=this;this._onReadyCallbacks.push(function(){i.ensureExtrapolatedToBar(e,t)})}},a.prototype.ensureExtrapolatedToBar=function(e,t){var i=this;return this._requestedAmountOfBars=t,this._extrapolateData(e,function(n){return i._extrapolatedBarsCache.length>=t||!i._shouldExtrapolateMore()?null:s.extrapolateBarsFrontByCount(i.newBarBuilder(e),n,t)})},a.prototype._ensureExtrapolatedToTime=function(e,t){var i=this;return this._extrapolateData(e,function(n){var o,r;return n>=t||!i._shouldExtrapolateMore()?null:(o=2e3,r=s.extrapolateBarsFrontToTime(i.newBarBuilder(e),n,t,o),r[r.length-1]<t&&console.warn("Extrapolation error: not enough data created"),r)})},a.prototype.newBarBuilder=function(e){var t=r.Symbol.newSession(e.timezone,e.session);return r.Symbol.newBarBuilder(this._resolution,t)},a.prototype._shouldExtrapolateMore=function(){return this._extrapolatedBarsCache.length<this._maxDepth},a.prototype.setLastBarTime=function(e,t){(null===this._lastRealBarIndex||this._lastRealBarIndex===e&&this._lastRealBarTime!==t)&&(this._extrapolatedBarsCache=[]),this._extrapolatedBarsCache&&this._extrapolatedBarsCache.length&&this._lastRealBarIndex!==e&&(this._lastRealBarIndex>e?this._extrapolatedBarsCache=[]:this._lastRealBarTime!==t&&this._extrapolatedBarsCache.shift(e-this._lastRealBarIndex)),this._lastRealBarIndex=e,this._lastRealBarTime=t;for(var i=0;i<this._onReadyCallbacks.length;++i)this._onReadyCallbacks[i]();this._onReadyCallbacks=[]},{remove:t,storage:n}}();e.exports=n},function(e,t,i){"use strict";(function(t){var n=i(37),o=i(15).Interval,r=function(){function e(e,t){return e}function r(e,t){var i=m.get_timezone(e.timezone),o=new n.Session;return o.init(i,e.session),f.Symbol.newBarBuilder(t,o,o)}function s(t,i,n,o,r,s){var a,l,c,h,u=e(i,n);for(p.hasOwnProperty(u)||(p[u]=[]),a=[],l=0;l<o.length;++l)o[l][1]<0&&(o[l][1]=0),0!==o[l][1]?(c=r.getPointTimeUTC(o[l][0],o[l][1],s),
a.push(c)):o[l][0]&&a.push(o[l][0]);h={guid:t,points:a},p[u].push(h)}function a(e){var t,i,n;for(t in p)for(i=p[t],n=0;n<i.length;++n)if(i[n].guid===e)return void i.splice(n,1)}function l(e,t,i,n,o){var r,s,a,l=[];for(r=0;r<e.points.length;++r){if(null==(s=e.points[r]))return null;if(null===(a=h(t,s,i,n,o)))return null;l.push({index:r,value:[a,s]})}return l}function c(t,i,n,o,r,s){var a,c,h,u,d=e(t,i);if(p.hasOwnProperty(d))for(a=p[d].length,c=0;c<a;++c)h=p[d][c],null!==(u=l(h,n,o,r,i))&&s(h.guid,u)}function h(e,t,i,o,s){var a,l;return 1e3*(t=r(o,s).alignTimeIfPossible(1e3*t)/1e3)<e[0].value[0]?-d(o,s,t,e[0].value[0]/1e3,i):(a=n.lower_bound(e,1e3*t,function(e,t){return e.value[0]>t?1:e.value[0]<t?-1:0}))>=0&&t<e[e.length-1].value[0]?(e[a].value[0]/1e3!==t&&0!==a&&a--,e[a].index):(l=i.indexOfBar(t,o),-1===l?null:l)}function u(e,t,i,n,o){function r(e,t){var i=new Date(1e3*e),n=new Date(1e3*t),o=12*(n.getFullYear()-i.getFullYear());return o-=i.getMonth()+1,o+=n.getMonth(),o<=0?0:o}var s,a,l,c,h,u,d,p,_,f,y,g,v,S,b;if(t.isMonths())s=r(n,o)/t.multiplier();else if(t.isWeeks())a=Math.ceil((o-n)/604800),s=Math.ceil(a/t.multiplier());else{if(l=m.utc_to_cal(i.timezone,+new Date(1e3*n)),c=m.utc_to_cal(i.timezone,+new Date(1e3*o)),(h=(o-n)/86400)>4*(7-i.spec.weekEndsCount()))d=h/7,u=d*(7-i.spec.weekEndsCount());else{for(p=0,_={},f=l;f.valueOf()<=c.valueOf();f=m.add_days_considering_dst(i.timezone,f,1))y=m.get_day_of_week(f),void 0===_[y]&&(_[y]=i.spec.isWeekEnd(y)),_[y]&&p++;u=h-p}if(t.isDays())s=Math.ceil(u/t.multiplier());else{if(g=t.isHours()?60*t.multiplier()*60:t.isSeconds()?t.multiplier():60*t.multiplier(),h<1&&(v=i.spec.findSessionEntry(m.get_day_of_week(l),m.get_minutes_from_midnight(l)),S=i.spec.findSessionEntry(m.get_day_of_week(c),m.get_minutes_from_midnight(c)),v===S))return Math.ceil((o-n)/g);y=i.spec.entries()[0].dayOfWeek(),b=60*i.spec.entries().reduce(function(e,t){return e+(t.dayOfWeek()===y?t.length():0)},0),s=Math.ceil(u*b/g)}}return s}function d(e,t,i,s,a){var l,c,h=new o(t),d=m.get_timezone(e.timezone),p=new n.Session;return p.init(d,e.session),l=r(e,t),i=l.alignTimeIfPossible(1e3*i)/1e3,s=l.alignTimeIfPossible(1e3*s)/1e3,i>=s?0:(c=u(e,h,p,i,s),c>=1e3?c:a.findDistanceInBars(i,s,e))}var p={},_="undefined"!=typeof window?window:t,f=i(25),m=_.PineJsCalendar?_.PineJsCalendar:i(35);return{createPointset:s,removePointset:a,broadcastPointsetsUpdates:c,tests:{approxBarsInterval:u,indexOfTime:h}}}();e.exports=r}).call(t,i(99))},function(e,t,i){"use strict";function n(e,t,i){return Object(a.isArray)(e)?o(e,t,i):Object(a.isObject)(e)&&(Object(a.isHashObject)(e)||i&&i.visitInstances)?r(e,t,i):e}function o(e,t,i){return e.map(function(e){var o=n(e,t,i),r=t(o);return void 0!==r?r:o})}function r(e,t,i){var o={};return Object.keys(e).forEach(function(r){var s=n(e[r],t,i),a=t(s);o[r]=void 0!==a?a:s}),o}function s(e,t,i){var o=n(e,t,i),r=t(o);return void 0!==r?r:o}var a;Object.defineProperty(t,"__esModule",{value:!0}),t.visitObject=s,a=i(12),i.n(a)},function(e,t,i){"use strict";function n(e,t){return e.ticker+"_"+t}
function o(e){return new Date(e).toISOString()}var r,s,a,l,c,h;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DatafeedRequestsCachedProcessor",function(){return h}),r=i(15),s=i(78),a=i(25),i.n(a),l=i(5),i.n(l),i(86),c=function(){function e(e,t,i,n){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._gaps=[],this._needPurgeCache=!1,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._datafeed=e,this._symbolInfo=t,this._resolution=i,this._dwmAligner=n}return e.prototype.destroy=function(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed},e.prototype.addSubscription=function(e,t,i){var n=this,o=this._getNextSubscriptionId(),r=Math.floor(e.from/1e3),s=Math.floor(e.to/1e3);return this._pendingSubscribers.push({key:o,range:{from:r,to:s},onHistoryCallback:t,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){return n._processPendingSubscribers()},0),o},e.prototype.removeSubscription=function(e){var t,i=this,n=this._pendingSubscribers.find(function(t){return t.key===e});return n?void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(n),1):(t=this._subscribers.find(function(t){return t.key===e}))?(this._subscribers.splice(this._subscribers.indexOf(t),1),void(this._subscribers.length||(this._symbolInfo.expired||this._symbolInfo.expiration_date?this._unsubscribeRealtime():this._resetCacheTimeout=setTimeout(function(){i._purgeCacheDelayed(),i._unsubscribeRealtime()})))):void console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._purgeCacheDelayed=function(){this._logMessage("Reset cache"),this._needPurgeCache=!0,this._clearResetCacheTimeout()},e.prototype._logMessage=function(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log("FEED [{0}|{1}]: {2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._clearResetCacheTimeout=function(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)},e.prototype._purgeCache=function(){this._cache={bars:[]},this._gaps=[],this._errorMessage=null,this._needPurgeCache=!1,this._leftDate=null,this._endOfData=!1},e.prototype._processPendingSubscribers=function(){var e,t,i,n,s,a,l=this,c=this._pendingSubscribers;if(c.length){if(this._requesting)return void this._logMessage("Processing is skipped due active request");if(this._logMessage("Processing pending subscribers, count="+c.length),this._needPurgeCache&&this._purgeCache(),this._errorMessage)return e=this._errorMessage,this._logMessage("Return error: "+e),this._pendingSubscribers=[],void c.forEach(function(t){t.onErrorCallback(e)});if(t=c.reduce(function(e,t){return Math.min(t.range.from,e)},1/0),this._logMessage('Leftmost requested "from" is '+o(1e3*t)),
(!this._leftDate||t<this._leftDate)&&(i=new r.Interval(this._resolution),n=(i.inMilliseconds(Date.now())||0)/1e3,s=!this._leftDate,a=!s&&!!this._cache.bars.length&&this._cache.bars[0].time/1e3-t<n,(s||!a)&&!this._endOfData))return void this._ensureRequestedTo(t);this._pendingSubscribers=[],c.forEach(function(e){var t=l._moveSubscriberToRealtime(e);l._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()}},e.prototype._moveSubscriberToRealtime=function(e){var t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t},e.prototype._subscribeRealtimeIfNeeded=function(){!this._subscribers.length||this._realtimeOn||this._symbolInfo.expired||this._symbolInfo.expiration_date||this._subscribeRealtime()},e.prototype._subscribeRealtime=function(){var e,t,i=this;this._symbolInfo.expired||this._realtimeOn||(e=function(e){i._dwmAligner&&(e.time=i._dwmAligner.tradingDayToSessionStart(e.time)),i._putToCacheNewBar(e),i._subscribers.forEach(function(t){var i=t.barset;if(null===i)throw Error("subscirber.barset is null");i.add(e),t.onHistoryCallback(i)})},t=function(){i._unsubscribeRealtime();var e=i._leftDate;i._purgeCache(),e&&i._ensureRequestedTo(e)},this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,e,n(this._symbolInfo,this._resolution),t),this._logMessage("Subscribed to realtime"))},e.prototype._unsubscribeRealtime=function(){!this._symbolInfo.expired&&this._realtimeOn&&(this._datafeed.unsubscribeBars(n(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)},e.prototype._returnHistoryDataToSubscriber=function(e,t){var i,n,r=e.range,s=l.enabled("cl_feed_return_all_data")?this._createBarset(this._leftDate||r.from):this._createBarset(r.from);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),o(s.bars[0].time),o(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,i=this._inGapNextTime(r.from),i?(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*i))),s.nextTime=i):0===s.count()&&(n=this._cache.bars.length&&this._cache.bars[this._cache.bars.length-1].time/1e3)&&r.from>n&&(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*n))),s.nextTime=n||void 0),this._endOfData&&null!==this._leftDate&&e.range.from<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)},e.prototype._createBarset=function(e){var t=Object(s.lowerbound)(this._cache.bars,1e3*e,function(e,t){return e.time<t});return new a.BarSet(this._symbolInfo,this._cache.bars.slice(t))},e.prototype._ensureRequestedTo=function(t){var i,n,r,s=this;if(this._leftDate&&this._leftDate<t)return void this._processPendingSubscribers();i=!this._leftDate,this._requesting=!0,n=t,r=this._leftDate?this._leftDate-1:this._symbolInfo.expiration_date||Math.floor(e._now()/1e3),this._leftDate=t,this._logMessage("Requesting data: [{0} ... {1}] ".format(o(1e3*n),o(1e3*r))),
this._datafeed.getBars(this._symbolInfo,this._resolution,n,r,function(e,t){s._requesting=!1,s._processBars(e,t)},function(e){s._requesting=!1,s._errorMessage=e||null,s._processPendingSubscribers()},i)},e.prototype._processBars=function(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?this._processFullBarset(e,t):this._processEmptyBarset(t),this._processPendingSubscribers()},e.prototype._processEmptyBarset=function(t){this._logMessage("Receiving bars: barset is empty"),t&&t.nextTime?(this._logMessage("Next time received: `{0}`".format(o(1e3*t.nextTime))),this._addGap(t.nextTime),this._leftDate=Math.min(this._leftDate||e._now()/1e3,t.nextTime+1)):t&&t.noData?(this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._cache.bars[0].time/1e3)):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned")},e.prototype._processFullBarset=function(e,t){var i=e[0].time,n=e[e.length-1].time;this._logMessage("Receiving bars: total {0} bars in [{1} ... {2}] ".format(e.length,o(i),o(n))),null!==this._leftDate&&i<1e3*this._leftDate&&!l.enabled("cl_feed_return_all_data")&&this._logMessage("Returned more data than needed"),this._putToCache(e)?null!==this._leftDate&&this._cache.bars.length&&this._leftDate>this._cache.bars[0].time/1e3&&(this._leftDate=this._cache.bars[0].time/1e3):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")},e.prototype._addGap=function(t){var i;this._gaps.find(function(e){return e.from===t})||(i=(this._cache.bars.length?this._cache.bars[0].time:e._now())/1e3,this._gaps.push({from:t,to:i}))},e.prototype._inGapNextTime=function(e){var t=this._gaps.find(function(t){return t.from<e&&t.to>e});return t?t.from:null},e.prototype._getNextSubscriptionId=function(){return this._nextSubscriptionId++},e.prototype._checkBars=function(e,t){var i,n;if(void 0===t&&(t=!1),l.enabled("charting_library_debug_mode"))for(i=1;i<e.length;i++)e[i].time<=e[i-1].time&&(n="Wrong bars time: time {0} of bar {1} should be more than time {2} of bar {3}".format(e[i].time,i,e[i-1].time,i-1),t&&this._dwmAligner&&(n+="\nCheck that you provide DWM bars without time part, i.e. 00:00 GMT"),console.error(n))},e.prototype._putToCache=function(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){var t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time
;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=e.concat(this._cache.bars),this._checkBars(this._cache.bars,!0),!0},e.prototype._putToCacheNewBar=function(e){var t=this._cache.bars.length,i=e.time,n=0===t?NaN:this._cache.bars[t-1].time;0===t||n<i?this._cache.bars.push(e):n===i?this._cache.bars[t-1]=e:console.error("putToCacheNewBar: time violation, previous bar time: "+o(n)+" should be less or equal to new time: "+o(i))},e.prototype._alignBarsTime=function(e){if(this._dwmAligner)for(var t=0;t<e.length;t++)e[t].time=this._dwmAligner.tradingDayToSessionStart(e[t].time)},e._now=function(){return Date.now()+6e4},e}(),h=function(){function e(e,t){this._threads={},this._datafeed=e,this._dwmAlignerCreator=t}return e.prototype.destroy=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={},delete this._datafeed},e.prototype.purgeCache=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={}},e.prototype.subscribe=function(e,t,i,o,r){var s,a=n(e,t);return this._threads[a]||(this._threads[a]=this._createThread(e,t)),s=this._threads[a].addSubscription(i,o,r),a+'"'+s},e.prototype.unsubscribe=function(e){var t,i,n=e.split('"');if(2!==n.length)return void console.warn("Wrong guid format");t=n[0],i=parseInt(n[1]),this._threads.hasOwnProperty(t)?this._threads[t].removeSubscription(i):console.warn("Data thread doesnt exist: "+e)},e.prototype._createThread=function(e,t){return new c(this._datafeed,e,t,this._dwmAlignerCreator(t,e.timezone,e.session))},e.prototype._forEachThread=function(e){var t=this;Object.keys(this._threads).forEach(function(i){return e(i,t._threads[i])})},e}()},function(e,t,i){"use strict";(function(t,n){function o(e,i,n,o){this._chartWidgetCollection=e,this._chartApiInstance=i,this._saveChartService=n,this._loadChartService=o,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._activeChangedChangedDelegate=new t,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this)),this._chartWidgets=new WeakMap}var r=i(62).linking,s=i(679),a=i(109).layouts,l=i(31),c=i(89),h=i(32),u=i(61),d=i(67),p=i(4),_=i(209).createNoticeDialog,f=i(83).createConfirmDialog,m=i(298),y=i(685).ThemesApi;o.prototype.subscribe=function(e,t){l.subscribe(e,t)},o.prototype.unsubscribe=function(e,t){l.unsubscribe(e,t)},o.prototype.onContextMenu=function(e){l.subscribe("onContextMenu",function(t){t.callback(e(t.unixtime,t.price))})},o.prototype.onGrayedObjectClicked=function(e){l.subscribe("onGrayedObjectClicked",e)},o.prototype.activeChart=function(){return this._getChartWidgetApi(this._chartWidgetCollection.activeChartWidget.value())},o.prototype._getChartWidgetApi=function(e){var t=this._chartWidgets.get(e);return void 0===t&&(t=new s(e),this._chartWidgets.set(e,t)),t},o.prototype.onActiveChartChanged=function(){
return this._activeChangedChangedDelegate},o.prototype.changeSymbol=function(e,t,i){r.interval.setValue(t),r.symbol.setValue(e),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)},o.prototype.setLayout=function(e){this._chartWidgetCollection.layout.setValue(e)},o.prototype.layout=function(){return this._chartWidgetCollection.layout.value()},o.prototype.layoutName=function(){return this._chartWidgetCollection.metaInfo.name.value()},o.prototype.chartsCount=function(){return a[this.layout()].count},o.prototype.chart=function(e){if(void 0===e&&(e=0),e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])},o.prototype.getSymbolInterval=function(e){var t={symbol:r.symbol.value(),interval:r.interval.value()};return e&&e(t),t},o.prototype.saveChart=function(e){var t=this;this._saveChartService.whenReadyToSave(function(){var i=t._saveChartService.saveToJSON();return e&&e(JSON.parse(i.content))})},o.prototype.loadChart=function(e){this._chartApiInstance.purgeCache(),this._chartApiInstance._studyEngine.stopSources(),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),r.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")},o.prototype.getStudiesList=function(){return this._chartApiInstance.allStudiesMetadata().filter(function(e){return!e.is_hidden_study}).map(function(e){return e.name||e.description})},o.prototype.getSavedCharts=function(e){d.getCharts(e)},o.prototype.loadChartFromServer=function(e){d.loadChart(e)},o.prototype.saveChartToServer=function(e,t,i,n){this._saveChartService.saveChartSilently(e,i,t,n)},o.prototype.removeChartFromServer=function(e,t){d.removeChart(e,t)},o.prototype.getIntervals=function(){var e=[],t=u.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),u.mergeResolutions(e,t)},o.prototype.closePopupsAndDialogs=function(){var e,t,n=document.querySelectorAll("._tv-dialog-title-close");for(e=0;e<n.length;e++)n[e].click();t=i.c[690],t&&t.exports.closeAllDialogs(),c.hideAll()},o.prototype.selectLineTool=function(e){m.supportedLineTools[e]&&(e=m.supportedLineTools[e].name,h.tool.value()!==e&&h.tool.setValue(e))},o.prototype.selectedLineTool=function(){var e,t=Object.keys(m.supportedLineTools),i=h.tool.value();for(e=0;e<t.length;++e)if(m.supportedLineTools[t[e]].name===i)return t[e];return""},o.prototype.lockAllDrawingTools=function(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new n(h.lockDrawings().value()),this._lockDrawingsWatchedValue.subscribe(function(e){h.lockDrawings().setValue(e)}),h.lockDrawings().subscribe(this,function(){this._lockDrawingsWatchedValue.setValue(h.lockDrawings().value())})),this._lockDrawingsWatchedValue},
o.prototype.hideAllDrawingTools=function(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new n(h.hideAllDrawings().value()),this._hideDrawingsWatchedValue.subscribe(function(e){h.hideAllDrawings().setValue(e)}),h.hideAllDrawings().subscribe(this,function(){this._hideDrawingsWatchedValue.setValue(h.hideAllDrawings().value())})),this._hideDrawingsWatchedValue},o.prototype.mainSeriesPriceFormatter=function(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(e){function t(){i&&(i(),i=null)}e=e||{};var i=e.callback;_({title:e.title,content:e.body||""}).then(function(e){e.on("action:ok",t),e.on("afterClose",t),e.open()})},o.prototype.showConfirmDialog=function(e){function t(e){i&&(i(e),i=null)}if(e=e||{},!e.callback)throw Error("callback must be exist");var i=e.callback;f({title:e.title,content:e.body||""}).then(function(e){e.on("action:yes",function(){e.close(),t(!0)}),e.on("action:no",t.bind(null,!1)),e.on("afterClose",t.bind(null,!1)),e.open()})},o.prototype.logs=function(){return{getLogHistory:p.getLogHistory,enable:p.loggingOn,disable:p.loggingOff}},o.prototype.showLoadChartDialog=function(){var e=this._loadChartService;e&&e.showLoadDialog()},o.prototype.showSaveAsChartDialog=function(){var e=this._saveChartService;e&&window.runOrSignIn(function(){e.saveChartAs()})},o.prototype.themes=function(){return new y({chartWidgetCollection:this._chartWidgetCollection})},o.prototype.undoRedoState=function(){return this._chartWidgetCollection.undoHistory.state()},o.prototype.takeScreenshot=function(){this._chartWidgetCollection.takeScreenshot()},e.exports=o}).call(t,i(8),i(16))},function(e,t,i){"use strict";(function(t){function n(e){var t,i,n=Object.keys(y),o=n.length;for(t=0;t<o;++t)if(i=n[t],y[i].name===e)return i;return null}function o(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}var r=i(7).ensureNotNull,s=i(680),a=i(162).applyOverridesToStudy,l=i(26),c=i(681).LineDataSourceApi,h=i(682).StudyApi,u=i(683).PaneApi,d=i(3).DefaultProperty,p=i(335).availableIcons,_=i(37),f=i(15).Interval,m=i(35),y=i(298).supportedLineTools,g=i(292).showTooManyStudiesNotice,v=i(12).isNumber,S=i(684).onSeriesCompletedOrErrorReceived,b=function(e){this._chartWidget=e,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap};b.prototype._getPaneApi=function(e){var t=this._panes.get(e);return void 0===t&&(t=new u(e),this._panes.set(e,t)),t},b.prototype._getStudyApi=function(e){var t=this._studies.get(e);return void 0===t&&(t=new h(e,this._chartWidget.model().model()),this._studies.set(e,t)),t},b.prototype._getLineDataSourceApi=function(e){var t=this._lineDataSources.get(e);return void 0===t&&(t=new c(e,this._chartWidget.model().model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:function(e){var t=this._chartWidget.model().mainSeries().syncModel(),i=this._chartWidget.model().timeScale();return e.map(function(e){
var n=i.normalizeBarIndex(e.index);return{price:e.price,time:t.projectTime(n.time_t,n.offset)}})}.bind(this)}),this._lineDataSources.set(e,t)),t},b.prototype._makeSubscriptionFromDelegate=function(e){var t=$.extend({},e);return delete t.fire,t},b.prototype.executeActionById=function(e){this._chartWidget.executeActionById(e)},b.prototype.getCheckableActionState=function(e){return this._chartWidget.getCheckableActionState(e)},b.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},b.prototype.clearMarks=function(){this._chartWidget.clearMarks()},b.prototype.symbol=function(){return this._chartWidget.getSymbol()},b.prototype.symbolExt=function(){var e=this._chartWidget.model().mainSeries().symbolInfo();return e?{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type}:null},b.prototype.resolution=function(){return this._chartWidget.model().mainSeries().properties().interval.value()},b.prototype.setSymbol=function(e,i){function n(e){e||i()}if(e!==this.symbol()||t.enabled("same_data_requery")){var o=this._chartWidget.model().mainSeries().dataEvents();return i&&S(o,n),this._chartWidget.setSymbol(e)}},b.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},b.prototype.setResolution=function(e,t){function i(e){e||t()}if((e=e.toUpperCase())!==this.resolution()){var n=this._chartWidget.model().mainSeries().dataEvents();return t&&S(n,i),this._chartWidget.setResolution(e)}},b.prototype.setEntityVisibility=function(e,t){var i,n;console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead"),(i=this._chartWidget.model().model().dataSourceForId(e))&&(n=i.properties())&&n.visible&&n.visible.setValue(t)},b.prototype.getAllStudies=function(){return this._chartWidget.model().model().allStudies().map(function(e){return{id:e.id(),name:e._metaInfo.description}})},b.prototype.getAllShapes=function(){return this._chartWidget.model().model().allLineTools().map(function(e){return{id:e.id(),name:n(e.toolname)}}).filter(function(e){return null!==e.name})},b.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},b.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},b.prototype.removeEntity=function(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);if(!t)return void console.warn("Can't find a source with id: "+e);this._chartWidget.model().chartModel().removeSource(t,!0)},b.prototype.createStudyTemplate=function(e){return this._chartWidget.model().model().studyTemplate(e.saveInterval)},b.prototype.applyStudyTemplate=function(e){this._chartWidget.model().model().restoreStudyTemplate(e,""+1e3*Math.random())},b.prototype.setVisibleRange=function(e,i){var n,o,r,s;if(void 0===e||!e.from||!e.to||isNaN(e.from)||isNaN(e.to))return void console.warn("Wrong time range: "+JSON.stringify(e)+'. Expected an object with "from" and "to" numeric values.');n=this._chartWidget.model().model(),o=n.mainSeries(),r=[parseInt(e.from),parseInt(e.to)],
s=f.isDWM(o.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(r):r,e.from=s[0],e.to=s[1],this._chartWidget.setVisibleTimeRange(e.from,e.to,i)},b.prototype.getVisibleRange=function(){var e,t,i,n,o,r,s={from:0,to:0},a=this._chartWidget.model().timeScale(),l=a.visibleBars();return null===l?s:(e=this._chartWidget.model().mainSeries(),null===(t=e.syncModel())?s:null===e.data().last()?s:(i=e.data().last(),n=l.lastBar()-i.index,o=n<=0,r=o?a.indexToTimePoint(l.lastBar()):t.projectTime(i.value[TradingView.TIME_PLOT],n),s.from=+a.indexToTimePoint(Math.max(0,l.firstBar()))||0,s.to=+r||0,s))},b.prototype.getVisiblePriceRange=function(){return this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null},b.prototype._createTradingPrimitive=function(e,t){function i(){var e=TradingView.CLOSE_PLOT,t=r(n._chartWidget.model().mainSeries().bars().last());return{index:t.index,price:t.value[e]}}var n=this,o=this._chartWidget.model().model(),s=o.paneForSource(o.mainSeries());return(t?o:this._chartWidget.model()).createLineTool(s,i(),e)._adapter},b.prototype.createOrderLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)},b.prototype.createPositionLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)},b.prototype.createExecutionShape=function(e){var e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)},b.prototype.createShape=function(e,t){return this.createMultipointShape([e],t)},b.prototype._alignPoints=function(e){var t,i,n=this._chartWidget.model().model(),o=n.mainSeries(),r=o.symbolInfo(),s=m.get_timezone(r.timezone);return n.timeScale().isEmpty()?e:(t=(new _.Session).init(s,r.session),i=_.createDWMAligner(o.interval(),t),null===i?e:e.map(function(e){return e?(i.moveTo(1e3*e),i.startOfBar(0)/1e3):e}))},b.prototype._convertUserPointsToDataSource=function(e){function i(e,t,i){var n,o,r,s=h.closestIndexLeft(e)||0,a={index:s},l=h.valueAt(s);return e>l&&(n=c.syncModel().distance(l,e),n.success&&(a.index=a.index+n.result)),v(t)?a.price=t:(o=["open","high","low","close"],r=i?o.indexOf(i)+1:1,r<=0&&(r=1),a.price=u.valueAt(s)[r]),a}var n,o,r,s,a,l=this._chartWidget.model().model(),c=l.mainSeries(),h=l.timeScale().points(),u=c.data();if(l.timeScale().isEmpty())return null;for(n=e.map(function(e){return e.time}),o=f.isDWM(c.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(n):n,r=[],s=0;s<e.length;s++)a=e[s],r.push(i(o[s],a.price,a.channel));return r},b.prototype.createMultipointShape=function(e,t,i){var n,r,s,a,l,c,h,u=t.disableUndo?this._chartWidget.model().model():this._chartWidget.model(),_=this._chartWidget.model().model(),f=_.mainSeries();if(!_.timeScale().isEmpty()){if(n=_.paneForSource(f),r=this._convertUserPointsToDataSource(e),s=y[t.shape]||y.flag,s.onlySelectable)throw Error('Cannot create "'+t.shape+'" shape')
;if("LineToolPolyline"===s.name)r[0].price===r[r.length-1].price&&r[0].index===r[r.length-1].index||r.push(r[0]);else if("LineToolIcon"===s.name){if(t.icon=t.icon||t.overrides&&t.overrides.icon,!t.hasOwnProperty("icon"))throw Error("icon must be specified in options");if(-1===p.indexOf(t.icon))throw Error("icon value must be valid");t.overrides=t.overrides||{},t.overrides.icon=t.icon}if(a=new d(s.name.toLowerCase()),t.overrides)for(l in t.overrides)a[l]?a[l].setValue(t.overrides[l]):o(s.name)&&-1!==["profitLevel","stopLevel"].indexOf(l)&&a.addProperty(l,t.overrides[l]);if(s.supportsText&&t.text&&a.text.setValue(t.text),c=u.createLineTool(n,r[0],s.name,a),c.pointsCount()!==r.length&&-1!==c.pointsCount())throw Error("Wrong points count for "+t.shape+". Required "+c.pointsCount());for(h=1;h<r.length&&this._chartWidget.model().lineBeingCreated();h++)u.coninueCreatingLine(r[h],{},h<r.length-1);return t.lock&&c.setUserEditEnabled(!1),t.disableSelection&&(c.customization.disableSelection=!0),t.disableSave&&(c.customization.disableSave=!0),t.hasOwnProperty("showInObjectsTree")&&(c.customization.showInObjectsTree=t.showInObjectsTree),t.zOrder&&("top"===t.zOrder?u.bringToFront(c):"bottom"===t.zOrder&&u.sendToBack(c)),c.id()}},b.prototype.getShapeById=function(e){var t=this._chartWidget.model().model().getLineToolById(e);if(null===t)throw Error("There is no such shape");return this._getLineDataSourceApi(t)},b.prototype.createStudy=function(e,t,i,n,o,c,h){var u,d,p,_,f,m;return h=h||{},h.checkLimit&&!this._chartWidget.model().canCreateStudy()?(g(),null):(e=e.toLowerCase(),u=this._chartWidget.model().chartModel(),d=l.findStudyMetaInfoByDescription(u.studiesMetaData(),e),d=$.extend({},d),delete d.state,d?(p={},n&&(p.inputs=s.getStudyRecordFromArray([e].concat(n),this._chartWidget).inputs),_=u.insertStudy(d,p,t,null,h.priceScale),c&&a(_,c),f=r(u.paneForSource(_)),m=f.priceScaleName(_.priceScale()),u.setPriceScaleVisibility(m,!0),i&&_.setUserEditEnabled(!1),o&&o(_.id()),_.id()):(console.warn("Study `"+e+"` not found."),null))},b.prototype.getStudyById=function(e){var t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw Error("There is no such study");return this._getStudyApi(t)},b.prototype.chartType=function(){return this._chartWidget.model().mainSeries().properties().style.value()},b.prototype.setChartType=function(e){this._chartWidget.model().mainSeries().properties().style.setValue(e)},b.prototype.priceFormatter=function(){return this._chartWidget.model().mainSeries().priceScale().formatter()},b.prototype.onDataLoaded=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())},b.prototype.onSymbolChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().symbolResolved())},b.prototype.onIntervalChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())},b.prototype.onVisibleRangeChanged=function(){
return this._makeSubscriptionFromDelegate(this._chartWidget.model().timeScale().visibleBarsChanged())},b.prototype.dataReady=function(e){var t=!this._chartWidget.model()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return e&&(t?this.onDataLoaded().subscribe(null,e,!0):e()),!t},b.prototype.crossHairMoved=function(e){this._makeSubscriptionFromDelegate(this._chartWidget.model().chartModel().crossHairMoved()).subscribe(null,e)},b.prototype.setTimezone=function(e){this._chartWidget.setTimezone(e)},b.prototype.getPanes=function(){return this._chartWidget.model().chartModel().panes().map(function(e){return this._getPaneApi(e)},this)},b.prototype.exportData=function(e){var t=this._chartWidget;return new Promise(function(n){i.e(26).then(function(o){var r=i(821).exportData;n(r(t.model().chartModel(),e))}.bind(null,i)).catch(i.oe)})},b.prototype.canZoomOut=function(){return!this._chartWidget.model().zoomStack().isEmpty()},b.prototype.zoomOut=function(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()},e.exports=b}).call(t,i(5))},function(e,t,i){"use strict";var n=function(){function e(e){return e.is_price_study}function t(e,t){var i,n=t.slice(0).toLowerCase();if(e){for(i=0;i<e.length;++i)if(e[i].description.toLowerCase()===n||e[i].shortDescription.toLowerCase()===n)return e[i];throw Error("Can't find metainfo for `"+t+"`")}throw Error("There is no studies metainfo at all")}function i(e){return e.inputs.map(function(e){return{id:e.id,type:e.type,name:e.name}})}function n(n,o){var r,a,l,c,h,u,d,p,_;if(!Array.isArray(n))return r=t(o.model().studiesMetaData(),n),{id:r.id,overlay:e(r)};for(a=n.slice(0),l=a[0],r=t(o.model().studiesMetaData(),l),c=e(r),h=i(r),d=a.splice(1),p=0;p<d.length;++p)u||(u={}),_=s[h[p].type]||s.string,u[h[p].id]=_(d[p]);return{id:r.id,name:l,overlay:c,inputs:u}}function o(e,n,o){function r(e){return e.name.toLowerCase()===a}var s,a,l,c=t(o.model().studiesMetaData(),e),h=i(c),u={};for(s in n)a=s.toLowerCase(),l=h.filter(r),0!==l.length?(l=l[0],u[l.id]=n[s]):console.warn("Uknown input `"+s+"` of `"+e+"`");return{id:c.id,name:e,inputs:u}}var r={},s={bool:function(e){return!!e},integer:function(e){return parseInt(e)},float:function(e){return parseFloat(e)},string:function(e){return e}};return r.getStudyRecordFromArray=function(e,t){return t=t||chartWidget,n(e,t)},r.getStudyRecordFromObject=function(e,t,i){return i=i||chartWidget,o(e,t,i)},r}();e.exports=n},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"LineDataSourceApi",function(){return r}),n=i(12),i.n(n),o=["alwaysShowStats","clonable","entryPrice","interval","lastUpdateTime","points","singleChartOnly","snapTo45Degrees","stopPrice","symbol","targetPrice"],r=function(){function e(e,t,i){this._source=e,this._model=t,this._pointsConverter=i}return e.prototype.isSelectionEnabled=function(){return this._source.isSelectionEnabled()},e.prototype.setSelectionEnabled=function(e){this._source.setSelectionEnabled(e)},e.prototype.isSavingEnabled=function(){
return this._source.isSavedInChart()},e.prototype.setSavingEnabled=function(e){this._source.setSavingInChartEnabled(e)},e.prototype.isShowInObjectsTreeEnabled=function(){return this._source.showInObjectTree()},e.prototype.setShowInObjectsTreeEnabled=function(e){this._source.setShowInObjectsTreeEnabled(e)},e.prototype.isUserEditEnabled=function(){return this._source.userEditEnabled()},e.prototype.setUserEditEnabled=function(e){this._source.setUserEditEnabled(e)},e.prototype.bringToFront=function(){this._model.bringToFront(this._source)},e.prototype.sendToBack=function(){this._model.sendToBack(this._source)},e.prototype.getProperties=function(){return this._source.properties().state(o,!0)},e.prototype.setProperties=function(e){this._setProps(this._source.properties(),e,"")},e.prototype.getPoints=function(){return this._pointsConverter.dataSourcePointsToPriced(this._source.points())},e.prototype.setPoints=function(e){var t,i,n=this._source.pointsCount(),o=-1===n?this._source.points().length:n;if(o!==e.length)throw Error("Wrong points count. Required="+o);for(t=this._pointsConverter.apiPointsToDataSource(e),i=0;i<t.length;++i)this._source.setPoint(i,t[i])},e.prototype._setProps=function(e,t,i){var o,r,s;for(o in t)t.hasOwnProperty(o)&&(r=0===i.length?o:i+"."+o,e.hasOwnProperty(o)?(s=t[o],Object(n.isHashObject)(s)?this._setProps(e[o],s,r):e[o].setValue(s)):console.warn('Unknown property "'+r+'"'))},e}()},function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyApi",function(){return s}),n=i(1),i(11),o=i(7),i.n(o),r=i(162),s=function(){function e(e,t){this._study=e,this._model=t}return e.prototype.isUserEditEnabled=function(){return this._study.userEditEnabled()},e.prototype.setUserEditEnabled=function(e){this._study.setUserEditEnabled(e)},e.prototype.getInputsInfo=function(){return this._study.metaInfo().inputs.map(function(e){return n.a({},e,{localizedName:void 0!==e.name?window.t(e.name,{context:"input"}):""})})},e.prototype.getInputValues=function(){var e=this._study.inputs();return Object.keys(e).map(function(t){return{id:t,value:e[t]}})},e.prototype.setInputValues=function(e){var t,i,n,o=this.getInputValues(),r=function(e){void 0!==o.find(function(t){return t.id===e.id})?s._study.properties().inputs[e.id].setValue(e.value):console.warn('There is no such input: "'+e.id+'"')},s=this;for(t=0,i=e;t<i.length;t++)n=i[t],r(n)},e.prototype.mergeUp=function(){this._model.mergeSourceUp(this._study),this._showStudyPriceScale()},e.prototype.mergeDown=function(){this._model.mergeSourceDown(this._study),this._showStudyPriceScale()},e.prototype.unmergeUp=function(){this._model.unmergeSourceUp(this._study),this._showStudyPriceScale()},e.prototype.unmergeDown=function(){this._model.unmergeSourceDown(this._study),this._showStudyPriceScale()},e.prototype.changePriceScale=function(e){var t,i,n,r=Object(o.ensureNotNull)(this._model.paneForSource(this._study)),s=null;switch(e){case"left":s=r.priceScaleByName("left");break;case"right":s=r.priceScaleByName("right");break;case"no-scale":

View File

@@ -10237,12 +10237,10 @@ html.theme-dark .tv-dialog__section--actions_with-border{ border-top-color: #363
}
.tv-dialog__grab {
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
}
.feature-no-touch .tv-dialog__grab:active,.feature-touch .tv-dialog__grab:active, .ui-draggable-dragging .tv-dialog__grab {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.tv-dialog__title {
@@ -12553,7 +12551,6 @@ html.theme-dark .tv-insert-indicator-dialog__create-script-message{ color: #c5cb
}
.pane--cursor-grabbing {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.pane--cursor-zoom-in {
@@ -12663,7 +12660,6 @@ html.theme-dark .custom-select .items .item.selected{ background: #2f3241; }
}
.price-axis--cursor-grabbing {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.price-axis--cursor-ns-resize {
@@ -12733,7 +12729,6 @@ html.theme-dark .tv-floating-toolbar {
align-items: center;
flex-shrink: 0;
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
width: 14px;
}
@@ -12747,7 +12742,6 @@ html.theme-dark .tv-floating-toolbar {
}
.tv-floating-toolbar.ui-draggable-dragging .tv-floating-toolbar__drag {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.tv-floating-toolbar__drag-ext {
@@ -12886,7 +12880,6 @@ html.feature-no-touch.theme-dark .tv-favorited-drawings-toolbar__widget.i-active
}
.time-axis--cursor-grabbing {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.time-axis--cursor-ew-resize {
@@ -12924,12 +12917,10 @@ html.feature-no-touch.theme-dark .tv-favorited-drawings-toolbar__widget.i-active
}
.dialog-aQQq411q- [data-dragg-area] {
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
}
.dialog-aQQq411q- [data-dragg-area].dragging-3fV74VcN- {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
@@ -15313,7 +15304,6 @@ html.theme-dark .tv-objects-tree-item.i-active{ background-color: #21384d; }
top: 0px;
padding: 16px 10px;
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
}
.tv-objects-tree-item__drag-icon svg {
@@ -15327,7 +15317,6 @@ html.theme-dark .tv-objects-tree-item.i-active{ background-color: #21384d; }
}
.tv-objects-tree-item.ui-sortable-helper, .tv-objects-tree-item.ui-sortable-helper .tv-objects-tree-item__drag-icon {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}

View File

@@ -10176,12 +10176,10 @@ html.theme-dark .tv-dialog__section--actions_with-border{ border-top-color: #363
}
.tv-dialog__grab {
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
}
.feature-no-touch .tv-dialog__grab:active,.feature-touch .tv-dialog__grab:active, .ui-draggable-dragging .tv-dialog__grab {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.tv-dialog__title {
@@ -12490,7 +12488,6 @@ html.theme-dark .tv-insert-indicator-dialog__create-script-message{ color: #c5cb
}
.pane--cursor-grabbing {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.pane--cursor-zoom-in {
@@ -12600,7 +12597,6 @@ html.theme-dark .custom-select .items .item.selected{ background: #2f3241; }
}
.price-axis--cursor-grabbing {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.price-axis--cursor-ns-resize {
@@ -12670,7 +12666,6 @@ html.theme-dark .tv-floating-toolbar {
align-items: center;
flex-shrink: 0;
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
width: 14px;
}
@@ -12684,7 +12679,6 @@ html.theme-dark .tv-floating-toolbar {
}
.tv-floating-toolbar.ui-draggable-dragging .tv-floating-toolbar__drag {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.tv-floating-toolbar__drag-ext {
@@ -12823,7 +12817,6 @@ html.feature-no-touch.theme-dark .tv-favorited-drawings-toolbar__widget.i-active
}
.time-axis--cursor-grabbing {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
.time-axis--cursor-ew-resize {
@@ -12861,12 +12854,10 @@ html.feature-no-touch.theme-dark .tv-favorited-drawings-toolbar__widget.i-active
}
.dialog-aQQq411q- [data-dragg-area] {
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
}
.dialog-aQQq411q- [data-dragg-area].dragging-3fV74VcN- {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}
@@ -15226,7 +15217,6 @@ html.theme-dark .tv-objects-tree-item.i-active{ background-color: #21384d; }
top: 0px;
padding: 16px 10px;
cursor: url(grab.bc156522a6b55a60be9fae15c14b66c5.cur), move;
cursor: -webkit-grab;
cursor: grab;
}
.tv-objects-tree-item__drag-icon svg {
@@ -15240,7 +15230,6 @@ html.theme-dark .tv-objects-tree-item.i-active{ background-color: #21384d; }
}
.tv-objects-tree-item.ui-sortable-helper, .tv-objects-tree-item.ui-sortable-helper .tv-objects-tree-item__drag-icon {
cursor: url(grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur), move;
cursor: -webkit-grabbing;
cursor: grabbing;
}

View File

@@ -1,4 +1,4 @@
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n,r,o=window.webpackJsonp;window.webpackJsonp=function(n,i,a){for(var s,u,l,c=0,f=[];c<n.length;c++)u=n[c],r[u]&&f.push(r[u][0]),r[u]=0;for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s]);for(o&&o(n,i,a);f.length;)f.shift()();if(a)for(c=0;c<a.length;c++)l=t(t.s=a[c]);return l},n={},r={34:0},t.e=function(e){function n(){a.onerror=a.onload=null,clearTimeout(s);var t=r[e];0!==t&&(t&&t[1](Error("Loading chunk "+e+" failed.")),r[e]=void 0)}var o,i,a,s,u=r[e];return 0===u?new Promise(function(e){e()}):u?u[2]:(o=new Promise(function(t,n){u=r[e]=[t,n]}),u[2]=o,i=document.getElementsByTagName("head")[0],a=document.createElement("script"),a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,t.nc&&a.setAttribute("nonce",t.nc),a.src=t.p+""+({0:"lt-pane-views",1:"chart-widget-gui",2:"create-dialog",3:"floating-toolbars",4:"take-chart-image-dialog-impl",5:"drawing-toolbar",6:"ds-property-pages",7:"restricted-toolset",8:"objecttreedialog",9:"go-to-date-dialog-impl",10:"load-chart-layout-dialog",11:"ie-fallback-logos",12:"chart-bottom-toolbar",13:"symbol-info-dialog-impl",14:"add-compare-dialog",15:"study-market",16:"confirm-inputs-dialog",17:"editobjectdialog",18:"header-toolbar",19:"confirm-symbol-input-dialog",20:"symbolsearch",21:"change-interval-dialog",23:"lazy-velocity",24:"study-pane-views",25:"series-pane-views",26:"export-data",27:"propertypagesfactory",28:"hammerjs",29:"library",30:"line-tools-icons",31:"lazy-jquery-ui",32:"series-icons-map"}[e]||e)+"."+{0:"92236c4fd18131ce41f4",1:"67de12c05d134554ff1c",2:"b388c187425e521c5a70",3:"348bec38a5b37a3f388f",4:"8581642b95a39228d178",5:"b5c7b558d29b0ded0e45",6:"0ec3f0e39331586d5be1",7:"a0f7780efd28528934ba",8:"b9fa79f3c22b36c514bf",9:"193ed211cd4f2c07f45e",10:"7bca15b478667d4a383c",11:"ecdc2f1255ecbff1dc5f",12:"7bbb5f176039f7d3dc2b",13:"6812ea9f986a1db1a6a9",14:"99e6e22e5d6b137269e9",15:"c4fcdd9f755d64995795",16:"acb4dc0e002888e741f5",17:"6741e8ad1a77a4388d0f",18:"95cfaecb949c7e2261e3",19:"741858b9ef54b3611d31",20:"e22809c43539f903c28a",21:"90d98fd5c50c9ae968da",22:"d344a511955b43dbefcc",23:"b369bcf3fef7b3d24234",24:"a750dba6fc5340758064",25:"9ee45674170ad7836ba4",26:"c8730af5d9a5f56fecc4",27:"42f63d141baef6e836f7",28:"9f017652d0f77438961c",29:"05d97551e2b48003a680",30:"d4bcd6d038b2fea6feed",31:"d97968c821f676a52e9b",32:"359d3b9b312cf5f56733",33:"bf2a2fc98cda3004cc87"}[e]+".js",s=setTimeout(n,12e4),a.onerror=a.onload=n,i.appendChild(a),o)},t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="bundles/",t.p=window.WEBPACK_PUBLIC_PATH||t.p,t.oe=function(e){throw console.error(e),e},t(t.s=360)}([,,,,,,,,,,function(e,t,n){
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n,r,o=window.webpackJsonp;window.webpackJsonp=function(n,i,a){for(var s,u,l,c=0,f=[];c<n.length;c++)u=n[c],r[u]&&f.push(r[u][0]),r[u]=0;for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s]);for(o&&o(n,i,a);f.length;)f.shift()();if(a)for(c=0;c<a.length;c++)l=t(t.s=a[c]);return l},n={},r={34:0},t.e=function(e){function n(){a.onerror=a.onload=null,clearTimeout(s);var t=r[e];0!==t&&(t&&t[1](Error("Loading chunk "+e+" failed.")),r[e]=void 0)}var o,i,a,s,u=r[e];return 0===u?new Promise(function(e){e()}):u?u[2]:(o=new Promise(function(t,n){u=r[e]=[t,n]}),u[2]=o,i=document.getElementsByTagName("head")[0],a=document.createElement("script"),a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,t.nc&&a.setAttribute("nonce",t.nc),a.src=t.p+""+({0:"lt-pane-views",1:"chart-widget-gui",2:"create-dialog",3:"floating-toolbars",4:"take-chart-image-dialog-impl",5:"drawing-toolbar",6:"ds-property-pages",7:"restricted-toolset",8:"objecttreedialog",9:"go-to-date-dialog-impl",10:"load-chart-layout-dialog",11:"ie-fallback-logos",12:"chart-bottom-toolbar",13:"symbol-info-dialog-impl",14:"add-compare-dialog",15:"study-market",16:"confirm-inputs-dialog",17:"editobjectdialog",18:"header-toolbar",19:"confirm-symbol-input-dialog",20:"symbolsearch",21:"change-interval-dialog",23:"lazy-velocity",24:"study-pane-views",25:"series-pane-views",26:"export-data",27:"propertypagesfactory",28:"hammerjs",29:"library",30:"line-tools-icons",31:"lazy-jquery-ui",32:"series-icons-map"}[e]||e)+"."+{0:"92236c4fd18131ce41f4",1:"67de12c05d134554ff1c",2:"b388c187425e521c5a70",3:"348bec38a5b37a3f388f",4:"8581642b95a39228d178",5:"b5c7b558d29b0ded0e45",6:"0ec3f0e39331586d5be1",7:"a0f7780efd28528934ba",8:"b9fa79f3c22b36c514bf",9:"193ed211cd4f2c07f45e",10:"7bca15b478667d4a383c",11:"ecdc2f1255ecbff1dc5f",12:"7bbb5f176039f7d3dc2b",13:"6812ea9f986a1db1a6a9",14:"99e6e22e5d6b137269e9",15:"c4fcdd9f755d64995795",16:"acb4dc0e002888e741f5",17:"6741e8ad1a77a4388d0f",18:"95cfaecb949c7e2261e3",19:"741858b9ef54b3611d31",20:"e22809c43539f903c28a",21:"90d98fd5c50c9ae968da",22:"d344a511955b43dbefcc",23:"b369bcf3fef7b3d24234",24:"a750dba6fc5340758064",25:"9ee45674170ad7836ba4",26:"c8730af5d9a5f56fecc4",27:"42f63d141baef6e836f7",28:"9f017652d0f77438961c",29:"6193a35b840b0cd54108",30:"d4bcd6d038b2fea6feed",31:"d97968c821f676a52e9b",32:"359d3b9b312cf5f56733",33:"bf2a2fc98cda3004cc87"}[e]+".js",s=setTimeout(n,12e4),a.onerror=a.onload=n,i.appendChild(a),o)},t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="bundles/",t.p=window.WEBPACK_PUBLIC_PATH||t.p,t.oe=function(e){throw console.error(e),e},t(t.s=360)}([,,,,,,,,,,function(e,t,n){
var r=n(22),o=n(90),i=n(74),a=n(75),s=n(55),u="prototype",l=function(e,t,n){var c,f,p,d,h=e&l.F,g=e&l.G,m=e&l.S,y=e&l.P,v=e&l.B,b=g?r:m?r[t]||(r[t]={}):(r[t]||{})[u],w=g?o:o[t]||(o[t]={}),x=w[u]||(w[u]={});g&&(n=t);for(c in n)f=!h&&b&&void 0!==b[c],p=(f?b:n)[c],d=v&&f?s(p,r):y&&"function"==typeof p?s(Function.call,p):p,b&&a(b,c,p,e&l.U),w[c]!=p&&i(w,c,d),y&&x[c]!=p&&(x[c]=p)};r.core=o,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){"use strict";function r(e){window.t=e}function o(e){s.$||(s.$={}),s.$.t=e}function i(e){return e?(window._tv_languages||{})[e]||null:null}function a(){document.body&&document.body.dispatchEvent(new c.CustomEvent("tradingview-i18next-initialized"))}var s,u,l,c,f,p,d,h,g;Object.defineProperty(t,"__esModule",{value:!0}),s=window,u=function(e,t){return e},r(u),o(u),l=n(237),c=n(240),n.d(t,"translate",function(){return u}),p={translate:u},window.__tradingviewI18nextInited||(d=window.language||null,h=i(d),d&&h||(console.error("No translation data"),d="en",h=i("en")),d&&h?(g={interpolation:{prefix:"__",suffix:"__"},keySeparator:":::",lng:d,nsSeparator:":::",resources:(f={},f[d]={translation:h},f)},l.init(g,a),p.translate=l.t.bind(l),r(p.translate),o(p.translate)):a(),window.__tradingviewI18nextInited=!0)},,,function(e,t){function n(e){var t,n,r=kt[e]={};for(e=e.split(/\s+/),t=0,n=e.length;t<n;t++)r[e[t]]=!0;return r}function r(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(D,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:_t.isNumeric(n)?+n:M.test(n)?_t.parseJSON(n):n)}catch(e){}_t.data(e,t,n)}else n=void 0}return n}function o(e){for(var t in e)if(("data"!==t||!_t.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function i(e,t,n){var r=t+"defer",o=t+"queue",i=t+"mark",a=_t._data(e,r);!a||"queue"!==n&&_t._data(e,o)||"mark"!==n&&_t._data(e,i)||setTimeout(function(){_t._data(e,o)||_t._data(e,i)||(_t.removeData(e,r,!0),a.fire())},0)}function a(){return!1}function s(){return!0}function u(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function l(e,t,n){if(t=t||0,_t.isFunction(t))return _t.grep(e,function(e,r){return!!t.call(e,r,e)===n});if(t.nodeType)return _t.grep(e,function(e,r){return e===t===n});if("string"==typeof t){var r=_t.grep(e,function(e){return 1===e.nodeType});if(ie.test(t))return _t.filter(t,r,!n);t=_t.filter(t,r)}return _t.grep(e,function(e,r){return _t.inArray(e,t)>=0===n})}function c(e){var t=le.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function f(e,t){return _t.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function p(e,t){if(1===t.nodeType&&_t.hasData(e)){var n,r,o,i=_t._data(e),a=_t._data(t,i),s=i.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,o=s[n].length;r<o;r++)_t.event.add(t,n,s[n][r])}a.data&&(a.data=_t.extend({},a.data))}}function d(e,t){var n;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),
t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),"object"===n?t.outerHTML=e.outerHTML:"input"!==n||"checkbox"!==e.type&&"radio"!==e.type?"option"===n?t.selected=e.defaultSelected:"input"===n||"textarea"===n?t.defaultValue=e.defaultValue:"script"===n&&t.text!==e.text&&(t.text=e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(_t.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached"))}function h(e){return void 0!==e.getElementsByTagName?e.getElementsByTagName("*"):void 0!==e.querySelectorAll?e.querySelectorAll("*"):[]}function g(e){"checkbox"!==e.type&&"radio"!==e.type||(e.defaultChecked=e.checked)}function m(e){var t=(e.nodeName||"").toLowerCase();"input"===t?g(e):"script"!==t&&void 0!==e.getElementsByTagName&&_t.grep(e.getElementsByTagName("input"),g)}function y(e){var t=bt.createElement("div");return ke.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function v(e,t,n){var r="width"===t?e.offsetWidth:e.offsetHeight,o="width"===t?1:0,i=4;if(r>0){if("border"!==n)for(;o<i;o+=2)n||(r-=parseFloat(_t.css(e,"padding"+Ae[o]))||0),"margin"===n?r+=parseFloat(_t.css(e,n+Ae[o]))||0:r-=parseFloat(_t.css(e,"border"+Ae[o]+"Width"))||0;return r+"px"}if(r=Me(e,t),(r<0||null==r)&&(r=e.style[t]),Oe.test(r))return r;if(r=parseFloat(r)||0,n)for(;o<i;o+=2)r+=parseFloat(_t.css(e,"padding"+Ae[o]))||0,"padding"!==n&&(r+=parseFloat(_t.css(e,"border"+Ae[o]+"Width"))||0),"margin"===n&&(r+=parseFloat(_t.css(e,n+Ae[o]))||0);return r+"px"}function b(e){return function(t,n){if("string"!=typeof t&&(n=t,t="*"),_t.isFunction(n))for(var r,o,i,a=t.toLowerCase().split(Xe),s=0,u=a.length;s<u;s++)r=a[s],i=/^\+/.test(r),i&&(r=r.substr(1)||"*"),o=e[r]=e[r]||[],o[i?"unshift":"push"](n)}}function w(e,t,n,r,o,i){o=o||t.dataTypes[0],i=i||{},i[o]=!0;for(var a,s=e[o],u=0,l=s?s.length:0,c=e===Je;u<l&&(c||!a);u++)"string"==typeof(a=s[u](t,n,r))&&(!c||i[a]?a=void 0:(t.dataTypes.unshift(a),a=w(e,t,n,r,a,i)));return!c&&a||i["*"]||(a=w(e,t,n,r,"*",i)),a}function x(e,t){var n,r,o=_t.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((o[n]?e:r||(r={}))[n]=t[n]);r&&_t.extend(!0,e,r)}function _(e,t,n,r){if(_t.isArray(t))_t.each(t,function(t,o){n||Fe.test(e)?r(e,o):_(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==_t.type(t))r(e,t);else for(var o in t)_(e+"["+o+"]",t[o],n,r)}function k(e,t,n){var r,o,i,a,s=e.contents,u=e.dataTypes,l=e.responseFields;for(o in l)o in n&&(t[l[o]]=n[o]);for(;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("content-type"));if(r)for(o in s)if(s[o]&&s[o].test(r)){u.unshift(o);break}if(u[0]in n)i=u[0];else{for(o in n){if(!u[0]||e.converters[o+" "+u[0]]){i=o;break}a||(a=o)}i=i||a}if(i)return i!==u[0]&&u.unshift(i),n[i]}function T(e,t){e.dataFilter&&(t=e.dataFilter(t,e.dataType));var n,r,o,i,a,s,u,l,c=e.dataTypes,f={},p=c.length,d=c[0];for(n=1;n<p;n++){if(1===n)for(r in e.converters)"string"==typeof r&&(f[r.toLowerCase()]=e.converters[r]);if(i=d,"*"===(d=c[n]))d=i;else if("*"!==i&&i!==d){
if(a=i+" "+d,!(s=f[a]||f["* "+d])){l=void 0;for(u in f)if(o=u.split(" "),(o[0]===i||"*"===o[0])&&(l=f[o[1]+" "+d])){u=f[u],!0===u?s=l:!0===l&&(s=u);break}}s||l||_t.error("No conversion from "+a.replace(" "," to ")),!0!==s&&(t=s?s(t):l(u(t)))}}return t}function E(){try{return new window.XMLHttpRequest}catch(e){}}function C(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function S(){return setTimeout(O,0),gt=_t.now()}function O(){gt=void 0}function N(e,t){var n={};return _t.each(ht.concat.apply([],ht.slice(0,t)),function(){n[this]=e}),n}function P(e){if(!ut[e]){var t=bt.body,n=_t("<"+e+">").appendTo(t),r=n.css("display");n.remove(),"none"!==r&&""!==r||(lt||(lt=bt.createElement("iframe"),lt.frameBorder=lt.width=lt.height=0),t.appendChild(lt),ct&&lt.createElement||(ct=(lt.contentWindow||lt.contentDocument).document,ct.write((_t.support.boxModel?"<!doctype html>":"")+"<html><body>"),ct.close()),n=ct.createElement(e),ct.body.appendChild(n),r=_t.css(n,"display"),t.removeChild(lt)),ut[e]=r}return ut[e]}function j(e){return _t.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}var A,M,D,L,R,F,I,H,U,W,B,z,q,$,V,K,X,G,Q,Y,J,Z,ee,te,ne,re,oe,ie,ae,se,ue,le,ce,fe,pe,de,he,ge,me,ye,ve,be,we,xe,_e,ke,Te,Ee,Ce,Se,Oe,Ne,Pe,je,Ae,Me,De,Le,Re,Fe,Ie,He,Ue,We,Be,ze,qe,$e,Ve,Ke,Xe,Ge,Qe,Ye,Je,Ze,et,tt,nt,rt,ot,it,at,st,ut,lt,ct,ft,pt,dt,ht,gt,mt,yt,vt,bt=window.document,wt=window.navigator,xt=window.location,_t=function(){function e(){if(!i.isReady){try{bt.documentElement.doScroll("left")}catch(t){return void setTimeout(e,1)}i.ready()}}var t,n,r,o,i=function(e,n){return new i.fn.init(e,n,t)},a=window.jQuery,s=window.$,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,l=/\S/,c=/^\s+/,f=/\s+$/,p=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,d=/^[\],:{}\s]*$/,h=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,g=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,m=/(?:^|:|,)(?:\s*\[)+/g,y=/(webkit)[ \/]([\w.]+)/,v=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,x=/-([a-z]|[0-9])/gi,_=/^-ms-/,k=function(e,t){return(t+"").toUpperCase()},T=wt.userAgent,E=Object.prototype.toString,C=Object.prototype.hasOwnProperty,S=Array.prototype.push,O=Array.prototype.slice,N=String.prototype.trim,P=Array.prototype.indexOf,j={};return i.fn=i.prototype={constructor:i,init:function(e,t,n){var r,o,a,s;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("body"===e&&!t&&bt.body)return this.context=bt,this[0]=bt.body,this.selector=e,this.length=1,this;if("string"==typeof e){if(!(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:u.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1])return t=t instanceof i?t[0]:t,s=t?t.ownerDocument||t:bt,a=p.exec(e),a?i.isPlainObject(t)?(e=[bt.createElement(a[1])],i.fn.attr.call(e,t,!0)):e=[s.createElement(a[1])]:(a=i.buildFragment([r[1]],[s]),e=(a.cacheable?i.clone(a.fragment):a.fragment).childNodes),i.merge(this,e);if((o=bt.getElementById(r[2]))&&o.parentNode){