vart="study_"+e.id;returne.pine&&e.pine.version&&(t+="_"+e.pine.version.replace(".","_")),t},n.addOrReplaceStudyMetaInfo=function(e,t){vari,o,s,l,c=newn(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))returnc;n.removeStudyMetaInfo(e,c,u)}elsen.removeStudyMetaInfo(e,c,u)&&r.logDebug("Study with id="+c.id+" already exists in the model!");returne.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){returnTradingView.defaultProperties["study_"+e]||null})},n.setDefaultsOverrides=function(e){l=e},n.createMetaInfoStub=function(e,t){vari,n,r;returno(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)returne.extra.kind===TVScript.Kinds.STRATEGY;if(!0===e.isTVScriptStrategy)return!0;vart=e.TVScriptSourceCode||e.scriptSource;return!!t&&TVScript.isStrategy(t)},n.replaceWithFullStudyMetaInfoAsync=function(e,t){vari=$.Deferred();returnt.isTVScriptStubToCompile||i.resolve(t),i.promise()},n.getOrderedInputIds=function(e){vart,i,n=[],o=e.inputs;for(t=0;t<o.length;++t)i=o[t],n.push(i.id);returnn},n.canBeChild=function(e){vart,i,o;if(e&&"string"==typeofe)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;returnn.isAllowedSourceInputsCount(i)},n.isAllowedSourceInputsCount=function(e){return1===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(vart=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,void0!==t&&t&&t.exports&&(t.exports=n)}).call(t,i(13),i(51)(e))},function(e,t,i){"use strict";functionn(e,t,i,n,o,r){vars,a,h,u;returnObject(l.equalPoints)(e,t)?null:(s=newl.Point(0,0),a=newl.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))}functiono(e){return.3*e}functionr(e){return2+.5*e}functions(e){returnnull!==e&&void0!==e&&!Object(h.isNaN)(e)}functiona(e,t){void0!==t&&Object(u.setLineStyle)(e,t)}varl,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){functionn(){this._zorder=0,this.m_priceScale=null,this._id=s.randomHashN(6),this._ownerSource=null,this._userEditEnabled=!0,this.hasAlert=newe(!1)}functiono(e){n.call(this),this._isOverlay=null,this._model=e}varr=i(3).DefaultProperty,s=i(33);n.prototype.createPropertiesObject=function(e,t,i){returnnewr(e,t,i)},n.prototype.id=function(){returnthis._id},n.prototype.preferNoScale=function(){return!1},n.prototype.idForAlert=function(){returnthis._id},n.prototype.setId=function(e){this._id=e},n.prototype.zorder=function(){returnthis._zorder},n.prototype.setZorder=function(e){"number"==typeofe&&this._zorder!==e&&(this._zorder=e)},n.prototype.title=function(){throwError("Implement this fun in a subclass")},n.prototype.priceScale=function(){returnthis.m_priceScale},n.prototype.setPriceScale=function(e){this.m_priceScale=e},n.prototype.ownerSource=function(){returnthis._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(){returnthis._userEditEnabled},n.prototype.canBeHidden=function(){returnthis.userEditEnabled()},n.prototype.isUserDeletable=function(){returnthis.userEditEnabled()},n.prototype.canHasAlert=function(){return!1},n.prototype.properties=function(){throwError("Implement this fun in a subclass")},n.prototype.statusView=function(){returnnull},n.prototype.dataWindowView=function(){returnnull},n.prototype.legendView=function(){returnnull},n.prototype.priceAxisViews=function(e,t){returnnull},n.prototype.updateAllViews=function(){},n.prototype.paneViews=function(e){returnnull},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(){
returnnull},n.prototype.getStylesPropertyPage=function(){returnnull},n.prototype.getDisplayPropertyPage=function(){returnnull},n.prototype.getVisibilitiesPropertyPage=function(){returnnull},n.prototype.getStrategyPropertyPage=function(){returnnull},n.prototype.getSourceIcon=function(){returnnull},n.prototype.doesMovingAffectsUndo=function(){return!0},inherit(o,n),o.prototype.isNoScale=function(){return!!this._isOverlay},o.prototype.base=function(){return0},o.prototype.formatter=function(){returnnull},o.prototype.model=function(){returnthis._model},o.prototype.priceRange=function(e,t){returnnull},o.prototype.isDraggable=function(){return!this._metaInfo||!this._metaInfo.linkedToSeries},o.prototype.priceLineColor=function(e){returne},t.DataSource=n,t.PriceDataSource=o}).call(t,i(16))},function(e,t,i){"use strict";functionn(e,t,i){varn,o,r,l,c;if(t=t||0,!s(e))returni?Object(a.rgbaToString)(Object(a.rgba)(Object(a.parseRgb)(e),Object(a.normalizeAlphaComponent)(1-t/100))):e;if(t<0&&t>100)throwError("invalid transparency");returnn=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])}functiono(e){returns(e)?e:Object(a.rgbaToString)(Object(a.rgba)(Object(a.parseRgb)(e),Object(a.normalizeAlphaComponent)(1)))}functionr(e){vart=Object(a.parseRgb)(e).map(function(e){returne/=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)}functions(e){return0===e.indexOf("#")}vara;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";functionn(e,t,i){varn=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()}}functiono(e,t,i){varo,r,s=n(e,t,i);return0<=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";functionn(e,t,i){u[e].unsubscribe(i,t)}functiono(e,t,i){r(e,t,i)}functionr(e,t,i,n){if(u.hasOwnProperty(e)||(u[e]=newh.a),p[e])returnvoidt.call(i);u[e].subscribe(i,t,n)}functions(e){d.push(e)}functiona(e){vart,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)}functionl(e){p[e]&&console.warn("Something went wrong: emitOnce called multiple times with same event ("+e+")"),p[e]=!0,a.apply(null,arguments)}varc,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){functionr(e){return"cursor"===e||"arrow"===e||"dot"===e}functions(e){!e&&u&&u.stayInDrawingMode.value()||this.tool.setValue(this.cursorTool.value())}functiona(e,t){returnfunction(t){
returnu(e,t,i,n,o,pe.getStudyPropertyRootName(e),r)}functionu(e,t,i,n,o,r,s){vara,l,c,h=p(e,t,i,n,o),u=newoe(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));returnu}functiond(e,n,o,r){vars,a,l,c,h,u,d,p,y=i(168);if(pe.versionOf(e)<1)throwError("This function cannot work with metainfo of the old format version. Required format version >= 1");returns=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(!(ninstanceoft),"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,deletec.inputs,deletec.defaults.inputs,u={},TradingView.merge(u,c.defaults),TradingView.merge(u,TradingView.factoryDefaults("study_"+c.id)),TradingView.merge(u,s),TradingView.merge(u,c),deleteu.defaults,s=u,d=null!==o?o.model().getStudyShiftColorStartOffset():void0,p=f(o,e),TradingView.merge(s,m(s,p,d)),n&&TradingView.merge(s.styles,n.styles),s}functionp(e,t,n,o,r){vars,a,l,c,h,u,d=i(168);returne.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,deletea.inputs,deletea.defaults.inputs,c={},TradingView.merge(c,a.defaults),TradingView.merge(c,TradingView.factoryDefaults("study_"+a.id)),TradingView.merge(c,s),deletea.defaults,TradingView.merge(c,a),s=c),h=null!==o?o.model().getStudyShiftColorStartOffset():void0,u=f(o,a),TradingView.merge(s,m(s,u,h)),s}function_(e,t){vari,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&&oine.styles&&TradingView.merge(r,e.styles[o]),e.styles[o]=r)}functionf(e,t){vari,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++);returns}functionm(e,t,i){varn,o;if(!t)returne;for(nine.styles)(o=e.styles[n].color)&&(e.styles[n].color=ne(o,t,i));returne}functiony(e,t,r,s){vara,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,
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(){returnthis._symbolsResolved},y.prototype.resolvedSymbolInfoBySymbol=function(e){returnthis._resolvedSymbols&&e?this._resolvedSymbols[e]||null:null},y.prototype._resolveSymbol=function(e){vart=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]){caseTradingView.Series.PD_REASON_EXTENDED_HOURS:break;caseTradingView.Series.PD_REASON_SYMBOL:if(i.params[3])returnvoidt(i.params[3],n);break;default:returnvoidt(i.params[2],n)}n.reject(e)}}.bind(this))}.bind(this),i=$.Deferred();returnt(e,i),i.promise()},y.prototype._allSymbolsAreResolved=function(){vare,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)));returnr.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(){vare,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,void0===(i=this._properties.inputs[t].value())||null==i))return!1;return!0},y.prototype.sourceId=function(){returnthis._studyId},y.prototype.source=function(){returnthis._source||this._series},y.prototype.ownerSource=function(){returnthis._isChildStudy?this._source:H.prototype.ownerSource.call(this)},y.prototype.getAllOwnerSources=function(){for(vare=[],t=this.ownerSource();null!=t;)e.push(t),t=t.ownerSource();returne},y.prototype.isChildStudy=function(){return!!this._isChildStudy},y.prototype.setChild=function(e){einstanceofy&&e.source()===this&&(this._children||(this._children=[]),-1===this._children.indexOf(e)&&this._children.push(e))},y.prototype.unsetChild=function(e){if(einstanceofy&&e.source()===this&&this._children){vart=this._children.indexOf(e);~t&&this._children.splice(t,1)}},y.prototype.hasChildren=function(){return!(!this._children||!this._children.length)},y.prototype.getAllChildren=function(){vare,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]);returne},y.prototype._debugId=function(){vare=[]
skipHiddenInputs:!1,skipFakeInputs:!1,asObject:!0};returnTradingView.merge(t,e),this._buildInputs(t)},y.prototype._buildInputs=function(e){vart,i;S(!!e,"options not set"),t={};try{t=this._prepareInputs(e)}catch(e){ve.logWarn("Failed to prepare study inputs: "+e)}returne.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){vart,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));returnt},y.prototype._prepareInput=function(e,t){vari=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){vari,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){vari,n,o,r,s,a,l,c,h,u,d;if(this._isChildStudy){if(this._source.unsetChild(this),deletethis._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)returnvoidve.logError("Can not find "+this._metaInfo.id+" meta info");deletethis._source,deletethis._isChildStudy,deletethis._ownerSource,this._metaInfo=r.state(!0),i=this._series._seriesId,n=te.REBIND_STUDY_CHILD_TO_STANDALONE}else{if(!(einstanceofy))returnve.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(!(einstanceofy))returnve.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(),
;vart=Object.keys(this._oldStudyInputs);returnS(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._seriesinstanceofTradingView.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){returnthis._priceAxisViewsCache[e]._fixedCoordinate},y.prototype.priceLabelText=function(e){vart,i,n,o;return1===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(vart=0;t<e.length;t++)this._paneViews.push(newj(this._model,this,e[t],"priceLabelText","showStudyPlotLabels"))},y.prototype.createViews=function(){vare,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(newM(this,this._series,this._model,n));elseif(this.isPlotShapesPlot(i))this._paneViews.push(newV(this,this._series,this._model,n));elseif(this.isPlotCharsPlot(i))this._paneViews.push(newD(this,this._series,this._model,n));elseif(this.isPlotArrowsPlot(i))this._paneViews.push(newO(this,this._series,this._model,n));elseif(this.isOHLCSeriesPlot(i)){if(o=this.metaInfo().plots[i].target,e[o])continue;e[o]=o,this.isOHLCBarsPlot(i)?this._paneViews.push(newR(this,this._series,this._model,o)):this.isOHLCCandlesPlot(i)&&this._paneViews.push(newB(this,this._series,this._model,o)),r=newA(this,{plotIndex:o}),this._priceAxisViewsCache[o]=r,this._priceAxisViewsBase.push(r),t.push(o)}elser=newA(this,{plotIndex:n}),this._priceAxisViewsCache[n]=r,this._priceAxisViewsBase.push(r),this._paneViews.push(newE(this,this._series,this._model,n)),this.properties().styles[n].trackPrice.value()&&this._paneViews.push(news(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(newC(this._properties.bands[i],this));if(this._properties.bandsBackground&&this._paneViews.push(newL(this)),a=this._paneViews,
this.clearData(),this._status="","string"==typeofe.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=(newDate).getTime()-this._loadingStartTime,ve.logDebug(n+", Study "+this._metaInfo.description+" loading took "+o+" ms"),deletethis._loadingStartTime,this._status="",this._statusView.update(),r=this._model.paneForSource(this),this._model.recalculatePane(r),this._updateSources(),this._model.invalidate(newee(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),void0!==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();varn=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(){vare,t;if(this._nonPriceParent)returnthis._nonPriceParent;for(e=this.source();einstanceofy;){if(t=e.metaInfo(),!t.is_price_study||"Compare@tv-basicstudies"===t.id)returnthis._nonPriceParent=e,e;e=e.source()}},y.prototype.firstValue=function(e){vart,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){varn,s,a
returnthis._statusView},y.prototype.priceAxisViews=function(e,t){returnthis._model.paneForSource(this)===e&&t===this.priceScale()&&(this._showLastValueOnPriceScale()||this.properties().oldShowLastValue&&this.properties().oldShowLastValue.value())?this._priceAxisViews:null},y.prototype._showLastValueOnPriceScale=function(){returnthis._model.properties().scalesProperties.showStudyLastValue.value()},y.prototype.isLinePlot=function(e){vart=this._metaInfo.plots[e];returnfe.isLinePlot(t)},y.isSelfColorerPlot=function(e,t){vari=e._metaInfo.plots[t];returnfe.isColorerPlot(i)},y.prototype.isSelfColorerPlot=function(e){returny.isSelfColorerPlot(this,e)},y.prototype.isTextColorerPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isTextColorerPlot(t)},y.prototype.isBarColorerPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isBarColorerPlot(t)},y.prototype.isBgColorerPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isBgColorerPlot(t)},y.prototype.isPlotShapesPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isShapesPlot(t)},y.prototype.isPlotCharsPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isCharsPlot(t)},y.prototype.isPlotArrowsPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isArrowsPlot(t)},y.prototype.isOHLCBarsPlot=function(e){vart=this._metaInfo.plots[e].target,i=this.metaInfo().defaults.ohlcPlots[t];returni&&this.isOHLCSeriesPlot(e)&&fe.isOhlcPlotStyleBars(i)},y.prototype.isOHLCCandlesPlot=function(e){vart=this._metaInfo.plots[e].target,i=this.metaInfo().defaults.ohlcPlots[t];returni&&this.isOHLCSeriesPlot(e)&&fe.isOhlcPlotStyleCandles(i)},y.prototype.isOHLCSeriesPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isOhlcPlot(t)},y.prototype.isOHLCOpenPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isOhlcOpenPlot(t)},y.prototype.isOHLCHighPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isOhlcHighPlot(t)},y.prototype.isOHLCLowPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isOhlcLowPlot(t)},y.prototype.isOHLCClosePlot=function(e){vart=this._metaInfo.plots[e];returnfe.isOhlcClosePlot(t)},y.prototype.isOHLCColorerPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isOhlcColorerPlot(t)},y.prototype.isDataOffsetPlot=function(e){vart=this._metaInfo.plots[e];returnfe.isDataOffsetPlot(t)},y.prototype.hasBarColorer=function(){for(vare=0;e<this._metaInfo.plots.length;++e)if(this.isBarColorerPlot(e))return!0;return!1},y.prototype.barColorer=function(){vare,t,i=null;for(e=0;e<this._metaInfo.plots.length;++e)this.isBarColorerPlot(e)&&(t=newP(this,e),null==i?i=t:i.pushBackBarColorer(t));if(null==i)throwError("Cannot create BarColorer: study doesn't have a bar_colorer plot!");returni},y.prototype.base=function(){return"Volume"===this._metaInfo.id?1:0},y.prototype._createFormatter=function(){vare,t,i;"default"===this.properties().precision.value()?this.metaInfo().defaults&&(e=parseInt(this.metaInfo().defaults.precision)):e=parseInt(this.properties().precision.value()),
this._minValue=i.m_minValue,this._maxValue=i.m_maxValue):(n=e,this._minValue=n,void0!==t&&(this._maxValue=t))}returne.prototype.equals=function(e){returnthis._minValue===e._minValue&&this._maxValue===e._maxValue},e.prototype.clone=function(){returnnewe(this._minValue,this._maxValue)},e.prototype.minValue=function(){returnthis._minValue},e.prototype.setMinValue=function(e){this._minValue=e},e.prototype.maxValue=function(){returnthis._maxValue},e.prototype.setMaxValue=function(e){this._maxValue=e},e.prototype.length=function(){returnthis._maxValue-this._minValue},e.prototype.isEmpty=function(){returnthis._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){returnnewe(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){vart,i,o,s;if(!Object(n.isNumber)(e))returnvoidr.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))returnvoidr.logDebug("PriceRange.shift: invalid coeff");this._maxValue+=e,this._minValue+=e},e.prototype.containsStrictly=function(e){returne.minValue()>this._minValue&&e.maxValue()<this._maxValue},e}()},function(e,t,i){"use strict";(function(e,t){varn,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(){functiont(e){returnM+"."+e}functioni(e,t){vari;returni=V[e],window.is_authenticated&&!W||null!=i||(i=V[e]),null==i?t:i}functionc(e,t){varn=i(e,void0);if(null==n)returnt;try{returnJSON.parse(n)}catch(i){returnf(e),t}}functionh(e,t){varn=i(e);returnnull==n?t:!(!n||"false"===n||0==+n)}functionu(e,t,n){varo,r=i(e,void0,n);if(null==r)returnt;if(o=parseFloat(r),!isFinite(o))thrownewTypeError('"'+r+'" is not float (key: "'+e+'")');returno}functiond(e,t,n){varo,r=i(e,void0,n);if(null==r)returnt;if(o=parseInt(r,10),!isFinite(o))thrownewTypeError('"'+r+'" is not int (key: "'+e+'")');returno}functionp(e,t,i){i=i||{};varn=""+t;returnV[e]!==n&&(V[e]=n,y(e)),i.forceFlush&&!R&&(R=setTimeout(function(){R=void0,g()},E)),l}function_(e,t,i){returnp(e,JSON.stringify(t),i),l}functionf(e,t){returnt=t||{},null!=V[e]&&(deleteV[e],y(e)),t.forceFlush&&g(),l}functionm(){O=void0,D.length&&g()}functiony(e){if(H)null==V[e]?H.removeValue(e):H.setValue(e,V[e]);elseif(!window.is_authenticated||W)try{null==V[e]?r.removeItem(t(e)):r.setItem(t(e),V[e])
returne>=t}functionr(e,t,i){returnMath.min(Math.max(e,t),i)}functions(e){returne<0?-1:e>0?1:0}functiona(e){if(e<0)returnf.logDebug("MathEx.isBaseDecimal: argument less zero"),!1;for(vart=e;t>1;t/=10)if(t%10!=0)return!1;return!0}functionl(e,t,i){returnt-e<=i}functionc(e,t,i){returnMath.abs(e-t)<i}functionh(e){returne<=0?(f.logDebug("MathEx.log10: argument less or equal zero"),NaN):Math.log(e)/Math.log(10)}functionu(e,t){returne<t?-1:e>t?1:0}functiond(e,t){vari,n;if(void0===t&&(t=u),e.length<1)throwError("array is empty");for(i=e[0],n=0;n<e.length;++n)t(e[n],i)<0&&(i=e[n]);returni}functionp(e,t){vari,n;if(void0===t&&(t=u),e.length<1)throwError("array is empty");for(i=e[0],n=0;n<e.length;++n)t(e[n],i)>0&&(i=e[n]);returni}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){returne.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){returne.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){returne.i}}),e.webpackPolyfill=1),e}},,,,,,,function(e,t,i){"use strict";varn,o=i(24),r=i(1),s=i(29),a=i(38),l=function(){functione(e){this.setData(e)}returne.prototype.setData=function(e){this._data=r.a({},e)},e.prototype.draw=function(e,t){vari,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){vari=e.fontSize+e.paddingTop+e.paddingBottom;returnthis._data.secondLine&&t?2*i+1:i},e}();i.d(t,"a",function(){returnn}),n=function(){functione(){this._rendererData={text:"",coordinate:0,
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";varn,o,r,s,a,l;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"Linking",function(){returna}),i.d(t,"linking",function(){returnl}),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(){functione(){this._watchedSymbol=newo.a,this._seriesShortSymbol=newo.a,this._proSymbol=newo.a,this._watchedInterval=newo.a,this._watchedIntraday=newo.a,this._watchedSupportedResolutions=newo.a,this._symbolNamesList=newo.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}returnObject.defineProperty(e.prototype,"symbol",{get:function(){returnthis._watchedSymbol},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"proSymbol",{get:function(){returnthis._proSymbol},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"symbolNamesList",{get:function(){returnthis._symbolNamesList},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"seriesShortSymbol",{get:function(){returnthis._seriesShortSymbol.readonly()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interval",{get:function(){returnthis._watchedInterval},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"intraday",{get:function(){returnthis._watchedIntraday.readonly()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"supportedResolutions",{get:function(){returnthis._watchedSupportedResolutions.readonly()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preventFeedBySymbol",{get:function(){returnthis._preventFeedBySymbol},enumerable:!0,configurable:!0}),e.prototype.bindToChartWidget=function(e){vart,i;if(this.unbindFromChartWidget(),this._activeChartWidget=e,t=e.model())returnvoidthis._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){cases.BoundToWidget:if(!this._activeChartWidget)throwError("ChartWidget is undefined")
;this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);break;cases.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),deletethis._watchedSymbol.hook,deletethis._watchedSymbol.writeLock}this._activeChartWidget=null,this._chartWidgetBindingState=s.NotBound},e.prototype.getChartWidget=function(){returnthis._activeChartWidget},e.prototype.bindToChartWidgetCollection=function(e){vart=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)throwError("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)throwError("No search charts defined");this._preventFeedBySymbol||this._searchCharts.feedBySymbol(e)}},e.prototype._mainSeries=function(){if(!this._activeChartWidget)throwError("ChartWidget is undefined");returnthis._activeChartWidget.model().mainSeries()},e.prototype._properties=function(){returnthis._mainSeries().properties()},e.prototype._symbolProperty=function(){returnthis._properties().symbol},e.prototype._intervalProperty=function(){returnthis._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){vart=this._mainSeries().symbolInfo();t&&this._applyValuesFromSymbolInfo(t)},e.prototype._applyValuesFromSymbolInfo=function(e){vart=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());vare=this._mainSeries().symbolInfo();e?(this._applyValuesFromSymbolInfo(e),
e.hasOwnProperty("supported_resolutions")?this._watchedSupportedResolutions.setValue(e.supported_resolutions):this._watchedSupportedResolutions.setValue(void0),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){vart,i,n;if(!this._activeChartWidget)throwError("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){returni.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=newa,window.TradingView.Linking=l},function(e,t,i){"use strict";(function(e,n,o,r){functions(){return{count:TradingView.DEFAULT_BAR_COUNT}}functiona(t,o,r){varl,_=i(120);L.call(this,t),this._dataEvents=newoe,this._boxSizeChanged=newe,this._tagsChanged=newe,this._symbolIntervalChanged=newe,this._intervalChanged=newe,this._extendedHoursChanged=newe,this.chartWidgetInitialized=newe,this._onStyleChanged=newe,this._onStatusChanged=newe,this._onRestarted=newe,this._onSessionsStudyCreated=newe,this.requestingIntradayWhenNotSupported=newe,this.requestingResolutionWhenNotSupported=newe,this._priceScaleChanged=newe,this._onInReplayStateChanged=newe,this._requestOptions=r||s(),this.m_model=t,this._chartApi=t._chartApi,this.m_data=newA,this.setProperties(o),this._prevChartStyle=o.style.value(),this.createPaneView(),this._dataWindowView=newd(this,t),this._legendView=newp(this,t),this._statusView=newc(this,t.properties()),this._priceAxisViews=[newu(this,{model:t}),newh(this,{model:t})],this._symbolInfo=null,this._status=a.STATUS_OFFLINE,this._syncModel=null,this._replaySubscriber=null,l=this,this._turnaroundCounter=1,
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(){deletethis._barColorerCache,this.invalidateBarStylesCache()},a.prototype.barColorer=function(){vare,t,i,n;if(this._barColorerCache)returnthis._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));returnnull===e?e=newC(this):e.pushBackBarColorer(newC(this)),this._barColorerCache=e,this._barColorerCache},a.prototype.properties=function(){returnthis._properties},a.prototype._barsState=function(e){vart=e.state();returnt.data.forEach(function(e){e.value.splice(7,1)}),t},a.prototype.state=function(e,t){vari=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};returnthis._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(){returnthis.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){vart,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]){casea.PD_REASON_EXTENDED_HOURS:this._dataEvents.fireExtendedHoursNotPermitted();break;casea.PD_REASON_SYMBOL:this._dataEvents.fireSymbolNotPermitted(e.params[3]);break;casea.PD_REASON_GROUP_PERMISSION:this._dataEvents.fireSymbolGroupNotPermitted(e.params[3]);break;default:this._dataEvents.fireSymbolNotPermitted(e.params[2])}elsethis.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=void0!==s&&s?r:r+10,this.m_model.setTimeViewport(o,c);break;case"series_error":n=e.params[2],deletethis._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"==typeofn&&(n.startsWith("study_not_auth:")?(h=n.split(":",2)[1].split("@",2)[0],hin{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=(newDate).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=(newDate).getTime()-this._loadingStartTime,Y.logDebug(u+", Series loading took "+d+" ms, eod:"+this._endOfData),deletethis._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(newM(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())returnvoidY.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(),newPromise(function(t){vari=v.properties().style.value()
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()+'"'),deletethis._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(){vare=this._checkIntervalWillChanged(this._parseInterval(this._properties.interval.value()).interval);returnthis._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){returnthis.m_interval!==e||P.enabled("same_data_requery")},a.prototype._parseInterval=function(e){vart=(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){varn,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),deletethis._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){
"string"!=typeofe&&(e="="+JSON.stringify(e)),e},a.prototype._getResolvingSymbolString=function(){returnthis.getSymbolString()},a.prototype.getStyleShortName=function(){vare=this._properties.style.value();if(a.STYLE_SHORT_NAMES.hasOwnProperty(e))returna.STYLE_SHORT_NAMES[e];throwError("Missed short name for style "+e)},a.prototype.getStyleProperties=function(){returnthis._properties[this.getStyleShortName()+"Style"]},a.prototype.getInputsProperties=function(){returnthis.getStyleProperties().inputs||newo},a.prototype.getRealVisibleRange=function(){vare,t,i=this.model().timeScale().visibleBars();returnnull===i?null:(e=this.data().search(i.firstBar(),B.NearestRight),t=this.data().search(i.lastBar(),B.NearestLeft),null===e||null===t?null:newx(e.index,t.index))},a.prototype.firstValue=function(){vare=this.firstBar();returnnull===e?null:this._barFunction(e)},a.prototype.firstBar=function(){vare,t,i=this.model().timeScale().visibleBars();returnnull===i?null:(e=i.firstBar(),t=this.data().search(e,B.NearestRight),null!==t?t.value:null)},a.prototype.sessionsStudy=function(){vare,t,i,n;if(this._sessionsStudy)returnthis._sessionsStudy;for(e=this.model().paneForSource(this),t=e.dataSources(),i=0;i<t.length;i++)if((n=t[i])instanceofTradingView.Study&&"Sessions"===n.metaInfo().shortId)returnthis._sessionsStudy=n,this._sessionsStudy;return!1},a.prototype.clearSessionStudy=function(){this._sessionsStudy=null},a.prototype.createSessStudy=function(){if(!this.sessionsStudy()){vare=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(){returnthis._symbolInfo?this._symbolInfo.legs[0]:""},a.prototype.firstShortName=function(){returnV.ticker(this.firstSymbol())},a.prototype.onSessionsStudyCreated=function(){returnthis._onSessionsStudyCreated},a.prototype.loadDataTo=function(e){this._turnaround="s"+++this._turnaroundCounter;vart=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"))){vare=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(){returnthis.m_priceScale},a.prototype.setPriceScale=function(e){this.m_priceScale!==e&&(this.m_priceScale=e,this._priceScaleChanged.fire(e),this._properties.removeProperty("priceAxisProperties"),
"string"!=typeofe&&(e="="+JSON.stringify(e)),e},a.prototype._getResolvingSymbolString=function(){returnthis.getSymbolString()},a.prototype.getStyleShortName=function(){vare=this._properties.style.value();if(a.STYLE_SHORT_NAMES.hasOwnProperty(e))returna.STYLE_SHORT_NAMES[e];throwError("Missed short name for style "+e)},a.prototype.getStyleProperties=function(){returnthis._properties[this.getStyleShortName()+"Style"]},a.prototype.getInputsProperties=function(){returnthis.getStyleProperties().inputs||newo},a.prototype.getRealVisibleRange=function(){vare,t,i=this.model().timeScale().visibleBars();returnnull===i?null:(e=this.data().search(i.firstBar(),B.NearestRight),t=this.data().search(i.lastBar(),B.NearestLeft),null===e||null===t?null:newx(e.index,t.index))},a.prototype.firstValue=function(){vare=this.firstBar();returnnull===e?null:this._barFunction(e)},a.prototype.firstBar=function(){vare,t,i=this.model().timeScale().visibleBars();returnnull===i?null:(e=i.firstBar(),t=this.data().search(e,B.NearestRight),null!==t?t.value:null)},a.prototype.sessionsStudy=function(){vare,t,i,n;if(this._sessionsStudy)returnthis._sessionsStudy;for(e=this.model().paneForSource(this),t=e.dataSources(),i=0;i<t.length;i++)if((n=t[i])instanceofTradingView.Study&&"Sessions"===n.metaInfo().shortId)returnthis._sessionsStudy=n,this._sessionsStudy;return!1},a.prototype.clearSessionStudy=function(){this._sessionsStudy=null},a.prototype.createSessStudy=function(){if(!this.sessionsStudy()){vare=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(){returnthis._symbolInfo?this._symbolInfo.legs[0]:""},a.prototype.firstShortName=function(){returnV.ticker(this.firstSymbol())},a.prototype.onSessionsStudyCreated=function(){returnthis._onSessionsStudyCreated},a.prototype.loadDataTo=function(e){this._turnaround="s"+++this._turnaroundCounter;vart=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"))){vare=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(){returnthis.m_priceScale},a.prototype.setPriceScale=function(e){this.m_priceScale!==e&&(this.m_priceScale=e,this._priceScaleChanged.fire(e),this._properties.removeProperty("priceAxisProperties"),
TradingView.isInherited(p.constructor,m)&&(d++,p.calcIsActualSymbol());returnthis._version=e.version,this.updateTimeScaleBaseIndex(),this.recalculateAllPanes(),this.invalidate(newN(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){functiono(e){returni&&!e.isSavedInStudyTemplates()||!e.state||!e.state()||!e.isSavedInChart(t)||n&&e.isActualSymbol&&!e.isActualSymbol()}varr,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());returna.stretchFactor=this._stretchFactor,this.m_mainDataSource&&(a.mainSourceId=this.m_mainDataSource.id()),a},B.prototype.sourceById=function(e){for(vart=0;t<this.m_dataSources.length;t++)if(this.m_dataSources[t].id()===e)returnthis.m_dataSources[t];returnnull},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){varo,r,s,a,l,c,u,d,p,_,f,y,g,v,S;if(n=n||{},!e.leftAxisState||!e.rightAxisState)throwError("invalid state");if(!e.leftAxisSources||!e.rightAxisSources)throwError("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(){vart,i,n,o,r,s=e.sources.find(function(t){returnt.id===e.mainSourceId});if(void0===s)returnvoidE.logWarn("There is no main source with id "+e.mainSourceId+", total sources="+e.sources.length)
TradingView.isInherited(p.constructor,m)&&(d++,p.calcIsActualSymbol());returnthis._version=e.version,this.updateTimeScaleBaseIndex(),this.recalculateAllPanes(),this.invalidate(newF(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){functiono(e){returni&&!e.isSavedInStudyTemplates()||!e.state||!e.state()||!e.isSavedInChart(t)||n&&e.isActualSymbol&&!e.isActualSymbol()}varr,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());returna.stretchFactor=this._stretchFactor,this.m_mainDataSource&&(a.mainSourceId=this.m_mainDataSource.id()),a},B.prototype.sourceById=function(e){for(vart=0;t<this.m_dataSources.length;t++)if(this.m_dataSources[t].id()===e)returnthis.m_dataSources[t];returnnull},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){varo,r,s,a,l,c,u,d,p,_,f,y,g,v,S;if(n=n||{},!e.leftAxisState||!e.rightAxisState)throwError("invalid state");if(!e.leftAxisSources||!e.rightAxisSources)throwError("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(){vart,i,n,o,r,s=e.sources.find(function(t){returnt.id===e.mainSourceId});if(void0===s)returnvoidE.logWarn("There is no main source with id "+e.mainSourceId+", total sources="+e.sources.length)
;if(!TradingView.isInherited(TradingView[s.type],m))returnvoidE.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)returnvoidE.logWarn("Pane contains more than 1 possibly main sources - auto fix cannot be applied");t=n}if(null===t)returnvoidE.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),void0!==e.leftPriceScaleRatio&&(this._lastLeftPriceScaleRatio=e.leftPriceScaleRatio),c=0;c<e.leftAxisSources.length;c++)(y=this.dataSourceForId(e.leftAxisSources[c]))&&(void0!==f.m_showSymbolLabels&&yinstanceofx&&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),void0!==e.rightPriceScaleRatio&&(this._lastRightPriceScaleRatio=e.rightPriceScaleRatio),c=0;c<e.rightAxisSources.length;c++)(y=this.dataSourceForId(e.rightAxisSources[c]))&&(void0!==f.m_showSymbolLabels&&yinstanceofx&&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=newh(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,
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),void0!==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){varo,r,s,a,l,c,h,d,p,_;returnt&&void0===e.data&&void0===e.nonSeriesData&&void0===e.indexes?voidE.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?voidE.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=newu(this._model,e,l.shortDescription),p.setId(o),_=this,h.updateMetaInfoAsync(l,t).done(function(i){functionr(n){varr,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)}vars,u,d;p.setStatus(""),s=i||newA(l),u=newn(_._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),deletethis._cachedOrderedSoruces,deletethis._cachedHitTestSources,p&&void0!==s&&p.setZorder(s),p))},B.prototype._restoreLineTool=function(e,t,i){varn,r,s,a,l,c,h,d,m,S,b,P,T,x,C,L,E,R,B;if(i=void0===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)))returnb=newu(this._model,e,m.shortDescription),b.setId(r),this.m_dataSources.push(b),void0!==a&&b.setZorder(a),b.setStatus($.t("not authorized")),voidb.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=newI("study_"+T.id,c,!0),h=p(n,this._model,d,T,this.mainDataSource())}elsex=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=newTradingView[n](this._model,d,!0);returnh.setId(r),h.linkKey=e.linkKey,C=e.alertId,C&&"function"==typeofh.setAlert&&k.enabled("alerts")&&!this._model.readOnly()&&!this._model.isJustClonedChart()&&h.setAlert(C,{noChartSave:!0}),L=e.indexes?e.indexes:[],
f=n(a,l,u,d,p,_)):(c=r,h=s,y=n(c,h,u,d,p,_))}returng?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}functiono(e,t){vari,n,o=e.A,r=t.A,s=e.B,a=t.B,l=e.C,c=t.C,h=o*a-r*s;returnMath.abs(h)<1e-6?null:(i=(s*c-a*l)/h,n=(r*l-o*c)/h,newm.Point(i,n))}functionr(e,t,i,n){varo,r=t.subtract(e),s=n.subtract(i),a=r.x*s.y-r.y*s.x;returnMath.abs(a)<1e-6?null:(o=e.subtract(i),(o.y*s.x-o.x*s.y)/a)}functions(e,t,i,n){varo,s,a,l=r(e,t,i,n);returnnull===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)}functiona(e,t){return-(e.C+e.B*t)/e.A}functionl(e,t){return-(e.C+e.A*t)/e.B}functionc(e,t){vari,n,o;for(i=0,n=e;i<n.length;i++)if(o=n[i],m.equalPoints(o,t))return!1;returne.push(t),!0}functionh(e,t,i){varn,o,r,s,h,u=t.x,d=t.y,p=i.x,_=i.y;if(0===e.A)returnn=-e.C/e.B,d<=n&&n<=_?m.lineSegment(m.point(u,n),m.point(p,n)):null;if(0===e.B)returno=-e.C/e.A,u<=o&&o<=p?m.lineSegment(m.point(o,d),m.point(o,_)):null;switch(r=[],s=function(t){vari=l(e,t);d<=i&&i<=_&&c(r,newm.Point(t,i))},h=function(t){vari=a(e,t);u<=i&&i<=p&&c(r,newm.Point(i,t))},s(u),h(d),s(p),h(_),r.length){case0:returnnull;case1:returnr[0];case2:returnm.equalPoints(r[0],r[1])?r[0]:m.lineSegment(r[0],r[1])}returnf.assert(!1,"We should have at most two intersection points"),null}functionu(e,t,i,n){varo,r=s(e,t,i,newm.Point(n.x,i.y)),a=s(e,t,newm.Point(n.x,i.y),n),l=s(e,t,n,newm.Point(i.x,n.y)),c=s(e,t,newm.Point(i.x,n.y),i),h=[];returnnull!==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){returne-t}),o=g.pointInRectangle(e,i,n)?h[0]:h[h.length-1],e.addScaled(t.subtract(e),o))}functiond(e,t){return!(e.length>0&&m.equalPoints(e[e.length-1],t))&&(e.push(t),!0)}functionp(e,t){vari,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);returnl.length>=3?l:null}function_(e,t){vari,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));returna}varf,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";varn,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"TimeFormatter",function(){returno}),n=i(21),o=function(){functione(e){this._formatStr=e||"%h:%m:%s"}returne.prototype.format=function(e){
id:"Linear Regression Curve@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Curve"},constructor:function(){this.main=function(e,t){vari,o,r,s,a;returnthis._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){returne?t:n.Std.na()},this.main=function(e,t){vari,o,r,s,a,l,c,h,u,d,p;returnthis._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){returne?t:n.Std.na()},this.main=function(e,t){vari,o,r,s,a,l,c,h,u,d,p;returnthis._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,
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";varn,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"MarkLocation",function(){returnn}),i.d(t,"HAlign",function(){returno}),i.d(t,"VAlign",function(){returnr}),i.d(t,"LineStyle",function(){returns}),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";varn,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"BarsRange",function(){returno}),n=i(7),i.n(n),o=function(){functione(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}returne.prototype.firstBar=function(){returnthis._firstBar},e.prototype.lastBar=function(){returnthis._lastBar},e.prototype.count=function(){returnthis._lastBar-this._firstBar+1},e.prototype.contains=function(e){returnthis._firstBar<=e&&e<=this._lastBar},e.prototype.equals=function(e){returnthis._firstBar===e.firstBar()&&this._lastBar===e.lastBar()},e}()},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";!function(e){if(document.createElement("canvas")&&document.createElement("canvas").getContext){vart=function(t){vari=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){vari,n,o=function(e,t){for(variine)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){varn,o=Array.prototype.slice.call(arguments);for(n=1;n<o.length;++n)o[n]&&(o[n]*=t);returno.length>5&&("width"ine&&(o[3]=Math.min(e.width,Math.max(1,o[3]))),"height"ine&&(o[4]=Math.min(e.height,Math.max(1,o[4])))),i.apply(this,o)},o(r,function(i,n){varo=e[n];e[n]=function(){vare,n;if("all"===i)for(n=[],e=arguments.length;0<e--;)n[e]=arguments[e]*t;elsefor(n=Array.prototype.slice.call(arguments),e=i.length;0<e--;)n[i[e]]&&(n[i[e]]=n[i[e]]*t);returno.apply(this,n)}}),e.drawImage=function(e){returnfunction(){
t[Z.Light]=JSON.parse(e[Z.Light]),t[Z.Dark]=JSON.parse(e[Z.Dark]),t})}functionu(e){returnh().then(function(t){returnt[e]})}functiond(e){returnX[e]||e}functionp(e){returnh().then(function(t){returnc().some(function(i){return_(t[i],e)})})}function_(e,t){vari=e.content===t.content;returnm(e.content,function(e,n){varo=g(e,t.content);return!(i=f(n,o))}),i}functionf(e,t){if("string"==typeofe&&"string"==typeoft)try{returnObject(G.areEqualRgb)(Object(G.parseRgb)(e),Object(G.parseRgb)(t))}catch(i){returne===t}returne===t}functionm(e,t){void0===e&&(e={});try{y(e,[],t)}catch(e){return}}functiony(e,t,i){varn,o;for(nine)if(e.hasOwnProperty(n))if(o=t.concat(n),"object"==typeofe[n])y(e[n],o,i);elseif(i(o,e[n]))throwError("exit")}functiong(e,t){vari,n;for(void0===t&&(t={}),i=t,n=0;n<e.length;n++){if(!i||"object"!=typeofi)return;i=i[e[n]]}if("string"==typeofi||"number"==typeofi)returni}functionv(e,t){vari,n;returnvoid0===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}functionS(e,t){vari=re[e];if(!i)throwError("No such color "+e);returni}functionb(e,t){vari,n;t||(t=window),i=t.document.documentElement;for(ninae)ae[n].className&&i.classList.toggle(ae[n].className,n===e)}functionw(e){return!e.isPrivate}functionP(){returnae[ce.value()]||ae[le]}functionT(e){returnP().getThemedColor(e)}functionx(e){ce.setValue(e)}functionC(){x(Object(z.getValue)(he)||le)}functionL(){returnObject(z.getValue)(he)||null}functionI(){Object(z.setValue)(he,P().name,{forceFlush:!0})}functionA(e){returnn(e)}functionk(){returno()}functionE(){returnc()}functionM(e){returnu(e).then(function(e){returne||{content:void0}})}functionV(){returnh()}functionD(e,t){returnr(e,t)}functionO(e){returns(e)}functionR(e){returna(e)}functionB(e){returnd(e)}functionN(e){returnp(e)}functionF(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()}}}varW,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){vart=v(e);ie[e]=Object(te.ensureNotNull)(t)}),re=ie,i.d(t,"themes",function(){returnae}),
t[Z.Light]=JSON.parse(e[Z.Light]),t[Z.Dark]=JSON.parse(e[Z.Dark]),t})}functionu(e){returnh().then(function(t){returnt[e]})}functiond(e){returnX[e]||e}functionp(e){returnh().then(function(t){returnc().some(function(i){return_(t[i],e)})})}function_(e,t){vari=e.content===t.content;returnm(e.content,function(e,n){varo=g(e,t.content);return!(i=f(n,o))}),i}functionf(e,t){if("string"==typeofe&&"string"==typeoft)try{returnObject(G.areEqualRgb)(Object(G.parseRgb)(e),Object(G.parseRgb)(t))}catch(i){returne===t}returne===t}functionm(e,t){void0===e&&(e={});try{y(e,[],t)}catch(e){return}}functiony(e,t,i){varn,o;for(nine)if(e.hasOwnProperty(n))if(o=t.concat(n),"object"==typeofe[n])y(e[n],o,i);elseif(i(o,e[n]))throwError("exit")}functiong(e,t){vari,n;for(void0===t&&(t={}),i=t,n=0;n<e.length;n++){if(!i||"object"!=typeofi)return;i=i[e[n]]}if("string"==typeofi||"number"==typeofi)returni}functionv(e,t){vari,n;returnvoid0===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}functionS(e,t){vari=re[e];if(!i)throwError("No such color "+e);returni}functionb(e,t){vari,n;t||(t=window),i=t.document.documentElement;for(ninae)ae[n].className&&i.classList.toggle(ae[n].className,n===e)}functionw(e){return!e.isPrivate}functionP(){returnae[ce.value()]||ae[le]}functionT(e){returnP().getThemedColor(e)}functionx(e){ce.setValue(e)}functionC(){x(Object(z.getValue)(he)||le)}functionL(){returnObject(z.getValue)(he)||null}functionI(){Object(z.setValue)(he,P().name,{forceFlush:!0})}functionA(e){returnn(e)}functionk(){returno()}functionE(){returnc()}functionM(e){returnu(e).then(function(e){returne||{content:void0}})}functionV(){returnh()}functionD(e,t){returnr(e,t)}functionO(e){returns(e)}functionR(e){returna(e)}functionB(e){returnd(e)}functionF(e){returnp(e)}functionN(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()}}}varW,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){vart=v(e);ie[e]=Object(te.ensureNotNull)(t)}),re=ie,i.d(t,"themes",function(){returnae}),
}).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)returnvoidl.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){vart=o(e);"ok"!==t.status&&r.logWarn("Chart delete request failed: "+t.message),a()})},a.getStudyTemplateContent=function(n,r){if(l)returnvoidl.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){varc={name:n.name,content:n.content};if(l)returnvoidl.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){vart=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){functionc(e){e=e.map(function(e){return{is_default:!1,name:e.name}}),a._templatesCache=e,n(e)}returna._templatesCache?voidn(a._templatesCache):(a._templatesCache=[],l?voidl.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){vart=o(e);if("ok"!==t.status)returnvoidr.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";functionn(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}varo,r,s,a;Object.defineProperty(t,"__esModule",{value:!0}),t.SaveRenameDialog=void0,o=function(){functione(e,t){vari,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"inn&&(n.writable=!0),Object.defineProperty(e,n.key,n)}returnfunction(t,i,n){returni&&e(t.prototype,i),n&&e(t,n),t}}(),i(484),r=i(83),s={YES:"yes",CLOSE:"close"},a=0,t.SaveRenameDialog=function(){functione(){vart=arguments.length>0&&void0!==arguments[0]?arguments[0]:{},i=t.fields,o=t.confirm,r=t.title,s=void0===r?"":r,a=t.destroyOnClose,l=void0===a||a,c=t.modal,h=void0!==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)}returno(e,[{key:"setField",value:function(e,t){this._fields.find(function(t){returnt.name===e}).value=t}},{key:"show",value:function(){vare=this,t=this._createDialog();returnnewPromise(function(i){t.then(function(t){t.on("action:submit",function(t){returne._onSubmit(t,i)}),t.open(),t.on("beforeClose",e._unmountFields.bind(e)),e._fields[a].select()})})}},{key:"_appendFieldsToForm",value:function(){vare=this;this._fields.forEach(function(t){t.appendTo(e._$form)})}},{key:"_createDialog",value:function(){vare=this;returnnewPromise(function(t){i.e(2).then(function(n){varo=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){vari=this,n=this._validate();if(n)e.error(n.error),n.focus();else{if(!this._needCheckConfirm)returnt(this._collectValues(),e),voide.close();Promise.resolve(this._shouldShowConfirm(this._collectValues())).then(function(n){if(!n)returnt(i._collectValues(),e),voide.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(){vare=this;returnnewPromise(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(){returnthis._fields.find(function(e){return!e.valid})}},{key:"_collectValues",value:function(){returnthis._fields.reduce(function(e,t){returne[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";functionn(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}varo;Object.defineProperty(t,"__esModule",{value:!0}),o=function(){functione(e,t){vari,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"inn&&(n.writable=!0),Object.defineProperty(e,n.key,n)}returnfunction(t,i,n){returni&&e(t.prototype,i),n&&e(t,n),t}}(),t.InputField=function(){functione(t){vari=t.label,o=t.name,r=t.maxLength,s=t.error,a=void0===s?"":s;n(this,e),this._name=o,
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=newV(window),B=newD(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(){void0!==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){vart=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){functionn(){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)})}varr,s,a,h,u,d,p,f,m,y,b,w,x,A,k;if(!Modernizr.canvas||!Modernizr.canvastext)throwError("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"),
f=window.chartWidgetCollection=newN(d),window.studyMarket=newI(f),"undefined"!=typeofserviceLocator&&serviceLocator.registerService(CHART_WIDGET_COLLECTION_SERVICE,f),f.activeChartWidget.subscribe(function(e){T.emit("activeChartChanged",f.getAll().indexOf(e))}),window.saver=newg(f),m=newv(f,window.saver),y=newS(f),window.chartWidget=f.activeChartWidget.value(),window.pro=newTradingView.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=newj(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){vart=i(822);window.lineToolPropertiesToolbar=newt(f)}.bind(null,i)).catch(i.oe),$(".tv-content").bind("contextmenu",function(e){vart=$(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&&void0===s&&(f.applyTheme(t),window.applyOverrides(window.__defaultsOverrides)),e.enabled("charting_library_debug_mode")&&T.subscribeToAll(function(){vare=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)returnvoida();vart=e.sort(function(e,t){returnt.modified_iso-e.modified_iso})[0];m.getChartContent(t,function(e){vart=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*newDate,r=t.createElement(i),s=t.getElementsByTagName(i)[0],r.async=1,r.src=n,s.parentNode.insertBefore(r,s)
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=newV(window),B=newD(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(){void0!==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){vart=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){functionn(){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)})}varr,s,a,h,u,d,p,f,m,y,b,w,x,A,k;if(!Modernizr.canvas||!Modernizr.canvastext)throwError("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"),
f=window.chartWidgetCollection=newF(d),window.studyMarket=newI(f),"undefined"!=typeofserviceLocator&&serviceLocator.registerService(CHART_WIDGET_COLLECTION_SERVICE,f),f.activeChartWidget.subscribe(function(e){T.emit("activeChartChanged",f.getAll().indexOf(e))}),window.saver=newg(f),m=newv(f,window.saver),y=newS(f),window.chartWidget=f.activeChartWidget.value(),window.pro=newTradingView.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=newj(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){vart=i(822);window.lineToolPropertiesToolbar=newt(f)}.bind(null,i)).catch(i.oe),$(".tv-content").bind("contextmenu",function(e){vart=$(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&&void0===s&&(f.applyTheme(t),window.applyOverrides(window.__defaultsOverrides)),e.enabled("charting_library_debug_mode")&&T.subscribeToAll(function(){vare=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)returnvoida();vart=e.sort(function(e,t){returnt.modified_iso-e.modified_iso})[0];m.getChartContent(t,function(e){vart=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*newDate,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");vari=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(){vare=!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){returnwindow.parent[urlParams.uid][e]},window.createShortcutAction=function(){vare={};returnfunction(t,i){void0===e[t]&&(e[t]=newy({shortcut:t})),e[t].callbacks().subscribe(null,i)}}(),window.initializationFinished=function(){window.chartWidgetCollection.undoHistory.clearStack()},window.resizeWindow=function(){$(window).resize()},window.headerReady=function(){returnX.promise},window.createButton=function(e){if(null===J)throwError("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");e=e||{};vart=e.align||"left";returnJ.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:{},
C.restoredLineToolState.subscribe(null,function(e){vart,n,o;i._model&&(t=i._model.model(),e.model!==t&&(n=t.dataSources().filter(function(t){returnt.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){vart=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){vart,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:void0,_=parseInt(this._options.defStyle),f=E.isValidStyle(_)?_:void0,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),void0===this._options.useUserChartPreferences&&(this._options.useUserChartPreferences=!0),this._properties=newW("chartproperties",void0,void0,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}),
e.push(n)})):e.push(newT({text:window.t("No study templates saved"),enabled:!1}))}vart,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){returne.id===o.model().model().properties().timezone.value()},s.forEach(function(e){if(!e.separator){vart=newT({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(){returnthis._actions||this._setActions(),this._actions},n.prototype._setActions=function(){vare,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=[newT({text:window.t("Eraser"),callbackContext:"eraser",statName:"Eraser"}),newx,newT({text:window.t("Trend Line"),callbackContext:"LineToolTrendLine",statName:"LineToolTrendLine"}),newT({text:window.t("Horizontal Line"),callbackContext:"LineToolHorzLine",statName:"LineToolHorzLine"}),newT({text:window.t("Vertical Line"),callbackContext:"LineToolVertLine",statName:"LineToolVertLine"}),newT({text:window.t("Arrow"),callbackContext:"LineToolArrow",statName:"LineToolArrow"}),newT({text:window.t("Ray"),callbackContext:"LineToolRay",statName:"LineToolRay"}),newT({text:window.t("Extended"),callbackContext:"LineToolExtended",statName:"LineToolExtended"}),newT({text:window.t("Parallel Channel"),callbackContext:"LineToolParallelChannel",statName:"LineToolParallelChannel"}),newx,newT({text:window.t("Pitchfork"),callbackContext:"LineToolPitchfork",statName:"LineToolPitchfork"}),newT({text:window.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork",statName:"LineToolSchiffPitchfork"}),newT({text:window.t("Pitchfan"),callbackContext:"LineToolPitchfan",statName:"LineToolPitchfan"}),newT({text:window.t("Gann Square"),callbackContext:"LineToolGannSquare",statName:"LineToolGannSquare"}),newT({text:window.t("Gann Fan"),callbackContext:"LineToolGannFan",statName:"LineToolGannFan"}),newT({text:window.t("Fib Retracement"),callbackContext:"LineToolFibRetracement",statName:"LineToolFibRetracement"}),newT({
e.push(n)})):e.push(newT({text:window.t("No study templates saved"),enabled:!1}))}vart,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){returne.id===o.model().model().properties().timezone.value()},s.forEach(function(e){if(!e.separator){vart=newT({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(){returnthis._actions||this._setActions(),this._actions},n.prototype._setActions=function(){vare,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=[newT({text:window.t("Eraser"),callbackContext:"eraser",statName:"Eraser"}),newx,newT({text:window.t("Trend Line"),callbackContext:"LineToolTrendLine",statName:"LineToolTrendLine"}),newT({text:window.t("Horizontal Line"),callbackContext:"LineToolHorzLine",statName:"LineToolHorzLine"}),newT({text:window.t("Vertical Line"),callbackContext:"LineToolVertLine",statName:"LineToolVertLine"}),newT({text:window.t("Arrow"),callbackContext:"LineToolArrow",statName:"LineToolArrow"}),newT({text:window.t("Ray"),callbackContext:"LineToolRay",statName:"LineToolRay"}),newT({text:window.t("Extended"),callbackContext:"LineToolExtended",statName:"LineToolExtended"}),newT({text:window.t("Parallel Channel"),callbackContext:"LineToolParallelChannel",statName:"LineToolParallelChannel"}),newx,newT({text:window.t("Pitchfork"),callbackContext:"LineToolPitchfork",statName:"LineToolPitchfork"}),newT({text:window.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork",statName:"LineToolSchiffPitchfork"}),newT({text:window.t("Pitchfan"),callbackContext:"LineToolPitchfan",statName:"LineToolPitchfan"}),newT({text:window.t("Gann Square"),callbackContext:"LineToolGannSquare",statName:"LineToolGannSquare"}),newT({text:window.t("Gann Fan"),callbackContext:"LineToolGannFan",statName:"LineToolGannFan"}),newT({text:window.t("Fib Retracement"),callbackContext:"LineToolFibRetracement",statName:"LineToolFibRetracement"}),newT({
text:window.t("Trend-Based Fib Extension"),callbackContext:"LineToolTrendBasedFibExtension",statName:"LineToolTrendBasedFibExtension"}),newT({text:window.t("Fib Speed Resistance Fan"),callbackContext:"LineToolFibSpeedResistanceFan",statName:"LineToolFibSpeedResistanceFan"}),newT({text:window.t("Fib Time Zone"),callbackContext:"LineToolFibTimeZone",statName:"LineToolFibTimeZone"}),newT({text:window.t("Circle Lines"),callbackContext:"LineToolCircleLines",statName:"LineToolCircleLines"}),newT({text:window.t("Fib Circles"),callbackContext:"LineToolFibCircles",statName:"LineToolFibCircles"}),newT({text:window.t("Fib Speed Resistance Arcs"),callbackContext:"LineToolFibSpeedResistanceArcs",statName:"LineToolFibSpeedResistanceArcs"}),newx,newT({text:window.t("Rectangle"),callbackContext:"LineToolRectangle",statName:"LineToolRectangle"}),newT({text:window.t("Ellipse"),callbackContext:"LineToolEllipse",statName:"LineToolEllipse"}),newT({text:window.t("Triangle"),callbackContext:"LineToolTriangle",statName:"LineToolTriangle"}),newT({text:window.t("Polyline"),callbackContext:"LineToolPolyline",statName:"LineToolPolyline"}),newT({text:window.t("Arc"),callbackContext:"LineToolArc",statName:"LineToolArc"}),newx,newT({text:window.t("Text",{context:"tool"}),callbackContext:"LineToolText",statName:"LineToolText"}),newT({text:window.t("Anchored Text"),callbackContext:"LineToolTextAbsolute",statName:"LineToolTextAbsolute"}),newT({text:window.t("Balloon"),callbackContext:"LineToolBalloon",statName:"LineToolBalloon"}),newT({text:window.t("Price Label"),callbackContext:"LineToolPriceLabel",statName:"LineToolPriceLabel"}),newx,newT({text:window.t("Elliott Wave Subminuette"),callbackContext:"LineToolElliottSubminuette",statName:"LineToolElliottSubminuette"}),newT({text:window.t("Elliott Wave Minor"),callbackContext:"LineToolElliottMinor",statName:"LineToolElliottMinor"}),newT({text:window.t("Elliott Wave Circle"),callbackContext:"LineToolElliottCircle",statName:"LineToolElliottCircle"}),newT({text:window.t("Elliott Minor Retracement"),callbackContext:"LineToolElliottMinorRetr",statName:"LineToolElliottMinorRetr"}),newT({text:window.t("Elliott Major Retracement"),callbackContext:"LineToolElliottMajorRetr",statName:"LineToolElliottMajorRetr"}),newx,newT({text:window.t("Brush"),callbackContext:"LineToolBrush",statName:"LineToolBrush"}),newx,newT({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=newT({text:window.t("Scales Properties..."),statName:"ScalesProperties"}),t=newT({text:window.t("Timezone/Sessions Properties..."),statName:"TimezoneSessionsProperties"})}r=newT({text:window.t("Reset Chart"),shortcut:"Alt+R",statName:"ResetChart"}),r.callbacks().subscribe(this,this.GUIResetScales),s=newT({text:window.t("Undo"),shortcut:"ctrl+z"}),s.callbacks().subscribe(null,function(){G("GUI","Undo"),fe._model.undoHistory.undo()}),s.disable(),a=newT({
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=newT({text:window.t("Loading")}),c=[l],h=newT({text:window.t("Color Theme"),subActions:c,statName:"ColorTheme"}),u=newT({text:window.t("TimeZone"),statName:"TimeZone"}),d=newT({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=newT({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=newT({text:window.t("Add To Watchlist"),shortcut:"Alt+W",statName:"AddToWatchlist"}),g.callbacks().subscribe(this,function(){vare,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=newT({text:window.t("Add To Text Notes"),shortcut:"Alt+N",statName:"AddToTextNotes"}),v.callbacks().subscribe(this,function(){vare=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=newT({text:window.t("Insert Study Template"),statName:"InserStudyTemplate"}),b=newT({shortcut:"Ctrl+Alt+Q",text:window.t("Reset Scale"),statName:"ResetScale"}),b.callbacks().subscribe(null,function(e){fe.model().resetTimeScale()}),w=newT({text:window.t("Insert Drawing Tool"),subActions:me,statName:"InsertDravingTool"}),P=newT({text:window.t("Remove All Indicators"),statName:"RemoveAllIndicators"}),L=newT({text:window.t("Remove All Drawing Tools"),statName:"RemoveAllDrawingTools"}),I=newT({text:window.t("All Indicators And Drawing Tools"),statName:"RemoveAllIndicatorsAndDrawingTools"}),k=newT({text:window.t("Insert Indicator..."),shortcut:"/",statName:"InsertIndicator"}),E=newT({text:window.t("Script Editor..."),statName:"ScriptEditor"}),M=newT({text:window.t("Compare or Add Symbol..."),statName:"CompareOrAddSymbol"}),V=newT({text:window.t("Compare..."),statName:"Compare"}),F=newT({text:window.t("Objects Tree..."),statName:"ObjectsTree"}),W=newT({text:window.t("Properties..."),statName:"ChartProperties",callback:function(e,t){fe.showChartProperties()}}),H=newT({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=newT({text:window.t("Loading")}),c=[l],h=newT({text:window.t("Color Theme"),subActions:c,statName:"ColorTheme"}),u=newT({text:window.t("TimeZone"),statName:"TimeZone"}),d=newT({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=newT({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=newT({text:window.t("Add To Watchlist"),shortcut:"Alt+W",statName:"AddToWatchlist"}),g.callbacks().subscribe(this,function(){vare,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=newT({text:window.t("Add To Text Notes"),shortcut:"Alt+N",statName:"AddToTextNotes"}),v.callbacks().subscribe(this,function(){vare=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=newT({text:window.t("Insert Study Template"),statName:"InserStudyTemplate"}),b=newT({shortcut:"Ctrl+Alt+Q",text:window.t("Reset Scale"),statName:"ResetScale"}),b.callbacks().subscribe(null,function(e){fe.model().resetTimeScale()}),w=newT({text:window.t("Insert Drawing Tool"),subActions:me,statName:"InsertDravingTool"}),P=newT({text:window.t("Remove All Indicators"),statName:"RemoveAllIndicators"}),L=newT({text:window.t("Remove All Drawing Tools"),statName:"RemoveAllDrawingTools"}),I=newT({text:window.t("All Indicators And Drawing Tools"),statName:"RemoveAllIndicatorsAndDrawingTools"}),k=newT({text:window.t("Insert Indicator..."),shortcut:"/",statName:"InsertIndicator"}),E=newT({text:window.t("Script Editor..."),statName:"ScriptEditor"}),M=newT({text:window.t("Compare or Add Symbol..."),statName:"CompareOrAddSymbol"}),V=newT({text:window.t("Compare..."),statName:"Compare"}),N=newT({text:window.t("Objects Tree..."),statName:"ObjectsTree"}),W=newT({text:window.t("Properties..."),statName:"ChartProperties",callback:function(e,t){fe.showChartProperties()}}),H=newT({text:window.t("Lock/Unlock"),statName:"ToggleLockSelectedObject"}),
H.callbacks().subscribe(this,n.prototype.toggleLockSelectedObject),j=newT({text:window.t("Hide"),statName:"HideSelectedObject"}),j.callbacks().subscribe(this,n.prototype.hideSelectedObject),p.enabled("property_pages")&&(z=newT({text:window.t("Format..."),statName:"EditSelectedObject"}),z.callbacks().subscribe(this,n.prototype.editSelectedObject)),U=newT({text:window.t("Source Code..."),statName:"OpenSelectedObjectSource"}),U.callbacks().subscribe(this,this.openSelectedObjectSource),q=newT({text:window.t("Left Axis"),checkable:!0,statName:"ToggleLeftAxis"}),q.binder=newf(q,this._properties.scalesProperties.showLeftScale,this.model(),window.t("Show Left Scale")),$=newT({text:window.t("Right Axis"),checkable:!0,statName:"ToggleRightAxis"}),$.binder=newf($,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=newT({text:window.t("Scale Price Chart Only"),checkable:!0,statName:"ScalePriceChartOnly"}),Y.binder=newf(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(newO(O.FULL_UPDATE))}),Z=newT({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=newT({text:window.t("Magnet Mode"),checkable:!0,statName:"ToggleMagnetMode"}),X.binder=newf(X,C.properties().magnet,this.model(),"Magnet"),Q=newT({text:window.t("Stay in Drawing Mode"),checkable:!0,statName:"ToggleStayInDrawingMode"}),Q.binder=newf(Q,C.properties().stayInDrawingMode,this.model(),window.t("Stay In Drawing Mode")),ee=newT({text:window.t("Sync drawings to all charts"),checkable:!0,statName:"ToggleSyncDrawings"}),ee.binder=newf(ee,C.properties().drawOnAllCharts,this.model(),"SyncDrawings"),te=newT({text:window.t("Lock All Drawing Tools"),checkable:!0,statName:"ToggleLockDrawings"}),te.binder=newf(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=newT({text:window.t("Hide All Drawing Tools"),checkable:!0,statName:"ToggleHideAllDrawingTools"}),ie.binder=newf(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=newT({text:window.t("Hide Marks On Bars"),checkable:!0,statName:"ToggleHideMarksOnBars"}),ne.binder=newf(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=newT({text:window.t("Extended Hours"),checkable:!0,statName:"ToggleExtendedHours"}),oe.binder=newf(oe,this.model().mainSeries().properties().extendedHours,this.model(),window.t("Change Extended Hours")),re=newT({text:window.t("Symbol Last Value"),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"}),re.binder=newf(re,this.properties().scalesProperties.showSeriesLastValue,this.model(),window.t("Show Symbol Last Value")),se=newT({text:window.t("Symbol Labels"),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"}),se.binding=newf(se,this.properties().scalesProperties.showSymbolLabels,this.model(),"Undo Show Symbol Labels"),ae=newT({text:window.t("Indicator Last Value"),checkable:!0,checked:!1,statName:"ToggleStudyLastValue"}),ae.binder=newf(ae,this.properties().scalesProperties.showStudyLastValue,this.model(),window.t("Show Indicator Last Value")),le=newT({text:window.t("Indicator Labels"),checkable:!0,checked:!1,statName:"ToggleIndicatorsLabels"}),le.binding=newf(le,this.properties().scalesProperties.showStudyPlotLabels,this.model(),"Undo Show Indicator Labels"),ce=newT({text:window.t("Countdown"),checkable:!0,checked:!1,statName:"ToggleCountdown"}),ce.binder=newf(ce,this.model().mainSeries().properties().showCountdown,this.model(),window.t("Show Countdown")),he=null,this._options.goToDateEnabled&&(he=newT({text:window.t("Go to Date..."),shortcut:"Alt+G",statName:"GoToDate"}),he.callbacks().subscribe(null,function(){vare=fe._chartWidgetCollection.activeChartWidget.value();y(e.model())})),ue=newT({text:window.t("Symbol Info..."),checkable:!1,statName:"SymbolInfo"}),ue.callbacks().subscribe(null,function(){vare=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=newT({text:window.t("Remove"),shortcut:"Del",statName:"RemoveSelectedObject"}),de.callbacks().subscribe(this,function(){vare;this._chartWidgetCollection&&(e=this._chartWidgetCollection.activeChartWidget.value()),
C.hideMarksOnBars().setValue(this.binder.value())}.bind(ne)),oe=newT({text:window.t("Extended Hours"),checkable:!0,statName:"ToggleExtendedHours"}),oe.binder=newf(oe,this.model().mainSeries().properties().extendedHours,this.model(),window.t("Change Extended Hours")),re=newT({text:window.t("Symbol Last Value"),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"}),re.binder=newf(re,this.properties().scalesProperties.showSeriesLastValue,this.model(),window.t("Show Symbol Last Value")),se=newT({text:window.t("Symbol Labels"),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"}),se.binding=newf(se,this.properties().scalesProperties.showSymbolLabels,this.model(),"Undo Show Symbol Labels"),ae=newT({text:window.t("Indicator Last Value"),checkable:!0,checked:!1,statName:"ToggleStudyLastValue"}),ae.binder=newf(ae,this.properties().scalesProperties.showStudyLastValue,this.model(),window.t("Show Indicator Last Value")),le=newT({text:window.t("Indicator Labels"),checkable:!0,checked:!1,statName:"ToggleIndicatorsLabels"}),le.binding=newf(le,this.properties().scalesProperties.showStudyPlotLabels,this.model(),"Undo Show Indicator Labels"),ce=newT({text:window.t("Countdown"),checkable:!0,checked:!1,statName:"ToggleCountdown"}),ce.binder=newf(ce,this.model().mainSeries().properties().showCountdown,this.model(),window.t("Show Countdown")),he=null,this._options.goToDateEnabled&&(he=newT({text:window.t("Go to Date..."),shortcut:"Alt+G",statName:"GoToDate"}),he.callbacks().subscribe(null,function(){vare=fe._chartWidgetCollection.activeChartWidget.value();y(e.model())})),ue=newT({text:window.t("Symbol Info..."),checkable:!1,statName:"SymbolInfo"}),ue.callbacks().subscribe(null,function(){vare=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=newT({text:window.t("Remove"),shortcut:"Del",statName:"RemoveSelectedObject"}),de.callbacks().subscribe(this,function(){vare;this._chartWidgetCollection&&(e=this._chartWidgetCollection.activeChartWidget.value()),
e||(e=this),e.removeSelectedSource()}),pe=newT({text:window.t("Stop syncing drawing"),statName:"StopSyncingDrawing"}),pe.callbacks().subscribe(this,function(){vare;this._chartWidgetCollection&&(e=this._chartWidgetCollection.activeChartWidget.value()),e||(e=this),e.unlinkSelectedLine()}),_e=newT({text:window.t("Sync drawing to all charts"),statName:"SyncDrawingToAllCharts"}),_e.callbacks().subscribe(this,function(){vare;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)returnconsole.warn('Action "takeScreenshot" is deprecated. Use method "takeScreenshot" instead'),voidthis._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'),einthis._actions){vart=this._actions[e];t.checkable&&t.setChecked(!t.checked),this._actions[e].callbacks().fire(t)}elseconsole.warn("Unknown action id: "+e)},n.prototype.getCheckableActionState=function(e){if("lockDrawingsAction"===e)returnconsole.warn('Action "lockDrawingsAction" is deprecated. Use method "lockAllDrawingTools" instead'),null
;if("hideAllDrawingsAction"===e)returnconsole.warn('Action "hideAllDrawingsAction" is deprecated. Use method "hideAllDrawingTools" instead'),null;if(einthis._actions){vart=this._actions[e];if(t.checkable)returnt.checked;console.warn("Action "+e+" has no state")}elseconsole.warn("Unknown action id: "+e);returnnull},n.prototype._updateScalesActions=function(){if(this._actions){for(vare=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(){returnthis._model},n.prototype.defaultSymbol=function(){returnthis._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(vare=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].update();this._timeAxisWidget.update()}},n.prototype.paint=function(e){e||(e=newO(O.FULL_UPDATE));for(vart=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(){returnthis._jqMainDiv},n.prototype.restoreState=function(e,t){this._adjustSize();this._model.restoreState(this._content,t);this._setActions()},n.prototype.redrawPanes=function(e){for(vart=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].paint();this._redrawPanes.fire()},n.prototype.setBackgroundColor=function(e){this.scaleBackgroundColor=e.value();for(vart=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,
t="forbidden";break;cased.STATUS_DELAYED:t="delayed";break;cased.STATUS_DELAYED_STREAMING:t="delayed_streaming";break;cased.STATUS_EOD:cased.STATUS_PULSE:t="endofday";break;cased.STATUS_OFFLINE:t="connecting";break;cased.STATUS_SNAPSHOT:t="snapshot";break;cased.STATUS_READY:t="realtime";break;cased.STATUS_REPLAY:t="replay";break;default:t=e}returnt},n.prototype._updateDataAndMarketStatus=function(e,t){vari,n;void0!==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(){vare,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(){vare,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){returne}),i=t.join(", "),this.indicatorText.attr("title",i)):this.indicatorText.attr("title",""),this.indicatorText.get(0).dispatchEvent(newg("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(vare=0;e<this._paneWidgets.length;e++)if(this._paneWidgets[e].containsMainSeries())returnthis._paneWidgets[e];returnnull},n.prototype.getMarketStatusTooltip=function(){
returnthis._options.marketStatusWidgetEnabled&&this.indicatorDot?this.indicatorDot.getTooltipText():"-"},n.prototype._startSpinner=function(e){if(!this._spinner){vart=$(e).get(0);t&&(this._spinner=(newY).spin(t))}},n.prototype.isJustClonedChart=function(){return!!(this._options||{}).justCloned},n.prototype.getLastPaneLeftBottom=function(){vare=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()),einstanceofv&&e.isChildStudy())returnvoidte.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){vart,i=this.actions();for(tini)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(){returnthis._isActive},n.prototype.trackTime=function(){returnthis._chartWidgetCollection.lock.trackTime},n.prototype.isMultipleLayout=function(){returnoe(this._chartWidgetCollection.layout.value())},n.prototype.id=function(){returnthis._guid},n.prototype.createBranding=function(){this._modelCreated.subscribe(this,function(){this._model.model().createBrandingSource()},!0)},n.prototype.selectBarMode=function(){returnthis._model.model().selectBarMode()},n.prototype.toggleSelectBarMode=function(){this._model.model().toggleSelectBarMode()},n.prototype.onBarSelected=function(){returnthis._model.model().onBarSelected()},n.prototype.trySetChartStyle=function(e){vart=this.model();return!!t&&(t.mainSeries().properties().style.value()===e||!!p.enabled("charting_library_base")&&(this._setChartStyle(e),!0))},n.prototype._setChartStyle=function(e){vart=this.model(),i=t.mainSeries().properties().style;t.setChartStyleProperty(i,e,"Change Series Style")},n.prototype.showReplayOrderConfirmationDialog=function(){if(!this.model().isInReplay())returnPromise.resolve()},n.prototype._addPerfMark=function(e){
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())returnnull;vare=this._chart.getTimeScale();returnnewC({text:window.t("Time Scale"),subActions:e.getContextMenuActions(),statName:"TimeScale"})},n.prototype.getDefaultPriceAxisWidget=function(){if(!this._state)returnnull;vare=this._state.defaultPriceScale();returne.isEmpty()?null:e===this._state.leftPriceScale?this.leftPriceAxisWidget():this.rightPriceAxisWidget()},n.prototype._priceAxisMenu=function(){vare=this.getDefaultPriceAxisWidget();returne?newC({text:window.t("Price Scale"),subActions:e.getContextMenuActions(),statName:"PriceScale"}):null},n.prototype._seriesContextMenu=function(e){vari,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),newI,this.createActionShowCountdown(e),newI,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),newI,this.createActionShowCountdown(e),newI],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,newI),n.length>0){for(s=0;s<n.length;s++)o.push(n[s]);o.push(newI)}o.push(this.createActionScaleLeft(e),this.createActionScaleRight(e),this.createActionNoScale(e)),pro.hasPackage("mtp-mtpredictor")&&o.push(newI,this._createMTPredictorActions()),c=A.createMenu(o)}returnc},n.prototype.toggleLockTimeAxis=function(e,t){vari,n,o;"boolean"!=typeoft&&(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){vart=newC({text:window.t("Lock Cursor in Time"),checkable:!0,statName:"ToggleLockCursorInTime"}),i=k.lockTimeAxis().value();returnt.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";vari=newC({text:"vertical"===t?window.t("Create Vertical Line"):window.t("Create Horizontal Line"),statName:"vertical"===t?"CreateVerticalLine":"CreateHorizontalLine"});returni.callbacks().subscribe(this,function(){vari=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
vart,i,o,r,s,a,l=newC({text:window.t("Visual Order"),statName:"VisualOrder"});returnl.subActions||(l.subActions=[]),t=newC({text:window.t("Bring to Front"),statName:"BringToFront"}),t.callbacks().subscribe(this,n.prototype.bringObjectToFront),l.subActions.push(t),i=newC({text:window.t("Send to Back"),statName:"SendToBack"}),i.callbacks().subscribe(this,n.prototype.sendObjectToBack),l.subActions.push(i),o=newC({text:window.t("Bring Forward"),statName:"BringForward"}),o.callbacks().subscribe(this,n.prototype.bringObjectForward),l.subActions.push(o),r=newC({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(){vare={};returne.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){vari=this;requestAnimationFrame(function(){i._state&&(i._updateTooltipImpl(e,t),i._rafSet=!1)}),this._rafSet=!0}},n.prototype._updateTooltipImpl=function(e,t){functioni(i){functiono(){returnTradingView.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())}varn,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(){vare,t;k.lockTimeAxis().value()&&(e=this._chart.model(),t=e.crossHairSource(),t.setPosition(t.index,t.price,P(this._state)))},n.prototype._isSelectBarModeEnabled=function(){returnthis._chart.model().crossHairSource().selectBarMode().value()},e.exports=n}).call(t,i(5))},function(e,t){},function(e,t,i){"use strict";functionn(e,t){this._source=t,this._properties=e,this._points=[newl(-1,-1)],this._invalidated=!0,this._lineRenderer=newh}functiono(){this._data=null}functionr(e){this._source=e,this._points=[],this._bandBgRenderer=newo
this._bandBgRenderer.setData(e),this._bandBgRenderer},t.BandPaneView=n,t.BandBackgroundPaneView=r,t.HlineFillPaneView=s},function(e,t,i){"use strict";varn,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyPriceAxisView",function(){returnr}),n=i(1),o=i(58),r=function(e){functiont(t,i){varn=e.call(this)||this;returnn._source=t,n._data=i,n}returnn.c(t,e),t.prototype._updateRendererData=function(e){e.visible=!1;vart=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";functionn(e,t,i,n){varo,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])}functiono(e,t,i,n){varo,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!"))}functionr(e,t,i,n){varo,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])}functions(e,t,i,n){r.call(this,e,t,i,n)}functiona(e,t,i,n){s.call(this,e,t,i,n)}functionl(e,t,i,n){r.call(this,e,t,i,n),this._maxAbsValue=0}functionc(e,t,i,n){varo,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,
o.setData(e),t.append(o);break;default:t.append(newL(e))}returnthis.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&t.append(neww(this._selectionData)),t}},o.prototype.items=function(){returnthis._items},o.prototype.update=function(){this._invalidated=!0},o.prototype._scalesReady=function(){vare=this._model.timeScale(),t=this._study.priceScale();returne&&t&&!e.isEmpty()&&!t.isEmpty()},o.prototype._getTranspValue=function(){vare=this._study.properties(),t=e.styles[this._plotName],i=0;returnt.transparency&&(i=t.transparency.value(),i=isNumber(i)?i:40),i},o.prototype._updateImpl=function(){vare,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){vari,n,a,l;returne+=c,i=t[this._plotIndex+1],n=newp(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(){vare,t;if(this._study.properties().styles[this._plotName].visible&&this._study.properties().styles[this._plotName].visible.value()&&this._scalesReady())returnthis._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=newN,t.append(newO(e)),t},r.prototype.items=function(){returnthis.m_items},r.prototype.update=function(){this.m_invalidated=!0},r.prototype._scalesReady=function(){vare=this.m_model.timeScale(),t=this.m_study.priceScale();returne&&t&&!e.isEmpty()&&!t.isEmpty()},r.prototype._updateImpl=function(){vare,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,
o.setData(e),t.append(o);break;default:t.append(newL(e))}returnthis.m_study===this.m_model.selectedSource()&&this._isMarkersEnabled&&t.append(neww(this._selectionData)),t}},o.prototype.items=function(){returnthis._items},o.prototype.update=function(){this._invalidated=!0},o.prototype._scalesReady=function(){vare=this._model.timeScale(),t=this._study.priceScale();returne&&t&&!e.isEmpty()&&!t.isEmpty()},o.prototype._getTranspValue=function(){vare=this._study.properties(),t=e.styles[this._plotName],i=0;returnt.transparency&&(i=t.transparency.value(),i=isNumber(i)?i:40),i},o.prototype._updateImpl=function(){vare,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){vari,n,a,l;returne+=c,i=t[this._plotIndex+1],n=newp(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(){vare,t;if(this._study.properties().styles[this._plotName].visible&&this._study.properties().styles[this._plotName].visible.value()&&this._scalesReady())returnthis._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=newF,t.append(newO(e)),t},r.prototype.items=function(){returnthis.m_items},r.prototype.update=function(){this.m_invalidated=!0},r.prototype._scalesReady=function(){vare=this.m_model.timeScale(),t=this.m_study.priceScale();returne&&t&&!e.isEmpty()&&!t.isEmpty()},r.prototype._updateImpl=function(){vare,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,
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))throwError("Problems in study migration process... Possible infinite cycle has been detected and stopped.");o=s.toVers}returno>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(n)),n},n.prototype._findMigration=function(e){vart,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);returnn<0?null:this._migrs[n]},n.prototype._applyMigration=function(e,t){vari,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);returnr},n.prototype._getApplyRuleFun=function(e){if("inputRemoved"===e)returnn._applyInputRemovedRule;if("inputChangedType"===e)returnn._applyInputChangedTypeRule;if("inputChangedMinMax"===e)returnn._applyInputChangedMinMaxRule;if("inputChangedOptions"===e)returnn._applyInputChangedOptionsRule;throwError("Unknown migration rule type: "+e)},n._applyInputRemovedRule=function(e,t){if(!(t.inputIdine))returne;if("removeVal"!==t.action)throwError("Unexpected rule.action="+t.action+" in rule.type="+t.type);vari=e[t.inputId];returndeletee[t.inputId],r.logNormal("Input "+t.inputId+"="+i+" removed"),e},n._applyInputChangedTypeRule=function(e,t){vari=e[t.inputId];if("resetToDefVal"===t.action)returne[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal),e;if("convertVal"===t.action){if(null==i)returne;if("float"===t.inputTypeFrom&&"integer"===t.inputType)returne[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)returne;if("text"===t.inputTypeFrom&&"source"===t.inputType)returnn._isValidSource(i,t.options)?e:(e[t.inputId]=t.defVal,e);throwError("Cannot convertVal from "+t.inputTypeFrom+" to "+t.inputType)}throwError("Unknown action "+t.action+" for rule with type "+t.type)},n._isValidSource=function(e,t){returne.indexOf("$")>=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throwError("Unknown action "+t.action+" for rule with type "+t.type);vari=e[t.inputId];returni<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))throwError("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);vari=e[t.inputId];returnt.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){functions(e){returneinstanceofM}functiona(e){
returne.isNoScale()?null:e.priceScale()}functionl(e,t,i,n,o){if(void0!==o)switch(o){case"right":returne.rightPriceScale();case"left":returne.leftPriceScale();case"no-scale":returnnull;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}returna(t);default:Y.logWarn("Unknown override for priceScale type - "+o+", default will be used")}varr=i.priceScale;returnn?null:(s(t)||e.isMainPane()&&void0===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()}functionc(e,i,r,s,a,l,h,u){vard,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=newx(this,u.timeScale),H.init(),d=this,this.m_panes=[],this.m_gridSource=newP,this.m_crossHairSource=newS(this,H.properties(),{additionalMenuEnabled:u.crossHairMenuEnabled}),this.m_crossHairSource.selectBarMode().subscribe(function(e){if(e&&d.lineBeingCreated()){vart=H.tool.value();d.cancelCreatingLine(),H.tool.setValue(t)}}),this.m_width=0,this._tagsChanged=newt,this._lineCancelled=newt,this._magnet=newT(H.properties().magnet,this.m_timeScale,r.paneProperties.magnetSensivity),p=newj("chartproperties.mainSeriesProperties"),p.addExclusion("minTick"),p.addExclusion("priceAxisProperties.lockScale"),p.addExclusion("priceAxisProperties.percentage"),p.addExclusion("priceAxisProperties.log"),this.createPane(void0,{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=newt,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=newW(this,p,s),this.m_panes[0].addDataSource(this.m_mainSeries,this.m_panes[0].rightPriceScale()),this._mainSeriesPriceScaleNameChanged=newt,this._mainSeriesPriceScaleNameProperty=newK(this),this._mainSeriesScaleRatioProperty=newG(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()){vare=this.m_mainSeries.bars().first()
returne.isNoScale()?null:e.priceScale()}functionl(e,t,i,n,o){if(void0!==o)switch(o){case"right":returne.rightPriceScale();case"left":returne.leftPriceScale();case"no-scale":returnnull;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}returna(t);default:Y.logWarn("Unknown override for priceScale type - "+o+", default will be used")}varr=i.priceScale;returnn?null:(s(t)||e.isMainPane()&&void0===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()}functionc(e,i,r,s,a,l,h,u){vard,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=newx(this,u.timeScale),H.init(),d=this,this.m_panes=[],this.m_gridSource=newP,this.m_crossHairSource=newS(this,H.properties(),{additionalMenuEnabled:u.crossHairMenuEnabled}),this.m_crossHairSource.selectBarMode().subscribe(function(e){if(e&&d.lineBeingCreated()){vart=H.tool.value();d.cancelCreatingLine(),H.tool.setValue(t)}}),this.m_width=0,this._tagsChanged=newt,this._lineCancelled=newt,this._magnet=newT(H.properties().magnet,this.m_timeScale,r.paneProperties.magnetSensivity),p=newj("chartproperties.mainSeriesProperties"),p.addExclusion("minTick"),p.addExclusion("priceAxisProperties.lockScale"),p.addExclusion("priceAxisProperties.percentage"),p.addExclusion("priceAxisProperties.log"),this.createPane(void0,{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=newt,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=newW(this,p,s),this.m_panes[0].addDataSource(this.m_mainSeries,this.m_panes[0].rightPriceScale()),this._mainSeriesPriceScaleNameChanged=newt,this._mainSeriesPriceScaleNameProperty=newK(this),this._mainSeriesScaleRatioProperty=newG(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()){vare=this.m_mainSeries.bars().first()
c.prototype.isSnapshot=function(){returnthis._isSnapshot},c.prototype.currentTool=function(){returnthis._currentTool},c.prototype.setCurrentTool=function(e){this._currentTool=e},c.prototype.timezone=function(){returnthis._properties.timezone.value()},c.prototype.version=function(){returnthis._version},c.prototype.initConnection=function(){this._chartApi.switchTimezone(this.timezone())},c.prototype.dumpViews=function(){vare,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());returno},c.prototype._paneInvalidationMask=function(e,t){vari=newk,n=this.m_panes.indexOf(e);returnvoid0===t&&(t=k.LIGHT_UPDATE),i.invalidatePane(n,t),i},c.prototype.updatePane=function(e){vart=this._paneInvalidationMask(e);this.invalidate(t)},c.prototype.fullUpdate=function(){this.invalidate(newk(k.FULL_UPDATE))},c.prototype.lightUpdate=function(){this.invalidate(newk(k.LIGHT_UPDATE))},c.prototype.updateSource=function(e){vart=this.paneForSource(e),i=this._paneInvalidationMask(t);this.invalidate(i)},c.prototype.studiesMetaData=function(){returnthis._studiesMetaData},c.prototype.studyVersioning=function(){returnthis._studyVersioning},c.prototype.disconnect=function(){vare,t,i=this.dataSources();for(t=0;t<i.length;t++)e=i[t],e.disconnect&&e.disconnect()},c.prototype.restart=function(){vare,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(){vare,t;if(!this.m_mainSeries.isStarted())throwError("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(){vare,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(){vare,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(){returnthis._readOnly},c.prototype.properties=function(){returnthis._properties},c.prototype.lineCancelled=function(){returnthis._lineCancelled},c.prototype.crossHairMoved=function(){returnthis.m_crossHairSource.moved()},c.prototype.chartApi=function(){returnthis._chartApi},c.prototype.propertyChangeHandler=function(){this.invalidate(newk(k.LIGHT_UPDATE))},c.prototype.visibilityChangeHandler=function(){this.setSelectedSource(),this.invalidate(newk(k.LIGHT_UPDATE))},c.prototype.updateAllPaneViews=function(){vare,t;for(e=0;e<this.m_panes.length;e++)t=this.m_panes[e],t.updateAllViews()},c.prototype.mainSeries=function(){returnthis.m_mainSeries},c.prototype.timeScale=function(){returnthis.m_timeScale},c.prototype.panes=function(){
(r=i[n].legendView())&&r.update();this.invalidate(newk(k.UPDATE_CURSOR_ONLY)),s=this._undoModel._chartWidget,s._chartWidgetCollection&&s._chartWidgetCollection.syncCrosshair(NaN,s)},c.prototype.onSyncScrollNeeded=function(e){vart,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){functioni(){returnp.tickMarks().indexToTime(p.tickMarks().minIndex).valueOf()-e}functionn(t){varn,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();returns=p.visibleBars(),a=s.lastBar()-s.firstBar(),!t&&s.contains(n)||(p.zoomToBarsRange(n-a/2,n+a/2),_.requestMoreData()),{timestamp:p.indexToTimePoint(n)}}}varo,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)returnY.logError("scrollTo called without an argument"),$.Deferred().reject().promise();e=this._scrollingState.targetDate,s=this._scrollingState.deferred}returna=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){vari,n,o=this._syncPointCache[e.uniqueId()];if(o){if(i=o[t.uniqueId()])returni}elsethis._syncPointCache[e.uniqueId()]={};returnn=newU(e,t),this._syncPointCache[e.uniqueId()][t.uniqueId()]=n,n},c.prototype.setExternalPosition=function(e,t){vari,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)returnthis._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),voiddeletethis._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()
;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){returne.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)(newr.Point(f.x,f.y),newr.Point(m.x,m.y),newr.Point(e.x,e.y)).distance<=s)returnnewh.HitTestResult(h.HitTestResult.REGULAR);returnnull},e.prototype._makeLine=function(e,t,i,n){varo,r,s,a,c,h,u,d,p,_;if(null!==this._data&&-1!==(o=t.findIndex(function(e){returnObject(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}}elseif(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);elseif(_&&Object(l.coordinateIsValid)(_.y))i?(d!==o&&e.lineTo(p.x,a),e.lineTo(p.x,p.y)):e.moveTo(p.x,p.y);elseif(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)}elsee.moveTo(p.x-c,p.y),e.lineTo(p.x+c,p.y);h=p}},e.prototype._makeLinearGradient=function(e,t,i,n,o){varr=e.createLinearGradient(0,n,0,o);returnr.addColorStop(0,t),r.addColorStop(1,i),r},e}()},function(e,t,i){"use strict";(function(t){vari=[{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(){functione(e,t){vari=function(){};returni.prototype=t.prototype,e.prototype=newi,e}functionn(e){returne.replace(/[\^\$\(\)\[\]\{\}\*\+\?\|\\]/g,"\\$&")}functiono(){}functionr(e){this.value=e}functions(){}functiona(){}functionl(){}functionc(){}functionh(){}functionu(){}functiond(){}functionp(){}function_(e){this.value=e}functionf(e){this.value=e}functionm(e){this.value=e}functiony(){_.apply(this,arguments)}functiong(){f.apply(this,arguments)}functionv(e,t){vari,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=newj[n].ctor(i[n+1]),o._offset=i.index,u.push(o));continuee}s=newm(i[0]),s._offset=i.index,u.push(s)}if(t&&t.recover)for(n=u.length;n--;)l=u[n],linstanceoff||linstanceof_?(void0!==a&&(c=new_(""),h=u.splice(n,a-n+1,c),c.value=h.map(function(e){returne.value}).join("")),a=n):linstanceofr||(a=void0);returnu}functionS(e){vari,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])instanceofr))if(deleteh.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";elseif(pinstanceof_||pinstanceoff){if(c===n){h.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}c=n}elseif(pinstanceofl){if(c!==n){h.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}c=o}elseif(pinstanceofs){if(c===n){h.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}u.push(p),c=i}elseif(pinstanceofa){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:news}}),c=n}elsepinstanceofm&&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:newa}),h.warnings.push(y);returnh.currentState=c,0===h.warnings.length&&deleteh.warnings,0===h.errors.length&&deleteh.errors,h}functionb(e){vart,i=[];for(t=0;t<e.length;t++)e[t]instanceofr||i.push(e[t]);returni}functionw(e){vart,i,n,o,r,c,h;for(e=b(e),t=[],i=[],o=0;o<e.length;o++)r=e[o],rinstanceofl?i.length&&i[i.length-1].minPrecedence>r.precedence&&(i[i.length-1].minPrecedence=r.precedence):rinstanceofs?i.push(n={minPrecedence:1/0,openBraceIndex:o}):rinstanceofa&&(n=i.pop(),c=e[n.openBraceIndex-1],(h=e[o+1])instanceofl&&!(h.precedence<=n.minPrecedence)||!(!(cinstanceofl)||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);returne}functionP(e){for(vart=0;t<e.length;t++)e[t].parse&&e[t].parse();returne}functionT(e){vart=x(e);returnw(t?t:[newf("1"),newd,news].concat(e).concat(newa))}functionx(e){vart,i,n,o=0,c=1,h=2,u=3,p=o,_=0;for(i=0;i<e.length;i++)if(!((n=e[i])instanceofr))switch(p){caseo:if(!(ninstanceoff&&1==+n.value))return!1;p=c;break;casec:if(!(p===c&&ninstanceofd))return!1;p=h,t=i+1;break;caseh:if(ninstanceofs)p=u,_=1;elseif(ninstanceofl)return!1;break;caseu:ninstanceofs?_++:ninstanceofa&&--_<=0&&(p=h)}returne.slice(t)}functionC(e){returnnew_(e).ticker()}functionL(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");returne=v(e),e.filter(function(e){returneinstanceof_}).map(function(e){returne.exchange()}).filter(function(e){returne})}functionI(e){returne=L(e),1!==e.length?null:e[0]}functionA(e,t){returne=L(e),e.some(function(e){return!!~t.indexOf((e||"").toUpperCase())})}functionk(e){returnA(e,["BATS"])}functionE(e){return(e=I(e))&&-1!==e.toUpperCase().indexOf("_EOD")}functionM(e){returnA(e,["CHXEUR"])}functionV(e){returnA(e,["CHXJPY"])}functionD(e){
returnA(e,pro.getProductsByType(pro.PRODUCT_TYPES.exchange).map(function(e){returne.exchange.toUpperCase()+"_DLY"}))}functionO(e,t){return!!(e=I(e))&&e.substr(0,t.length)===t}functionR(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");vart=w(b(v(e)));returnt.forEach(function(e){einstanceof_&&e.exchange(null)}),N(t)}functionB(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");returnN(w(b(v(e))))}functionN(e){returne.join("")}varF,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}];returno.prototype.toString=function(){returnthis.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")){vare=W.test(this._ticker)?"'":"";returne+(this._exchange?this._exchange+":":"")+this._ticker+e}returnthis.value},_.prototype.parse=function(){vare=F.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},_.prototype.parseAsFutures=function(){vare,t,n;for(this.hasOwnProperty("_ticker")||this.parse(),e=function(e){returni.some(function(t){returnt.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))returnthis._exchange;null===e||void0===e?deletethis._exchange:this._exchange=e+""},_.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))returnthis._ticker;null===e||void0===e?deletethis._ticker:this._ticker=e+"",deletethis._root,deletethis._contract},_.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))returnthis._root;null===e||void0===e?deletethis._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))returnthis._root;null===e||void0===e?deletethis._contract:(this._contract=e+"",
returnA(e,pro.getProductsByType(pro.PRODUCT_TYPES.exchange).map(function(e){returne.exchange.toUpperCase()+"_DLY"}))}functionO(e,t){return!!(e=I(e))&&e.substr(0,t.length)===t}functionR(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");vart=w(b(v(e)));returnt.forEach(function(e){einstanceof_&&e.exchange(null)}),F(t)}functionB(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");returnF(w(b(v(e))))}functionF(e){returne.join("")}varN,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}];returno.prototype.toString=function(){returnthis.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")){vare=W.test(this._ticker)?"'":"";returne+(this._exchange?this._exchange+":":"")+this._ticker+e}returnthis.value},_.prototype.parse=function(){vare=N.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},_.prototype.parseAsFutures=function(){vare,t,n;for(this.hasOwnProperty("_ticker")||this.parse(),e=function(e){returni.some(function(t){returnt.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))returnthis._exchange;null===e||void0===e?deletethis._exchange:this._exchange=e+""},_.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))returnthis._ticker;null===e||void0===e?deletethis._ticker:this._ticker=e+"",deletethis._root,deletethis._contract},_.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))returnthis._root;null===e||void0===e?deletethis._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))returnthis._root;null===e||void0===e?deletethis._contract:(this._contract=e+"",
i.prototype.nearestIndex=function(e){for(vart,i=this.minIndex,n=this.maxIndex;n-i>2;){if(1e3*this._marksByIndex[i].time===e)returni;if(1e3*this._marksByIndex[n].time===e)returnn;t=Math.round((i+n)/2),1e3*this._marksByIndex[t].time>e?n=t:i=t}returni},i.prototype.build=function(e,t){vari,n,o,r,s,a,l,c,h,u,d,p,_,f,m=Math.ceil(t/e);if(this._maxbar===m&&this._cache)returnthis._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])}returnthis._cache=i,this._cache},i.prototype.state=function(){vare,t=[];for(e=this._marksBySpan.length;e--;)this._marksBySpan[e]&&(t=t.concat(this._marksBySpan[e]));returnt=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=[],deletethis.maxIndex,deletethis.minIndex,e&&e.marks&&e.marks.length)if(2===e.version){vart=e.marks.map(function(e){return{span:e[0],time:e[1],index:e[2]}});this.merge(t)}elsethis.merge(e.marks)},e.exports=i}).call(t,i(8))},function(e,t,i){"use strict";varn,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"TimePoints",function(){returnr}),n=i(4),o=Object(n.getLogger)("Chart.TimePoints"),r=function(){functione(){this._zoffset=0,this._items=[]}returne.prototype.clear=function(){this._zoffset=0,this._items=[]},e.prototype.size=function(){returnthis._items.length},e.prototype.firstIndex=function(){returnthis._offsetToIndex(0)},e.prototype.lastIndex=function(){returnthis._offsetToIndex(this._items.length-1)},e.prototype.merge=function(e,t,i){varn,r,s,a,l,c,h,u;if(0===i.length)returno.logError("merge: 'values' does not contain any time points"),[];if(t>this._zoffset&&e+t>0)returno.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)returnthis._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)returno.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]});returnthis._zoffset=t,a},e.prototype.addTail=function(e,t){for(vari=t?1:0;i<e.length;i++)this._items.push(e[i])},
deletethis.tooltips[e]))},n.prototype.removeAll=function(){vare,t;for(einthis.tooltips)this.tooltips.hasOwnProperty(e)&&(t=this.tooltips[e],t.remove());this.tooltips={}},n.prototype.removeTooltip=function(e){deletethis.tooltips[e]},n.prototype._createTooltip=function(){returnnewo(this,this.tooltipFactory())},o.prototype._drawPlate=function(e,t){vari=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";functionn(e){vart,i;if(e&&e.__esModule)returne;if(t={},null!=e)for(iine)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);returnt.default=e,t}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functionr(e,t,i){varn,o=2*J,r=document.createElement("canvas");returnr.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}functions(e,t){returnfunction(){i.e(11).then(function(){X=i(811),e.call(t)}.bind(null,i)).catch(i.oe)}}functiona(e){return!x||e>L}functionl(e){return!T||e>C}varc,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=void0,c=function(){functione(e,t){vari,n,o=[],r=!0,s=!1,a=void0;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)throwa}}returno}returnfunction(t,i){if(Array.isArray(t))returnt;if(Symbol.iteratorinObject(t))returne(t,i);thrownewTypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){functione(e,t){vari,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"inn&&(n.writable=!0),Object.defineProperty(e,n.key,n)}returnfunction(t,i,n){returni&&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,
deletethis.tooltips[e]))},n.prototype.removeAll=function(){vare,t;for(einthis.tooltips)this.tooltips.hasOwnProperty(e)&&(t=this.tooltips[e],t.remove());this.tooltips={}},n.prototype.removeTooltip=function(e){deletethis.tooltips[e]},n.prototype._createTooltip=function(){returnnewo(this,this.tooltipFactory())},o.prototype._drawPlate=function(e,t){vari=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";functionn(e){vart,i;if(e&&e.__esModule)returne;if(t={},null!=e)for(iine)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);returnt.default=e,t}functiono(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functionr(e,t,i){varn,o=2*J,r=document.createElement("canvas");returnr.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}functions(e,t){returnfunction(){i.e(11).then(function(){X=i(811),e.call(t)}.bind(null,i)).catch(i.oe)}}functiona(e){return!x||e>L}functionl(e){return!T||e>C}varc,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=void0,c=function(){functione(e,t){vari,n,o=[],r=!0,s=!1,a=void0;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)throwa}}returno}returnfunction(t,i){if(Array.isArray(t))returnt;if(Symbol.iteratorinObject(t))returne(t,i);thrownewTypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){functione(e,t){vari,n;for(i=0;i<t.length;i++)n=t[i],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"inn&&(n.writable=!0),Object.defineProperty(e,n.key,n)}returnfunction(t,i,n){returni&&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,
re.call(this,i),this._targetObj=e,this._newValue=t,this._model=n}functionr(e,t,i,n){re.call(this,i),this._priceScale=t,this._newMode=e,this._model=n}functions(e,t,i,n){re.call(this,i),this._property=e,this._newValue=t,this._model=n,this._priceScale=this._model.mainSeries().priceScale()}functiona(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}functionl(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}functionc(e,t,i,n){this._model=e,this._series=t,this._oldSymbol=t.symbol(),this._oldInterval=t.interval(),this._symbol=i,this._interval=n}functionh(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()}functionu(e,t){re.call(this,"Remove Source"),this._model=e,this._sourceId=t.id()}functiond(e,t){re.call(this,"Remove Drawing(s)"),this._model=e,this._linetools=t,this._statesByPaneIndexes={}}functionp(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)}functionf(e,t){_.call(this,e,t,"Merge Up"),this._mergeRedoFn=this._model.mergeSourceUp,this._mergeUndoFn=this._model.unmergeSourceDown}functionm(e,t){_.call(this,e,t,"Merge Down"),this._mergeRedoFn=this._model.mergeSourceDown,this._mergeUndoFn=this._model.unmergeSourceUp}functiony(e,t){_.call(this,e,t,"Unmerge Up"),this._mergeRedoFn=this._model.unmergeSourceUp,this._mergeUndoFn=this._model.mergeSourceDown}functiong(e,t){_.call(this,e,t,"Unmerge Down"),this._mergeRedoFn=this._model.unmergeSourceDown,this._mergeUndoFn=this._model.mergeSourceUp}functionv(e,t,i){re.call(this,"Create line "+i,!1),this._model=e,this._paneIndex=e.panes().indexOf(t),this._lineTool=i}functionS(e,t,i,n){re.call(this,"Move Drawing",!1),this._model=e,this._sourceId=t.id(),this._origPoint=iinstanceofF?i.clone():TradingView.clone(i),this._pointIndex=n}functionb(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}functionw(e,t){re.call(this,"Send "+t.title()+" to back"),this._model=e,this._sourceId=t.id()}functionP(e,t){re.call(this,"Bring "+t.title()+" to front"),this._model=e,this._sourceId=t.id()}functionT(e,t,i){
re.call(this,i),this._targetObj=e,this._newValue=t,this._model=n}functionr(e,t,i,n){re.call(this,i),this._priceScale=t,this._newMode=e,this._model=n}functions(e,t,i,n){re.call(this,i),this._property=e,this._newValue=t,this._model=n,this._priceScale=this._model.mainSeries().priceScale()}functiona(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}functionl(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}functionc(e,t,i,n){this._model=e,this._series=t,this._oldSymbol=t.symbol(),this._oldInterval=t.interval(),this._symbol=i,this._interval=n}functionh(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()}functionu(e,t){re.call(this,"Remove Source"),this._model=e,this._sourceId=t.id()}functiond(e,t){re.call(this,"Remove Drawing(s)"),this._model=e,this._linetools=t,this._statesByPaneIndexes={}}functionp(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)}functionf(e,t){_.call(this,e,t,"Merge Up"),this._mergeRedoFn=this._model.mergeSourceUp,this._mergeUndoFn=this._model.unmergeSourceDown}functionm(e,t){_.call(this,e,t,"Merge Down"),this._mergeRedoFn=this._model.mergeSourceDown,this._mergeUndoFn=this._model.unmergeSourceUp}functiony(e,t){_.call(this,e,t,"Unmerge Up"),this._mergeRedoFn=this._model.unmergeSourceUp,this._mergeUndoFn=this._model.mergeSourceDown}functiong(e,t){_.call(this,e,t,"Unmerge Down"),this._mergeRedoFn=this._model.unmergeSourceDown,this._mergeUndoFn=this._model.mergeSourceUp}functionv(e,t,i){re.call(this,"Create line "+i,!1),this._model=e,this._paneIndex=e.panes().indexOf(t),this._lineTool=i}functionS(e,t,i,n){re.call(this,"Move Drawing",!1),this._model=e,this._sourceId=t.id(),this._origPoint=iinstanceofN?i.clone():TradingView.clone(i),this._pointIndex=n}functionb(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}functionw(e,t){re.call(this,"Send "+t.title()+" to back"),this._model=e,this._sourceId=t.id()}functionP(e,t){re.call(this,"Bring "+t.title()+" to front"),this._model=e,this._sourceId=t.id()}functionT(e,t,i){
re.call(this,"Remove pane"),this._model=e,this._index=t,this._pane=this._model.panes()[t],this._chart=i}functionx(e,t,i,n){re.call(this,"Rearrange panes"),this._model=e,this._index=t,this._direction=i,this._chart=n}functionC(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}functionL(e,t,i){re.call(this,"Zoom"),this._baseCmd=e,this._zoomStack=t,this._inOut=i}functionI(e,t,i,n,o){re.call(this,"",!1),this._model=e,this._paneA=t,this._paneB=i,this._prevStretchA=n,this._currStretchA=o}functionA(e,t){re.call(this,"Restore Defaults"),this._model=e,this._defaultProperty=t,this._state=t.state(t._exclusions),this._chartWidget=e._undoModel._chartWidget}functionk(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),deletethis._newChartProps.scalesProperties.showLeftScale,deletethis._newChartProps.scalesProperties.showRightScale,deletethis._newChartProps.scalesProperties.scaleSeriesOnly,deletethis._newChartProps.scalesProperties.showSeriesLastValue,deletethis._newChartProps.scalesProperties.showStudyLastValue,deletethis._newChartProps.scalesProperties.showSymbolLabels,deletethis._newChartProps.scalesProperties.showStudyPlotLabels,e.timeScale().preserveBarSpacing()&&deletethis._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(),deletethis._oldChartProps.paneProperties.topMargin,deletethis._oldChartProps.paneProperties.bottomMargin,this._oldSeriesProps=e.properties().state().mainSeriesProperties}functionE(e,t,i,n){varo;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.m_model.startMovingSource(e,t,i)},n.prototype.sourceBeingMoved=function(){returnthis.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(){returnthis.m_model.dataSources()},n.prototype.orderedDataSources=function(e){returnthis.m_model.orderedDataSources(e)},n.prototype.dataSourceForId=function(e){returnthis.m_model.dataSourceForId(e)},n.prototype.state=function(e,t){returnthis.m_model.state(e,t)},n.prototype.asyncState=function(e){returnthis.m_model.asyncState(e)},n.prototype.restoreState=function(e,t){returnthis.m_model.restoreState(e,t)},n.prototype.calculateDefaultTags=function(){returnthis.m_model.calculateDefaultTags()},n.prototype.onTagsChanged=function(){returnthis.m_model.onTagsChanged()},n.prototype.changeZOrder=function(e,t){vari=newb(this.m_model,e,t);this.pushUndoCommand(i),this.emitEvent("changeZOrder",[e,t])},n.prototype.sendToBack=function(e){vart=neww(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("changeZOrder",[e])},n.prototype.bringToFront=function(e){vart=newP(this.m_model,e);this.pushUndoCommand(t),this.emitEvent("changeZOrder",[e])},n.prototype.removeAllStudies=function(){vare,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){vart,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){vart=newO(this.m_model,e);this.pushUndoCommand(t)},n.prototype.copyToOtherCharts=function(e){this.m_model.copyToOtherCharts(e)},n.prototype.moveLeft=function(){vare,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(){vare,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())},
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){vari=newD(this.m_model,e,t);returnthis.pushUndoCommand(i),this.emitEvent("cloneLineTool"),i.clonedLineToolId()},n.prototype.alertsList=function(){returnthis.m_model.alertsList()},n.prototype.alertsListChanged=function(){returnthis.m_model.alertsListChanged()},n.prototype.insertStudyStub=function(e){returnthis.m_model.insertStudyStub(e)},n.prototype.removeStudyStub=function(e){returnthis.m_model.removeStudyStub(e)},n.prototype.isJustClonedChart=function(){returnthis._chartWidget.isJustClonedChart()},n.prototype.copySourceToClip=function(e){if(e&&!e.properties().blockCopying){vart={};if(einstanceofH)t.type="drawing",t.geometry=e.geometry();else{if(!(einstanceofee))return!1;t.type="study"}returnt.source=e.state&&e.state(),(deletet.source.alertId,deletet.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){vari=newR(this.m_model,t,e);this.pushUndoCommand(i)},n.prototype.pasteStudy=function(e){vart=newB(this.m_model,e);this.pushUndoCommand(t)},n.prototype.pasteSourceFromClip=function(e,t){vari=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(){returnthis._chartWidget.trackTime()},n.prototype.isInReplay=function(){returnthis.m_model.isInReplay()},n.prototype.switchToReplay=function(e){},n.prototype.switchToRealtime=function(){},n.prototype.startCustomMoving=function(e,t,i){this._currentCustomMoveCommand=newN(t,i),this._currentCustomMoveSource=e},n.prototype.customMoveBeingProcessed=function(){returnnull!==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(newse(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(newq(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(newq(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(newq(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){vari=newD(this.m_model,e,t);returnthis.pushUndoCommand(i),this.emitEvent("cloneLineTool"),i.clonedLineToolId()},n.prototype.alertsList=function(){returnthis.m_model.alertsList()},n.prototype.alertsListChanged=function(){returnthis.m_model.alertsListChanged()},n.prototype.insertStudyStub=function(e){returnthis.m_model.insertStudyStub(e)},n.prototype.removeStudyStub=function(e){returnthis.m_model.removeStudyStub(e)},n.prototype.isJustClonedChart=function(){returnthis._chartWidget.isJustClonedChart()},n.prototype.copySourceToClip=function(e){if(e&&!e.properties().blockCopying){vart={};if(einstanceofH)t.type="drawing",t.geometry=e.geometry();else{if(!(einstanceofee))return!1;t.type="study"}returnt.source=e.state&&e.state(),(deletet.source.alertId,deletet.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){vari=newR(this.m_model,t,e);this.pushUndoCommand(i)},n.prototype.pasteStudy=function(e){vart=newB(this.m_model,e);this.pushUndoCommand(t)},n.prototype.pasteSourceFromClip=function(e,t){vari=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(){returnthis._chartWidget.trackTime()},n.prototype.isInReplay=function(){returnthis.m_model.isInReplay()},n.prototype.switchToReplay=function(e){},n.prototype.switchToRealtime=function(){},n.prototype.startCustomMoving=function(e,t,i){this._currentCustomMoveCommand=newF(t,i),this._currentCustomMoveSource=e},n.prototype.customMoveBeingProcessed=function(){returnnull!==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(newse(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(newq(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(newq(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(newq(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(newq(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(newq(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(newq(q.LIGHT_UPDATE)))},inherit(a,re),a.prototype.undo=function(){if(null!==this.m_newPriceScaleState)returnvoid_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)returnvoid_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)returnvoid_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)returnvoid_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(){vare,t,i=null;returnthis._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"),deletethis._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(){returnthis._model.dataSourceForId(this._studyId)},h.prototype.undo=function(){vare,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(){
vare,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(){vare=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(){vare,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]);deletethis._linetools},d.prototype.undo=function(){vare,t,i,n,o,r,s;this._linetools=[];for(einthis._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(newq(q.LIGHT_UPDATE))},inherit(p,re),p.prototype.redo=function(){vare,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(){vare,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(){vare=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){varn,o;returnthis._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){returnthis._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(){returnthis._lineId?this._model.dataSourceForId(this._lineId):null},v.prototype.undo=function(){vare=this.line();e&&(this._lineState=e.state(),this._model.removeSource(e),deletethis._lineId)},v.prototype.redo=function(){this._lineState||_e.logError("This command was never undone - nothing to redo");vare=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);this._lineId=e.id(),deletethis._lineState},inherit(S,re),S.prototype.setPoint=function(e){this._point=einstanceofF?e.clone():TradingView.clone(e)},S.prototype.undo=function(){vare=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(){vare=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(){vare=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,-this._shift)},b.prototype.redo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,this._shift)};inherit(w,re),w.prototype.undo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},w.prototype.redo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},inherit(P,re),P.prototype.undo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},P.prototype.redo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},n.prototype.removePane=function(e,t){vari=newT(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){varn=newx(this,t,i,e);this.pushUndoCommand(n),this._onRearrangePanes.fire()},inherit(x,re),x.prototype.redo=function(){vare=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(newq(q.FULL_UPDATE))},x.prototype.undo=function(){vare;"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(newq(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(){returnthis._lineId?this._model.dataSourceForId(this._lineId):null},v.prototype.undo=function(){vare=this.line();e&&(this._lineState=e.state(),this._model.removeSource(e),deletethis._lineId)},v.prototype.redo=function(){this._lineState||_e.logError("This command was never undone - nothing to redo");vare=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);this._lineId=e.id(),deletethis._lineState},inherit(S,re),S.prototype.setPoint=function(e){this._point=einstanceofN?e.clone():TradingView.clone(e)},S.prototype.undo=function(){vare=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(){vare=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(){vare=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,-this._shift)},b.prototype.redo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(e,this._shift)};inherit(w,re),w.prototype.undo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},w.prototype.redo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},inherit(P,re),P.prototype.undo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(e)},P.prototype.redo=function(){vare=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(e)},n.prototype.removePane=function(e,t){vari=newT(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){varn=newx(this,t,i,e);this.pushUndoCommand(n),this._onRearrangePanes.fire()},inherit(x,re),x.prototype.redo=function(){vare=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(newq(q.FULL_UPDATE))},x.prototype.undo=function(){vare;"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(newq(q.FULL_UPDATE))},inherit(C,re),C.prototype.redo=function(){this._timeScaleState=this._model.timeScale().state(),this._priceScaleState=this._pane.defaultPriceScale().state(),
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||cinstanceofee)&&(c.isRemovedByStudyTemplates()||i.push(c),_.removeSource(c));for(h=e.panes,function(e,t){returne.dataSources().some(function(e){returne.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&&(deletec.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(newq(q.FULL_UPDATE))},E.prototype.redo=function(){vare,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(){vare,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(newF(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");vare=this._model.dataSourceForId(this._lineState.id);this._model.removeSource(e)},D.prototype.clonedLineToolId=function(){returnthis._lineState.id},inherit(O,re),
O.prototype.redo=function(){deletethis._model.dataSourceForId(this._sourceId).linkKey},O.prototype.undo=function(){this._model.dataSourceForId(this._sourceId).linkKey=this._linkKey},inherit(R,re),R.prototype.redo=function(){vare,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&&(uinstanceofX&&(e=!1),uinstanceofee&&(e=!u.metaInfo().is_price_study)),r=TradingView.clone(this._clipboardData.source),deleter.state.symbol,e?(s=this._model,a=function(e){vart=e.x*s.timeScale().width(),i=e.y*u.priceScale().height();returnnewF(t,i)},l=u.firstValue(),r.points=this._clipboardData.geometry.map(function(e){vart=a(e),i=s.timeScale().coordinateToIndex(t.x),n=s.timeScale().normalizeBarIndex(i);returnn.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(newq(q.LIGHT_UPDATE,!0))},R.prototype.undo=function(){vare,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(){vare,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");vare=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(){returnthis._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";varn,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SaveLineToolStateUndoCommand",function(){returns}),n=i(1),o=i(7),i.n(o),r=i(43),s=function(e){functiont(t,i,n,o){void0===o&&(o=!0);varr=e.call(this,n,o)||this;returnr._model=t,r._savedState=i.state(!0),r}returnn.c(t,e),t.prototype.redo=function(){this._toggleState()},t.prototype.undo=function(){this._toggleState()},t.prototype._getSource=function(){returnObject(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||cinstanceofee)&&(c.isRemovedByStudyTemplates()||i.push(c),_.removeSource(c));for(h=e.panes,function(e,t){returne.dataSources().some(function(e){returne.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&&(deletec.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(newq(q.FULL_UPDATE))},E.prototype.redo=function(){vare,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(){vare,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(newN(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");vare=this._model.dataSourceForId(this._lineState.id);this._model.removeSource(e)},D.prototype.clonedLineToolId=function(){returnthis._lineState.id},inherit(O,re),
O.prototype.redo=function(){deletethis._model.dataSourceForId(this._sourceId).linkKey},O.prototype.undo=function(){this._model.dataSourceForId(this._sourceId).linkKey=this._linkKey},inherit(R,re),R.prototype.redo=function(){vare,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&&(uinstanceofX&&(e=!1),uinstanceofee&&(e=!u.metaInfo().is_price_study)),r=TradingView.clone(this._clipboardData.source),deleter.state.symbol,e?(s=this._model,a=function(e){vart=e.x*s.timeScale().width(),i=e.y*u.priceScale().height();returnnewN(t,i)},l=u.firstValue(),r.points=this._clipboardData.geometry.map(function(e){vart=a(e),i=s.timeScale().coordinateToIndex(t.x),n=s.timeScale().normalizeBarIndex(i);returnn.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(newq(q.LIGHT_UPDATE,!0))},R.prototype.undo=function(){vare,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(){vare,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");vare=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(){returnthis._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";varn,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"SaveLineToolStateUndoCommand",function(){returns}),n=i(1),o=i(7),i.n(o),r=i(43),s=function(e){functiont(t,i,n,o){void0===o&&(o=!0);varr=e.call(this,n,o)||this;returnr._model=t,r._savedState=i.state(!0),r}returnn.c(t,e),t.prototype.redo=function(){this._toggleState()},t.prototype.undo=function(){this._toggleState()},t.prototype._getSource=function(){returnObject(o.ensureNotNull)(this._model.dataSourceForId(this._savedState.id))},
@@ -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){varn,o=this._studiesCache[t][e];if(!o)throwError("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){varn,o,r,s,a=this._studiesCache[t][e];if(!a)throwError("This should never happen");if(this._isEndOfData(t,e,a.turnaround))returnn=a.engine.runner.host.symbolInfo.data_status,voidsetTimeout(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){varo=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){returnthis._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},f.prototype.createSeries=function(e,t,i,o,r,s){functiona(e,n,o){l._extrapolationManager.storage(i,e.full_name,t).setLastBarTime(n,o)}varl,c=e,h=newy.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){vard,p,_,f,m,y;if(!l._studiesCache[i][o])throwError("This should never happen");if(l._sessionsLastDataCache[i]=n,d=l._convertBarsTimeToUnix(n),p=d.length>0?1e3*d[0].value[0]:void0,u.nextTime&&(!p||u.nextTime<p/1e3))returnvoidl.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){varu,d=l._convertBarsTimeToUnix(e),p=d[d.length-1];if(n){if(l._rangeExtensionData[i]||l.purgeRangeExtensionData(i),void0===l._rangeExtensionData[i].realtimeBarsCount&&(l._rangeExtensionData[i].realtimeBarsCount=0),l._rangeExtensionData[i].realtimeBarsCount+=1,!l._studiesCache[i][o])throwError("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])}elsel._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){vars,c,h,u,d,p,_,f;if("projection"!==e.type)throwError("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){vars=this._extrapolationManager.storage(e,n.full_name,o);this._pointsetsManager.createPointset(t,i,o,r,s,n)},f.prototype.studiesMetadata=function(){return0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map(function(e){returne.metainfo})),this._metainfoCache},f.prototype.searchSymbols=function(e,t,i,n){functiono(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));varr=this;this._externalDatafeed.searchSymbols(e,t,i,o)},
f.prototype.resolveSymbol=function(e,t,i){varn,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){vart,i=this,n=$.Deferred();returnthis._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){void0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});vari=this;t.forEach(function(t){void0===i._marketStatusWatchers[e][t]&&(i._marketStatusWatchers[e][t]=newm(i,e,t))})},f.prototype._removeMarketStatusWatchers=function(e){vart=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=void0),this._removeMarketStatusWatchers(e)},f.prototype._startQuotesSubscription=function(e){functiont(t,i){varn=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]))}functioni(e){e.forEach(function(e){void0!==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})})}varo={},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:void0}},f.prototype.quoteDeleteSession=function(e){
o&&e.regular_session&&(e.session=e.regular_session);vars=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){varn=t.get_timezone(i.timezone),o=new_.Session;returno.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){vars,a,l,c,h,u,d,p,m=f.parsePeriod(i),y=(newDate).valueOf(),g=e.expired?t.cal_to_utc(t.get_timezone(e.timezone),newDate(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=void0===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)returnconsole.error("unsupported resolution for rebuild: "+i),voidthis.listeners.onError("unsupported resolution for rebuild: "+i);this.symbolInfo=r;varh=this;this.engine=newm({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=newg(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){vari=Object.assign({},t);i.nonseries=!0,i.data=t.bars,deletei.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){vari,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=newg(e.info)),(o=t[8])instanceofArray)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(){
returne===t?0:(this.historyExtrapolator().setLastBarTime(0,1e3*e),this.historyExtrapolator().indexOfBar(t,i))},a.prototype.indexOfBar=function(e,t){this._ensureExtrapolatedToTime(t,1e3*e);vari=s.lower_bound(this._extrapolatedBarsCache,e,function(e,t){returne>t?1:e<t?-1:0});return-1===i?i:this._lastRealBarIndex+i+1},a.prototype._extrapolateData=function(e,t){vari,n,o;if(!this._lastRealBarTime)throwError("No real bars known, so cannot extrapolate anything");if(!(i=t(this._lastRealBarTime))||0===i.length)returnvoid(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 "+newDate(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{vari=this;this._onReadyCallbacks.push(function(){i.ensureExtrapolatedToBar(e,t)})}},a.prototype.ensureExtrapolatedToBar=function(e,t){vari=this;returnthis._requestedAmountOfBars=t,this._extrapolateData(e,function(n){returni._extrapolatedBarsCache.length>=t||!i._shouldExtrapolateMore()?null:s.extrapolateBarsFrontByCount(i.newBarBuilder(e),n,t)})},a.prototype._ensureExtrapolatedToTime=function(e,t){vari=this;returnthis._extrapolateData(e,function(n){varo,r;returnn>=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){vart=r.Symbol.newSession(e.timezone,e.session);returnr.Symbol.newBarBuilder(this._resolution,t)},a.prototype._shouldExtrapolateMore=function(){returnthis._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(vari=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){varn=i(37),o=i(15).Interval,r=function(){functione(e,t){returne}functionr(e,t){vari=m.get_timezone(e.timezone),o=newn.Session;returno.init(i,e.session),f.Symbol.newBarBuilder(t,o,o)}functions(t,i,n,o,r,s){vara,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),
"use strict";functionn(e,t){returne.ticker+"_"+t}functiono(e){returnnewDate(e).toISOString()}varr,s,a,l,c,h;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DatafeedRequestsCachedProcessor",function(){returnh}),r=i(15),s=i(78),a=i(25),i.n(a),l=i(5),i.n(l),i(86),c=function(){functione(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}returne.prototype.destroy=function(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),deletethis._datafeed},e.prototype.addSubscription=function(e,t,i){varn=this,o=this._getNextSubscriptionId(),r=Math.floor(e.from/1e3),s=Math.floor(e.to/1e3);returnthis._pendingSubscribers.push({key:o,range:{from:r,to:s},onHistoryCallback:t,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){returnn._processPendingSubscribers()},0),o},e.prototype.removeSubscription=function(e){vart,i=this,n=this._pendingSubscribers.find(function(t){returnt.key===e});returnn?voidthis._pendingSubscribers.splice(this._pendingSubscribers.indexOf(n),1):(t=this._subscribers.find(function(t){returnt.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()})))):voidconsole.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(){vare,t,i,n,s,a,l=this,c=this._pendingSubscribers;if(c.length){if(this._requesting)returnvoidthis._logMessage("Processing is skipped due active request");if(this._logMessage("Processing pending subscribers, count="+c.length),this._needPurgeCache&&this._purgeCache(),this._errorMessage)returne=this._errorMessage,this._logMessage("Return error: "+e),this._pendingSubscribers=[],voidc.forEach(function(t){t.onErrorCallback(e)});if(t=c.reduce(function(e,t){returnMath.min(t.range.from,e)},1/0),
this._logMessage('Leftmost requested "from" is '+o(1e3*t)),(!this._leftDate||t<this._leftDate)&&(i=newr.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))returnvoidthis._ensureRequestedTo(t);this._pendingSubscribers=[],c.forEach(function(e){vart=l._moveSubscriberToRealtime(e);l._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()}},e.prototype._moveSubscriberToRealtime=function(e){vart={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};returnthis._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(){vare,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){vari=t.barset;if(null===i)throwError("subscirber.barset is null");i.add(e),t.onHistoryCallback(i)})},t=function(){i._unsubscribeRealtime();vare=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){vari,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||void0),this._endOfData&&null!==this._leftDate&&e.range.from<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)},e.prototype._createBarset=function(e){vart=Object(s.lowerbound)(this._cache.bars,1e3*e,function(e,t){returne.time<t});returnnewa.BarSet(this._symbolInfo,this._cache.bars.slice(t))},e.prototype._ensureRequestedTo=function(t){vari,n,r,s=this;if(this._leftDate&&this._leftDate<t)returnvoidthis._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){vari=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){vari;this._gaps.find(function(e){returne.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){vart=this._gaps.find(function(t){returnt.from<e&&t.to>e});returnt?t.from:null},e.prototype._getNextSubscriptionId=function(){returnthis._nextSubscriptionId++},e.prototype._checkBars=function(e,t){vari,n;if(void0===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)returnthis._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){
vart=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)returnthis._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}returnthis._cache.bars=e.concat(this._cache.bars),this._checkBars(this._cache.bars,!0),!0},e.prototype._putToCacheNewBar=function(e){vart=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(vart=0;t<e.length;t++)e[t].time=this._dwmAligner.tradingDayToSessionStart(e[t].time)},e._now=function(){returnDate.now()+6e4},e}(),h=function(){functione(e,t){this._threads={},this._datafeed=e,this._dwmAlignerCreator=t}returne.prototype.destroy=function(){this._forEachThread(function(e,t){returnt.destroy()}),this._threads={},deletethis._datafeed},e.prototype.purgeCache=function(){this._forEachThread(function(e,t){returnt.destroy()}),this._threads={}},e.prototype.subscribe=function(e,t,i,o,r){vars,a=n(e,t);returnthis._threads[a]||(this._threads[a]=this._createThread(e,t)),s=this._threads[a].addSubscription(i,o,r),a+'"'+s},e.prototype.unsubscribe=function(e){vart,i,n=e.split('"');if(2!==n.length)returnvoidconsole.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){returnnewc(this._datafeed,e,t,this._dwmAlignerCreator(t,e.timezone,e.session))},e.prototype._forEachThread=function(e){vart=this;Object.keys(this._threads).forEach(function(i){returne(i,t._threads[i])})},e}()},function(e,t,i){"use strict";(function(t,n){functiono(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=newt,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this)),this._chartWidgets=newWeakMap}varr=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(){returnthis._getChartWidgetApi(this._chartWidgetCollection.activeChartWidget.value())},o.prototype._getChartWidgetApi=function(e){vart=this._chartWidgets.get(e);returnvoid0===t&&(t=news(e),
this._lockDrawingsWatchedValue.setValue(h.lockDrawings().value())})),this._lockDrawingsWatchedValue},o.prototype.hideAllDrawingTools=function(){returnnull===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=newn(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(){returnthis._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(e){functiont(){i&&(i(),i=null)}e=e||{};vari=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){functiont(e){i&&(i(e),i=null)}if(e=e||{},!e.callback)throwError("callback must be exist");vari=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(){vare=this._loadChartService;e&&e.showLoadDialog()},o.prototype.showSaveAsChartDialog=function(){vare=this._saveChartService;e&&window.runOrSignIn(function(){e.saveChartAs()})},o.prototype.themes=function(){returnnewy({chartWidgetCollection:this._chartWidgetCollection})},o.prototype.undoRedoState=function(){returnthis._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){functionn(e){vart,i,n=Object.keys(y),o=n.length;for(t=0;t<o;++t)if(i=n[t],y[i].name===e)returni;returnnull}functiono(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}varr=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=newWeakMap,this._studies=newWeakMap,this._lineDataSources=newWeakMap};b.prototype._getPaneApi=function(e){vart=this._panes.get(e);returnvoid0===t&&(t=newu(e),this._panes.set(e,t)),t},b.prototype._getStudyApi=function(e){vart=this._studies.get(e);returnvoid0===t&&(t=newh(e,this._chartWidget.model().model()),this._studies.set(e,t)),t},b.prototype._getLineDataSourceApi=function(e){vart=this._lineDataSources.get(e);returnvoid0===t&&(t=newc(e,this._chartWidget.model().model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:function(e){
vart=this._chartWidget.model().mainSeries().syncModel(),i=this._chartWidget.model().timeScale();returne.map(function(e){varn=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){vart=$.extend({},e);returndeletet.fire,t},b.prototype.executeActionById=function(e){this._chartWidget.executeActionById(e)},b.prototype.getCheckableActionState=function(e){returnthis._chartWidget.getCheckableActionState(e)},b.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},b.prototype.clearMarks=function(){this._chartWidget.clearMarks()},b.prototype.symbol=function(){returnthis._chartWidget.getSymbol()},b.prototype.symbolExt=function(){vare=this._chartWidget.model().mainSeries().symbolInfo();returne?{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type}:null},b.prototype.resolution=function(){returnthis._chartWidget.model().mainSeries().properties().interval.value()},b.prototype.setSymbol=function(e,i){functionn(e){e||i()}if(e!==this.symbol()||t.enabled("same_data_requery")){varo=this._chartWidget.model().mainSeries().dataEvents();returni&&S(o,n),this._chartWidget.setSymbol(e)}},b.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},b.prototype.setResolution=function(e,t){functioni(e){e||t()}if((e=e.toUpperCase())!==this.resolution()){varn=this._chartWidget.model().mainSeries().dataEvents();returnt&&S(n,i),this._chartWidget.setResolution(e)}},b.prototype.setEntityVisibility=function(e,t){vari,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(){returnthis._chartWidget.model().model().allStudies().map(function(e){return{id:e.id(),name:e._metaInfo.description}})},b.prototype.getAllShapes=function(){returnthis._chartWidget.model().model().allLineTools().map(function(e){return{id:e.id(),name:n(e.toolname)}}).filter(function(e){returnnull!==e.name})},b.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},b.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},b.prototype.removeEntity=function(e){vart=this._chartWidget.model().chartModel().dataSourceForId(e);if(!t)returnvoidconsole.warn("Can't find a source with id: "+e);this._chartWidget.model().chartModel().removeSource(t,!0)},b.prototype.createStudyTemplate=function(e){returnthis._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){varn,o,r,s;if(void0===e||!e.from||!e.to||isNaN(e.from)||isNaN(e.to))returnvoidconsole.warn("Wrong time range: "+JSON.stringify(e)+'. Expected an object with "from" and "to" numeric values.')
;vars=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){varn=t.get_timezone(i.timezone),o=new_.Session;returno.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){vars,a,l,c,h,u,d,p,m=f.parsePeriod(i),y=(newDate).valueOf(),g=e.expired?t.cal_to_utc(t.get_timezone(e.timezone),newDate(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=void0===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)returnconsole.error("unsupported resolution for rebuild: "+i),voidthis.listeners.onError("unsupported resolution for rebuild: "+i);this.symbolInfo=r;varh=this;this.engine=newm({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=newg(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){vari=Object.assign({},t);i.nonseries=!0,i.data=t.bars,deletei.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){vari,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=newg(e.info)),(o=t[8])instanceofArray)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(){
this.historyExtrapolator().indexOfBar(t,i))},a.prototype.indexOfBar=function(e,t){this._ensureExtrapolatedToTime(t,1e3*e);vari=s.lower_bound(this._extrapolatedBarsCache,e,function(e,t){returne>t?1:e<t?-1:0});return-1===i?i:this._lastRealBarIndex+i+1},a.prototype._extrapolateData=function(e,t){vari,n,o;if(!this._lastRealBarTime)throwError("No real bars known, so cannot extrapolate anything");if(!(i=t(this._lastRealBarTime))||0===i.length)returnvoid(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 "+newDate(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{vari=this;this._onReadyCallbacks.push(function(){i.ensureExtrapolatedToBar(e,t)})}},a.prototype.ensureExtrapolatedToBar=function(e,t){vari=this;returnthis._requestedAmountOfBars=t,this._extrapolateData(e,function(n){returni._extrapolatedBarsCache.length>=t||!i._shouldExtrapolateMore()?null:s.extrapolateBarsFrontByCount(i.newBarBuilder(e),n,t)})},a.prototype._ensureExtrapolatedToTime=function(e,t){vari=this;returnthis._extrapolateData(e,function(n){varo,r;returnn>=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){vart=r.Symbol.newSession(e.timezone,e.session);returnr.Symbol.newBarBuilder(this._resolution,t)},a.prototype._shouldExtrapolateMore=function(){returnthis._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(vari=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){varn=i(37),o=i(15).Interval,r=function(){functione(e,t){returne}functionr(e,t){vari=m.get_timezone(e.timezone),o=newn.Session;returno.init(i,e.session),f.Symbol.newBarBuilder(t,o,o)}functions(t,i,n,o,r,s){vara,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),
functiono(e){returnnewDate(e).toISOString()}varr,s,a,l,c,h;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DatafeedRequestsCachedProcessor",function(){returnh}),r=i(15),s=i(78),a=i(25),i.n(a),l=i(5),i.n(l),i(86),c=function(){functione(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}returne.prototype.destroy=function(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),deletethis._datafeed},e.prototype.addSubscription=function(e,t,i){varn=this,o=this._getNextSubscriptionId(),r=Math.floor(e.from/1e3),s=Math.floor(e.to/1e3);returnthis._pendingSubscribers.push({key:o,range:{from:r,to:s},onHistoryCallback:t,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){returnn._processPendingSubscribers()},0),o},e.prototype.removeSubscription=function(e){vart,i=this,n=this._pendingSubscribers.find(function(t){returnt.key===e});returnn?voidthis._pendingSubscribers.splice(this._pendingSubscribers.indexOf(n),1):(t=this._subscribers.find(function(t){returnt.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()})))):voidconsole.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(){vare,t,i,n,s,a,l=this,c=this._pendingSubscribers;if(c.length){if(this._requesting)returnvoidthis._logMessage("Processing is skipped due active request");if(this._logMessage("Processing pending subscribers, count="+c.length),this._needPurgeCache&&this._purgeCache(),this._errorMessage)returne=this._errorMessage,this._logMessage("Return error: "+e),this._pendingSubscribers=[],voidc.forEach(function(t){t.onErrorCallback(e)});if(t=c.reduce(function(e,t){returnMath.min(t.range.from,e)},1/0),this._logMessage('Leftmost requested "from" is '+o(1e3*t)),
(!this._leftDate||t<this._leftDate)&&(i=newr.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))returnvoidthis._ensureRequestedTo(t);this._pendingSubscribers=[],c.forEach(function(e){vart=l._moveSubscriberToRealtime(e);l._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()}},e.prototype._moveSubscriberToRealtime=function(e){vart={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};returnthis._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(){vare,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){vari=t.barset;if(null===i)throwError("subscirber.barset is null");i.add(e),t.onHistoryCallback(i)})},t=function(){i._unsubscribeRealtime();vare=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){vari,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||void0),this._endOfData&&null!==this._leftDate&&e.range.from<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)},e.prototype._createBarset=function(e){vart=Object(s.lowerbound)(this._cache.bars,1e3*e,function(e,t){returne.time<t});returnnewa.BarSet(this._symbolInfo,this._cache.bars.slice(t))},e.prototype._ensureRequestedTo=function(t){vari,n,r,s=this;if(this._leftDate&&this._leftDate<t)returnvoidthis._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){vari=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){vari;this._gaps.find(function(e){returne.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){vart=this._gaps.find(function(t){returnt.from<e&&t.to>e});returnt?t.from:null},e.prototype._getNextSubscriptionId=function(){returnthis._nextSubscriptionId++},e.prototype._checkBars=function(e,t){vari,n;if(void0===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)returnthis._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){vart=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time
;if(this._cache.bars=[],!t)returnthis._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}returnthis._cache.bars=e.concat(this._cache.bars),this._checkBars(this._cache.bars,!0),!0},e.prototype._putToCacheNewBar=function(e){vart=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(vart=0;t<e.length;t++)e[t].time=this._dwmAligner.tradingDayToSessionStart(e[t].time)},e._now=function(){returnDate.now()+6e4},e}(),h=function(){functione(e,t){this._threads={},this._datafeed=e,this._dwmAlignerCreator=t}returne.prototype.destroy=function(){this._forEachThread(function(e,t){returnt.destroy()}),this._threads={},deletethis._datafeed},e.prototype.purgeCache=function(){this._forEachThread(function(e,t){returnt.destroy()}),this._threads={}},e.prototype.subscribe=function(e,t,i,o,r){vars,a=n(e,t);returnthis._threads[a]||(this._threads[a]=this._createThread(e,t)),s=this._threads[a].addSubscription(i,o,r),a+'"'+s},e.prototype.unsubscribe=function(e){vart,i,n=e.split('"');if(2!==n.length)returnvoidconsole.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){returnnewc(this._datafeed,e,t,this._dwmAlignerCreator(t,e.timezone,e.session))},e.prototype._forEachThread=function(e){vart=this;Object.keys(this._threads).forEach(function(i){returne(i,t._threads[i])})},e}()},function(e,t,i){"use strict";(function(t,n){functiono(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=newt,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this)),this._chartWidgets=newWeakMap}varr=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(){returnthis._getChartWidgetApi(this._chartWidgetCollection.activeChartWidget.value())},o.prototype._getChartWidgetApi=function(e){vart=this._chartWidgets.get(e);returnvoid0===t&&(t=news(e),this._chartWidgets.set(e,t)),t},o.prototype.onActiveChartChanged=function(){
o.prototype.hideAllDrawingTools=function(){returnnull===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=newn(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(){returnthis._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(e){functiont(){i&&(i(),i=null)}e=e||{};vari=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){functiont(e){i&&(i(e),i=null)}if(e=e||{},!e.callback)throwError("callback must be exist");vari=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(){vare=this._loadChartService;e&&e.showLoadDialog()},o.prototype.showSaveAsChartDialog=function(){vare=this._saveChartService;e&&window.runOrSignIn(function(){e.saveChartAs()})},o.prototype.themes=function(){returnnewy({chartWidgetCollection:this._chartWidgetCollection})},o.prototype.undoRedoState=function(){returnthis._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){functionn(e){vart,i,n=Object.keys(y),o=n.length;for(t=0;t<o;++t)if(i=n[t],y[i].name===e)returni;returnnull}functiono(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}varr=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=newWeakMap,this._studies=newWeakMap,this._lineDataSources=newWeakMap};b.prototype._getPaneApi=function(e){vart=this._panes.get(e);returnvoid0===t&&(t=newu(e),this._panes.set(e,t)),t},b.prototype._getStudyApi=function(e){vart=this._studies.get(e);returnvoid0===t&&(t=newh(e,this._chartWidget.model().model()),this._studies.set(e,t)),t},b.prototype._getLineDataSourceApi=function(e){vart=this._lineDataSources.get(e);returnvoid0===t&&(t=newc(e,this._chartWidget.model().model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:function(e){vart=this._chartWidget.model().mainSeries().syncModel(),i=this._chartWidget.model().timeScale();returne.map(function(e){
varn=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){vart=$.extend({},e);returndeletet.fire,t},b.prototype.executeActionById=function(e){this._chartWidget.executeActionById(e)},b.prototype.getCheckableActionState=function(e){returnthis._chartWidget.getCheckableActionState(e)},b.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},b.prototype.clearMarks=function(){this._chartWidget.clearMarks()},b.prototype.symbol=function(){returnthis._chartWidget.getSymbol()},b.prototype.symbolExt=function(){vare=this._chartWidget.model().mainSeries().symbolInfo();returne?{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type}:null},b.prototype.resolution=function(){returnthis._chartWidget.model().mainSeries().properties().interval.value()},b.prototype.setSymbol=function(e,i){functionn(e){e||i()}if(e!==this.symbol()||t.enabled("same_data_requery")){varo=this._chartWidget.model().mainSeries().dataEvents();returni&&S(o,n),this._chartWidget.setSymbol(e)}},b.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},b.prototype.setResolution=function(e,t){functioni(e){e||t()}if((e=e.toUpperCase())!==this.resolution()){varn=this._chartWidget.model().mainSeries().dataEvents();returnt&&S(n,i),this._chartWidget.setResolution(e)}},b.prototype.setEntityVisibility=function(e,t){vari,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(){returnthis._chartWidget.model().model().allStudies().map(function(e){return{id:e.id(),name:e._metaInfo.description}})},b.prototype.getAllShapes=function(){returnthis._chartWidget.model().model().allLineTools().map(function(e){return{id:e.id(),name:n(e.toolname)}}).filter(function(e){returnnull!==e.name})},b.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},b.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},b.prototype.removeEntity=function(e){vart=this._chartWidget.model().chartModel().dataSourceForId(e);if(!t)returnvoidconsole.warn("Can't find a source with id: "+e);this._chartWidget.model().chartModel().removeSource(t,!0)},b.prototype.createStudyTemplate=function(e){returnthis._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){varn,o,r,s;if(void0===e||!e.from||!e.to||isNaN(e.from)||isNaN(e.to))returnvoidconsole.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)],
;if("LineToolPolyline"===s.name)r[0].price===r[r.length-1].price&&r[0].index===r[r.length-1].index||r.push(r[0]);elseif("LineToolIcon"===s.name){if(t.icon=t.icon||t.overrides&&t.overrides.icon,!t.hasOwnProperty("icon"))throwError("icon must be specified in options");if(-1===p.indexOf(t.icon))throwError("icon value must be valid");t.overrides=t.overrides||{},t.overrides.icon=t.icon}if(a=newd(s.name.toLowerCase()),t.overrides)for(lint.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())throwError("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);returnt.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){vart=this._chartWidget.model().model().getLineToolById(e);if(null===t)throwError("There is no such shape");returnthis._getLineDataSourceApi(t)},b.prototype.createStudy=function(e,t,i,n,o,c,h){varu,d,p,_,f,m;returnh=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),deleted.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){vart=this._chartWidget.model().model().getStudyById(e);if(null===t)throwError("There is no such study");returnthis._getStudyApi(t)},b.prototype.chartType=function(){returnthis._chartWidget.model().mainSeries().properties().style.value()},b.prototype.setChartType=function(e){this._chartWidget.model().mainSeries().properties().style.setValue(e)},b.prototype.priceFormatter=function(){returnthis._chartWidget.model().mainSeries().priceScale().formatter()},b.prototype.onDataLoaded=function(){returnthis._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())},b.prototype.onSymbolChanged=function(){returnthis._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().symbolResolved())},b.prototype.onIntervalChanged=function(){returnthis._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())},b.prototype.onVisibleRangeChanged=function(){
returnthis._makeSubscriptionFromDelegate(this._chartWidget.model().timeScale().visibleBarsChanged())},b.prototype.dataReady=function(e){vart=!this._chartWidget.model()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();returne&&(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(){returnthis._chartWidget.model().chartModel().panes().map(function(e){returnthis._getPaneApi(e)},this)},b.prototype.exportData=function(e){vart=this._chartWidget;returnnewPromise(function(n){i.e(26).then(function(o){varr=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";varn=function(){functione(e){returne.is_price_study}functiont(e,t){vari,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)returne[i];throwError("Can't find metainfo for `"+t+"`")}throwError("There is no studies metainfo at all")}functioni(e){returne.inputs.map(function(e){return{id:e.id,type:e.type,name:e.name}})}functionn(n,o){varr,a,l,c,h,u,d,p,_;if(!Array.isArray(n))returnr=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}}functiono(e,n,o){functionr(e){returne.name.toLowerCase()===a}vars,a,l,c=t(o.model().studiesMetaData(),e),h=i(c),u={};for(sinn)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}}varr={},s={bool:function(e){return!!e},integer:function(e){returnparseInt(e)},float:function(e){returnparseFloat(e)},string:function(e){returne}};returnr.getStudyRecordFromArray=function(e,t){returnt=t||chartWidget,n(e,t)},r.getStudyRecordFromObject=function(e,t,i){returni=i||chartWidget,o(e,t,i)},r}();e.exports=n},function(e,t,i){"use strict";varn,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"LineDataSourceApi",function(){returnr}),n=i(12),i.n(n),o=["alwaysShowStats","clonable","entryPrice","interval","lastUpdateTime","points","singleChartOnly","snapTo45Degrees","stopPrice","symbol","targetPrice"],r=function(){functione(e,t,i){this._source=e,this._model=t,this._pointsConverter=i}returne.prototype.isSelectionEnabled=function(){returnthis._source.isSelectionEnabled()},e.prototype.setSelectionEnabled=function(e){this._source.setSelectionEnabled(e)},e.prototype.isSavingEnabled=function(){
returnthis._source.isSavedInChart()},e.prototype.setSavingEnabled=function(e){this._source.setSavingInChartEnabled(e)},e.prototype.isShowInObjectsTreeEnabled=function(){returnthis._source.showInObjectTree()},e.prototype.setShowInObjectsTreeEnabled=function(e){this._source.setShowInObjectsTreeEnabled(e)},e.prototype.isUserEditEnabled=function(){returnthis._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(){returnthis._source.properties().state(o,!0)},e.prototype.setProperties=function(e){this._setProps(this._source.properties(),e,"")},e.prototype.getPoints=function(){returnthis._pointsConverter.dataSourcePointsToPriced(this._source.points())},e.prototype.setPoints=function(e){vart,i,n=this._source.pointsCount(),o=-1===n?this._source.points().length:n;if(o!==e.length)throwError("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){varo,r,s;for(oint)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";varn,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyApi",function(){returns}),n=i(1),i(11),o=i(7),i.n(o),r=i(162),s=function(){functione(e,t){this._study=e,this._model=t}returne.prototype.isUserEditEnabled=function(){returnthis._study.userEditEnabled()},e.prototype.setUserEditEnabled=function(e){this._study.setUserEditEnabled(e)},e.prototype.getInputsInfo=function(){returnthis._study.metaInfo().inputs.map(function(e){returnn.a({},e,{localizedName:void0!==e.name?window.t(e.name,{context:"input"}):""})})},e.prototype.getInputValues=function(){vare=this._study.inputs();returnObject.keys(e).map(function(t){return{id:t,value:e[t]}})},e.prototype.setInputValues=function(e){vart,i,n,o=this.getInputValues(),r=function(e){void0!==o.find(function(t){returnt.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){vart,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":
if(a=i+" "+d,!(s=f[a]||f["* "+d])){l=void0;for(uinf)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)))}}returnt}functionE(){try{returnnewwindow.XMLHttpRequest}catch(e){}}functionC(){try{returnnewwindow.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}functionS(){returnsetTimeout(O,0),gt=_t.now()}functionO(){gt=void0}functionN(e,t){varn={};return_t.each(ht.concat.apply([],ht.slice(0,t)),function(){n[this]=e}),n}functionP(e){if(!ut[e]){vart=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&<.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}returnut[e]}functionj(e){return_t.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}varA,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(){functione(){if(!i.isReady){try{bt.documentElement.doScroll("left")}catch(t){returnvoidsetTimeout(e,1)}i.ready()}}vart,n,r,o,i=function(e,n){returnnewi.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={};returni.fn=i.prototype={constructor:i,init:function(e,t,n){varr,o,a,s;if(!e)returnthis;if(e.nodeType)returnthis.context=this[0]=e,this.length=1,this;if("body"===e&&!t&&bt.body)returnthis.context=bt,this[0]=bt.body,this.selector=e,this.length=1,this;if("string"==typeofe){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])returnt=tinstanceofi?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){
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.