").appendTo(l);D75.enabled("link_to_tradingview")&&$('').append(o).appendTo(h),i&&a.addClass("on-pane")}:function(e,t,i){if(D75.enabled("link_to_tradingview")){t=t||Q1._jqMainDiv,$(t).find(".onchart-tv-logo").remove();var r=$('').appendTo(t);D75.enabled("minimalistic_logo")?r.on("mouseenter",function(){$(this).addClass("expanded")}).on("mouseleave",function(){$(this).removeClass("expanded")}):r.addClass("expanded"),i&&r.addClass("on-pane")}};var m=D75.enabled("widget_logo")&&"true"!=urlParams.disableLogo;if(m&&(Q1.createLogo=g,D75.enabled("show_logo_on_all_charts")&&(_.createLogo=g.bind(this)),D75.enabled("move_logo_to_main_pane")||Q1.withModel(null,g)),TradingView.tokenInitialized.resolve(),urlParams.toolbarbg){var y="#"+urlParams.toolbarbg;$(".tv-side-toolbar").css("background-color",y),$(".chart-controls-bar").css("background-color",y),$("#chart-area").css("background-color",y),e.css("background-color",y),$("#footer-chart-panel").css("background-color",y)}TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||$68.setSearchRequestDelay(Math.max(0,+urlParams.ssreqdelay));var w=new a({container:$(".tv-side-toolbar"),Q4:_,onWidget:!0,enabledDrawings:urlParams.enabledDrawings?JSON.parse(urlParams.enabledDrawings):[],disabledDrawings:urlParams.disabledDrawings?JSON.parse(urlParams.disabledDrawings):[],drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,forceVisible:"false"==urlParams.hideSideToolbar&&!!D75.enabled("left_toolbar")});window.sideToolbar=w,window.lineToolPropertiesToolbar=new s(_),Q1.onDisconnected().subscribe(null,function(e){e&&window.showCriticalErrorMessage()}),$(".tv-content").bind("contextmenu",function(e){var t=$(e.originalEvent.target);return t.is("input")||t.is("textarea")?void 0:!1}),u.resolve(),function(){function e(e){Q1.withModel(null,function(){if(Q1.model().mainSeries().bars().size()>0)e();else{var t=function(){e(),Q1.model().mainSeries().onBarReceived().unsubscribe(null,t)};Q1.model().mainSeries().onBarReceived().subscribe(null,t)}})}window.widgetReady=e;for(var t=0;te||e>v())throw"Incorrect index: "+e;return new TradingView.ChartWidgetApi(window.Q4.getAll()[e])};var m=window.activeChart=function(){return new TradingView.ChartWidgetApi(window.Q4.activeChartWidget.value())};window.changeSymbol=function(e,t,i){$44.interval.setValue(t),$44.symbol.setValue(e),i&&m().onDataLoaded().subscribe(null,i,!0)},window.resizeWindow=function(){$(window).resize()},window.mainSeriesPriceFormatter=function(){return Q1.model().mainSeries().priceScale().formatter()}},function(e,t,i){"use strict";function r(e){function t(e,t){for(var i=[],r=n[q].count,o=0;r>o;o++)i.push(W[o].Q1.state(e,t));var a={layout:q,charts:i};return K.value()&&(a.symbolLock=1),X.value()&&(a.intervalLock=1),TradingView.drawingState.hideAllDrawings().value()&&(a.hideAllDrawings=!0),a}function i(e){for(var t=$.Deferred(),i=[],r=n[q].count,o=0;r>o;o++)i.push(W[o].Q1.asyncState(e));return $.when.apply($,i).then(function(){for(var e={charts:[]},i=0;ir||rr){if(W[r]){ae.append(W[r].wrap),W[r].Q1.isDetached=!1;var a=Y.shift();a&&W[r].Q1.loadContent(a.content)}else h($.extend({},re,Y.shift()||(N.value()?{content:N.value().state()}:null)||{},0===r||K.value()?{}:{defSymbol:null}));W[r].wrap.toggleClass("multiple",i>1),s(r)}else W[r]&&(W[r].Q1.isDetached=!0,W[r].wrap.detach())}c(),Q15.emit("layout_changed")}function c(){var e=Math.min(j.count,W.length)-1;if(0>e)return void N.deleteValue();var t=U;0>t&&(t=0),t>e&&(t=e),N.setValue(W[t].Q1)}function u(){for(var e=W.length;e--;){var t=e===U;W[e].wrap.toggleClass("active",t).toggleClass("inactive",!t)}}function _(){return $.grep(W,function(e){return!e.Q1.isDetached}).sort(function(e,t){var i=e.metrics.top,r=t.metrics.top,n=e.metrics.left,o=t.metrics.left;return i===r?o>n?-1:n>o?1:0:r>i?-1:1})}function f(){var e=O.layout.value();if("s"!==e){var t=n[e].count;ie.value()||(H=_());var i=z+1,r=H[i];!r||i>t?(r=H[0],z=0):z=i,N.setValue(r.Q1);var o=ie.value();o&&p(e,!0)}}function g(e){if(pe!==e){if(pe){pe.modelCreated().unsubscribe(null,v);var t=pe.model();if(t){var i=t.mainSeries().properties();i.style.unsubscribe(null,m);var r=t.model();r.onSelectedSourceChanged().unsubscribe(null,y),pe=null}}if(e){var n=e.model();n?v(n):e.modelCreated().subscribe(null,v),pe=e}}}function v(e){var t=e.mainSeries().properties();t.style.subscribe(null,m),m(t.style);var i=e.model();i.onSelectedSourceChanged().subscribe(null,y),y(e.selectedSource())}function m(e){de.setValue(e.value())}function y(e){he.setValue(e)}function w(e){if(e!==K.value()){if(a.UndoHistory.beginUndoMacro("Symbol Lock"),e)for(var t=N.value(),i=t.getSymbol(),r=0;rr;r++)t.push(W[r].Q1.images());return{layout:q,hidpiRatio:window.hidpiCanvasRatio||1,charts:t}}function P(){for(var e=[],t=0;tn;n++){var o=W[n].Q1;if(o!==t){var a=o.model();a&&a.model().setExternalPosition(e)}}}function E(){return W.forEach(function(e){e.Q1.destroy()})}function V(){oe.id.setValue(void 0),oe.uid.setValue(void 0),oe.name.setValue(void 0)}function I(){var t={snapshotUrl:e.snapshotUrl},i=D75.enabled("show_dialog_on_snapshot_ready")?TradingView.getImageOfChart:TradingView.getImageOfChartSilently;i(this,t,function(e){le.fire(e)})}function A(){for(var e=n[q].count;e=0;t--){var i=e[t];if(!$.isArray(i.value))return!0;for(var r=i.value.length-1;r>0;r--){var n=i.value[r];if(null!==n&&void 0!==n&&!TradingView.isNaN(n))return!0}}return!1}if(!D75.enabled("alerts"))return!1;var i=function(){return e.data()&&!e.data().isEmpty()&&t(e.data())},r=e.uniqueId&&e.uniqueId(),n=e===this.D98.mainSeries(),o=e instanceof f,a=!(e instanceof T||e instanceof w||e instanceof y),s=e.metaInfo?e.metaInfo():null,l=s?s.isTVScript:!1,d=s?s.isTVScriptStrategy:!1,h=function(){var t=e.stateForAlert&&e.stateForAlert();return t?x.prototype._getPlotsFromDatasourceState(t).length:!1},p=s?-1!=$.inArray(s.fullId,this._alertsStudiesList):!1;return r&&!d&&(n||o&&a&&i()&&(p||l&&h()))},r._filterAuthorizedMetaInfo=function(e){for(var t=[],i=0;e&&i0?this.model().zoomIn(s,l):0>r&&this.model().zoomOut(s,l),i&&this.model().scrollChart(-80*i),!1}}.bind(this)),this._initBarsMarksSources(),TradingView.Q16("esdindicatorfeature")&&this.initESDTimelineWidget(),this._containsData||this._createChartEventsSource(),this.setAutoScaleOnSymbolChange(),this.readOnly()||this._hideSymbolSearch||$68.registerDialogKeypressHandler(this),this.adaptOnChartLogo()},r.prototype._checkObsoleteTimezone=function(){var e=this.Q0.timezone.value();TradingView.timezoneIsAvailable(e)||this.Q0.timezone.setValue(TradingView.getTzByObsoleteName(e))},r.prototype._initBarsMarksSources=function(){var e=this;this.withModel(this,function(){this.model().barsMarksSources().map(function(t){t.onNeedRepaint.subscribe(e,e.paint)})})},r.prototype.initESDTimelineWidget=function(){new b(this)},r.prototype.setAutoScaleOnSymbolChange=function(){this.withModel(this,function(){this.model().mainSeries().properties().symbol.listeners().subscribe(this,function(){(!this.model().mainSeries()instanceof TradingView.Series||!this.model().mainSeries().properties().lockScale.value())&&this.model().mainSeries().priceScale().setAutoScale(!0)})})},r.prototype.initColors=function(){this.Q0.paneProperties.background.listeners().subscribe(this,r.prototype.setBackgroundColor),this.Q0.paneProperties.vertGridProperties.color.listeners().subscribe(this,r.prototype.redrawPanes),this.Q0.paneProperties.horzGridProperties.color.listeners().subscribe(this,r.prototype.redrawPanes),this.Q0.scalesProperties.lineColor.listeners().subscribe(this,r.prototype.setScaleLineColor),this.Q0.scalesProperties.textColor.listeners().subscribe(this,r.prototype.setScaleTextColor)},r.prototype.paneWidgets=function(){return this._paneWidgets},r.prototype.paneByCanvas=function(e){for(var t=0;ts;s++){var d=n[s];TradingView.isInherited(d.constructor,g)&&d.isUserDeletable()&&(o=!0),TradingView.isInherited(d.constructor,f)&&d.removeByRemoveAllStudies()&&(a=!0)}this._readOnly||(r.paneRemoveAllStudies&&r.paneRemoveAllStudies.setEnabled(a),r.paneRemoveAllDrawingTools&&r.paneRemoveAllDrawingTools.setEnabled(o),r.paneRemoveAllStudiesDrawingTools&&r.paneRemoveAllStudiesDrawingTools.setEnabled(a||o)),e(TradingView.getThemesList(e)),window.studyTemplates&&(t(),studyTemplates.refreshStudyTemplateList(t));var h=this,p=[],c=TradingView.availableTimezones,u=function(e){return e.id===h.model().model().properties().timezone.value()};c.forEach(function(e){if(!e.separator){var t=new TradingView.Action({text:e.title,checkable:!0,checked:u(e)});t.callbacks().subscribe(this,function(){h.model().setProperty(h.model().model().properties().timezone,e.id,"Changed Time Zone")}),p.push(t)}},this),r.applyTimeZone.subActions=p,r.addToWatchlist.text=$.t("Add {0} To Watchlist").format(this.getSymbol(!0)),r.addToTextNotes&&(r.addToTextNotes.text=$.t("Add Text Note For {0}").format(this.getSymbol(!0))),this.updateActionForIntradayOnly(r.sessionBreaks)},r.prototype.actions=function(){return this._actions||this._setActions(),this._actions},r.prototype._setActions=function(){var e=i(179).ActionBinder,t=this,n=[];if(!this._readOnly){n=[new TradingView.Action({text:$.t("Eraser"),callbackContext:"eraser"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Trend Line"),callbackContext:"LineToolTrendLine"}),new TradingView.Action({text:$.t("Horizontal Line"),callbackContext:"LineToolHorzLine"}),new TradingView.Action({text:$.t("Vertical Line"),callbackContext:"LineToolVertLine"}),new TradingView.Action({text:$.t("Arrow"),callbackContext:"LineToolArrow"}),new TradingView.Action({text:$.t("Ray"),callbackContext:"LineToolRay"}),new TradingView.Action({text:$.t("Extended"),callbackContext:"LineToolExtended"}),new TradingView.Action({text:$.t("Parallel Channel"),callbackContext:"LineToolParallelChannel"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Pitchfork"),callbackContext:"LineToolPitchfork"}),new TradingView.Action({text:$.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork"}),new TradingView.Action({text:$.t("Pitchfan"),callbackContext:"LineToolPitchfan"}),new TradingView.Action({text:$.t("Gann Square"),callbackContext:"LineToolGannSquare"}),new TradingView.Action({text:$.t("Gann Fan"),callbackContext:"LineToolGannFan"}),new TradingView.Action({text:$.t("Fib Retracement"),callbackContext:"LineToolFibRetracement"}),new TradingView.Action({text:$.t("Trend-Based Fib Extension"),callbackContext:"LineToolTrendBasedFibExtension"}),new TradingView.Action({text:$.t("Fib Speed Resistance Fan"),callbackContext:"LineToolFibSpeedResistanceFan"}),new TradingView.Action({text:$.t("Fib Time Zone"),callbackContext:"LineToolFibTimeZone"}),new TradingView.Action({text:$.t("Circle Lines"),callbackContext:"LineToolCircleLines"}),new TradingView.Action({text:$.t("Fib Circles"),callbackContext:"LineToolFibCircles"}),new TradingView.Action({text:$.t("Fib Speed Resistance Arcs"),callbackContext:"LineToolFibSpeedResistanceArcs"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Rectangle"),callbackContext:"LineToolRectangle"}),new TradingView.Action({text:$.t("Ellipse"),callbackContext:"LineToolEllipse"}),new TradingView.Action({text:$.t("Triangle"),callbackContext:"LineToolTriangle"}),new TradingView.Action({text:$.t("Polyline"),callbackContext:"LineToolPolyline"}),new TradingView.Action({text:$.t("Arc"),callbackContext:"LineToolArc"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Text"),callbackContext:"LineToolText"}),new TradingView.Action({text:$.t("Anchored Text"),callbackContext:"LineToolTextAbsolute"}),new TradingView.Action({text:$.t("Balloon"),callbackContext:"LineToolBalloon"}),new TradingView.Action({text:$.t("Price Label"),callbackContext:"LineToolPriceLabel"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Elliott Wave Subminuette"),callbackContext:"LineToolElliottSubminuette"}),new TradingView.Action({text:$.t("Elliott Wave Minor"),callbackContext:"LineToolElliottMinor"}),new TradingView.Action({text:$.t("Elliott Wave Circle"),callbackContext:"LineToolElliottCircle"}),new TradingView.Action({text:$.t("Elliott Minor Retracement"),callbackContext:"LineToolElliottMinorRetr"}),new TradingView.Action({text:$.t("Elliott Major Retracement"),callbackContext:"LineToolElliottMajorRetr"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Brush"),callbackContext:"LineToolBrush"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Forecast"),callbackContext:"LineToolPrediction"})];for(var t=this,o=function(e){TradingView.drawingState.tool.setValue(e.callbackContext())},s=0;s'),this.$shield=$('').appendTo(this.$element),this.$element.appendTo(t),this._showed=!1,this._cw.withModel(this,this._connectToModel)},r.LoadingScreen.prototype._connectToModel=function(){this._cw.model().mainSeries().onDataLoaded().subscribe(this,function(e){switch(e.method){case"symbol_error":"permission denied"!==e.params[1]&&this.hide();break;case"series_error":D75.enabled("hide_loading_screen_on_series_error")&&this.hide();break;case"series_completed":this.hide()}})},r.LoadingScreen.prototype.show=function(){return this._cw._inLoadingState=!0,this._showed||this._cw.isDetached||(this._showed=!0,this._show()),$.Deferred().resolve()},r.LoadingScreen.prototype._show=function(){var e=this._cw.properties().paneProperties.background.value();this.$shield.css("background",e),this.$element.addClass("fade")},r.LoadingScreen.prototype.hide=function(){delete this._cw._inLoadingState,this._showed&&this._hide()},r.LoadingScreen.prototype._hide=function(){this._showed=!1,this.$element.removeClass("fade")},r.LoadingScreen.prototype.$canvas=null,r.LoadingScreen.prototype.context=null,r.prototype._makeMasterTable=function(){this._jqMainTable=$(document.createElement("table")),this._jqMainTable.appendTo(this._jqMainDiv),this._jqMainTable.addClass("chart-markup-table"),this._jqMainTable.attr("cellpading","0"),this._jqMainTable.attr("cellspacing","0")},r.prototype.unsetActivePaneWidget=function(){this.activePaneWidget=!1},r.prototype.setActivePaneWidget=function(e){this.activePaneWidget=e},r.prototype.isMaximizedPane=function(){return!!this._maximizedPaneWidget},r.prototype.toggleMaximizePane=function(e){if(!(this._paneWidgets.length<2)){this._maximizedPaneWidget?(this._maximizedPaneWidget=null,this._paneSeparators.forEach(function(e){e.show()})):(this._maximizedPaneWidget=e,this._paneSeparators.forEach(function(e){e.hide()}));for(var t=this._paneWidgets.length;t--;)this._paneWidgets[t].updateControls();this._adjustSize(),this.updateIndicatorImagePosition()}},r.prototype._makePaneWidgetsAndSeparators=function(){for(var e=this.D98.panes(),t=e.length,i=this._paneWidgets.length,r=t;i>r;r++){var n=this._paneWidgets.pop();n.jqRow.remove(),n.jqRow.find("*").remove(),n.destroy();var a=this._paneSeparators.pop();a&&a.jqRow.remove()}for(var r=i;t>r;r++){var n=new o(this,e[r],this._onWidget);if(n.onMouseLeave=this.unsetActivePaneWidget.bind(this),n.onMouseEnter=this.setActivePaneWidget.bind(this),this._paneWidgets.push(n),r>0){var a=new $51(this,r-1,r);this._paneSeparators.push(a),this._timeAxisWidget?a.jqRow.insertBefore(this._timeAxisWidget.jqRow):a.jqRow.appendTo(this._jqMainTable)}this._timeAxisWidget?n.jqRow.insertBefore(this._timeAxisWidget.jqRow):n.jqRow.appendTo(this._jqMainTable)}for(var r=0;t>r;r++){var s=e[r],n=this._paneWidgets[r];n.state()!==s&&n.setState(s)}for(var r=t;r--;)this._paneWidgets[r].updateControls()},r.prototype._makeTimeAxisWidget=function(){this._timeAxisWidget||(this._timeAxisWidget=new h(this,this._onWidget),this._timeAxisWidget.jqRow.appendTo(this._jqMainTable))},r.prototype.insertStudyOrShowDialog=function(e){if(this.isSymbolicStudy(e)){var t=defaults("study_"+e.id).description;$82.showAddSymbolDialog(this,{title:t,okButtonTitle:$.t("Apply"),callback:function(t,i){var r={inputs:{symbol:t}};this.model().insertStudy(e,r,i)}.bind(this)})}else if(this.hasConfirmInputs(e)){var t=defaults("study_"+e.id).description;i(186),$82.showConfirmInputsDialog(this,e,{title:t,okButtonTitle:$.t("Apply"),callback:function(t){this.model().insertStudy(e,t,!1)}.bind(this)})}else if(f.isPointsBasedStudy(e.id)){var r=f.lineToolNameForPointsBasedStudy(e.id);TradingView.drawingState.tool.setValue(r)}else{var n="Volume@tv-basicstudies"==e.id;this.insertStudy(e.id,!0,n)}},r.prototype.hasConfirmInputs=function(e){var t=e.inputs;if(void 0===t)return!1;for(var i=0;i 0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state},r.prototype.updateSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.updateUI()},r.prototype.tickSeriesControlClock=function(){this._seriesControlWidget&&this._seriesControlWidget.tickClock()},r.prototype.resizeSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.resizeUI()},r.prototype.updateUndoRedo=function(){a.UndoHistory.undoStack().isEmpty()?this.actions().undo.setEnabled(!1):this.actions().undo.setEnabled(!0),a.UndoHistory.redoStack().isEmpty()?this.actions().redo.setEnabled(!1):this.actions().redo.setEnabled(!0)},r.prototype.createSessionBreaksActions=function(e){var t,r=i(179).ActionBinder,n=this,o=function(){t=new TradingView.Action({text:$.t("Session Breaks"),checkable:!0}),t.binder=new r(t,n.model().mainSeries().sessionsStudy().properties().graphics.vertlines.sessBreaks.visible,n.model(),"Session Breaks"),n._actions.sessionBreaks=t};n.model().mainSeries().sessionsStudy()?o():n.model().mainSeries().onSessionsStudyCreated().subscribe(n,function(){o()})},r.prototype.updateActionForIntradayOnly=function(e){!e||!e instanceof TradingView.Action||e.setEnabled(!!this.model().mainSeries().isIntradayInterval())},r.prototype.withModel=function(e,t){this.model()?t.call(e):this.modelCreated().subscribe(e,t,!0)},r.prototype.containsVolume=function(){return this.model().Q17().some(function(e){return e instanceof f&&"Volume"==e.metaInfo().shortId})},r.prototype.containsStudy=function(e){return this.D98?this.D98.Q17().some(function(t){if(!(t instanceof f))return!1;var i=t.metaInfo();return i.id===e||i.fullId===e}):!1},r.prototype.containsSessions=function(){return this.model().Q17().some(function(e){return e instanceof f&&"Sessions"==e.metaInfo().shortId})},r.prototype.isSmall=function(e){return this.constructor.isSmall(this._jqParent)},r.isSmall=function(e){return e.width()<550||e.height()<300},r.prototype.onWidget=function(){return this._onWidget},r.prototype.onCmeWidget=function(){return"cme"===this.widgetCustomer()},r.prototype.widgetCustomer=function(){return this._widgetCustomer},r.prototype.resize=function(){this._resizeHandler&&this._jqMainDiv&&this._resizeHandler()},r.prototype.chartSession=function(){return this._chartSession},r.prototype.maxLhsPriceAxisWidth=0,r.prototype.maxRhsPriceAxisWidth=0,r.prototype.GUIResetScales=function(){TradingView.trackEvent("GUI","Reset Scales"),this.model()&&(this._containsData&&this.model().chartModel().restoreAxisState(this._content),this.model().resetScales())},r.prototype.onLineCancelled=function(){TradingView.drawingState.resetToCursor()},r.prototype.createIndicatorImage=function(){var e=this;this.indicatorImage=$('').appendTo(this._jqMainDiv),D75.enabled("display_market_status")&&(this.indicatorText=$('').appendTo(this.indicatorImage),this.indicatorDot=this.indicatorText.find(".dot")),e.withModel(null,function(){var t=e.D98.mainSeries();t.onStatusChanged().subscribe(null,e.updateIndicatorImage.bind(e)),t.marketStatus.subscribe(e.updateIndicatorImage.bind(e)),e.updateIndicatorImage(),e.checkCompactMode(),e.D98.onRearrangePanes().subscribe(null,function(){e.resetIndicatorSize(),e.resizeIndicator()})}),e.rhsPriceAxisWidthChanged.subscribe(e,e.updateIndicatorImagePosition),e.updateIndicatorImagePosition()},r.prototype.updateIndicatorImage=function(){function e(e,t){return a.hasOwnProperty(e)?a[e]:t}var t=this.indicatorImage;if(this.indicatorImage){var i=this.D98;if(i){var r=i.mainSeries(),n=r.status(),o=this._statusDetails(),a=null;a=o.hasOwnProperty(n)?o[n]:o.defaults,t.attr("title",e("title","")),this._updateDataAndMarketStatus(r.marketStatus.value(),r.status())}}},r.prototype.checkCompactMode=function(){this._jqMainDiv&&this._jqMainDiv.toggleClass("i-compact",this._jqMainDiv.width()<=400),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth())},r.prototype._statusDetails=function(){return this.__statusDetails||(this.__statusDetails={},this.__statusDetails[TradingView.Series.STATUS_SNAPSHOT]={className:"snapshot",text:"",showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_LOADING]=this.__statusDetails[TradingView.Series.STATUS_RESOLVING]={className:"loading",text:$.t("loading data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_INVALID_SYMBOL]={className:"invalid",text:$.t("invalid symbol"),showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_NO_BARS]={className:"invalid",text:$.t("no bars"),showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_OFFLINE]={className:"connecting",text:$.t("retrying"),priority:1},this.__statusDetails[TradingView.Series.STATUS_EOD]=this.__statusDetails[TradingView.Series.STATUS_PULSE]={className:"eod",text:$.t("eod data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED]={className:"delayed",title:$.t("Quotes are delayed by 10 min and updated every 30 seconds"),text:$.t("eod delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED_STREAMING]={className:"delayed-streaming",text:$.t("delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_READY]=this.__statusDetails.defaults={className:"realtime",text:$.t("realtime"),priority:-1},this.__statusDetails.pre_market={text:$.t("pre-market"),className:"pre-market",priority:0},this.__statusDetails.post_market={text:$.t("post-market"),className:"post-market",priority:0},this.__statusDetails.out_of_session={text:$.t("closed"),className:"out-of-session",priority:0},this.__statusDetails.market=this.__statusDetails.defaults),this.__statusDetails},r.prototype._updateDataAndMarketStatus=function(e,t){if(void 0!==this.indicatorText){var i=this._resultingStatusRecord(e,t);this.indicatorText.removeClass().addClass("series-status-text "+i.className).find(".text").html(i.text),this.indicatorDot.attr("title",i.text),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth()),this.resizeIndicator()}},r.prototype.resetIndicatorSize=function(){if(this._paneWidgets[0]&&this._paneWidgets[0].legendWidget)for(var e=0;ei.priority?r:i}return this._statusDetails()[t]},r.prototype.updateIndicatorImagePosition=function(){var e=this.indicatorImage;this.indicatorImage&&e.css("marginRight",this.maxRhsPriceAxisWidth)},r.prototype._startSpinner=function(e){if("function"==typeof Spinner&&!this._spinner){var t=$(e).get(0);t&&(this._spinner=TradingView.unifiedSpinner("",{zIndex:"auto"}).spin(t))}},r.prototype.isJustClonedChart=function(){return!!(this._options||{}).justCloned},r.prototype.getLastPaneLeftBottom=function(){var e=this._paneWidgets[this._paneWidgets.length-1].jqPane,t=e.offset();return{left:t.left,bottom:$(document.body).height()-t.top-e.height()}},r.prototype.setDataWindowWidget=function(e){this._dataWindowWidget=e},r.prototype.removeDataWindowWidget=function(){this._dataWindowWidget=null},D75.enabled("datasource_copypaste")&&(r.prototype.onAppClipboardPaste=function(e,t){TradingView.logDebugChart("[[paste]]"),this.D98&&this.D98.pasteSourceFromClip(e,t);
-},r.prototype.onAppClipboardCopy=function(e){TradingView.logDebugChart("[[copy]]"),this.D98&&this.D98.copySourceToClip(e||this.D98.selectedSource())},r.prototype.onAppClipboardCut=function(e){TradingView.logDebugChart("[[cut]]"),this.D98&&this.D98.cutSourceToClip(e||this.D98.selectedSource())}),r.prototype.applyOverrides=function(e){applyPropertiesOverrides(this.properties(),null,!1,e),this.D98&&(applyPropertiesOverrides(this.D98.model().properties(),null,!1,e),applyPropertiesOverrides(this.D98.mainSeries().properties(),null,!1,e,"mainSeriesProperties"))},r.prototype.setActive=function(e){var t=this.actions();for(var i in t)t.hasOwnProperty(i)&&this.actions()[i].setActive(e)},r.Performance=function(e){this.chartDrawTypes=["cursor","light","full","light_partial"],this.chartDraw={},this.lastValues={},this.cma={},this.slowReports=[],this.Q1=e,this.chartDrawTypes.forEach(function(e){this.chartDraw[e]=this.emptyStatObj(),this.lastValues[e]=[]}.bind(this)),this.initialTimeout=setTimeout(function(){this.checkpointInterval=setInterval(this.performanceCheckPoint.bind(this),1e3)}.bind(this),3e3),this.cmaFilterHigh=60,this.cmaFilterLow=15,this.thresholdEmissionsRatio=3,this.maxDroppedEmissions=1},r.Performance.prototype.emptyStatObj=function(){return{totalDuration:0,totalWait:0,count:0,invalidations:0}},r.Performance.prototype.performanceCheckPoint=function(){for(var e=0;e0&&(this.cma[t]?i.avgDuration>this.cma[t].durationHigh*this.thresholdEmissionsRatio&&this.cma[t].droppedEmissionsMath.max(20,t.durationHigh)&&(t.slowdownDurationDetected||(this.slowReports.push({type:e,param:"duration",cma:t,cmaDifference:t.durationLow-t.durationHigh,values:i}),t.slowdownDurationDetected=!0))},r.Performance.prototype.flushReport=function(){if(this.slowReports.length){var e=this.Q1.model().undoStack().m_commands;e=e.slice(e.length-20,e.length).reduce(function(e,t){return e+t.text()+"\n"},""),TradingView.logWarn({slowReports:this.slowReports,history:e}),$71.sendReport("slow_page",{slowReports:this.slowReports,history:e},!0,!0),this.slowReports=[]}},r.Performance.prototype.newChartDraw=function(e){var t=e._invalidationLevel,i=this.textLvl(t);for(var r in e._invalidatedPanes)e._invalidatedPanes[r]>t&&(t=e._invalidatedPanes[r],i=this.textLvl(t)+"_partial");this.addStats(i,e._timeCreated,e._timeStart,e._timeEnd,e._documentHidden,e._mergeCount)},r.Performance.prototype.addStats=function(e,t,i,r,n,o){if(!n){var a=this.chartDraw[e];a.totalDuration+=r-i,a.totalWait+=i-t,a.invalidations+=1+o,a.count++}},r.Performance.prototype.draw=function(){if(TradingView.getDisplayFpsLevel()==TradingView.FPS_SHOw_FULL){if(this.fpsCanvas)this.fpsCanvas.width=360;else{if(!this.Q1._jqMainTable)return!1;this.fpsCanvas=TradingView.addCanvasTo(this.Q1._jqMainTable.parent(),new $60(360,80)),this.ctx=this.fpsCanvas.getContext("2d"),$(this.fpsCanvas).css({position:"absolute",bottom:"23px",right:"65px"})}var e=this.ctx;e.font='10px "Lucida Console", monospace';for(var t=["cursor","light","light_partial","full"],i=0,r=0;r"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqPane),this.canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._zoomSelector=$(""),this._zoomSelector.addClass("zoom-selector"),this._zoomSelector.css("display","none"),this._zoomSelector.appendTo(this._dv),this._tooltipSelector=$(" "),this._tooltipSelector.addClass("tooltip tooltip-selector tooltip-selector-hidden"),this._tooltipSelector.appendTo(this._dv),this.legendWidget=new a(this,this._chart.model(),this._chart._jqMainDiv),this.jqRow=$(document.createElement("tr")),this.lhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.jqPane.appendTo(this.jqRow),this.legendWidget.$el.appendTo(this._dv),this.rhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.setCursorForTool(),TradingView.setMouseEventHandler($(this.top_canvas),this,!0);t&&!this._chart.readOnly()&&(this.paneControls=new $50(this,this._chart.model(),this._dv)),this.updateScalesVisibility(),this.actions=[],this.readonlyActions=[],this._onKeyUpListener=this._onKeyUpListener.bind(this),this._lineCancelledCallback=this._lineCancelledCallback.bind(this),$(window).on("keyup.panewidget",this._onKeyUpListener),this._chart.withModel(this,this._lineCancelledCallback),this._overlays={},this._contextMenuX=0,this._contextMenuY=0,this._lockDrawingsProperty=TradingView.drawingState.lockDrawings(),this._chart.withModel(this,function(){var e=this._chart.model();e.onSimpleZoomIn().subscribe(this,this._updateCrosshairOnZoom),e.onSimpleZoomOut().subscribe(this,this._updateCrosshairOnZoom)}),t&&D75.enabled("move_logo_to_main_pane")&&t._isMainPane&&e.createLogo&&e.createLogo(null,this._dv,!0)}var n=i(5),o=i(74).Study,a=i(174),s=i(175),l=i(359),d=i(153),h=i(152),p=i(13).LineDataSource,c=i(61).ESDStudyBase,u=i(137),_=i(71).BarsMarksContainer,f=i(72),g=i(18).PriceDataSource,v=i(360),m=i(59),y=i(243);r.prototype.destroy=function(){$(window).off("keyup.panewidget",this._onKeyUpListener),this.legendWidget&&(this.legendWidget.$el.remove(),delete this.legendWidget),this.paneControls&&(this.paneControls.jqDiv.remove(),delete this.paneControls),this._chart.withModel({chart:this._chart,instance:this,callback:this._hideTooltip},function(){this.chart.model().lineCancelled().unsubscribe(this.instance,this.callback)});for(var e in this)delete this[e]},r.prototype.cancelZoom=function(){this._zoomSelector.css("display","none"),delete this._firstZoomPoint},r.prototype._onKeyUpListener=function(e){if(27==e.keyCode){this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine(),this._firstZoomPoint&&this.cancelZoom();var t=this._chart.model().model().crossHairSource();t.clearMeasure(),this.setCursorForTool(),this._hideTooltip()}},r.prototype._lineCancelledCallback=function(){try{this._chart.model().lineCancelled().subscribe(this,this._hideTooltip)}catch(e){}},r.prototype.backgroundColor=function(){return this._chart.properties().paneProperties.background.value()},r.prototype.priceAxisByCanvas=function(e){return e===this.lhsPriceAxisWidget.canvas||e===this.lhsPriceAxisWidget.top_canvas?this.lhsPriceAxisWidget:e===this.rhsPriceAxisWidget.canvas||e===this.rhsPriceAxisWidget.canvas?this.rhsPriceAxisWidget:null},r.prototype.updateScalesVisibility=function(){this.lhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showLeftScale.value()),this.rhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showRightScale.value())},r.prototype.chart=function(){return this._chart},r.prototype.state=function(){return this._state},r.prototype.setState=function(e){this._state=e},r.prototype.stretchFactor=function(){return this._state?this._state._stretchFactor:D73.DEFAULT_STRETCH_FACTOR},r.prototype.setStretchFactor=function(e){this._state&&(this._state._stretchFactor=e)},r.prototype.mouseEnterEvent=function(e){var t=this._chart.model();t&&(t.crossHairSource().visible=!0,"function"==typeof this.onMouseEnter&&this.onMouseEnter(this))},r.prototype.isLineTool=function(e){var t=TradingView[e];return"function"==typeof t&&t.prototype instanceof p},r.prototype.hideInplaceEditor=function(){return this._inplaceEditor?(this._inplaceEditor.remove(),this._inplaceEditor=void 0,!0):!1},r.prototype._processMouseMoveWhileZoom=function(e){var t=this._state.defaultPriceScale(),i=(t.coordinateToPrice(e.localY),Math.floor(this._chart.model().timeScale().coordinateToIndex(e.localX))),r=this._chart.model().timeScale().indexToCoordinate(i)-.5*this._chart.model().timeScale().barSpacing(),n=e.localY,o=Math.abs(r-this._firstZoomPoint.x),a=Math.abs(n-this._firstZoomPoint.y);r =0)&&this._mouseDownEventForLineTool(e,i,l,s));var h=this.dataSourceAtPoint(e.localX,e.localY),c=h&&h.source&&h.source.customization?h.source.customization:{};if(h.hittest&&h.hittest.result()==TradingView.HitTestResult.CUSTOM){var u=h.hittest.data().mouseDownHandler;u&&u()}if(!this._chart.readOnly()){if(h&&!c.disableSelection){var _=h.hittest&&h.hittest.result()>TradingView.HitTestResult.MOVEPOINT_BACKGROUND;_=_||h.hittest&&h.hittest.result()==TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any(),_?t.setSelectedSource(h.source,h.hittest&&h.hittest.data()):t.setSelectedSource(null)}if(h.source&&"eraser"===TradingView.drawingState.tool.value()&&!c.disableErasing&&(TradingView.isInherited(h.source.constructor,p)||TradingView.isInherited(h.source.constructor,o))){var f=h.hittest.eraseMarker();return void(e.ctrlKey&&void 0!==f&&h.source.processErase?h.source.processErase(t,f):t.removeSource(h.source))}var v=h.source&&TradingView.isInherited(h.source.constructor,p)&&h.source.isLocked(),m=this._lockDrawingsProperty.value()||v;if(!m){if(h.source&&h.source.userEditEnabled&&!h.source.userEditEnabled())return;if(h.hittest&&h.hittest.result()===TradingView.HitTestResult.CHANGEPOINT){var n=h.source.priceScale(),s=n.coordinateToPrice(e.localY);return t.startChangingLinetool(h.source,{index:l,price:s},h.hittest.data(),i),void this._updateTooltip(e.localX,e.localY)}if(h.hittest&&this.checkMovepoint(h.hittest.result())){if(h.source.isFixed&&h.source.isFixed())t.startMovingSource(h.source,new MathEx.Point(e.localX,e.localY),h.hittest.data());else{var n=h.source.priceScale(),s=n.coordinateToPrice(e.localY);t.startMovingSource(h.source,{index:l,price:s},h.hittest.data())}return}}if(h.source&&TradingView.isInherited(h.source.constructor,g))return void(this._chart.draggingSource=h.source)}h.hittest&&h.hittest.result()==TradingView.HitTestResult.REGULAR||(this._processing=!0)}},r.prototype.drawRightThere=function(e){if(this.isLineTool(e)){var t=this._chart.model(),i=t.crossHairSource();t.createLineTool(this._state,{index:i.index,price:i.price},e)}},r.prototype._finishTool=function(e){var t=this._chart.model(),i=TradingView.drawingState.tool.value();if(TradingView.drawingState.resetToCursor(),this._hideTooltip(),t.setSelectedSource(e),this._chart.isTextTool(i)){var r=t.createUndoCheckpoint(),n=new s(e,t,r);n.show(),n.focusOnText()}},r.prototype._mouseDownEventForLineTool=function(e,t,i,r){var n=this._chart.model(),o=!1,a=null,s=e.localX,l=e.localY,d=this._chart.model().model().crossHairSource(),h=TradingView.drawingState.tool.value();if(TradingView.drawingState.hideAllDrawings().setValue(!1),TradingView.drawingState.lockDrawings().setValue(!1),TradingView.supportTouch()&&this.isLineTool(h)&&"LineToolBrush"!==h&&!n.lineBeingCreated()&&(this._startTouchPoint=new MathEx.Point(s,l),this._initCrossHairPosition=d.currentPoint(),this._skipFirstMove=!0),!n.lineBeingCreated()||n.lineBeingCreated()instanceof u){if(!TradingView.supportTouch()||"LineToolBrush"==h){var p={index:i,price:r};a=n.createLineTool(this._state,p,h),n.lineBeingCreated()||(o=!0)}}else if(TradingView.supportTouch()){if(this._skipFirstMove=!0,!this._startTouchPoint){this._startTouchPoint=new MathEx.Point(s,l);var c=n.lineBeingCreated().points(),_=c[c.length-1],f=n.timeScale().indexToCoordinate(_.index),r=_.price,g=n.lineBeingCreated().priceScale();if(g.isPercent()){var v=n.lineBeingCreated().ownerSource().firstValue();r=g.priceRange().convertToPercent(r,v)}var m=g.priceToCoordinate(r);return void(this._lastDrawingPoint=new MathEx.Point(f,m))}}else{a=n.lineBeingCreated();var y=n.paneForSource(a);if(y!==this._state){var w=this._dv.offset(),s=e.localX+w.left,l=e.localY+w.top,T=this._chart.paneByState(y);w=T._dv.offset(),s-=w.left,l-=w.top;var r=a.priceScale().coordinateToPrice(l),i=Math.round(n.timeScale().coordinateToIndex(s));o=n.coninueCreatingLine({index:i,price:r},t)}else o=n.coninueCreatingLine({index:i,price:r},t)}n.setSelectedSource(a),o?this._finishTool(a):TradingView.supportTouch()&&"LineToolBrush"!=h||this._updateTooltip(e.localX,e.localY)},r.prototype._equalsCursorCache=function(e,t){return TradingView.drawingState.toolIsCursor(e.tool)?e.tool===t.tool&&e.theme===t.theme&&e.crosshair===t.crosshair:e.tool===t.tool&&e.theme===t.theme},r.prototype._setCursor=function(e){this._cursorCache&&this._equalsCursorCache(this._cursorCache,e)||(this._cursorCache=e,TradingView.drawingState.toolIsCursor(e.tool)?this.jqPane.css("cursor",e.crosshair):this.jqPane.css("cursor",TradingView.cursorCss(e.state.name,e.state.hotspot,e.theme)))},r.prototype.setCursorForTool=function(e,t){var i={_default:{name:"cursor_cross",hotspot:"11 11"},zoom:{name:"zoom",hotspot:"5 5"},pointer:{name:"cursor_pointinghand",hotspot:"13 7"},dragger:{name:"cursor_closed_hand",hotspot:"8 8"}},r=TradingView.drawingState.tool.value();TradingView.drawingState.toolIsCursor(r)&&(this._chart.draggingSource||this._isScrolling||this._chart.model()&&this._chart.model().sourceBeingMoved()?r="dragger":e&&(r="pointer")),this._chart.model()&&this._chart.model().lineBeingEdited()?r=this._chart.model().lineBeingEdited()._constructor:t==TradingView.HitTestResult.CHANGEPOINT&&(r=e._constructor);var n=i._default;r in i&&(n=i[r]);var o="light";this._setCursor({tool:r,theme:o,state:n,crosshair:this.defaultPaneCursor(o)})},r.prototype.setDragToAnotherPaneCursor=function(){var e="light";this._setCursor({tool:"dragger",theme:e,state:{name:"cursor_closed_hand_move",hotspot:"8 8"},crosshair:this.defaultPaneCursor(e)})},r.prototype.defaultPaneCursor=function(e){var t={cursor:{name:"cursor_cross",hotspot:"11 11"},dot:{name:"cursor_dot",hotspot:"11 11"},crosshair:{name:"cursor_cross",hotspot:"11 11"},eraser:{name:"cursor_eraser",hotspot:"5 5"}},i=t[TradingView.drawingState.tool.value()];return i||(i=t[TradingView.drawingState.cursorTool.value()]),i?TradingView.cursorCss(i.name,i.hotspot,e):"default"},r.prototype.gestureStartEvent=function(e){this._prev_pinch_scale=1,this._pinching=!0},r.prototype.gestureChangeEvent=function(e){var t=(e.originalEvent.pageX||e.originalEvent.offsetX)-5,i=this._chart.paneWidgets()[0].lhsPriceAxisWidget.size.w,r=this._chart.model().timeScale().width();i&&(t=Math.max(0,t-i)),t=Math.min(t,r);var n=2*(t/r-.5),o=5*(e.scale-this._prev_pinch_scale);o>0?this._chart.model().zoomIn(n,o):this._chart.model().zoomOut(n,-o),this._prev_pinch_scale=e.scale},r.prototype.gestureEndEvent=function(e){this._pinching=!1},r.prototype._updateCommonTooltip=function(e){var t=this._lastCommonTooltipData,i=null;if(e&&e.hittest&&e.hittest.result()===TradingView.HitTestResult.CUSTOM){var r=e.hittest.data();r&&(i=r.tooltip||null)}if(null!=t||null!=i){if(null==i)return this._lastCommonTooltipData=null,void TradingView.Tooltip.hide();if(!t||i.text!==t.text||i.rect.x!==t.rect.x||i.rect.y!==t.rect.y||i.rect.w!==t.rect.w||i.rect.h!==t.rect.h){this._lastCommonTooltipData=i;var n=TradingView.clone(i),o=this.jqPane.offset();n.rect.x+=o.left,n.rect.y+=o.top,TradingView.Tooltip.show(n)}}},r.prototype.mouseMoveEvent=function(e){var t=this._chart.model();if(t){var i=e.localX,n=e.localY,o=new r.EvironmentState(e);if(this._firstZoomPoint)return void this._processMouseMoveWhileZoom(e);if(!(this._chart.readOnly()||this._editDialog&&this._editDialog.isVisible())){this.setCursorForTool();var a=TradingView.drawingState.tool.value(),s=null;this._processing||!TradingView.drawingState.toolIsCursor(a)&&"eraser"!==a||(s=this.dataSourceAtPoint(e.localX,e.localY),s.hittest&&s.hittest.result()>TradingView.HitTestResult.MOVEPOINT_BACKGROUND?(this.setCursorForTool(s.source,s.hittest?s.hittest.result():null),!s.source||"eraser"===a&&s.source.constructor===TradingView.Series?t.setHoveredSource(null):t.setHoveredSource(s.source,s.hittest.data())):t.setHoveredSource(null)),this._updateCommonTooltip(s)}if(this._chart.readOnly()){var s=this.dataSourceAtPoint(e.localX,e.localY);t.hoveredSource();null!==s.source?t.setHoveredSource(s.source,s.hittest.data()):t.setHoveredSource(null,null)}if(this._chart.model().lineBeingCreated()){var l=this._chart.model().lineBeingCreated(),d=this._chart.model().paneForSource(l);if(d!==this._state){var h=this._dv.offset();i+=h.left,n+=h.top;var p=this._chart.paneByState(d);return h=p._dv.offset(),i-=h.left,n-=h.top,void t.setCurrentPosition(i,n,d)}}var a=TradingView.drawingState.tool.value();TradingView.supportTouch()&&this.isLineTool(a)||(t.setCurrentPosition(i,n,this._state,o),this._updateTooltip(i,n))}},r.prototype.pressedMouseMoveEvent=function(e){if(!this._pinching){this._skipFirstMove?(delete this._skipFirstMove,delete this._touchMove):this._touchMove=!0;var t=new r.EvironmentState(e),i=this._chart.model(),n=e.localX,o=e.localY;if(this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);var a=TradingView.drawingState.tool.value();if(TradingView.supportTouch()&&this._startTouchPoint&&this.isLineTool(a)&&"LineToolBrush"!==a&&!i.lineBeingCreated()){var s=(this._chart.model().model().crossHairSource(),this._initCrossHairPosition),l=new MathEx.Point(n,o),d=l.substract(this._startTouchPoint),h=s.add(d);return this._chart.model().setCurrentPosition(h.x,h.y,this._state),void this._updateTooltip(h.x,h.y)}if(!TradingView.supportTouch()||!i.lineBeingCreated()||i.lineBeingCreated()instanceof u){i.setCurrentPosition(n,o,this._state,t),this._updateTooltip(n,o);var c=TradingView.drawingState.tool.value();if((!this.isLineTool(c)||"LineToolBrush"===a)&&(0===e.button||Modernizr.touch)){if("LineToolBrush"===c){var _=this._state.defaultPriceScale();if(_.isEmpty())return;if(!this._chart.model().lineBeingCreated())return;var f=_.coordinateToPrice(e.localY),g=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX));return void((!D75.enabled("charting_library_base")||g>=0)&&this._chart.model().coninueCreatingLine({index:g,price:f}))}if(this._chart.draggingSource){var v=e.target,m=this._chart.paneByCanvas(v);m&&(m!==this?m.setDragToAnotherPaneCursor():m.setCursorForTool());var y=this._chart.priceAxisByCanvas(v);y&&y.jqCell.css("cursor",TradingView.cursorCss("cursor_closed_hand","8 8"));var w=this._chart.timeAxisByCanvas(v);w&&w.jqCell.css("cursor",TradingView.cursorCss("cursor_closed_hand_move","8 8"))}if(i.timeScale().isEmpty())return;if(i.lineBeingEdited()){var g=Math.round(this._chart.model().timeScale().coordinateToIndex(n));return(!D75.enabled("charting_library_base")||g>=0)&&i.changeLinePoint({x:n,y:o},t),this._updateTooltip(n,o),void this.setCursorForTool()}if(i.sourceBeingMoved()){var _=i.sourceBeingMoved().priceScale();if(_.isEmpty())return;var g=this._chart.model().timeScale().coordinateToIndex(e.localX),f=_.coordinateToPrice(e.localY),T=i.sourceBeingMoved();if(this.setCursorForTool(),D75.enabled("charting_library_base")&&!i.sourceBeingMoved().onlyYMoving()){var b=T.points().reduce(function(e,t){return t.index=1?y():requestAnimationFrame(S)};requestAnimationFrame(S)}else y()}if(this._chart.draggingSource){var C=e.target,x=this._chart.paneByCanvas(C);if(x&&x!=this){var P=x._state.findSuitableScale(this._chart.draggingSource);v&&(v=!1,n.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,x._state,P)}var L=this._chart.priceAxisByCanvas(C);if(L){var x=L.pane,a=L._isLeft?x._state.leftPriceScale():x._state.rightPriceScale();v&&(v=!1,n.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,x._state,a)}var E=this._chart.timeAxisByCanvas(C);E&&(v&&(v=!1,n.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,null,null),E.jqCell.css("cursor","")),this._chart.draggingSource=null;var V=this.dataSourceAtPoint(e.localX,e.localY);this.setCursorForTool(V.source,V.hittest||null)}}delete this._touchMove},r.prototype.mouseLeaveEvent=function(e){var t=this._chart.model();t&&(TradingView.isMobile.any()||t.model().clearCurrentPosition(),t.setHoveredSource(null),this._updateCommonTooltip(null),"function"==typeof this.onMouseLeave&&this.onMouseLeave(this))},r.prototype.mouseClickEvent=function(e){this._chart.model().hoveredSource()instanceof _&&this._chart.model().hoveredSource().onClicked()},r.prototype.showEditDialogForSource=function(e){this.chart().onWidget()||e.userEditEnabled&&!e.userEditEnabled()||(this._editDialog=new s(e,this._chart.model()),this._editDialog.show())},r.prototype.mouseDoubleClickEvent=function(e){var t=!this._chart.readOnly()&&!this.isLineTool(TradingView.drawingState.tool.value())&&this.dataSourceAtPoint(e.localX,e.localY),i=t&&t.hittest&&t.source;i&&t.hittest.result()<=TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&!TradingView.isMobile.any()&&(i=null),i&&i.customization&&i.customization.disableSelection&&(i=null),i&&i._metaInfo&&"Sessions@tv-basicstudies"==i._metaInfo.id&&(i=this._chart.model().mainSeries()),i?t.source instanceof m?TradingView.alertsDispatcher.openEditDialog(t.source.alert()):this.showEditDialogForSource(i):this._chart.readOnly()||this.isLineTool(TradingView.drawingState.tool.value())||this._chart.model().lineBeingCreated()||this._chart.model().selectedSource()||this._chart.toggleMaximizePane(this)},r.prototype.showContextMenuForSource=function(e,t){e.hasContextMenu()&&(this._chart.model().setSelectedSource(e),e.constructor===TradingView.Series?this._seriesContextMenu(e).show(t):TradingView.isInherited(e.constructor,c)?this._studyEsdContextMenu(e).show(t):TradingView.isInherited(e.constructor,o)?this._studyContextMenu(e).show(t):TradingView.isInherited(e.constructor,f)?this._publishedChartsContextMenu(e).show(t):TradingView.isInherited(e.constructor,d)||TradingView.isInherited(e.constructor,h)?this._tradingDrawingsContextMenu(e).show(t):TradingView.isInherited(e.constructor,p)?this._lineContextMenu(e).show(t):TradingView.isInherited(e.constructor,m)&&!e.fake?this._alertLabelContextMenu(e).show(t):TradingView.isInherited(e.constructor,v)&&this._chartEventsContextMenu(e).show(t))},r.prototype.contextMenuEvent=function(e,t){if(D75.enabled("pane_context_menu")){if(this._chart.model().crossHairSource().startMeasurePoint())return void this._chart.model().crossHairSource().clearMeasure();if(!this._pinching&&(this._firstZoomPoint&&this.cancelZoom(),!this.hideInplaceEditor())){if(!TradingView.drawingState.toolIsCursor(TradingView.drawingState.tool.value())){if(TradingView.isMobile.any())return;return TradingView.drawingState.resetToCursor(!0),this.setCursorForTool(),this._hideTooltip(),void(this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine())}if(!this.chart().readOnly()&&!this._disableContextMenu){this._chart.model().mainSeries().createSessStudy(),this._chart.updateActions(),this._contextMenuX=e.localX,this._contextMenuY=e.localY;var i=this.dataSourceAtPoint(e.localX,e.localY),r=i?i.source:null,n=i&&i.hittest?i.hittest.result():0,o=n>=TradingView.HitTestResult.REGULAR||n>=TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any();
-null!==r&&o?this.showContextMenuForSource(r,e):(this._contextMenu(e).show(e),this._chart.model().setSelectedSource(null)),this.paint()}}}},r.prototype._contextMenu=function(e){function t(e){return null===e.text}var i=this._initActions(e),r=this._customActions();r.remove.forEach(function(e){for(var t=0;t0;o--)t(n[o])&&t(n[o-1])&&n.splice(o,1);return n.length&&t(n[0])&&n.splice(0,1),n.length&&t(n[n.length-1])&&n.splice(n.length-1,1),TradingView.ContextMenu.createMenu(n)},r.prototype.createRemoveMenu=function(){var e=this._chart.actions(),t=new TradingView.Action({text:$.t("Remove")});t.subActions||(t.subActions=[]);var i=t.subActions;return i.push(e.paneRemoveAllStudies),i.push(e.paneRemoveAllDrawingTools),i.push(e.paneRemoveAllStudiesDrawingTools),t},r.prototype.createDrawingMenu=function(){var e=this._chart.actions(),t=new TradingView.Action({text:$.t("Drawing Tools")});t.subActions||(t.subActions=[]);var i=t.subActions;return i.push(e.drawingToolbarAction),D75.enabled("charting_library_base")||i.push(e.favoriteDrawingToolbar),i.push(new TradingView.ActionSeparator),i.push(e.magnetAction),i.push(e.stayInDrawingModeAction),D75.enabled("support_multicharts")&&i.push(e.syncModeAction),i.push(new TradingView.ActionSeparator),i.push(e.lockDrawingsAction),i.push(e.hideAllDrawingsAction),i.push(e.paneRemoveAllDrawingTools),t},r.prototype._initActions=function(e){var t=this,i=this._chart.actions(),r=[];if(D75.enabled("datasource_copypaste")){var n=TradingView.AppClipboard.get();if(n&&("study"===n.type||"drawing"===n.type)){var o=new TradingView.Action({text:$.t("Paste %s",$.t(n.title||n.type)),shortcut:"Ctrl-V"});o.callbacks().subscribe(null,function(){t._chart.onAppClipboardPaste(t.state())}),r.push(o)}}if(D75.enabled("alerts")&&(r.length&&r.push(new TradingView.ActionSeparator),r.push(this._createActionAddAlert({e:e}))),!this.chart().onWidget()){var a=this.createActionTrade(e);a&&r.push(a)}i.gotoDate&&r.push(i.gotoDate),r.length&&r.push(new TradingView.ActionSeparator),r.push(i.chartReset),r.push(i.symbolSearch),r.push(i.changeInterval);var s=window.widgetbar&&(!window.widgetbar._customization||window.widgetbar._customization.watchlist);s&&r.push(i.addToWatchlist),D75.enabled("text_notes")&&r.push(i.addToTextNotes),D75.enabled("symbol_info")&&r.push(i.showSymbolInfoDialog),r.push(new TradingView.ActionSeparator),r.push(this._createLockTimeAxisAction(e)),r.push(new TradingView.ActionSeparator),r.push(i.paneObjectTree),r.push(i.insertIndicator),D75.enabled("charting_library_base")||r.push(i.applyStudyTemplate),D75.enabled("compare_symbol")&&r.push(i.compareOrAdd),r.push(this.createDrawingMenu()),D75.enabled("charting_library_base")&&r.push(i.hideAllMarks),r.push(this.createRemoveMenu()),r.push(new TradingView.ActionSeparator);var l=this._priceAxisMenu();l&&r.push(l);var d=this._timeAxisMenu();return d&&r.push(d),D75.enabled("charting_library_base")||r.push(i.applyColorTheme),r.push(i.chartProperties),pro.hasPackage("mtp-mtpredictor")&&this.state().containsMainSeries()&&(r.push(new TradingView.ActionSeparator),r.push(this._createMTPredictorActions())),r},r.prototype._customActions=function(){var e={top:[],bottom:[],remove:[]},t=this._chart.model(),i=t.timeScale(),r=this._state.defaultPriceScale();if(!D75.enabled("custom_items_in_context_menu"))return e;var n=i.isEmpty()?void 0:i.indexToUserTime(i.coordinateToIndex(this._contextMenuX));return Q15.emit("onContextMenu",{unixtime:n?n/1e3:void 0,price:r.isEmpty()?void 0:r.coordinateToPrice(this._contextMenuY),callback:function(t){[].concat(t).forEach(function(t){if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{var i;"-"===t.text?i=new TradingView.ActionSeparator:(i=new TradingView.Action({text:t.text}),i.callbacks().subscribe(null,t.click)),t.position&&"top"==t.position?e.top.push(i):e.bottom.push(i)}})}}),e},r.prototype._timeAxisMenu=function(){if(this._chart.model().timeScale().isEmpty())return null;var e=this._chart.getTimeScale();return new TradingView.Action({text:$.t("Time Scale"),subActions:e.getContextMenuActions()})},r.prototype._priceAxisMenu=function(){var e=this._state.defaultPriceScale();if(e.isEmpty())return null;var t=e===this._state.leftPriceScale?this.leftPriceAxisWidget():this.rightPriceAxisWidget();return new TradingView.Action({text:$.t("Price Scale"),subActions:t.getContextMenuActions()})},r.prototype._seriesContextMenu=function(e){var t=this._chart.actions(),i=e.properties().visible.value(),r=null;if(this._chart.readOnly()){var n=[i?t.seriesHide:this.createActionShow(e),new TradingView.ActionSeparator,this.createActionShowCountdown(e),new TradingView.ActionSeparator,this.createActionScaleLeft(e),this.createActionScaleRight(e),this.createActionNoScale(e)];D75.enabled("countdown")||n.splice(3,1),r=TradingView.ContextMenu.createMenu(n)}else{var o=this._mergeContentMenuItems(e),a=[t.showSymbolInfoDialog,t.compare,i?t.seriesHide:this.createActionShow(e),this.createVisualOrderAction(e),new TradingView.ActionSeparator,this.createActionShowCountdown(e),new TradingView.ActionSeparator];D75.enabled("countdown")||a.splice(5,2),D75.enabled("compare_symbol")||a.splice(1,1),D75.enabled("symbol_info")||a.splice(0,1),this.chart().onWidget()||a.unshift(t.format),this.chart().canCreateAlertForDataSource(e)&&a.unshift(this._createActionAddAlert({series:e}));var s=this.createActionLockScale(e);if(s&&(a.push(s),a.push(new TradingView.ActionSeparator)),o.length>0){for(var l=0;lp&&(r=h,i=a)}}}}if(this.containsMainSeries()){for(var c=this._chart.model().barsMarksSources(),o=0;o1;if(!i)return null;var n=new TradingView.Action({checkable:!1,text:$.t("Unmerge Up"),enabled:!0});return n.setCallbackContext(e),n.callbacks().subscribe(this,r.prototype.onUnmergeUp),n},r.prototype.onUnmergeUp=function(e){var t=e.callbackContext(),i=this._chart.model().paneForSource(t),r=this._chart.model().panes().indexOf(i),n=this._chart.model().createPane(r),o=n.findSuitableScale(t);this._chart.model().move(t,n,o)},r.prototype.createActionMergeDown=function(e){var t=this._chart.model().paneForSource(e),i=this._chart.model().panes(),n=t!==i[i.length-1];if(!n)return null;var o=new TradingView.Action({checkable:!1,text:$.t("Merge Down"),enabled:!0});return o.setCallbackContext(e),o.callbacks().subscribe(this,r.prototype.onMergeDown),o},r.prototype.onMergeDown=function(e){var t=e.callbackContext(),i=this._chart.model().paneForSource(t),r=this._chart.model().panes().indexOf(i),n=this._chart.model().panes()[r+1],o=n.findSuitableScale(t);this._chart.model().move(t,n,o)},r.prototype.createActionUnmergeDown=function(e){var t=this._chart.model().paneForSource(e),i=t.Q17().filter(function(e){return TradingView.isInherited(e.constructor,g)&&e.showInObjectTree()}).length>1;if(!i)return null;var n=new TradingView.Action({checkable:!1,text:$.t("Unmerge Down"),enabled:!0});return n.setCallbackContext(e),n.callbacks().subscribe(this,r.prototype.onUnmergeDown),n},r.prototype.onUnmergeDown=function(e){var t=e.callbackContext(),i=this._chart.model().paneForSource(t),r=this._chart.model().panes().indexOf(i),n=this._chart.model().createPane(r+1),o=n.findSuitableScale(t);this._chart.model().move(t,n,o)},r.prototype._mergeContentMenuItems=function(e){var t=[],i=this.createActionMergeUp(e);i&&t.push(i);var i=this.createActionUnmergeUp(e);i&&t.push(i);var i=this.createActionMergeDown(e);i&&t.push(i);var i=this.createActionUnmergeDown(e);return i&&t.push(i),t},r.prototype.createActionShow=function(e){var t=i(179).ActionBinder,r=new TradingView.Action({checkable:!0,text:$.t("Show"),enabled:!0});return r._binding=new t(r,e.properties().visible,this._chart.model(),r.text),r._binding.setValue(e.properties().visible.value()),r},r.prototype.bringObjectForward=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().changeZOrder(t,1)},r.prototype.sendObjectToBack=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().sendToBack(t)},r.prototype.bringObjectToFront=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().bringToFront(t)},r.prototype.sendObjectBackward=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().changeZOrder(t,-1)},r.prototype.createVisualOrderAction=function(e){var t=new TradingView.Action({text:$.t("Visual Order")});t.subActions||(t.subActions=[]);var i=new TradingView.Action({text:$.t("Bring to Front")});i.callbacks().subscribe(this,r.prototype.bringObjectToFront),t.subActions.push(i);var n=new TradingView.Action({text:$.t("Send to Back")});n.callbacks().subscribe(this,r.prototype.sendObjectToBack),t.subActions.push(n);var o=new TradingView.Action({text:$.t("Bring Forward")});o.callbacks().subscribe(this,r.prototype.bringObjectForward),t.subActions.push(o);var a=new TradingView.Action({text:$.t("Send Backward")});a.callbacks().subscribe(this,r.prototype.sendObjectBackward),t.subActions.push(a);var s=this._chart.model().paneForSource(e),l=s.getZOrderMinMax();return n.setEnabled(!0),o.setEnabled(!0),a.setEnabled(!0),i.setEnabled(!0),e.zorder()===l.minZOrder&&(n.setEnabled(!1),a.setEnabled(!1)),e.zorder()===l.maxZOrder&&(o.setEnabled(!1),i.setEnabled(!1)),t},r.prototype._createActionAddAlert=function(e){function t(e){s.series=e}function r(e){s={drawing:e}}function n(e){void 0===e||null===e||TradingView.isNaN(e)||(l+=" ("+e+") ",s.value=e)}var a=this._chart,s={},l=$.t("Add Alert"),d=this._state;if(e.series){var h,p;if(e.series instanceof TradingView.Series)p=e.series.lastValueData(null,!0,!0);else if(e.series instanceof o){var c=e.series.metaInfo().plots[0].id;p=e.series.lastValueData(c,!0,!0)}if(p&&(h=p.price),h){var u=(e.series.priceScale()||this._state.mainDataSource().priceScale()||a.model().mainSeries().priceScale()).formatter();u.formatAsDecimal&&(h=u.formatAsDecimal(h)),n(h)}t(e.series)}else if(e.e){var _=d.defaultPriceScale(),f=_.coordinateToPrice(e.e.localY);if(_.isPercentage()){var g=this._state.mainDataSource().firstValue();f=void 0!==g?_.priceRange().convertFromPercent(f,g):null}n(this._state.mainDataSource().formatter().formatAsDecimal(f));var v=d.mainDataSource();t(v)}else e.drawing&&(l+=" "+$.t("on")+" "+$.t(e.drawing.title()),r(e.drawing));l+="...";var m=new TradingView.Action({text:l,shortcut:"Alt+A",doNotBindShortcut:!0});return m.callbacks().subscribe(null,function(){var e=i(28);runOrSignIn(function(){new e(s)},{source:"Alert add from pane context menu",sourceMeta:"Chart"})}),m},r.prototype.image=function(){var e={};return e.leftAxis=this.leftPriceAxisWidget().image(),e.rightAxis=this.rightPriceAxisWidget().image(),e.content=this.canvas.toDataURL(),e.contentWidth=this.size.w,
-e.contentHeight=this.size.h,e},r.prototype._updateTooltip=function(e,t){if(!this._rafSet){var i=this;requestAnimationFrame(function(){i._updateTooltipImpl(e,t),i._rafSet=!1}),this._rafSet=!0}},r.prototype._updateTooltipImpl=function(e,t){function i(i){function n(){return TradingView.isMobile.any()?{left:e-r._tooltipSelector.outerWidth()-16,top:t-r._tooltipSelector.outerHeight()-16}:{left:e+16,top:t+16}}TradingView[a].getTooltipText&&(i=TradingView[a].getTooltipText(l)||i),r._tooltipSelector.html(i).removeClass("tooltip-selector-hidden").css(n())}if(this._chart){for(var r=this,n=this._chart.paneWidgets(),a=TradingView.drawingState.tool.value(),s=this._state.model(),l=s.lineBeingCreated(),d=n.length-1;d>=0;d--)n[d]._hideTooltip();o.isStudyLineTool(a)&&!TradingView.isMobile.any()?i($.t("Click to set a point")):TradingView.isMobile.any()&&"LineToolBrush"!=a&&r.isLineTool(a)&&!r._chart.model().lineBeingCreated()?i($.t("1. Slide your finger to select location for first anchor 2. Tap anywhere to place the first anchor")):TradingView.isMobile.any()&&"LineToolBrush"!=a&&r.isLineTool(a)&&i($.t("1. Slide your finger to select location for next anchor 2. Tap anywhere to place the next anchor"))}},r.prototype._hideTooltip=function(){this._tooltipSelector.addClass("tooltip-selector-hidden")},r.prototype._updateCrosshairOnZoom=function(){if(TradingView.drawingState.lockTimeAxis().value()){var e=this._chart.model(),t=e.crossHairSource();t.setPosition(t.index,t.price,this._state)}},e.exports=r},function(e,t,i){"use strict";function r(e,t){var i="Change Chart Layout to "+q[t].title;o.call(this,i),this.Q3=e,this._newLayoutId=t,this._oldLayoutId=e.layout.value()}function n(e,t,i,r,n,o,s,l){this.Q2=l,this.m_model=new J(e,t,i,r,n,o,s,this,!!l._containsData),this.m_undoStack=new a,this.m_redoStack=new a,this.m_zoomStack=new a,this._onRearrangePanes=new Delegate,this._onSimpleZoomIn=new Delegate,this._onSimpleZoomOut=new Delegate}function o(e){this._text=e}function a(){this.m_commands=[],this._onChange=new Delegate}function s(e){o.call(this,e),this._subcommands=[]}function l(e,t,i,r){o.call(this,i),this._targetObj=e,this._newValue=t,this.D98=r}function d(e,t,i,r,n){o.call(this,r),this._property=e,this._priceScale=i,this._newValue=t,this.D98=n}function h(e,t,i,r,n){o.call(this,r),this._percentage=e,this._priceScale=i,this._newValue=t,this.D98=n}function p(e,t,i,r,n){o.call(this,r),this._log=e,this._priceScale=i,this._newValue=t,this.D98=n}function c(e,t,i,r,n,a){o.call(this,r),this._style=e,this._mainSeries=i,this._priceAxisProperties=i.properties().priceAxisProperties,this._newValue=t,this.D98=n,this.Q2=a}function u(e,t,i,r,n){o.call(this,r),this._property=e,this._mainSeries=i,this._priceAxisProperties=i.properties().priceAxisProperties,this._newValue=t,this.D98=n}function _(e,t,i,r){this.m_model=e,this.m_pane=t,this.m_priceScale=i,this.m_state=r,this.m_newPriceScaleState=null}function f(e,t,i){o.call(this,i),this.m_model=e,this.m_state=t,this.m_newTimeScaleState=null}function g(e,t,i,r){this.D98=e,this._series=t,this._oldSymbol=t.symbol(),this._oldInterval=t.interval(),this._symbol=i,this._interval=r}function v(e,t,i,r){o.call(this,"Insert "+t.id),this.D98=e,this._studyMetaInfo=t,this._props=i,this._isOverlay=r}function m(e,t){this.D98=e,this.D97=t}function y(e,t){this.D98=e,this._linetools=t,this._statesByPaneIndexes={}}function w(e,t,i,r,n){this.D98=e,this.D97=t,this._scale=n,this._sources=[t].concat(this.D98.children(t)),this._oldPane=i,this._oldPaneIndex=e.panes().indexOf(i),this._oldPaneState=this._oldPane.state(),this._oldScaleName=i.priceScaleName(t.priceScale()),this._pane=r,this._samePane=this._pane===this._oldPane}function T(e,t,i,r){o.call(this,"Create line "+t.toolname),this.D98=e,this._line=t,this._paneIndex=e.panes().indexOf(i),this._points=[{point:r}]}function b(e,t,i,r){this.D98=e,this.D97=t,this._prevState=t.state(!0),this._nextState=this._prevState}function S(e,t,i,r){this.D98=e,this.D97=t,i instanceof MathEx.Point?this._origPoint=i.clone():this._origPoint=TradingView.clone(i),this._pointIndex=r}function C(e,t,i){o.call(this,"Change "+t.title()+" Z order"),this.D98=e,this.D97=t,this._shift=i}function x(e,t){o.call(this,"Change "+t.title()+" Z order"),this.D98=e,this.D97=t}function P(e,t){o.call(this,"Change "+t.title()+" Z order"),this.D98=e,this.D97=t}function L(e,t,i){o.call(this,"Remove pane"),this.D98=e,this._index=t,this._pane=this.D98.panes()[t],this._chart=i}function E(e,t,i,r){o.call(this,"Rearrange panes"),this.D98=e,this._index=t,this._direction=i,this._chart=r}function V(e,t,i,r,n,o){this.D98=e,this._startBar=t,this._endBar=i,this._startPrice=r,this._endPrice=n,this._pane=o}function I(e,t,i){this._baseCmd=e,this._zoomStack=t,this._inOut=i}function A(e,t,i,r,n){this.D98=e,this._paneA=t,this._paneB=i,this._prevStretchA=r,this._currStretchA=n}function k(e,t){o.call(this,"Restore Defaults"),this.D98=e,this._defaultProperty=t,this._state=t.state(t._exclusions),this.Q2=e._undoModel.Q2}function R(e,t){o.call(this,"Apply Chart Theme"),this.D98=e,this._newChartProps=TradingView.factoryDefaults("chartproperties"),["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.D98.properties().state().paneProperties.legendProperties,this._newChartProps=$.extend(!0,{},this._newChartProps,t.chartProperties),delete this._newChartProps.scalesProperties.showLeftScale,delete this._newChartProps.scalesProperties.showRightScale,delete this._newChartProps.scalesProperties.scaleSeriesOnly,delete this._newChartProps.scalesProperties.showSeriesLastValue,delete this._newChartProps.scalesProperties.showStudyLastValue,delete this._newChartProps.scalesProperties.showSymbolLabels,delete this._newChartProps.scalesProperties.showStudyPlotLabels,this._newSeriesProps=t.mainSourceProperties,this._newChartProps.symbolWatermarkProperties||(this._newChartProps.symbolWatermarkProperties=defaults("chartproperties.symbolWatermarkProperties"),this._newChartProps.symbolWatermarkProperties.color=this._newChartProps.scalesProperties.textColor),this._oldChartProps=e.properties().state(),delete this._oldChartProps.paneProperties.topMargin,delete this._oldChartProps.paneProperties.bottomMargin,this._oldSeriesProps=e.properties().state().mainSeriesProperties}function M(e,t){o.call(this,"Apply Drawing Template"),this.D97=e,this._oldProps=e.properties().state();TradingView.factoryDefaults("linetoolvisibilities");this._newProps=t}function O(e,t,i,r){var r=" "+r||"",n=r+" Study template";o.call(this,n),this.D98=e,this._oldProps=t,this._newProps=i}function D(e,t,i,r,n){this.D98=e,this._pane=t,this._priceScale=i,this._topMargin=r,this._bottomMargin=n,this._oldTopMargin=i.topMargin(),this._oldBottomMargin=i.bottomMargin()}function B(e,t){this.D98=e,this._range=t}function N(e,t,i,r,n){o.call(this,e),this._property=t,this._value=i,this._forceSetProperty=n,this._prevValue=t.value(),this._cw=r}function F(e,t){var i,r=t.priceScale(),n=[];r.isPercent()&&(i=t.firstValue());for(var o=0;o20&&(this.pushUndoCommand(new _(this.m_model,e,t,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(e,t,i))},n.prototype.endScrollPrice=function(e,t){t.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(e,t))},n.prototype.setPriceAutoScale=function(e,t,i){this.pushUndoCommand(new _(this.m_model,e,t,t.state())),this.chartModel().setPriceAutoScale(e,t,i)},n.prototype.resetPriceScale=function(e,t){this.pushUndoCommand(new _(this.m_model,e,t,t.state())),this.chartModel().resetPriceScale(e,t)},n.prototype.startScaleTime=function(e){this.pushUndoCommand(new f(this.m_model,this.m_model.timeScale().state(),"scale time")),this.chartModel().startScaleTime(e)},n.prototype.scaleTimeTo=function(e){this.chartModel().scaleTimeTo(e)},n.prototype.endScaleTime=function(){this.chartModel().endScaleTime()},n.prototype.startScrollTime=function(e){this._initialTimeScrollState=this.m_model.timeScale().state(),this._initialTimeScrollPos=e,this.chartModel().startScrollTime(e)},n.prototype.scrollTimeTo=function(e){this._initialTimeScrollPos&&Math.abs(e-this._initialTimeScrollPos)>20&&(this.pushUndoCommand(new f(this.m_model,this._initialTimeScrollState,"scroll time")),delete this._initialTimeScrollPos,delete this._initialTimeScrollState),this.chartModel().scrollTimeTo(e)},n.prototype.endScrollTime=function(){this.chartModel().endScrollTime(),delete this._initialTimeScrollPos,delete this._initialTimeScrollState},n.prototype.resetTimeScale=function(){this.pushUndoCommand(new f(this.m_model,this.m_model.timeScale().state())),this.chartModel().resetTimeScale()},n.prototype.canZoomIn=function(){return this.chartModel().canZoomIn()},n.prototype.canZoomOut=function(){return this.chartModel().canZoomOut()},n.prototype.setWidth=function(e){this.m_model.setWidth(e)},n.prototype.setPaneHeight=function(e,t){this.m_model.setPaneHeight(e,t)},n.prototype.gridSource=function(){return this.m_model.gridSource()},n.prototype.watermarkSource=function(){return this.m_model.watermarkSource()},n.prototype.addAlertsSource=function(e){return this.m_model.addAlertsSource(e)},n.prototype.alertsSources=function(){return this.m_model.alertsSources()},n.prototype.publishedChartsTimelineSource=function(){return this.m_model.publishedChartsTimelineSource()},n.prototype.barsMarksSources=function(){return this.m_model.barsMarksSources()},n.prototype.crossHairSource=function(){return this.m_model.crossHairSource()},n.prototype.model=function(){return this.m_model},n.prototype.mainSeries=function(){return this.m_model.m_mainSeries},n.prototype.panes=function(){return this.m_model.m_panes},n.prototype.timeScale=function(){return this.m_model.timeScale()},n.prototype.setSelectedSource=function(e,t){this.m_model.setSelectedSource(e,t)},n.prototype.setHoveredSource=function(e,t){this.m_model.setHoveredSource(e,t)},n.prototype.selectedSource=function(){return this.m_model.selectedSource()},n.prototype.onSelectedSourceChanged=function(){return this.m_model.onSelectedSourceChanged()},n.prototype.hoveredSource=function(){return this.m_model.hoveredSource()},n.prototype.activeStrategySource=function(){return this.m_model.activeStrategySource()},n.prototype.Q18=function(e){this.m_model.Q18(e)},n.prototype.setCurrentPosition=function(e,t,i,r){this.m_model.setCurrentPosition(e,t,i,r)},n.prototype.modifySeries=function(e,t,i){var r=new g(this.m_model,e,t,i);this.pushUndoCommand(r),r.redo()},n.prototype.insertStudy=function(e,t,i){if(!this.model()._chartApi._chartApi.isCanCreateStudy())return void $82.showTooManyStudiesNotice();if(TradingView.Q16("indicators_limit")&&!user.is_pro&&this.m_model.countUserStudies()>=j.FREE_STUDY_LIMIT)return void $82.showGoProDialog({feature:"studyLimit"});if(TradingView.Q16("backtesting")||!e.isTVScriptStrategy){var r=new v(this.m_model,e,t,i);return this.pushUndoCommand(r),r.redo()}},n.prototype.setProperty=function(e,t,i){if(e&&e.value()!==t){var r=new l(e,t,i,this.m_model);this.pushUndoCommand(r),r.redo(),this.emitEvent("setProperty")}},n.prototype.setPercentProperty=function(e,t,i,r){if(e.value()!==t){var n=new h(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setLogProperty=function(e,t,i,r){if(e.value()!==t){var n=new p(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setAutoScaleProperty=function(e,t,i,r){if(e.value()!==t){var n=new d(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setChartStyleProperty=function(e,t,i){if(e.value()!==t){var r=new c(e,t,this.mainSeries(),i,this.m_model,this.Q2);this.pushUndoCommand(r),r.redo(),this.emitEvent("setChartStyleProperty")}},n.prototype.setLockScaleProperty=function(e,t,i,r){if(e.value()!==t){var n=new u(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setScreenChartProperty=function(e,t,i,r,n){if(n||e.value()!==t){var o=new N(r,e,t,i,n);this.pushUndoCommand(o),o.redo()}},n.prototype.beginUndoMacro=Z.beginUndoMacro,n.prototype.endUndoMacro=Z.endUndoMacro,n.prototype.createUndoCheckpoint=Z.createUndoCheckpoint,n.prototype.undoToCheckpoint=Z.undoToCheckpoint,n.prototype.removeSource=function(e,t){var i=t||!1;if(e.isUserDeletable()){var r=new m(this.m_model,e);this.pushUndoCommand(r),r.redo(),i||this.emitEvent("removeSource",[e])}},n.prototype.removeSelectedSource=function(){var e=this.m_model.selectedSource();if(e&&e.isUserDeletable()){this.setSelectedSource(null);var t=new m(this.m_model,e);this.pushUndoCommand(t),t.redo(),this.emitEvent("removeSource",[e])}},n.prototype.removeLineTools=function(e){var t=new y(this.m_model,e);this.pushUndoCommand(t),t.redo()},n.prototype.move=function(e,t,i){var r=this.m_model.paneForSource(e),n=new w(this.m_model,e,r,t,i);this.pushUndoCommand(n),n.redo(),this.emitEvent("moveSource",[e])},n.prototype.createLineTool=function(e,t,i,r,n){if("LineToolRegressionTrend"==i&&!this.model()._chartApi._chartApi.isCanCreateStudy())return void $82.showTooManyStudiesNotice();var o=this.m_model.createLineTool(e,t,i,r,n);return this._createLineCommand=new T(this.m_model,o,e,t),this.m_model.lineBeingCreated()||(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),o},n.prototype.lineBeingCreated=function(){return this.m_model.lineBeingCreated()},n.prototype.paneBeingCreatedLineOn=function(){return this.m_model.paneBeingCreatedLineOn()},n.prototype.coninueCreatingLine=function(e,t,i){var r=(this.m_model.lineBeingCreated(),this.m_model.paneBeingCreatedLineOn(),this.m_model.coninueCreatingLine(e,t,i));return this._createLineCommand.coninueCreatingLine(e,t),r&&(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),r},n.prototype.finishLineTool=function(e){this.m_model.finishLineTool(e)},n.prototype.cancelCreatingLine=function(){this.m_model.cancelCreatingLine()},n.prototype.lineCancelled=function(){return this.m_model.lineCancelled()},n.prototype.startChangingLinetool=function(e,t,i,r){this._currentLineChangeCommand=new b(this.m_model,e,i,r),this.m_model.startChangingLinetool(e,t,i,r)},n.prototype.lineBeingEdited=function(){return this.m_model.lineBeingEdited()},n.prototype.changeLinePoint=function(e,t){this._currentLineChangeCommand.setPoint(e,t),this.m_model.changeLinePoint(e,t)},n.prototype.endChangingLinetool=function(e){this.m_model.endChangingLinetool(e),this._currentLineChangeCommand.endChanging(),this.pushUndoCommand(this._currentLineChangeCommand),this._currentLineChangeCommand=null},n.prototype.startMovingSource=function(e,t,i){this._currentLineMoveCommand=new S(this.m_model,e,t,i),this.m_model.startMovingSource(e,t,i)},n.prototype.sourceBeingMoved=function(){return this.m_model.sourceBeingMoved()},n.prototype.moveSource=function(e){this._currentLineMoveCommand.setPoint(e),this.m_model.moveSource(e)},n.prototype.endMovingSource=function(e){this.m_model.endMovingSource(e),this._currentLineMoveCommand._point&&(this.pushUndoCommand(this._currentLineMoveCommand),this._currentLineChangeCommand=null)},n.prototype.Q17=function(){return this.m_model.Q17()},n.prototype.state=function(e,t){return this.m_model.state(e,t)},n.prototype.asyncState=function(e){return this.m_model.asyncState(e)},n.prototype.restoreState=function(e,t){return this.m_model.restoreState(e,t)},n.prototype.calculateDefaultTags=function(){return this.m_model.calculateDefaultTags()},n.prototype.onTagsChanged=function(){return this.m_model.onTagsChanged()},n.prototype.changeZOrder=function(e,t){var i=new C(this.m_model,e,t);this.pushUndoCommand(i),i.redo(),this.emitEvent("changeZOrder",[e,t])},n.prototype.sendToBack=function(e){var t=new x(this.m_model,e);this.pushUndoCommand(t),t.redo(),this.emitEvent("changeZOrder",[e])},n.prototype.bringToFront=function(e){var t=new P(this.m_model,e);this.pushUndoCommand(t),t.redo(),this.emitEvent("changeZOrder",[e])},n.prototype.removeAllStudies=function(){this.beginUndoMacro("remove all studies");for(var e=this.m_model.Q17(),t=0;t=0;e--)this._subcommands[e].undo()},inherit(l,o),l.prototype.redo=function(){this._oldValue=this._targetObj.value(),TradingView.saveDefaultProperties(!0),this._targetObj.setValue(this._newValue),TradingView.saveDefaultProperties(!1),this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},l.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._targetObj.setValue(this._oldValue),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(d,o),d.prototype.redo=function(){this._oldValue=this._property.value(),this._oldLockScaleValue=this._priceScale.mainSource()instanceof TradingView.Series?this._priceScale.mainSource().properties().lockScale.value():void 0,TradingView.saveDefaultProperties(!0),this._property.setValue(this._newValue),this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(!1),TradingView.saveDefaultProperties(!1),this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},d.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._property.setValue(this._oldValue),this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(this._oldLockScaleValue),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(h,o),h.prototype.redo=function(){this._oldValue=this._percentage.value(),this._oldAutoScaleValue=this._priceScale.properties().autoScale.value(),this._oldLogValue=this._priceScale.properties().log.value(),this._oldLogDisabled=this._priceScale.properties().logDisabled.value(),TradingView.saveDefaultProperties(!0),this._percentage.setValue(this._newValue),this._priceScale.properties().autoScaleDisabled.setValue(this._newValue),this._priceScale.properties().log.setValue(!1),TradingView.saveDefaultProperties(!1),this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},h.prototype.undo=function(){if(TradingView.saveDefaultProperties(!0),this._percentage.setValue(this._oldValue),this._priceScale.properties().autoScale.setValue(this._oldAutoScaleValue),this._priceScale.properties().autoScaleDisabled.setValue(this._oldValue),this._priceScale.properties().log.setValue(this._oldLogValue),!(this._oldAutoScaleValue||this._priceScale.mainSource()instanceof TradingView.Series&&this._priceScale.mainSource().isLockScale())){var e=this.D98.timeScale().visibleBars();this._priceScale.setPriceRange(this._priceScale.priceRange().convertFromPercents(this._priceScale.mainSource().close(e.firstBar())))}TradingView.saveDefaultProperties(!1),this._oldValue=null,this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(p,o),p.prototype.redo=function(){this._oldValue=this._log.value(),this._oldPercValue=this._priceScale.properties().percentage.value(),this._oldPercDisabled=this._priceScale.properties().percentageDisabled.value(),TradingView.saveDefaultProperties(!0),this._log.setValue(this._newValue),this._priceScale.properties().percentage.setValue(!1),this._priceScale.properties().autoScaleDisabled.setValue(this._priceScale.properties().percentage.value()),TradingView.saveDefaultProperties(!1),this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},p.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._log.setValue(this._oldValue),this._priceScale.properties().percentage.setValue(this._oldPercValue),
-TradingView.saveDefaultProperties(!1),this._oldValue=null,this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(c,o),c.prototype.redo=function(){var e=$.Deferred().resolve();this._mainSeries.Q0.style===this._style&&this.D98.mainSeries().isNeedRestart(this._newValue)&&(e=this.Q2.screen.show()),e.done(function(){this._oldValue=this._style.value(),this._oldAutoScale=this._priceAxisProperties.autoScale.value(),this._oldLogValue=this._priceAxisProperties.log.value(),this._oldLogDisabled=this._priceAxisProperties.logDisabled.value(),this._oldPercentageValue=this._priceAxisProperties.percentage.value(),this._oldPercentageDisabled=this._priceAxisProperties.percentageDisabled.value(),TradingView.saveDefaultProperties(!0),this._style.setValue(this._newValue),this.Q2.model()._preparePriceAxisProperties(this._mainSeries.properties(),this._priceAxisProperties),TradingView.saveDefaultProperties(!1),this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))}.bind(this))},c.prototype.undo=function(){var e=$.Deferred().resolve();this._mainSeries.Q0.style===this._style&&this.D98.mainSeries().isNeedRestart(this._newValue)&&(e=this.Q2.screen.show()),e.done(function(){TradingView.saveDefaultProperties(!0),this._style.setValue(this._oldValue),this._priceAxisProperties.log.setValue(this._oldLogValue),this._priceAxisProperties.logDisabled.setValue(this._oldLogDisabled),this._priceAxisProperties.percentage.setValue(this._oldPercentageValue),this._priceAxisProperties.percentageDisabled.setValue(this._oldPercentageDisabled),this._priceAxisProperties.autoScale.setValue(this._oldAutoScale),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))}.bind(this))},inherit(u,o),u.prototype.redo=function(){this._oldValue=this._property.value(),this._oldAutoScale=this._priceAxisProperties.autoScale.value(),this._oldPercentage=this._priceAxisProperties.percentage.value(),this._oldLog=this._priceAxisProperties.log.value(),TradingView.saveDefaultProperties(!0),this._newValue&&(this._priceAxisProperties.percentage.setValue(!1),this._priceAxisProperties.log.setValue(!1),this._priceAxisProperties.autoScale.setValue(!1));var e=this._mainSeries.properties().style.value();e!==TradingView.Series.STYLE_RENKO&&e!==TradingView.Series.STYLE_KAGI&&e!==TradingView.Series.STYLE_PNF&&e!==TradingView.Series.STYLE_PB&&this._mainSeries.fixBoxSize(),this._property.setValue(this._newValue),TradingView.saveDefaultProperties(!1),this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},u.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._priceAxisProperties.percentage.setValue(this._oldPercentage),this._priceAxisProperties.log.setValue(this._oldLog),this._priceAxisProperties.autoScale.setValue(this._oldAutoScale),this._property.setValue(this._oldValue),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.D98&&(this.D98.recalculateAllPanes(),this.D98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(_,o),_.prototype.undo=function(){return null!==this.m_newPriceScaleState?void TradingView.logDebugChart("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),void this.m_priceScale.recalcLockedScale(null))},_.prototype.redo=function(){return null===this.m_newPriceScaleState?void TradingView.logDebugChart("PriceScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_newPriceScaleState),void(this.m_newPriceScaleState=null))},inherit(f,o),f.prototype.undo=function(){return null!==this.m_newTimeScaleState?void TradingView.logDebugChart("TimeScaleChangeUndoCommand.undo: Command is already undone"):(this.m_newTimeScaleState=this.m_model.timeScale().state(),this.m_model.restoreTimeScaleState(this.m_state),void this.m_model.timeScale().recalcLockedScale())},f.prototype.redo=function(){return null===this.m_newTimeScaleState?void TradingView.logDebugChart("TimeScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restoreTimeScaleState(this.m_newTimeScaleState),void(this.m_newTimeScaleState=null))},inherit(g,o),g.prototype.redo=function(){this.D98.modifySeries(this._series,this._symbol,this._interval)},g.prototype.undo=function(){this.D98.modifySeries(this._series,this._oldSymbol,this._oldInterval)},inherit(v,o),v.prototype.redo=function(){return this.D99=this.D98.insertStudy(this._studyMetaInfo,this._props,this._isOverlay),this.D99},v.prototype.undo=function(){this.D98.removeSource(this.D99)},inherit(m,o),m.prototype.redo=function(){this._sourceState=this.D97.state();var e=this.D98.paneForSource(this.D97);this._paneIndex=this.D98.panes().indexOf(e),this._priceScaleName=e.priceScaleName(this.D97.priceScale());var t=this.D98.children(this.D97);this._removeChildUndoCommands=[];for(var i=0;i=0;e--){var t=this._removeChildUndoCommands[e];t.undo()}this._removeChildUndoCommands.length=0},inherit(y,o),y.prototype.redo=function(){for(var e=0;e0&&(this.D98.panes().splice(this._index,1),this.D98.panes().splice(this._index-1,0,e)),"down"===this._direction&&this._index=0)var l=new d(t,i,a);else var l=new d(t,i);return l},e.exports=r},function(e,t,i){"use strict";for(var r={LineToolFibRetracement:i(8),LineToolFibChannel:i(99),LineToolFibSpeedResistanceArcs:i(100),LineToolProjection:i(101),LineToolTrendBasedFibExtension:i(103),LineToolElliott:i(96).LineToolElliott,LineToolFibCircles:i(97).LineToolFibCircles,LineToolRegressionTrend:i(81),LineToolTrading:i(104),LineToolVbPFixed:i(105),LineStudyMtp:i(106),LineToolVertLine:i(86).LineToolVertLine,LineToolBarsPattern:i(92),LineToolTrendBasedFibTime:i(107),LineToolFibTimeZone:i(108),LineToolCircleLines:i(109),LineToolDateRange:i(110),LineToolPriceRange:i(111),LineToolDateAndPriceRange:i(112),LineToolParallelChannel:i(83).LineToolParallelChannel,LineToolTrendAngle:i(94),LineToolTrendLine:i(55).LineToolTrendLine,LineToolArrowMark:i(113).LineToolArrowMark,LineToolExecution:i(57).LineToolExecution,LineToolPitchfan:i(115),LineToolGannSquare:i(117),LineToolFibSpeedResistanceFan:i(118),LineToolGannComplex:i(119),LineToolGannFan:i(120),LineToolFibWedge:i(102).LineToolFibWedge,LineToolPitchfork:i(116).LineToolPitchfork,LineToolDisjointAngle:i(121),LineToolFlatBottom:i(122),LineToolIcon:i(123),LineToolRotatedRectangle:i(124),LineToolFibSpiral:i(125),LineToolHeadAndShoulders:i(126),LineToolTriangle:i(127).LineToolTriangle,LineToolTrianglePattern:i(128),LineTool5PointsPattern:i(129).LineTool5PointsPattern,LineToolThreeDrivers:i(130),LineToolABCD:i(131),LineToolRiskReward:i(132).LineToolRiskReward,LineToolPolyline:i(133),LineToolPrediction:i(134),LineToolPriceLabel:i(135),LineToolNote:i(136).LineToolNote,LineToolNoteAbsolute:i(136).LineToolNoteAbsolute,LineToolBrush:i(137),LineToolArc:i(138),LineToolCallout:i(93),LineToolBalloon:i(139),LineToolText:i(45).LineToolText,LineToolHorzLine:i(43).LineToolHorzLine,LineToolHorzRay:i(140),LineToolRectangle:i(12).LineToolRectangle,LineToolEllipse:i(141),LineToolTimeCycles:i(142),LineToolSineLine:i(143),LineToolGhostFeed:i(95),LineToolBezierQuadro:i(144).LineToolBezierQuadro,LineToolBezierCubic:i(144).LineToolBezierCubic,LineToolArrow:i(145),LineToolRay:i(146),LineToolExtended:i(147),LineToolSchiffPitchfork:i(148),LineToolSchiffPitchfork2:i(149),LineToolInsidePitchfork:i(150),LineToolTextAbsolute:i(45).LineToolTextAbsolute,LineToolArrowMarkLeft:i(113).LineToolArrowMarkLeft,LineToolArrowMarkRight:i(113).LineToolArrowMarkRight,LineToolArrowMarkUp:i(113).LineToolArrowMarkUp,LineToolArrowMarkDown:i(113).LineToolArrowMarkDown,LineToolFlagMark:i(151),LineToolCypherPattern:i(129).LineToolCypherPattern,LineToolElliottImpulse:i(96).LineToolElliottImpulse,LineToolElliottTriangle:i(96).LineToolElliottTriangle,LineToolElliottTripleCombo:i(96).LineToolElliottTripleCombo,LineToolElliottCorrection:i(96).LineToolElliottCorrection,LineToolElliottDoubleCombo:i(96).LineToolElliottDoubleCombo,LineToolRiskRewardLong:i(132).LineToolRiskRewardLong,LineToolRiskRewardShort:i(132).LineToolRiskRewardShort,LineToolPosition:i(152),LineToolOrder:i(153)},n=Object.keys(r),o=n.length;o--;)TradingView[n[o]]=r[n[o]];e.exports=r},function(e,t,i){"use strict";function r(){l.call(this)}function n(e,t){h.call(this,e,t),this._rendererCache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolFibRetracement";var i=t?t:new this.createPropertiesObject("linetoolfibretracement");d.call(this,e,new n(this,e),i),this.version=o.version,this.Q0._stateVersion=1,e._fibRetracementLabelsCache||(e._fibRetracementLabelsCache=new r)}var a=i(9),s=i(12).RectangleTransparencyRenderer,l=i(98),d=i(13).LineDataSource,h=i(44),p=i(55).TrendLineRenderer;inherit(r,l),r.prototype.levelsCount=function(){return o.LevelsCount},inherit(n,h),n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){if(h.prototype.update.call(this),this._cacheState=this.D98._fibRetracementLabelsCache.updateSource(this.D97),!(this.D97.points().length<2)&&this.D97.priceScale()&&!this.D97.priceScale().isEmpty()&&!this.D98.timeScale().isEmpty()){var e=this.D97.points()[0],t=this.D97.points()[1],i=!1,r=this.D97.properties();r.reverse&&r.reverse.value()&&(i=r.reverse.value()),this._levels=[];var n,a=i?t.price-e.price:e.price-t.price,s=i?e.price:t.price;if(!this.D97.priceScale().isPercent()||(n=this.D97.ownerSource().firstValue(),null!==n))for(var l=1;l<=o.LevelsCount;l++){var d="level"+l,p=r[d];if(p.visible.value()){var c=p.coeff.value(),u=p.color.value(),_=s+c*a;this.D97.priceScale().isPercent()&&(_=this.D97.priceScale().priceRange().convertToPercent(_,n));var f=this.D97.priceScale().priceToCoordinate(_);this._levels.push({color:u,y:f,linewidth:r.levelsStyle.linewidth.value(),linestyle:r.levelsStyle.linestyle.value(),index:l})}}}},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;for(var t=this._points[0],i=this._points[1],r=Math.min(t.x,i.x),n=(Math.min(t.y,i.y),Math.max(t.x,i.x)),o=(Math.max(t.y,i.y),this.D97.properties()),a=o.fillBackground.value(),l=o.transparency.value(),h=o.extendLines.value()?this.D98.timeScale().width():n,c=this.D98._fibRetracementLabelsCache,u=c.canvas().get(0),_=0;_0&&a){var f=this._levels[_-1],t=new MathEx.Point(r,this._levels[_].y),i=new MathEx.Point(h,f.y),g={};g.points=[t,i],g.color=this._levels[_].color,g.linewidth=0,g.backcolor=this._levels[_].color,g.fillBackground=!0,g.transparency=l,e.append(new s(g))}var t=new MathEx.Point(r,this._levels[_].y),i=new MathEx.Point(n,this._levels[_].y),v={points:[t,i],width:this.D98.timeScale().width(),height:this.D97.priceScale().height(),color:this._levels[_].color,linewidth:this._levels[_].linewidth,linestyle:this._levels[_].linestyle,extendleft:!1,extendright:o.extendLines.value(),leftend:d.LINEEND_NORMAL,rightend:d.LINEEND_NORMAL},m=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,this._levels[_].index);if(e.append(new p(v,m)),o.showCoeffs.value()||o.showPrices.value()){if(!this._cacheState.preparedCells)continue;var y=this._cacheState.preparedCells.cells[this._levels[_].index-1];if(!y)continue;var w;switch(o.horzLabelsAlign.value()){case"left":w=t;break;case"center":w=t.add(i).scaled(.5),w.x+=y.width/2,w.x=Math.round(w.x);break;case"right":o.extendLines.value()?w=new MathEx.Point(h-4,this._levels[_].y):(w=new MathEx.Point(h+4,this._levels[_].y),w.x+=y.width,w.x=Math.round(w.x))}var T={left:y.left,top:c.topByRow(this._cacheState.row),width:y.width,height:c.rowHeight(this._cacheState.row)},b={left:w.x-T.width,top:w.y,width:y.width,height:T.height},S=o.vertLabelsAlign.value();"middle"==S&&(b.top-=b.height/2),"bottom"==S&&(b.top-=b.height);var C=new TradingView.PaneRendererCachedImage(u,T,b);e.append(C)}}if(o.trendline.visible.value()){var v={points:[this._points[0],this._points[1]],width:this.D98.timeScale().width(),height:this.D97.priceScale().height(),color:o.trendline.color.value(),linewidth:o.trendline.linewidth.value(),linestyle:o.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:d.LINEEND_NORMAL,rightend:d.LINEEND_NORMAL};e.append(new p(v))}return this.addAnchors(e),e},inherit(o,d),o.version=2,o.LevelsCount=24,o.prototype.stop=function(){d.prototype.stop.call(this),this.D98._fibRetracementLabelsCache.removeSource(this.id())},o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Fib Retracement"},o.prototype.migrateVersion=function(e,t,i){1==e&&this.properties().extendLines.setValue(!0)},o.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},o.prototype.createPropertiesObject=function(e,t,i){return new a(e,t,i,{range:[1,24],names:["coeff","color","visible"]})},e.exports=o},function(e,t,i){"use strict";function r(e,t,i,r){this._map=$.extend({},this._map,r),t&&(t=this.unpackLevels(t)),A50.call(this,e,t,i)}var n=i(10).isSameType;inherit(r,A50),r.prototype.state=function(e,t){var i=Property.prototype.state.call(this,e);return t?i:this.packLevels(i)},r.prototype.merge=function(e){Property.prototype.merge.call(this,this.unpackLevels(e))},r.prototype._map={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:Object,unpack:Array}},r.prototype._packLvlTpl=function(){return[]},r.prototype._unpackLvlTpl=function(){return{}},r.prototype._packLvlFill=function(e,t,i,r){return r.push(i[t]),r},r.prototype._unpackLvlFill=function(e,t,i,r){return r[t]=i[e],r},r.prototype._iterateLevels=function(e,t){for(var i in this._map.prefixes)for(var r=(this._map.prefixes[i]||"")+"level",o=this._map.range[0];o<=this._map.range[1];o++)if(e[r+o]&&n(e[r+o],t.typecheck())){var a=t.tpl();for(var s in this._map.names)a=t.fill(s,this._map.names[s],e[r+o],a);e[r+o]=a}return e},r.prototype.packLevels=function(e){return this._iterateLevels(e,{tpl:this._packLvlTpl,fill:this._packLvlFill,typecheck:this._map.typecheck.pack})},r.prototype.unpackLevels=function(e){return this._iterateLevels(e,{tpl:this._unpackLvlTpl,fill:this._unpackLvlFill,typecheck:this._map.typecheck.unpack})},r.prototype.saveDefaults=function(){TradingView.saveDefaults(this._defaultName,this.state(this._exclusions,!0))},e.exports=r},function(e,t,i){(function(e){function t(e){return"number"==typeof e&&isFinite(e)}function i(e){return null===e||void 0===e?!1:e.constructor==Function}function r(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),e.prototype.superclass=t}var n=n||{},o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};n.isNaN=function(e){return!(0>=e||e>0)},Number.isNaN=Number.isNaN||function(e){return e!=e},n.isSameType=function(e,t){return Number.isNaN(e)||Number.isNaN(t)?Number.isNaN(e)===Number.isNaN(t):{}.toString.call(e)==={}.toString.call(t)},n.isInteger=function(e){return"number"==typeof e&&e%1===0},n.parseBool=function(e){return e===!0||"true"===e},n.isBoolean=function(e){return e===!0||e===!1},n.isString=function(e){return null===e||void 0===e?!1:e.constructor==String},n.declareClassAsPureInterface=function(e,t){for(var i in e.prototype)"function"==typeof e.prototype[i]&&e.prototype.hasOwnProperty(i)&&(e.prototype[i]=function(){throw t+"::"+i+" is an interface member declaration and must be overloaded in order to be called";
-})},n.requireFullInterfaceImplementation=function(e,t,i,r){for(var n in i.prototype)if("function"==typeof i.prototype[n]&&!e.prototype[n])throw"Interface implementation assertion failed: "+t+" does not implement "+r+"::"+n+" function"},n.isInherited=function(e,t){return e===t?!0:e&&e.prototype?void 0===e.prototype.superclass||null===e.prototype.superclass?!1:e.prototype.superclass===t?!0:n.isInherited(e.prototype.superclass,t):!1},n.TypeValidator=function(e){this.m_type=e},n.TypeValidator.prototype.check=function(e){return e.constructor===this.m_type||n.isInherited(e.constructor,this.m_type)},n.PredicateValidator=function(e){this.m_predicate=e},n.PredicateValidator.prototype.check=function(e){return this.m_predicate(e)},n.clone=function(e){if(!e||"object"!=typeof e)return e;var t;t="function"==typeof e.pop?[]:{};var i,r;for(i in e)e.hasOwnProperty(i)&&(r=e[i],r&&"object"==typeof r?t[i]=n.clone(r):t[i]=r);return t},n.deepEquals=function(e,t,r){if(r||(r=""),e===t)return[!0,r];if(i(e)&&(e=void 0),i(t)&&(t=void 0),void 0===e&&void 0!==t)return[!1,r];if(void 0===t&&void 0!==e)return[!1,r];if(null===e&&null!==t)return[!1,r];if(null===t&&null!==e)return[!1,r];if(n.isString(e)&&n.isString(t))return[e===t,r];if(Array.isArray(e)&&Array.isArray(t)){var a=e.length,s=t.length;if(a!==s)return[!1,r];for(var l=0;a>l;l++){var d=n.deepEquals(e[l],t[l],r+"["+l+"]");if(!d[0])return d}return[!0,r]}if(o(e)||o(t))return[!1,r];for(var h in e){var d=n.deepEquals(e[h],t[h],r+"["+h+"]");if(!d[0])return d}return[!0,r]},n.merge=function(e,t){for(var i in t)"object"==typeof t[i]&&e.hasOwnProperty(i)?n.merge(e[i],t[i]):e[i]=t[i];return e},n.mergeObj=function(e,t){for(var i in t)t[i].constructor===Object&&e.hasOwnProperty(i)?n.mergeObj(e[i],t[i]):e[i]=t[i];return e},n.mergeWithRules=function(e,t,i,r){for(var o in t){var a=r?r+"."+o:o;i&&a in i?e[o]=i[a](e[o],t[o]):"object"==typeof t[o]&&e.hasOwnProperty(o)?n.merge(e[o],t[o],i,a):e[o]=t[o]}},n.sortMultipleFunction=function(){var e=[].slice.call(arguments),t=e.length;return function(i,r){var n,o,a,s,l,d,h;for(h=0;t>h&&(d=0,a=e[h],s="string"==typeof a?a:a.name,n=i[s],o=r[s],"function"==typeof a.fn&&(n=a.fn(n),o=a.fn(o)),l=a.reverse?-1:1,o>n&&(d=-1*l),n>o&&(d=1*l),0===d);h++);return d}},void 0!==e&&e&&e.exports&&(e.exports={inherit:r,merge:n.merge,isNumber:t,isInteger:n.isInteger,isBoolean:n.isBoolean,isString:n.isString,isNaN:n.isNaN,isSameType:n.isSameType})}).call(t,i(11)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t,i){"use strict";function r(e,t,i){this._data=e,this._hittestResult=t||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),this._backHittestResult=i||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND)}function n(e,t){l.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolRectangle";var i=t?t:new A50("linetoolrectangle");s.call(this,e,new n(this,e),i)}function a(e,t,i){r.call(this,e,t,i)}var s=i(13).LineDataSource,l=i(44);r.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency)},r.prototype.draw=function(e){if(!(this._data.points.length<2)){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t=this._data.points[0],i=this._data.points[1],r=i.substract(t);e.canvas.width,e.canvas.height;e.beginPath(),e.rect(t.x,t.y,r.x,r.y),this._data.linewidth>0&&e.stroke(),this._data.fillBackground&&(e.fillStyle=this.getColor(),e.fill())}},r.prototype.hitTest=function(e){if(this._data.points.length<2||this._data.nohittest)return null;var t=3,i=this._data.points[0],r=this._data.points[1],n=new MathEx.Point(r.x,i.y),o=new MathEx.Point(i.x,r.y),a=MathEx.distanceToSegment(i,n,e);if(a.distance<=t)return this._hittestResult;if(a=MathEx.distanceToSegment(n,r,e),a.distance<=t)return this._hittestResult;if(a=MathEx.distanceToSegment(r,o,e),a.distance<=t)return this._hittestResult;if(a=MathEx.distanceToSegment(o,i,e),a.distance<=t)return this._hittestResult;if(this._data.fillBackground){var s=Math.min(i.x,r.x),l=Math.max(i.x,r.x),d=Math.min(i.y,r.y),h=Math.max(i.y,r.y);if(i=new MathEx.Point(s,d),r=new MathEx.Point(l,h),MathEx.pointInRect(e,i,r))return this._backHittestResult}return null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};if(e.points=this._points,e.color=this.D97.properties().color.value(),e.linewidth=this.D97.properties().linewidth.value(),e.backcolor=this.D97.properties().backgroundColor.value(),e.fillBackground=this.D97.properties().fillBackground.value(),e.transparency=this.D97.properties().transparency.value(),this.isAnchorsRequired()){var t=new TradingView.CompositeRenderer;return t.append(new r(e)),this.addAnchors(t),t}return new r(e)},inherit(o,s),o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Rectangle"},inherit(a,r),a.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency,!0)},t.RectangleRenderer=r,t.RectangleTransparencyRenderer=a,t.LineToolRectangle=o},function(e,t,i){"use strict";function r(e,t){a.call(this,e,t),this._linetool=e,this._pointIndex=t,this._text="",this._coordinate=0,this._background="#5592C9",this._activeBackground="#0F6DBF",this._borderColor="#2E84A6",this._color="white",this._invalidated=!0,this.D98=e.D98}function n(e,t){l.call(this),this._linetool=e,this._pointindex=t,this.D98=e.D98,this._text="",this._coordinate=0,this._background="#5592C9",this._activeBackground="#0F6DBF",this._borderColor="#2E84A6",this._color="white",this._visible=!1,this._invalidated=!0}function o(e,t,i){h.call(this),this.D98=e,this.Q0=i,i.visible&&i.frozen||this.Q0.merge(defaults("linetool"));var r=defaults("linetoolvisibilities");if(i.intervalsVisibilities)for(var a in r.intervalsVisibilities)this.Q0.intervalsVisibilities[a]||this.Q0.intervalsVisibilities.addProperty(a,r.intervalsVisibilities[a]);else this.Q0.merge(r);if($.isArray(t)?this._paneViews=t:this._paneViews=[t],this._points=[],this._fixedPoints=[],this._timePoint=[],!this.Q0.symbol){this.Q0.merge({symbol:e.mainSeries().symbol()});var s=e.mainSeries().symbolInfo();s&&this.Q0.merge({symbolInfo:{listed_exchange:s.listed_exchange,short_name:s.name}})}if(this.Q0.interval||this.Q0.merge({interval:e.mainSeries().interval()}),this.Q0.addExclusion&&(this.Q0.addExclusion("symbol"),this.Q0.addExclusion("symbolInfo"),this.Q0.addExclusion("points"),this.Q0.addExclusion("interval"),this.Q0.addExclusion("visible"),this.Q0.addExclusion("lastUpdateTime")),this.calcIsActualSymbol(),this.Q0.intervalsVisibilities.listeners().subscribe(this,o.prototype.calcIsActualSymbol),this.Q0.listeners().subscribe(this,o.prototype.propertiesChanged),this._createPointsProperties(),"_tooltipFieldsHash"in this&&!this.hasOwnProperty("_tooltipFieldsHash")&&(this._tooltipFieldsHash=$.extend(!0,{},this._tooltipFieldsHash)),this.m_priceAxisViews=[],this.m_timeAxisViews=[],this.pointsCount()>0)for(var l=0;l=t.multiplier()&&(i=e.key)}),i},o.prototype.calcIsActualSymbol=function(){var e=this.Q0,t=this.D98.mainSeries(),i=t.symbolInfo();i&&e.symbolInfo?this._isActualSymbol=e.symbolInfo.listed_exchange.value()===i.listed_exchange&&e.symbolInfo.short_name.value()===i.name:this._isActualSymbol=e.symbol.value()===t.symbol()||e.symbol.value().split(":").slice(-1)[0]===t.symbol().split(":").slice(-1)[0],this.calcIsActualInterval()},o.prototype.calcIsActualInterval=function(){var e=this.Q0,t=this.D98.mainSeries(),i=(t.symbolInfo(),TradingView.Interval.parse(t.interval())),r=e.intervalsVisibilities;if(this._isActualInterval=!1,i.kind()===TradingView.Interval.SECONDS){var n=r.seconds.value(),o=r.secondsFrom.value(),a=r.secondsTo.value();this._isActualInterval=n&&i.multiplier()>=o&&i.multiplier()<=a}if(i.kind()===TradingView.Interval.MINUTES&&i.multiplier()<60){var n=r.minutes.value(),o=r.minutesFrom.value(),a=r.minutesTo.value();this._isActualInterval=n&&i.multiplier()>=o&&i.multiplier()<=a}if(i.kind()===TradingView.Interval.MINUTES&&i.multiplier()>=60){var s=Math.floor(i.multiplier()/60),n=r.hours.value(),o=r.hoursFrom.value(),a=r.hoursTo.value();this._isActualInterval=n&&s>=o&&a>=s}if(i.kind()===TradingView.Interval.DAYS){var n=r.days.value(),o=r.daysFrom.value(),a=r.daysTo.value();this._isActualInterval=n&&i.multiplier()>=o&&i.multiplier()<=a}i.kind()===TradingView.Interval.WEEKS&&(this._isActualInterval=r.weeks.value()),i.kind()===TradingView.Interval.MONTHS&&(this._isActualInterval=r.months.value()),this._isActualInterval||this.D98.selectedSource()!=this||this.D98.setSelectedSource(null)},o.PointPriceProperty.prototype.value=function(){var e=this._lineSource.points()[this._pointIndex].price,t=this._lineSource.ownerSource().formatter(),i=t.parse(t.format(e));return i.price?i.price:i.value},o.PointPriceProperty.prototype.setValue=function(e){var t=this._lineSource.points()[this._pointIndex];t.price=parseFloat(e);var i=this._lineSource.priceScale();if(i.isPercent()){var r=this._lineSource.ownerSource().firstValue();t.price=i.priceRange().convertToPercent(t.price,r)}this._lineSource.setPoint(this._pointIndex,t),this._lineSource.D98.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging(!0),this._lineSource._syncMultichartState(),this._lineSource.Q0.lastUpdateTime.setValue((new Date).valueOf())},o.PointIndexProperty=function(e,t){Property.call(this),this._lineSource=e,this._pointIndex=t},inherit(o.PointIndexProperty,Property),o.PointIndexProperty.prototype.value=function(){return this._lineSource.points()[this._pointIndex].index},o.PointIndexProperty.prototype.setValue=function(e){var t=this._lineSource.points()[this._pointIndex];t.index=e;var i=this._lineSource.priceScale();if(i.isPercent()){var r=this._lineSource.ownerSource().firstValue();t.price=i.priceRange().convertToPercent(t.price,r)}this._lineSource.setPoint(this._pointIndex,t),this._lineSource.D98.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging(!0),this._lineSource._syncMultichartState(),this._lineSource.Q0.lastUpdateTime.setValue((new Date).valueOf())},o.prototype._syncMultichartState=function(){var e={points:this._timePoint,interval:this.D98.mainSeries().interval()};this.linkKey&&!this.properties().singleChartOnly&&TradingView.drawingState.finishChangingLineTool({model:this.D98,linkKey:this.linkKey,symbol:this.D98.mainSeries().symbol(),finalState:e})},o.prototype._createPointProperty=function(e){var t=this.Q0.points;t.addProperty(e);var i=t[e];i.addProperty("price"),i.price=new o.PointPriceProperty(this,e),i.addProperty("bar"),i.bar=new o.PointIndexProperty(this,e)},o.prototype._createPointsProperties=function(){this.Q0.addProperty("points");for(var e=0;e0&&(this._points=e)},o.prototype.restorePoints=function(e,t,i){this._timePoint=e,this._points=t,i||this.denormalizeTimePoints()},o.prototype.restoreExternalPoints=function(e){this.properties().interval.setValue(e.interval),this._timePoint=e.points,this.denormalizeTimePoints(),this.createServerPoints()},o.prototype.restorePositionPercents=function(e){this._positionPercents=e},o.prototype.updateAllViewsAndRedraw=function(){this.updateAllViews(),this.D98.updateSource(this)},o.prototype.propertiesChanged=function(){if(this.calcIsActualSymbol(),this.updateAllViewsAndRedraw(),this.linkKey){var e=this.properties().state();delete e.interval,TradingView.drawingState.changeLineStyle({linkKey:this.linkKey,state:e,model:this.D98})}},o.prototype.points=function(){for(var e=[],t=0;t=2&&this.Q0.snapTo45Degrees&&this._snapPoint45Degree(r,this.points()[this.points().length-2]);var n=this.priceScale();if(n.isPercent()){var o=this.ownerSource().firstValue();r.price=n.priceRange().convertFromPercent(r.price,o)}this._points.push(r);var a=this._points.length==this.pointsCount();return a?(this._lastPoint=null,i||(this.normalizePoints(),this.createServerPoints())):this._lastPoint=r,a},o.prototype.addFixedPoint=function(e){this._fixedPoints.push(e);var t=this._fixedPoints.length==this.pointsCount();return t&&this.calcPositionPercents(),t},o.prototype.calcPositionPercents=function(){if(!this.priceScale()||this.priceScale().isEmpty())return[];this._positionPercents=[];for(var e=0;e=0;--i)t.push(this._paneViews[i]);return t},o.prototype.dataWindowView=function(){return null},o.prototype.statusView=function(){return null},o.prototype.priceAxisViews=function(e,t){if(!this._isActualSymbol)return null;if(-1!==e.Q17().indexOf(this)&&t===this.priceScale()){if(this.D98.lineBeingEdited()===this){var i=this.D98.linePointBeingEdited();if(i=2&&this.Q0.snapTo45Degrees&&this._snapPoint45Degree(e,this.points()[this.points().length-2]);var i=this.priceScale();if(i.isPercent()){var r=this.ownerSource().firstValue();e.price=i.priceRange().convertFromPercent(e.price,r)}this._lastPoint=e,this.updateAllViews()},o.prototype.setLastFixedPoint=function(e){this._lastFixedPoint=e,this.updateAllViews()},o.prototype.title=function(){return"Line Tool"},o._pointSetId=1,o.prototype.start=function(){this.createServerPoints()},o.prototype.createServerPoints=function(){if(!this._recursiveGuard&&this._isActualSymbol&&this.D98.chartApi().connected()&&(this._currentPointsetId&&(this.D98.chartApi().removePointset(this.currentPointsetId()),this._currentPointsetId=null),!this.D98.timeScale().isEmpty()&&(0===this._timePoint.length&&this.normalizePoints(),0!==this._timePoint.length))){this._currentPointsetId=++o._pointSetId;for(var e=this.D98.mainSeries().symbolId(),t=this.properties().interval.value(),i=[],r=0;r"+e.title+": "+e.value}).join(" ")},o.prototype.pointToScreenPoint=function(e){var t=this.D98.timeScale(),i=this.priceScale();if(!i||i.isEmpty()||t.isEmpty())return[new MathEx.Point(0,0),new MathEx.Point(0,0)];var r=null;if(i.isPercent()){if(!this.ownerSource())return;if(r=this.ownerSource().firstValue(),null===r||!isFinite(r))return}var n=t.indexToCoordinate(e.index,!0),o=e.price;i.isPercent()&&(o=i.priceRange().convertToPercent(o,r));var a=i.priceToCoordinate(o,!0),s=new MathEx.Point(n,a),n=t.indexToCoordinate(e.index,!1),a=i.priceToCoordinate(o,!1),l=new MathEx.Point(n,a);return[s,l]},o.prototype.screenPointToPoint=function(e){var t=this.D98.timeScale(),i=this.priceScale(),r=t.coordinateToIndex(e.x),n=i.coordinateToPrice(e.y),o=null;if(i.isPercent()){if(!this.ownerSource())return;if(o=this.ownerSource().firstValue(),null===o||!isFinite(o))return}return i.isPercent()&&(n=i.priceRange().convertFromPercent(n,o)),{price:n,index:r}},o.prototype.tags=function(){return[this._constructor]},o.prototype._snapPoint45Degree=function(e,t,i){var r=this.D98.timeScale(),n=r.indexToCoordinate(t.index),o=r.indexToCoordinate(e.index)-n,a=this.m_priceScale,s=t.price,l=e.price,d=this.ownerSource().firstValue();a.isPercent()&&(s=a.priceRange().convertToPercent(s,d));var h=a.priceToCoordinate(s),p=a.priceToCoordinate(l)-h,c=Math.round(Math.atan2(o,p)/Math.PI*4);if(2==Math.abs(c))i||(e.price=s);else if(0===Math.abs(c)||4==Math.abs(c))i||(e.index=t.index);else if(0===Math.abs(c)||4===Math.abs(c))i||(e.index=t.index);else{var u=Math.sqrt(o*o+p*p),_=0>o?-1:1,f=0>p?-1:1,g=Math.max(Math.abs(p),Math.abs(o)),v=g*Math.sqrt(2),m=v/u;g/=m;var y=Math.round(r.coordinateToIndex(n+g*_)),w=Math.abs(r.indexToCoordinate(y)-n),T=a.coordinateToPrice(h+w*f);e.index=y,e.price=T}},o.prototype.createPriceAxisView=function(e){return new r(this,e)},o.prototype.version=1,o.isLineTool=function(e){var t=TradingView[e];return t?TradingView.isInherited(t,o):!1},o.prototype.alertId=function(){return this._alertId},o.prototype.setAlert=function(e,t){function r(){!t.noChartSave&&window.saver?window.saver.saveChartSilently(t.success,!1,function(){$82.showGoProDialog({feature:"savedChartsForAlertLimit"}),"function"==typeof t.error&&t.error()},{noDefaultOnFail:!0}):"function"==typeof t.success&&t.success()}var n=i(19),o=this,t=t||{},a=e instanceof n?e.id:parseInt(e),s=o.D98.hoveredSource()===o,l=o.D98.selectedSource()===o;this.canHasAlert()&&(o._alertId=a,o.hasAlert.setValue(!0),TradingView.alertsDispatcher&&o.getAlert().done(function(e){o._processAlertHanders("unsubscribe"),o._processAlertHanders("subscribe"),e.set("hovered",s),e.set("selected",l)}).fail(function(e){o._processAlertHanders("unsubscribe"),"not_exists"===e&&o._flushAlert()}).always(function(){setTimeout(r,0)}))},o.prototype._flushAlert=function(e){delete this._alertId,delete this._alert,this.hasAlert.setValue(!1),window.saver&&window.saver.saveChartSilently(null,!1)},o.prototype._processAlertHanders=function(e){var t,i,r=this,e="subscribe"===e?"subscribe":"unsubscribe";if("unsubscribe"!==e||r._alertCallbacks){i="subscribe"===e?"on":"off",t=r.properties();var n=r._alertCallbacks||{
-flush:r._flushAlert.bind(r),hovered:function(e,t){t?r.D98.setHoveredSource(r):r.D98.hoveredSource()===r&&r.D98.setHoveredSource(null)}.bind(r),selected:function(e,t){t&&r.D98.setSelectedSource(r)}.bind(r),synchronizeSilently:function(e){r.synchronizeAlert(!1)}.bind(r)};r._alertCallbacks||(r._alertCallbacks=n),r.getAlert().done(function(o){o&&(o[i]("destroy",n.flush),o[i]("change:hovered",n.hovered),o[i]("change:selected",n.selected),t.extendLeft&&t.extendLeft[e](r,n.synchronizeSilently),t.extendRight&&t.extendRight[e](r,n.synchronizeSilently))})}},o.prototype.editAlert=function(){function e(e){"not_exists"===e&&(t._flushAlert(),$82.ShowConfirm($.t("Alert"),$.t("Alert does not exist. Create new?"),function(){new r({drawing:t})}))}var t=this,r=i(28);t.hasAlert.value()&&TradingView.alertsDispatcher.openEditDialog(this.alertId(),{error:e})},o.prototype.getAlert=function(e){var t=this,e=e||{},i=$.Deferred();return TradingView.alertsDispatcher?TradingView.alertsDispatcher.requestAlert(t._alertId,{success:i.resolve.bind(i),error:i.reject.bind(i),fromCache:e.fromCache}):TradingView.logError("[Alerts] Can't get alert without alerts dispatcher"),i.promise()},o.prototype.synchronizeAlert=function(e){var t=this;t.hasAlert.value()&&setTimeout(function(){function i(){t._alertUndoMode=!0,o.undoToCheckpoint(t._undoCheckpointAlert),setTimeout(function(){t._alertUndoMode=!1,t.localAndServerAlersMismatch=!1},0)}function r(e){e.set("resolution",t.properties().interval.value()),e.get("extra").drawing(t),t.localAndServerAlersMismatch=!0}function n(e){TradingView.alertsDispatcher.restartAlert(e,{success:function(){t.localAndServerAlersMismatch=!1},error:i,complete:function(){delete t._undoCheckpointAlert}})}var o=t.D98._undoModel;if(!t._undoCheckpointAlert&&!t._alertUndoMode){var a=o.undoStack().pop();t._undoCheckpointAlert=o.createUndoCheckpoint(),o.undoStack().push(a)}t.getAlert().done(function(t){r(t),e&&n(t)}).fail(i)},0)},o.prototype.stateForAlert=function(){if(this.canHasAlert()){var e=this.state();e.uniqueId=this.uniqueId(),e.title=this.title();var t=this._getAlertPlots();return t&&(e.plots=t),e}},o.prototype._getAlertPlots=function(){return null},o.prototype._linePointsToAlertPlot=function(e,t,i,r){if(2!==e.length)return TradingView.logError("[Drawing Alert] Wrong points"),null;var n=this.D98.timeScale();return!n||n.isEmpty()?null:{type:"LinePlot",title:t||this.title(),timestamp:Math.round(n.indexToTimePoint(0).getTime()/1e3),offset1:e[0].index,offset2:e[1].index,price1:e[0].price,price2:e[1].price,extendBackward:i||!1,extendForward:r||!1}},o.prototype.getAlertIsActive=function(e){this.getAlert({fromCache:!0}).done(function(t){e(t?t.get("active"):!1)}).fail(function(){e(!1)})},o.prototype.geometry=function(){var e=this,t=function(t){var i=t.x/e.D98.timeScale().width(),r=t.y/e.priceScale().height();return new MathEx.Point(i,r)},i=this.points().map(function(i){var r=e.pointToScreenPoint(i)[0];return t(r)});return i},o.prototype.onlyYMoving=function(){return!1},t.LineToolPriceAxisView=r,t.LineDataSource=o},function(e,t){"use strict";function i(){this._text="",this._background="#585858",this._coordinate=0}i.prototype.text=function(){return this._text},i.prototype.background=function(){return this._background},i.prototype.color=function(){return new TradingView.RGBColor(this._background).blackWhiteContrast()},i.prototype.coordinate=function(){return this._coordinate},i.prototype.floatCoordinate=function(){return this._floatCoordinate||this._coordinate},e.exports=i},function(e,t){"use strict";function i(e){this._data=e}i.prototype.draw=function(e,t){if(this._data.visible){var i=t.fontSize;e.font=t.font;var r=t.tickLength,n=t.borderSize,o=t.paddingTop,a=t.paddingBottom,s=t.paddingInner,l=t.paddingOuter,d=Math.ceil(t.widthCache.measureText(e,this._data.text)),h=t.baselineOffset;e.strokeStyle=this._data.borderColor,e.fillStyle=this._data.background,e.lineWidth=1;var p,c=t.fontSize+o+a,u=n+d+s+l+r,_=this._data.coordinate,f=_-Math.floor(i/2)-o-.5,g=f+c;p=t.isLeft?t.width-n-.5:.5;var v,m,y=p;if(this._data.text&&(t.isLeft?(y=p-u,v=p-r,m=y+l):(y=p+u,v=p+r,m=p+n+r+s),e.beginPath(),e.moveTo(p,f),e.lineTo(y,f),e.lineTo(y,g),e.lineTo(p,g),e.fill(),e.beginPath(),e.strokeStyle=this._data.color,e.moveTo(p,_),e.lineTo(v,_),e.stroke(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(this._data.text,m,g-a-h)),this._data.secondLine){var w=Math.ceil(t.widthCache.measureText(e,this._data.secondLine)),T=w+s+l;e.fillStyle=this._data.background,this._data.text&&(f+=c+1,g+=c+1),t.isLeft?(y=Math.min(y,t.width-r),p=y+T,m=y+l):(p=Math.max(y-T,n),y=p+T,m=p+s),e.beginPath(),e.moveTo(p,f),e.lineTo(y,f),e.lineTo(y,g),e.lineTo(p,g),e.fill(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(this._data.secondLine,m,g-a-h)}}},i.prototype.height=function(e,t){var i=e.fontSize+e.paddingTop+e.paddingBottom;return this._data.secondLine&&t?2*i+1:i},e.exports=i},function(e,t){"use strict";function i(){this._text="",this._background="#585858",this._coordinate=0}i.prototype.text=function(){return this._text},i.prototype.background=function(){return this._background},i.prototype.color=function(){return new TradingView.RGBColor(this._background).blackWhiteContrast()},i.prototype.coordinate=function(){return this._coordinate},e.exports=i},function(e,t){"use strict";function i(e){this._data=e}i.prototype.draw=function(e,t){if(this._data.visible!==!1){e.font=t.font;var i=t.paddingHorizontal,r=(t.paddingTop,t.borderSize,t.widthCache.measureText(e,this._data.text));if(!(0>=r)){var n=r+2*i,o=Math.floor(this._data.coordinate-n/2)+.5,a=o,s=a+n,l=s,d=Math.round(this._data.coordinate+1),h=d,p=.5,c=p+t.borderSize+t.tickLength+t.paddingTop+t.fontSize+t.paddingBottom,u=c,_=p,f=_,g=f+t.borderSize+t.tickLength,v=c-t.baselineOffset-t.paddingBottom;e.fillStyle=this._data.background,e.lineWidth=1,e.beginPath(),e.strokeStyle=this._data.color,e.moveTo(o,p),e.lineTo(a,c),e.lineTo(s,u),e.lineTo(l,_),e.fill(),e.beginPath(),e.moveTo(d,f),e.lineTo(h,g),e.stroke(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(this._data.text,o+i,v)}}},e.exports=i},function(e,t){"use strict";function i(){this._zorder=0,this.m_priceScale=null,this._id=TradingView.randomHashN(6),this._ownerSource=null,this._userEditEnabled=!0,this.hasAlert=new WatchedValue(!1)}function r(e){i.call(this),this._isOverlay=null,this.D98=e}i.prototype.createPropertiesObject=function(e,t,i){return new A50(e,t,i)},i.prototype.id=function(){return this._id},i.prototype.uniqueId=function(){return this._id},i.prototype.setId=function(e){this._id=e},i.prototype.zorder=function(){return this._zorder},i.prototype.setZorder=function(e){"number"==typeof e&&this._zorder!=e&&(this._zorder=e)},i.prototype.title=function(){throw Error("Implement this fun in a subclass")},i.prototype.priceScale=function(){return this.m_priceScale},i.prototype.setPriceScale=function(e){this.m_priceScale=e},i.prototype.ownerSource=function(){return this._ownerSource},i.prototype.setOwnerSource=function(e){this._ownerSource=e,e&&this.setPriceScale(e.priceScale())},i.prototype.isSavedInChart=function(e){return!0},i.prototype.isSavedInStudyTemplates=function(){return!0},i.prototype.isRemovedByStudyTemplates=function(){return!0},i.prototype.hasContextMenu=function(){return!0},i.prototype.showInObjectTree=function(){return!0},i.prototype.setUserEditEnabled=function(e){this._userEditEnabled=e},i.prototype.userEditEnabled=function(){return this._userEditEnabled},i.prototype.isUserDeletable=function(){return this.userEditEnabled()},i.prototype.canHasAlert=function(){return!1},i.prototype.properties=function(){throw Error("Implement this fun in a subclass")},i.prototype.statusView=function(){return null},i.prototype.dataWindowView=function(){return null},i.prototype.priceAxisViews=function(e,t){return null},i.prototype.updateAllViews=function(){},i.prototype.paneViews=function(e){return null},inherit(r,i),r.prototype.isNoScale=function(){return!!this._isOverlay},r.prototype.base=function(){return 0},r.prototype.formatter=function(){return null},r.prototype.model=function(){return this.D98},r.prototype.priceRange=function(e,t){return null},t.DataSource=i,t.PriceDataSource=r},function(e,t,i){(function(t){"use strict";function r(e){var e=parseInt(e);return"chartproperties.alertsProperties."+e}var n=i(22),o=2,a=n.extend({constructor:function(e,i){var r={};["autoDeactivation","frequency","extra","crossInterval"].forEach(function(t){e.hasOwnProperty(t)&&(r[t]=e[t],delete e[t])}),t.isEmpty(r)||(this.__delayedInitAttrs=r),e.version=e.version||this.VERSION,n.call(this,e,i)},initialize:function(){function e(e){t.set("crossInterval",!!e)}var t=this;this.on("change:autoDeactivation",function(e,t,i){var r;t?(e.set("frequency","once"),r=e.get("extra"),r&&r.frequency("once")):"once"===e.get("frequency")&&e.set("frequency","once_per_bar")}).on("change:frequency",function(e,t,i){var r=e.get("extra");"once"===t?(e.set("autoDeactivation",!0),r&&r.removeFrequency()):("once_per_bar"===t||"on_bar_close"===t||/^\d+$/.test(t))&&(e.set("autoDeactivation",!1),r&&r.frequency(t))}).on("change:extra",function(t,i,r){i&&(i.crossInterval.unsubscribe(e),i.crossInterval.subscribe(e),t.set("crossInterval",i.crossInterval.value()))}).on("change:crossInterval",function(e,t,i){var r=e.get("extra");t?e.set("resolution","1"):r&&"MainSeries"==r.mainSeries().type&&e.set("resolution",r.mainSeries().state.interval)}).on("destroy",function(){TVSettings.remove(t.TVSettingsPropertiesKey(t.id))}),this.id===TVSettings.getInt("alerts.widget.selected_alert_id",0)&&this.set("selected",!0),this.__delayedInitAttrs&&(this.set(this.__delayedInitAttrs),delete this.__delayedInitAttrs)},set:function(e,t,i){var r,i=i||{};return null==e?this:i.noPrepare?n.prototype.set.call(this,e,t,i):("object"==typeof e?(r=e,i=t):(r={})[e]=t,r=this._prepareToSet(r),n.prototype.set.call(this,r,i))},_prepareToSet_soundDuration:function(e){var e=parseInt(e);return isNaN(e)&&(e=0),e},_prepareToSet_expired:function(e){return e instanceof Date?e:new Date(1e3*e)},_prepareToSet_extra:function(e){var t=this.get("extra"),i=t&&e,r=e&&!(e instanceof TradingView.AlertExtra);return i?e=t.update(e):r?e=new TradingView.AlertExtra(e):e||(e=null),e},isPrice:function(){var e=this.get("extra")?this.get("extra").price():null;return null!==e},isDrawing:function(){return this.get("extra")&&this.get("extra").drawing()},isMoving:function(){return this.get("extra")&&"moving"===(this.get("extra").conditionData()||{}).type},isOHLC:function(){var e=this.get("extra");return e&&e.mainSeries()?"MainSeries"===e.mainSeries().type:void 0},isPine:function(){var e=this.get("extra"),t=e&&e.mainSeries(),i=t&&t.metaInfo;return!!TradingView.StudyMetaInfo.getAlerts(i)},expiredReadable:function(){return this._formatDate(this.get("expired"))},expiredUnix:function(){return Math.round(this.get("expired").getTime()/1e3)},defaultDescription:function(){var e=this.get("extra"),t=e?e.price():null,i=e&&e.conditionData()?e.conditionData().title:"",r="";return i&&t&&(r=this.shortSymbol()+" "+i+" ",r+=e.conditionData().isChannel?"(Upper Bound: "+t.upperBand+" , Lower Bound: "+t.lowerBand+")":t),r},setDefaultDescription:function(){this.set("description",this.defaultDescription())},statusTitle:function(){var e="",t=this.get("stopReason")||"",i=this.get("error");return this.get("active")?e=$.t("Active"):(e={manual:$.t("Stopped Manual"),expired:$.t("Expired"),auto:$.t("Triggered and Not Active"),error:$.t("Error"),"default":$.t("Stopped")}[t||"default"],"error"===t&&i&&(e+=i)),e},state:function(){return this.toJSON()},toJSON:function(){var e,t,i={};for(e in this.attributes)this.attributes.hasOwnProperty(e)&&(t=this.attributes[e],i[e]=t&&"function"==typeof t.toJSON?t.toJSON():t);return i.expired&&(i.expired=this.expiredUnix()),i},prepareToSend:function(){for(var e,t,i=this.toJSON(),r=["id","crossInterval","autoDeactivation","description","sendEmail","expired","extra","showPopup","resolution","script","sendSms","playSound","soundDuration","soundFile","symbol"],n={},o=r.length-1;o>=0;o--)e=r[o],t=i[e],void 0!==t&&(n[e]=t);return n.playSound||(delete n.soundDuration,delete n.soundFile),n.extra&&(n.extra=JSON.stringify(n.extra)),n},saveState:function(){this._oldState=this.state()},restoreState:function(e){var e=e||this._oldState||{};!e.extra||e.extra instanceof TradingView.AlertExtra||(e.extra=new TradingView.AlertExtra(e.extra)),this.set(e),delete this._oldState},getSavedState:function(){var e;return this._oldState&&(e=$.extend({},this._oldState),e.extra&&(e.extra=new TradingView.AlertExtra(e.extra))),e},TVSettingsPropertiesKey:function(){return r(this.id)},generateScript:function(e){function t(e){l.reject(e)}function i(e){n.translateToILAsync(e).done(r).fail(t)}function r(t){e&&o.set("script",t),l.resolve(t)}var n,o=this,a={symbol:o.get("symbol"),resolution:o.get("resolution"),extra:o.get("extra")},s=Object.keys(a),l=$.Deferred();if(!TradingView.AlertScriptGenerator)return void TradingView.logError("[Alerts] Can't generate script without TradingView.AlertScriptGenerator");for(var d=0;d=0&&a>o;o+=e){var s=n?n[o]:o;r=i(r,t[s],s,t)}return r}return function(i,r,n,o){r=S(r,o,4);var a=!I(i)&&b.keys(i),s=(a||i).length,l=e>0?0:s-1;return arguments.length<3&&(n=i[a?a[l]:l],l+=e),t(i,r,n,a,l,s)}}function o(e){return function(t,i,r){i=C(i,r);for(var n=V(t),o=e>0?0:n-1;o>=0&&n>o;o+=e)if(i(t[o],o,t))return o;return-1}}function a(e,t,i){return function(r,n,o){var a=0,s=V(r);if("number"==typeof o)e>0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(i&&o&&s)return o=i(r,n),r[o]===n?o:-1;if(n!==n)return o=t(_.call(r,a,s),b.isNaN),o>=0?o+a:-1;for(o=e>0?a:s-1;o>=0&&s>o;o+=e)if(r[o]===n)return o;return-1}}function s(e,t){var i=O.length,r=e.constructor,n=b.isFunction(r)&&r.prototype||p,o="constructor";for(b.has(e,o)&&!b.contains(t,o)&&t.push(o);i--;)o=O[i],o in e&&e[o]!==n[o]&&!b.contains(t,o)&&t.push(o)}var l=this,d=l._,h=Array.prototype,p=Object.prototype,c=Function.prototype,u=h.push,_=h.slice,f=p.toString,g=p.hasOwnProperty,v=Array.isArray,m=Object.keys,y=c.bind,w=Object.create,T=function(){},b=function(e){return e instanceof b?e:this instanceof b?void(this._wrapped=e):new b(e)};void 0!==e&&e.exports&&(t=e.exports=b),t._=b,b.VERSION="1.8.3";var S=function(e,t,i){if(void 0===t)return e;switch(null==i?3:i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,r){return e.call(t,i,r)};case 3:return function(i,r,n){return e.call(t,i,r,n)};case 4:return function(i,r,n,o){return e.call(t,i,r,n,o)}}return function(){return e.apply(t,arguments)}},C=function(e,t,i){return null==e?b.identity:b.isFunction(e)?S(e,t,i):b.isObject(e)?b.matcher(e):b.property(e)};b.iteratee=function(e,t){return C(e,t,1/0)};var x=function(e,t){return function(i){var r=arguments.length;if(2>r||null==i)return i;for(var n=1;r>n;n++)for(var o=arguments[n],a=e(o),s=a.length,l=0;s>l;l++){var d=a[l];t&&void 0!==i[d]||(i[d]=o[d])}return i}},P=function(e){if(!b.isObject(e))return{};if(w)return w(e);T.prototype=e;var t=new T;return T.prototype=null,t},L=function(e){return function(t){return null==t?void 0:t[e]}},E=Math.pow(2,53)-1,V=L("length"),I=function(e){var t=V(e);return"number"==typeof t&&t>=0&&E>=t};b.each=b.forEach=function(e,t,i){t=S(t,i);var r,n;if(I(e))for(r=0,n=e.length;n>r;r++)t(e[r],r,e);else{var o=b.keys(e);for(r=0,n=o.length;n>r;r++)t(e[o[r]],o[r],e)}return e},b.map=b.collect=function(e,t,i){t=C(t,i);for(var r=!I(e)&&b.keys(e),n=(r||e).length,o=Array(n),a=0;n>a;a++){var s=r?r[a]:a;o[a]=t(e[s],s,e)}return o},b.reduce=b.foldl=b.inject=i(1),b.reduceRight=b.foldr=i(-1),b.find=b.detect=function(e,t,i){var r;return r=I(e)?b.findIndex(e,t,i):b.findKey(e,t,i),void 0!==r&&-1!==r?e[r]:void 0},b.filter=b.select=function(e,t,i){var r=[];return t=C(t,i),b.each(e,function(e,i,n){t(e,i,n)&&r.push(e)}),r},b.reject=function(e,t,i){return b.filter(e,b.negate(C(t)),i)},b.every=b.all=function(e,t,i){t=C(t,i);for(var r=!I(e)&&b.keys(e),n=(r||e).length,o=0;n>o;o++){var a=r?r[o]:o;if(!t(e[a],a,e))return!1}return!0},b.some=b.any=function(e,t,i){t=C(t,i);for(var r=!I(e)&&b.keys(e),n=(r||e).length,o=0;n>o;o++){var a=r?r[o]:o;if(t(e[a],a,e))return!0}return!1},b.contains=b.includes=b.include=function(e,t,i,r){return I(e)||(e=b.values(e)),("number"!=typeof i||r)&&(i=0),b.indexOf(e,t,i)>=0},b.invoke=function(e,t){var i=_.call(arguments,2),r=b.isFunction(t);return b.map(e,function(e){var n=r?t:e[t];return null==n?n:n.apply(e,i)})},b.pluck=function(e,t){return b.map(e,b.property(t))},b.where=function(e,t){return b.filter(e,b.matcher(t))},b.findWhere=function(e,t){return b.find(e,b.matcher(t))},b.max=function(e,t,i){var r,n,o=-(1/0),a=-(1/0);if(null==t&&null!=e){e=I(e)?e:b.values(e);for(var s=0,l=e.length;l>s;s++)r=e[s],r>o&&(o=r)}else t=C(t,i),b.each(e,function(e,i,r){n=t(e,i,r),(n>a||n===-(1/0)&&o===-(1/0))&&(o=e,a=n)});return o},b.min=function(e,t,i){var r,n,o=1/0,a=1/0;if(null==t&&null!=e){e=I(e)?e:b.values(e);for(var s=0,l=e.length;l>s;s++)r=e[s],o>r&&(o=r)}else t=C(t,i),b.each(e,function(e,i,r){n=t(e,i,r),(a>n||n===1/0&&o===1/0)&&(o=e,a=n)});return o},b.shuffle=function(e){for(var t,i=I(e)?e:b.values(e),r=i.length,n=Array(r),o=0;r>o;o++)t=b.random(0,o),t!==o&&(n[o]=n[t]),n[t]=i[o];return n},b.sample=function(e,t,i){return null==t||i?(I(e)||(e=b.values(e)),e[b.random(e.length-1)]):b.shuffle(e).slice(0,Math.max(0,t))},b.sortBy=function(e,t,i){return t=C(t,i),b.pluck(b.map(e,function(e,i,r){return{value:e,index:i,criteria:t(e,i,r)}}).sort(function(e,t){var i=e.criteria,r=t.criteria;if(i!==r){if(i>r||void 0===i)return 1;if(r>i||void 0===r)return-1}return e.index-t.index}),"value")};var A=function(e){return function(t,i,r){var n={};return i=C(i,r),b.each(t,function(r,o){var a=i(r,o,t);e(n,r,a)}),n}};b.groupBy=A(function(e,t,i){b.has(e,i)?e[i].push(t):e[i]=[t]}),b.indexBy=A(function(e,t,i){e[i]=t}),b.countBy=A(function(e,t,i){b.has(e,i)?e[i]++:e[i]=1}),b.toArray=function(e){return e?b.isArray(e)?_.call(e):I(e)?b.map(e,b.identity):b.values(e):[]},b.size=function(e){return null==e?0:I(e)?e.length:b.keys(e).length},b.partition=function(e,t,i){t=C(t,i);var r=[],n=[];return b.each(e,function(e,i,o){(t(e,i,o)?r:n).push(e)}),[r,n]},b.first=b.head=b.take=function(e,t,i){return null!=e?null==t||i?e[0]:b.initial(e,e.length-t):void 0},b.initial=function(e,t,i){return _.call(e,0,Math.max(0,e.length-(null==t||i?1:t)))},b.last=function(e,t,i){return null!=e?null==t||i?e[e.length-1]:b.rest(e,Math.max(0,e.length-t)):void 0},b.rest=b.tail=b.drop=function(e,t,i){return _.call(e,null==t||i?1:t)},b.compact=function(e){return b.filter(e,b.identity)};var k=function(e,t,i,r){for(var n=[],o=0,a=r||0,s=V(e);s>a;a++){var l=e[a];if(I(l)&&(b.isArray(l)||b.isArguments(l))){t||(l=k(l,t,i));var d=0,h=l.length;for(n.length+=h;h>d;)n[o++]=l[d++]}else i||(n[o++]=l)}return n};b.flatten=function(e,t){return k(e,t,!1)},b.without=function(e){return b.difference(e,_.call(arguments,1))},b.uniq=b.unique=function(e,t,i,r){b.isBoolean(t)||(r=i,i=t,t=!1),null!=i&&(i=C(i,r));for(var n=[],o=[],a=0,s=V(e);s>a;a++){var l=e[a],d=i?i(l,a,e):l;t?(a&&o===d||n.push(l),o=d):i?b.contains(o,d)||(o.push(d),n.push(l)):b.contains(n,l)||n.push(l)}return n},b.union=function(){return b.uniq(k(arguments,!0,!0))},b.intersection=function(e){for(var t=[],i=arguments.length,r=0,n=V(e);n>r;r++){var o=e[r];if(!b.contains(t,o)){for(var a=1;i>a&&b.contains(arguments[a],o);a++);a===i&&t.push(o)}}return t},b.difference=function(e){var t=k(arguments,!0,!0,1);return b.filter(e,function(e){return!b.contains(t,e)})},b.zip=function(){return b.unzip(arguments)},b.unzip=function(e){for(var t=e&&b.max(e,V).length||0,i=Array(t),r=0;t>r;r++)i[r]=b.pluck(e,r);return i},b.object=function(e,t){for(var i={},r=0,n=V(e);n>r;r++)t?i[e[r]]=t[r]:i[e[r][0]]=e[r][1];return i},b.findIndex=o(1),b.findLastIndex=o(-1),b.sortedIndex=function(e,t,i,r){i=C(i,r,1);for(var n=i(t),o=0,a=V(e);a>o;){var s=Math.floor((o+a)/2);i(e[s])o;o++,e+=i)n[o]=e;return n};var R=function(e,t,i,r,n){if(!(r instanceof t))return e.apply(i,n);var o=P(e.prototype),a=e.apply(o,n);return b.isObject(a)?a:o};b.bind=function(e,t){if(y&&e.bind===y)return y.apply(e,_.call(arguments,1));if(!b.isFunction(e))throw new TypeError("Bind must be called on a function");var i=_.call(arguments,2),r=function(){return R(e,r,t,this,i.concat(_.call(arguments)))};return r},b.partial=function(e){var t=_.call(arguments,1),i=function(){for(var r=0,n=t.length,o=Array(n),a=0;n>a;a++)o[a]=t[a]===b?arguments[r++]:t[a];for(;r=r)throw Error("bindAll must be passed function names");for(t=1;r>t;t++)i=arguments[t],e[i]=b.bind(e[i],e);return e},b.memoize=function(e,t){var i=function(r){var n=i.cache,o=""+(t?t.apply(this,arguments):r);return b.has(n,o)||(n[o]=e.apply(this,arguments)),n[o]};return i.cache={},i},b.delay=function(e,t){var i=_.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},b.defer=b.partial(b.delay,b,1),b.throttle=function(e,t,i){var r,n,o,a=null,s=0;i||(i={});var l=function(){s=i.leading===!1?0:b.now(),a=null,o=e.apply(r,n),a||(r=n=null)};return function(){var d=b.now();s||i.leading!==!1||(s=d);var h=t-(d-s);return r=this,n=arguments,0>=h||h>t?(a&&(clearTimeout(a),a=null),s=d,o=e.apply(r,n),a||(r=n=null)):a||i.trailing===!1||(a=setTimeout(l,h)),o}},b.debounce=function(e,t,i){var r,n,o,a,s,l=function(){var d=b.now()-a;t>d&&d>=0?r=setTimeout(l,t-d):(r=null,i||(s=e.apply(o,n),r||(o=n=null)))};return function(){o=this,n=arguments,a=b.now();var d=i&&!r;return r||(r=setTimeout(l,t)),d&&(s=e.apply(o,n),o=n=null),s}},b.wrap=function(e,t){return b.partial(t,e)},b.negate=function(e){return function(){return!e.apply(this,arguments)}},b.compose=function(){var e=arguments,t=e.length-1;return function(){for(var i=t,r=e[t].apply(this,arguments);i--;)r=e[i].call(this,r);return r}},b.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},b.before=function(e,t){var i;return function(){return--e>0&&(i=t.apply(this,arguments)),1>=e&&(t=null),i}},b.once=b.partial(b.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),O=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];b.keys=function(e){if(!b.isObject(e))return[];if(m)return m(e);var t=[];for(var i in e)b.has(e,i)&&t.push(i);return M&&s(e,t),t},b.allKeys=function(e){if(!b.isObject(e))return[];var t=[];for(var i in e)t.push(i);return M&&s(e,t),t},b.values=function(e){for(var t=b.keys(e),i=t.length,r=Array(i),n=0;i>n;n++)r[n]=e[t[n]];return r},b.mapObject=function(e,t,i){t=C(t,i);for(var r,n=b.keys(e),o=n.length,a={},s=0;o>s;s++)r=n[s],a[r]=t(e[r],r,e);return a},b.pairs=function(e){for(var t=b.keys(e),i=t.length,r=Array(i),n=0;i>n;n++)r[n]=[t[n],e[t[n]]];return r},b.invert=function(e){for(var t={},i=b.keys(e),r=0,n=i.length;n>r;r++)t[e[i[r]]]=i[r];return t},b.functions=b.methods=function(e){var t=[];for(var i in e)b.isFunction(e[i])&&t.push(i);return t.sort()},b.extend=x(b.allKeys),b.extendOwn=b.assign=x(b.keys),b.findKey=function(e,t,i){t=C(t,i);for(var r,n=b.keys(e),o=0,a=n.length;a>o;o++)if(r=n[o],t(e[r],r,e))return r},b.pick=function(e,t,i){var r,n,o={},a=e;if(null==a)return o;b.isFunction(t)?(n=b.allKeys(a),r=S(t,i)):(n=k(arguments,!1,!1,1),r=function(e,t,i){return t in i},a=Object(a));for(var s=0,l=n.length;l>s;s++){var d=n[s],h=a[d];r(h,d,a)&&(o[d]=h)}return o},b.omit=function(e,t,i){if(b.isFunction(t))t=b.negate(t);else{var r=b.map(k(arguments,!1,!1,1),String);t=function(e,t){return!b.contains(r,t)}}return b.pick(e,t,i)},b.defaults=x(b.allKeys,!0),b.create=function(e,t){var i=P(e);return t&&b.extendOwn(i,t),i},b.clone=function(e){return b.isObject(e)?b.isArray(e)?e.slice():b.extend({},e):e},b.tap=function(e,t){return t(e),e},b.isMatch=function(e,t){var i=b.keys(t),r=i.length;if(null==e)return!r;for(var n=Object(e),o=0;r>o;o++){var a=i[o];if(t[a]!==n[a]||!(a in n))return!1}return!0};var D=function(e,t,i,r){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof b&&(e=e._wrapped),t instanceof b&&(t=t._wrapped);var n=f.call(e);if(n!==f.call(t))return!1;switch(n){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var o="[object Array]"===n;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!(b.isFunction(a)&&a instanceof a&&b.isFunction(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}i=i||[],r=r||[];for(var l=i.length;l--;)if(i[l]===e)return r[l]===t;if(i.push(e),r.push(t),o){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!D(e[l],t[l],i,r))return!1}else{var d,h=b.keys(e);if(l=h.length,b.keys(t).length!==l)return!1;for(;l--;)if(d=h[l],!b.has(t,d)||!D(e[d],t[d],i,r))return!1}return i.pop(),r.pop(),!0};b.isEqual=function(e,t){return D(e,t)},b.isEmpty=function(e){return null==e?!0:I(e)&&(b.isArray(e)||b.isString(e)||b.isArguments(e))?0===e.length:0===b.keys(e).length},b.isElement=function(e){return!(!e||1!==e.nodeType)},b.isArray=v||function(e){return"[object Array]"===f.call(e)},b.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},b.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){b["is"+e]=function(t){return f.call(t)==="[object "+e+"]"}}),b.isArguments(arguments)||(b.isArguments=function(e){return b.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(b.isFunction=function(e){return"function"==typeof e||!1}),b.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},b.isNaN=function(e){return b.isNumber(e)&&e!==+e},b.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===f.call(e)},b.isNull=function(e){return null===e},b.isUndefined=function(e){return void 0===e},b.has=function(e,t){return null!=e&&g.call(e,t)},b.noConflict=function(){return l._=d,this},b.identity=function(e){return e},b.constant=function(e){return function(){return e}},b.noop=function(){},b.property=L,b.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},b.matcher=b.matches=function(e){return e=b.extendOwn({},e),function(t){return b.isMatch(t,e)}},b.times=function(e,t,i){var r=Array(Math.max(0,e));t=S(t,i,1);for(var n=0;e>n;n++)r[n]=t(n);return r},b.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},b.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},N=b.invert(B),F=function(e){var t=function(t){return e[t]},i="(?:"+b.keys(e).join("|")+")",r=RegExp(i),n=RegExp(i,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(n,t):e}};b.escape=F(B),b.unescape=F(N),b.result=function(e,t,i){var r=null==e?void 0:e[t];return void 0===r&&(r=i),b.isFunction(r)?r.call(e):r};var W=0;b.uniqueId=function(e){var t=++W+"";return e?e+t:t},b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},U=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+z[e]};b.template=function(e,t,i){!t&&i&&(t=i),t=b.defaults({},t,b.templateSettings);var r=RegExp([(t.escape||H).source,(t.interpolate||H).source,(t.evaluate||H).source].join("|")+"|$","g"),n=0,o="__p+='";e.replace(r,function(t,i,r,a,s){return o+=e.slice(n,s).replace(U,G),n=s+t.length,i?o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=Function(t.variable||"obj","_",o)}catch(s){throw s.source=o,s}var l=function(e){return a.call(this,e,b)},d=t.variable||"obj";return l.source="function("+d+"){\n"+o+"}",l},b.chain=function(e){var t=b(e);return t._chain=!0,t};var j=function(e,t){return e._chain?b(t).chain():t};b.mixin=function(e){b.each(b.functions(e),function(t){var i=b[t]=e[t];b.prototype[t]=function(){var e=[this._wrapped];return u.apply(e,arguments),j(this,i.apply(b,e))}})},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=h[e];b.prototype[e]=function(){var i=this._wrapped;return t.apply(i,arguments),"shift"!==e&&"splice"!==e||0!==i.length||delete i[0],j(this,i)}}),b.each(["concat","join","slice"],function(e){var t=h[e];b.prototype[e]=function(){return j(this,t.apply(this._wrapped,arguments))}}),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){return""+this._wrapped},r=[],n=function(){return b}.apply(t,r),!(void 0!==n&&(e.exports=n))}).call(this)},function(e,t,i){(function(t){"use strict";var r=i(26),n=t.Model.extend({constructor:function(e,i){e=this._prepareToSet(e,!0),t.Model.call(this,e,i)},_prepareToSet:function(e,t){var i,r,n;if(e)for(i in e)e.hasOwnProperty(i)&&(r=e[i],n="_prepareToSet_"+i,"function"==typeof this[n]&&(e[i]=this[n](r,e,t)));return e},destroy:function(){this.stopListening(),this.trigger("destroy",this)},save:function(){TradingView.logError("[Alerts] Use disaptcher to save")},shortSymbol:function(e){return $67?$67.shortName(e||this.get("symbol")||""):(TradingView.logWarn("[Alerts] can't get short symbol"),e)},resolutionReadable:function(e){if(!r)return TradingView.logWarn("[Alerts] can't get resolution readable"),e;var e=e||this.get("resolution");return e?r.prototype.readable(e,!1,!0):""},title:function(){return this.get("crossInterval")?this.shortSymbol():this.shortSymbol()+", "+this.resolutionReadable()},_formatDate:function(e){return moment(e||new Date).format("ll")}});e.exports=n}).call(t,i(23))},function(e,t,i){var r,n;(function(o){!function(a){var s="object"==typeof self&&self.self==self&&self||"object"==typeof o&&o.global==o&&o;r=[i(20),i(24),t],n=function(e,$,t){s.Backbone=a(s,t,e,$)}.apply(t,r),!(void 0!==n&&(e.exports=n))}(function(e,t,i,$){var r=e.Backbone,n=[].slice;t.VERSION="1.2.1",t.$=$,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var o=function(e,t,r){switch(e){case 1:return function(){return i[t](this[r])};case 2:return function(e){return i[t](this[r],e)};case 3:return function(e,n){return i[t](this[r],e,n)};case 4:return function(e,n,o){return i[t](this[r],e,n,o)};default:return function(){var e=n.call(arguments);return e.unshift(this[r]),i[t].apply(i,e)}}},a=function(e,t,r){i.each(t,function(t,n){i[n]&&(e.prototype[n]=o(t,n,r))})},s=t.Events={},l=/\s+/,d=function(e,t,r,n,o){var a,s=0;if(r&&"object"==typeof r){void 0!==n&&"context"in o&&void 0===o.context&&(o.context=n);for(a=i.keys(r);s'),n=v.link?$('').append(r):r,o=$('Powered by TradingView'),a=$('').appendTo(t),s=$('').appendTo(a),l=$('').appendTo(s),d=$("").appendTo(l);$('| ').append(n).appendTo(d);var h=$(" | ").appendTo(l);Z75.enabled("link_to_tradingview")&&$('').append(o).appendTo(h),i&&a.addClass("on-pane")}:function(e,t,i){if(Z75.enabled("link_to_tradingview")){t=t||Q1._jqMainDiv,$(t).find(".onchart-tv-logo").remove();var r=$('').appendTo(t);Z75.enabled("minimalistic_logo")?r.on("mouseenter",function(){$(this).addClass("expanded")}).on("mouseleave",function(){$(this).removeClass("expanded")}):r.addClass("expanded"),i&&r.addClass("on-pane")}};var m=Z75.enabled("widget_logo")&&"true"!=urlParams.disableLogo;if(m&&(Q1.createLogo=g,Z75.enabled("show_logo_on_all_charts")&&(_.createLogo=g.bind(this)),Z75.enabled("move_logo_to_main_pane")||Q1.withModel(null,g)),TradingView.tokenInitialized.resolve(),urlParams.toolbarbg){var y="#"+urlParams.toolbarbg;$(".tv-side-toolbar").css("background-color",y),$(".chart-controls-bar").css("background-color",y),$("#chart-area").css("background-color",y),e.css("background-color",y),$("#footer-chart-panel").css("background-color",y)}TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||$68.setSearchRequestDelay(Math.max(0,+urlParams.ssreqdelay));var w=new a({container:$(".tv-side-toolbar"),Q4:_,onWidget:!0,enabledDrawings:urlParams.enabledDrawings?JSON.parse(urlParams.enabledDrawings):[],disabledDrawings:urlParams.disabledDrawings?JSON.parse(urlParams.disabledDrawings):[],drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,forceVisible:"false"==urlParams.hideSideToolbar&&!!Z75.enabled("left_toolbar")});window.sideToolbar=w,window.lineToolPropertiesToolbar=new s(_),Q1.onDisconnected().subscribe(null,function(e){e&&window.showCriticalErrorMessage()}),$(".tv-content").bind("contextmenu",function(e){var t=$(e.originalEvent.target);return t.is("input")||t.is("textarea")?void 0:!1}),u.resolve(),function(){function e(e){Q1.withModel(null,function(){if(Q1.model().mainSeries().bars().size()>0)e();else{var t=function(){e(),Q1.model().mainSeries().onBarReceived().unsubscribe(null,t)};Q1.model().mainSeries().onBarReceived().subscribe(null,t)}})}window.widgetReady=e;for(var t=0;te||e>v())throw"Incorrect index: "+e;return new TradingView.ChartWidgetApi(window.Q4.getAll()[e])};var m=window.activeChart=function(){return new TradingView.ChartWidgetApi(window.Q4.activeChartWidget.value())};window.changeSymbol=function(e,t,i){$44.interval.setValue(t),$44.symbol.setValue(e),i&&m().onDataLoaded().subscribe(null,i,!0)},window.resizeWindow=function(){$(window).resize()},window.mainSeriesPriceFormatter=function(){return Q1.model().mainSeries().priceScale().formatter()}},function(e,t,i){"use strict";function r(e){function t(e,t){for(var i=[],r=n[q].count,o=0;r>o;o++)i.push(W[o].Q1.state(e,t));var a={layout:q,charts:i};return K.value()&&(a.symbolLock=1),X.value()&&(a.intervalLock=1),TradingView.drawingState.hideAllDrawings().value()&&(a.hideAllDrawings=!0),a}function i(e){for(var t=$.Deferred(),i=[],r=n[q].count,o=0;r>o;o++)i.push(W[o].Q1.asyncState(e));return $.when.apply($,i).then(function(){for(var e={charts:[]},i=0;ir||rr){if(W[r]){ae.append(W[r].wrap),W[r].Q1.isDetached=!1;var a=Y.shift();a&&W[r].Q1.loadContent(a.content)}else h($.extend({},re,Y.shift()||(N.value()?{content:N.value().state()}:null)||{},0===r||K.value()?{}:{defSymbol:null}));W[r].wrap.toggleClass("multiple",i>1),s(r)}else W[r]&&(W[r].Q1.isDetached=!0,W[r].wrap.detach())}c(),Q15.emit("layout_changed")}function c(){var e=Math.min(j.count,W.length)-1;if(0>e)return void N.deleteValue();var t=U;0>t&&(t=0),t>e&&(t=e),N.setValue(W[t].Q1)}function u(){for(var e=W.length;e--;){var t=e===U;W[e].wrap.toggleClass("active",t).toggleClass("inactive",!t)}}function _(){return $.grep(W,function(e){return!e.Q1.isDetached}).sort(function(e,t){var i=e.metrics.top,r=t.metrics.top,n=e.metrics.left,o=t.metrics.left;return i===r?o>n?-1:n>o?1:0:r>i?-1:1})}function f(){var e=O.layout.value();if("s"!==e){var t=n[e].count;ie.value()||(H=_());var i=z+1,r=H[i];!r||i>t?(r=H[0],z=0):z=i,N.setValue(r.Q1);var o=ie.value();o&&p(e,!0)}}function g(e){if(pe!==e){if(pe){pe.modelCreated().unsubscribe(null,v);var t=pe.model();if(t){var i=t.mainSeries().properties();i.style.unsubscribe(null,m);var r=t.model();r.onSelectedSourceChanged().unsubscribe(null,y),pe=null}}if(e){var n=e.model();n?v(n):e.modelCreated().subscribe(null,v),pe=e}}}function v(e){var t=e.mainSeries().properties();t.style.subscribe(null,m),m(t.style);var i=e.model();i.onSelectedSourceChanged().subscribe(null,y),y(e.selectedSource())}function m(e){de.setValue(e.value())}function y(e){he.setValue(e)}function w(e){if(e!==K.value()){if(a.UndoHistory.beginUndoMacro("Symbol Lock"),e)for(var t=N.value(),i=t.getSymbol(),r=0;rr;r++)t.push(W[r].Q1.images());return{layout:q,hidpiRatio:window.hidpiCanvasRatio||1,charts:t}}function P(){for(var e=[],t=0;tn;n++){var o=W[n].Q1;if(o!==t){var a=o.model();a&&a.model().setExternalPosition(e)}}}function E(){return W.forEach(function(e){e.Q1.destroy()})}function V(){oe.id.setValue(void 0),oe.uid.setValue(void 0),oe.name.setValue(void 0)}function I(){var t={snapshotUrl:e.snapshotUrl},i=Z75.enabled("show_dialog_on_snapshot_ready")?TradingView.getImageOfChart:TradingView.getImageOfChartSilently;i(this,t,function(e){le.fire(e)})}function A(){for(var e=n[q].count;e=0;t--){var i=e[t];if(!$.isArray(i.value))return!0;for(var r=i.value.length-1;r>0;r--){var n=i.value[r];if(null!==n&&void 0!==n&&!TradingView.isNaN(n))return!0}}return!1}if(!Z75.enabled("alerts"))return!1;var i=function(){return e.data()&&!e.data().isEmpty()&&t(e.data())},r=e.uniqueId&&e.uniqueId(),n=e===this.Z98.mainSeries(),o=e instanceof f,a=!(e instanceof T||e instanceof w||e instanceof y),s=e.metaInfo?e.metaInfo():null,l=s?s.isTVScript:!1,d=s?s.isTVScriptStrategy:!1,h=function(){var t=e.stateForAlert&&e.stateForAlert();return t?x.prototype._getPlotsFromDatasourceState(t).length:!1},p=s?-1!=$.inArray(s.fullId,this._alertsStudiesList):!1;return r&&!d&&(n||o&&a&&i()&&(p||l&&h()))},r._filterAuthorizedMetaInfo=function(e){for(var t=[],i=0;e&&i0?this.model().zoomIn(s,l):0>r&&this.model().zoomOut(s,l),i&&this.model().scrollChart(-80*i),!1}}.bind(this)),this._initBarsMarksSources(),TradingView.Q16("esdindicatorfeature")&&this.initESDTimelineWidget(),this._containsData||this._createChartEventsSource(),this.setAutoScaleOnSymbolChange(),this.readOnly()||this._hideSymbolSearch||$68.registerDialogKeypressHandler(this),this.adaptOnChartLogo()},r.prototype._checkObsoleteTimezone=function(){var e=this.Q0.timezone.value();TradingView.timezoneIsAvailable(e)||this.Q0.timezone.setValue(TradingView.getTzByObsoleteName(e))},r.prototype._initBarsMarksSources=function(){var e=this;this.withModel(this,function(){this.model().barsMarksSources().map(function(t){t.onNeedRepaint.subscribe(e,e.paint)})})},r.prototype.initESDTimelineWidget=function(){new b(this)},r.prototype.setAutoScaleOnSymbolChange=function(){this.withModel(this,function(){this.model().mainSeries().properties().symbol.listeners().subscribe(this,function(){(!this.model().mainSeries()instanceof TradingView.Series||!this.model().mainSeries().properties().lockScale.value())&&this.model().mainSeries().priceScale().setAutoScale(!0)})})},r.prototype.initColors=function(){this.Q0.paneProperties.background.listeners().subscribe(this,r.prototype.setBackgroundColor),this.Q0.paneProperties.vertGridProperties.color.listeners().subscribe(this,r.prototype.redrawPanes),this.Q0.paneProperties.horzGridProperties.color.listeners().subscribe(this,r.prototype.redrawPanes),this.Q0.scalesProperties.lineColor.listeners().subscribe(this,r.prototype.setScaleLineColor),this.Q0.scalesProperties.textColor.listeners().subscribe(this,r.prototype.setScaleTextColor)},r.prototype.paneWidgets=function(){return this._paneWidgets},r.prototype.paneByCanvas=function(e){for(var t=0;ts;s++){var d=n[s];TradingView.isInherited(d.constructor,g)&&d.isUserDeletable()&&(o=!0),TradingView.isInherited(d.constructor,f)&&d.removeByRemoveAllStudies()&&(a=!0)}this._readOnly||(r.paneRemoveAllStudies&&r.paneRemoveAllStudies.setEnabled(a),r.paneRemoveAllDrawingTools&&r.paneRemoveAllDrawingTools.setEnabled(o),r.paneRemoveAllStudiesDrawingTools&&r.paneRemoveAllStudiesDrawingTools.setEnabled(a||o)),e(TradingView.getThemesList(e)),window.studyTemplates&&(t(),studyTemplates.refreshStudyTemplateList(t));var h=this,p=[],c=TradingView.availableTimezones,u=function(e){return e.id===h.model().model().properties().timezone.value()};c.forEach(function(e){if(!e.separator){var t=new TradingView.Action({text:e.title,checkable:!0,checked:u(e)});t.callbacks().subscribe(this,function(){h.model().setProperty(h.model().model().properties().timezone,e.id,"Changed Time Zone")}),p.push(t)}},this),r.applyTimeZone.subActions=p,r.addToWatchlist.text=$.t("Add {0} To Watchlist").format(this.getSymbol(!0)),r.addToTextNotes&&(r.addToTextNotes.text=$.t("Add Text Note For {0}").format(this.getSymbol(!0))),this.updateActionForIntradayOnly(r.sessionBreaks)},r.prototype.actions=function(){return this._actions||this._setActions(),this._actions},r.prototype._setActions=function(){var e=i(179).ActionBinder,t=this,n=[];if(!this._readOnly){n=[new TradingView.Action({text:$.t("Eraser"),callbackContext:"eraser"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Trend Line"),callbackContext:"LineToolTrendLine"}),new TradingView.Action({text:$.t("Horizontal Line"),callbackContext:"LineToolHorzLine"}),new TradingView.Action({text:$.t("Vertical Line"),callbackContext:"LineToolVertLine"}),new TradingView.Action({text:$.t("Arrow"),callbackContext:"LineToolArrow"}),new TradingView.Action({text:$.t("Ray"),callbackContext:"LineToolRay"}),new TradingView.Action({text:$.t("Extended"),callbackContext:"LineToolExtended"}),new TradingView.Action({text:$.t("Parallel Channel"),callbackContext:"LineToolParallelChannel"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Pitchfork"),callbackContext:"LineToolPitchfork"}),new TradingView.Action({text:$.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork"}),new TradingView.Action({text:$.t("Pitchfan"),callbackContext:"LineToolPitchfan"}),new TradingView.Action({text:$.t("Gann Square"),callbackContext:"LineToolGannSquare"}),new TradingView.Action({text:$.t("Gann Fan"),callbackContext:"LineToolGannFan"}),new TradingView.Action({text:$.t("Fib Retracement"),callbackContext:"LineToolFibRetracement"}),new TradingView.Action({text:$.t("Trend-Based Fib Extension"),callbackContext:"LineToolTrendBasedFibExtension"}),new TradingView.Action({text:$.t("Fib Speed Resistance Fan"),callbackContext:"LineToolFibSpeedResistanceFan"}),new TradingView.Action({text:$.t("Fib Time Zone"),callbackContext:"LineToolFibTimeZone"}),new TradingView.Action({text:$.t("Circle Lines"),callbackContext:"LineToolCircleLines"}),new TradingView.Action({text:$.t("Fib Circles"),callbackContext:"LineToolFibCircles"}),new TradingView.Action({text:$.t("Fib Speed Resistance Arcs"),callbackContext:"LineToolFibSpeedResistanceArcs"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Rectangle"),callbackContext:"LineToolRectangle"}),new TradingView.Action({text:$.t("Ellipse"),callbackContext:"LineToolEllipse"}),new TradingView.Action({text:$.t("Triangle"),callbackContext:"LineToolTriangle"}),new TradingView.Action({text:$.t("Polyline"),callbackContext:"LineToolPolyline"}),new TradingView.Action({text:$.t("Arc"),callbackContext:"LineToolArc"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Text"),callbackContext:"LineToolText"}),new TradingView.Action({text:$.t("Anchored Text"),callbackContext:"LineToolTextAbsolute"}),new TradingView.Action({text:$.t("Balloon"),callbackContext:"LineToolBalloon"}),new TradingView.Action({text:$.t("Price Label"),callbackContext:"LineToolPriceLabel"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Elliott Wave Subminuette"),callbackContext:"LineToolElliottSubminuette"}),new TradingView.Action({text:$.t("Elliott Wave Minor"),callbackContext:"LineToolElliottMinor"}),new TradingView.Action({text:$.t("Elliott Wave Circle"),callbackContext:"LineToolElliottCircle"}),new TradingView.Action({text:$.t("Elliott Minor Retracement"),callbackContext:"LineToolElliottMinorRetr"}),new TradingView.Action({text:$.t("Elliott Major Retracement"),callbackContext:"LineToolElliottMajorRetr"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Brush"),callbackContext:"LineToolBrush"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Forecast"),callbackContext:"LineToolPrediction"})];for(var t=this,o=function(e){TradingView.drawingState.tool.setValue(e.callbackContext())},s=0;s'),this.$shield=$('').appendTo(this.$element),this.$element.appendTo(t),this._showed=!1,this._cw.withModel(this,this._connectToModel)},r.LoadingScreen.prototype._connectToModel=function(){this._cw.model().mainSeries().onDataLoaded().subscribe(this,function(e){switch(e.method){case"symbol_error":"permission denied"!==e.params[1]&&this.hide();break;case"series_error":Z75.enabled("hide_loading_screen_on_series_error")&&this.hide();break;case"series_completed":this.hide()}})},r.LoadingScreen.prototype.show=function(){return this._cw._inLoadingState=!0,this._showed||this._cw.isDetached||(this._showed=!0,this._show()),$.Deferred().resolve()},r.LoadingScreen.prototype._show=function(){var e=this._cw.properties().paneProperties.background.value();this.$shield.css("background",e),this.$element.addClass("fade")},r.LoadingScreen.prototype.hide=function(){delete this._cw._inLoadingState,this._showed&&this._hide()},r.LoadingScreen.prototype._hide=function(){this._showed=!1,this.$element.removeClass("fade")},r.LoadingScreen.prototype.$canvas=null,r.LoadingScreen.prototype.context=null,r.prototype._makeMasterTable=function(){this._jqMainTable=$(document.createElement("table")),this._jqMainTable.appendTo(this._jqMainDiv),this._jqMainTable.addClass("chart-markup-table"),this._jqMainTable.attr("cellpading","0"),this._jqMainTable.attr("cellspacing","0")},r.prototype.unsetActivePaneWidget=function(){this.activePaneWidget=!1},r.prototype.setActivePaneWidget=function(e){this.activePaneWidget=e},r.prototype.isMaximizedPane=function(){return!!this._maximizedPaneWidget},r.prototype.toggleMaximizePane=function(e){if(!(this._paneWidgets.length<2)){this._maximizedPaneWidget?(this._maximizedPaneWidget=null,this._paneSeparators.forEach(function(e){e.show()})):(this._maximizedPaneWidget=e,this._paneSeparators.forEach(function(e){e.hide()}));for(var t=this._paneWidgets.length;t--;)this._paneWidgets[t].updateControls();this._adjustSize(),this.updateIndicatorImagePosition()}},r.prototype._makePaneWidgetsAndSeparators=function(){for(var e=this.Z98.panes(),t=e.length,i=this._paneWidgets.length,r=t;i>r;r++){var n=this._paneWidgets.pop();n.jqRow.remove(),n.jqRow.find("*").remove(),n.destroy();var a=this._paneSeparators.pop();a&&a.jqRow.remove()}for(var r=i;t>r;r++){var n=new o(this,e[r],this._onWidget);if(n.onMouseLeave=this.unsetActivePaneWidget.bind(this),n.onMouseEnter=this.setActivePaneWidget.bind(this),this._paneWidgets.push(n),r>0){var a=new $51(this,r-1,r);this._paneSeparators.push(a),this._timeAxisWidget?a.jqRow.insertBefore(this._timeAxisWidget.jqRow):a.jqRow.appendTo(this._jqMainTable)}this._timeAxisWidget?n.jqRow.insertBefore(this._timeAxisWidget.jqRow):n.jqRow.appendTo(this._jqMainTable)}for(var r=0;t>r;r++){var s=e[r],n=this._paneWidgets[r];n.state()!==s&&n.setState(s)}for(var r=t;r--;)this._paneWidgets[r].updateControls()},r.prototype._makeTimeAxisWidget=function(){this._timeAxisWidget||(this._timeAxisWidget=new h(this,this._onWidget),this._timeAxisWidget.jqRow.appendTo(this._jqMainTable))},r.prototype.insertStudyOrShowDialog=function(e){if(this.isSymbolicStudy(e)){var t=defaults("study_"+e.id).description;$82.showAddSymbolDialog(this,{title:t,okButtonTitle:$.t("Apply"),callback:function(t,i){var r={inputs:{symbol:t}};this.model().insertStudy(e,r,i)}.bind(this)})}else if(this.hasConfirmInputs(e)){var t=defaults("study_"+e.id).description;i(186),$82.showConfirmInputsDialog(this,e,{title:t,okButtonTitle:$.t("Apply"),callback:function(t){this.model().insertStudy(e,t,!1)}.bind(this)})}else if(f.isPointsBasedStudy(e.id)){var r=f.lineToolNameForPointsBasedStudy(e.id);TradingView.drawingState.tool.setValue(r)}else{var n="Volume@tv-basicstudies"==e.id;this.insertStudy(e.id,!0,n)}},r.prototype.hasConfirmInputs=function(e){var t=e.inputs;if(void 0===t)return!1;for(var i=0;i 0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state},r.prototype.updateSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.updateUI()},r.prototype.tickSeriesControlClock=function(){this._seriesControlWidget&&this._seriesControlWidget.tickClock()},r.prototype.resizeSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.resizeUI()},r.prototype.updateUndoRedo=function(){a.UndoHistory.undoStack().isEmpty()?this.actions().undo.setEnabled(!1):this.actions().undo.setEnabled(!0),a.UndoHistory.redoStack().isEmpty()?this.actions().redo.setEnabled(!1):this.actions().redo.setEnabled(!0)},r.prototype.createSessionBreaksActions=function(e){var t,r=i(179).ActionBinder,n=this,o=function(){t=new TradingView.Action({text:$.t("Session Breaks"),checkable:!0}),t.binder=new r(t,n.model().mainSeries().sessionsStudy().properties().graphics.vertlines.sessBreaks.visible,n.model(),"Session Breaks"),n._actions.sessionBreaks=t};n.model().mainSeries().sessionsStudy()?o():n.model().mainSeries().onSessionsStudyCreated().subscribe(n,function(){o()})},r.prototype.updateActionForIntradayOnly=function(e){!e||!e instanceof TradingView.Action||e.setEnabled(!!this.model().mainSeries().isIntradayInterval())},r.prototype.withModel=function(e,t){this.model()?t.call(e):this.modelCreated().subscribe(e,t,!0)},r.prototype.containsVolume=function(){return this.model().Q17().some(function(e){return e instanceof f&&"Volume"==e.metaInfo().shortId})},r.prototype.containsStudy=function(e){return this.Z98?this.Z98.Q17().some(function(t){if(!(t instanceof f))return!1;var i=t.metaInfo();return i.id===e||i.fullId===e}):!1},r.prototype.containsSessions=function(){return this.model().Q17().some(function(e){return e instanceof f&&"Sessions"==e.metaInfo().shortId})},r.prototype.isSmall=function(e){return this.constructor.isSmall(this._jqParent)},r.isSmall=function(e){return e.width()<550||e.height()<300},r.prototype.onWidget=function(){return this._onWidget},r.prototype.onCmeWidget=function(){return"cme"===this.widgetCustomer()},r.prototype.widgetCustomer=function(){return this._widgetCustomer},r.prototype.resize=function(){this._resizeHandler&&this._jqMainDiv&&this._resizeHandler()},r.prototype.chartSession=function(){return this._chartSession},r.prototype.maxLhsPriceAxisWidth=0,r.prototype.maxRhsPriceAxisWidth=0,r.prototype.GUIResetScales=function(){TradingView.trackEvent("GUI","Reset Scales"),this.model()&&(this._containsData&&this.model().chartModel().restoreAxisState(this._content),this.model().resetScales())},r.prototype.onLineCancelled=function(){TradingView.drawingState.resetToCursor()},r.prototype.createIndicatorImage=function(){var e=this;this.indicatorImage=$('').appendTo(this._jqMainDiv),Z75.enabled("display_market_status")&&(this.indicatorText=$('').appendTo(this.indicatorImage),this.indicatorDot=this.indicatorText.find(".dot")),e.withModel(null,function(){var t=e.Z98.mainSeries();t.onStatusChanged().subscribe(null,e.updateIndicatorImage.bind(e)),t.marketStatus.subscribe(e.updateIndicatorImage.bind(e)),e.updateIndicatorImage(),e.checkCompactMode(),e.Z98.onRearrangePanes().subscribe(null,function(){e.resetIndicatorSize(),e.resizeIndicator()})}),e.rhsPriceAxisWidthChanged.subscribe(e,e.updateIndicatorImagePosition),e.updateIndicatorImagePosition()},r.prototype.updateIndicatorImage=function(){function e(e,t){return a.hasOwnProperty(e)?a[e]:t}var t=this.indicatorImage;if(this.indicatorImage){var i=this.Z98;if(i){var r=i.mainSeries(),n=r.status(),o=this._statusDetails(),a=null;a=o.hasOwnProperty(n)?o[n]:o.defaults,t.attr("title",e("title","")),this._updateDataAndMarketStatus(r.marketStatus.value(),r.status())}}},r.prototype.checkCompactMode=function(){this._jqMainDiv&&this._jqMainDiv.toggleClass("i-compact",this._jqMainDiv.width()<=400),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth())},r.prototype._statusDetails=function(){return this.__statusDetails||(this.__statusDetails={},this.__statusDetails[TradingView.Series.STATUS_SNAPSHOT]={className:"snapshot",text:"",showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_LOADING]=this.__statusDetails[TradingView.Series.STATUS_RESOLVING]={className:"loading",text:$.t("loading data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_INVALID_SYMBOL]={className:"invalid",text:$.t("invalid symbol"),showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_NO_BARS]={className:"invalid",text:$.t("no bars"),showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_OFFLINE]={className:"connecting",text:$.t("retrying"),priority:1},this.__statusDetails[TradingView.Series.STATUS_EOD]=this.__statusDetails[TradingView.Series.STATUS_PULSE]={className:"eod",text:$.t("eod data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED]={className:"delayed",title:$.t("Quotes are delayed by 10 min and updated every 30 seconds"),text:$.t("eod delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED_STREAMING]={className:"delayed-streaming",text:$.t("delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_READY]=this.__statusDetails.defaults={className:"realtime",text:$.t("realtime"),priority:-1},this.__statusDetails.pre_market={text:$.t("pre-market"),className:"pre-market",priority:0},this.__statusDetails.post_market={text:$.t("post-market"),className:"post-market",priority:0},this.__statusDetails.out_of_session={text:$.t("closed"),className:"out-of-session",priority:0},this.__statusDetails.market=this.__statusDetails.defaults),this.__statusDetails},r.prototype._updateDataAndMarketStatus=function(e,t){if(void 0!==this.indicatorText){var i=this._resultingStatusRecord(e,t);this.indicatorText.removeClass().addClass("series-status-text "+i.className).find(".text").html(i.text),this.indicatorDot.attr("title",i.text),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth()),this.resizeIndicator()}},r.prototype.resetIndicatorSize=function(){if(this._paneWidgets[0]&&this._paneWidgets[0].legendWidget)for(var e=0;ei.priority?r:i}return this._statusDetails()[t]},r.prototype.updateIndicatorImagePosition=function(){var e=this.indicatorImage;this.indicatorImage&&e.css("marginRight",this.maxRhsPriceAxisWidth)},r.prototype._startSpinner=function(e){if("function"==typeof Spinner&&!this._spinner){var t=$(e).get(0);t&&(this._spinner=TradingView.unifiedSpinner("",{zIndex:"auto"}).spin(t))}},r.prototype.isJustClonedChart=function(){return!!(this._options||{}).justCloned},r.prototype.getLastPaneLeftBottom=function(){var e=this._paneWidgets[this._paneWidgets.length-1].jqPane,t=e.offset();return{left:t.left,bottom:$(document.body).height()-t.top-e.height()}},r.prototype.setDataWindowWidget=function(e){this._dataWindowWidget=e},r.prototype.removeDataWindowWidget=function(){this._dataWindowWidget=null},Z75.enabled("datasource_copypaste")&&(r.prototype.onAppClipboardPaste=function(e,t){TradingView.logDebugChart("[[paste]]"),this.Z98&&this.Z98.pasteSourceFromClip(e,t);
+},r.prototype.onAppClipboardCopy=function(e){TradingView.logDebugChart("[[copy]]"),this.Z98&&this.Z98.copySourceToClip(e||this.Z98.selectedSource())},r.prototype.onAppClipboardCut=function(e){TradingView.logDebugChart("[[cut]]"),this.Z98&&this.Z98.cutSourceToClip(e||this.Z98.selectedSource())}),r.prototype.applyOverrides=function(e){applyPropertiesOverrides(this.properties(),null,!1,e),this.Z98&&(applyPropertiesOverrides(this.Z98.model().properties(),null,!1,e),applyPropertiesOverrides(this.Z98.mainSeries().properties(),null,!1,e,"mainSeriesProperties"))},r.prototype.setActive=function(e){var t=this.actions();for(var i in t)t.hasOwnProperty(i)&&this.actions()[i].setActive(e)},r.Performance=function(e){this.chartDrawTypes=["cursor","light","full","light_partial"],this.chartDraw={},this.lastValues={},this.cma={},this.slowReports=[],this.Q1=e,this.chartDrawTypes.forEach(function(e){this.chartDraw[e]=this.emptyStatObj(),this.lastValues[e]=[]}.bind(this)),this.initialTimeout=setTimeout(function(){this.checkpointInterval=setInterval(this.performanceCheckPoint.bind(this),1e3)}.bind(this),3e3),this.cmaFilterHigh=60,this.cmaFilterLow=15,this.thresholdEmissionsRatio=3,this.maxDroppedEmissions=1},r.Performance.prototype.emptyStatObj=function(){return{totalDuration:0,totalWait:0,count:0,invalidations:0}},r.Performance.prototype.performanceCheckPoint=function(){for(var e=0;e0&&(this.cma[t]?i.avgDuration>this.cma[t].durationHigh*this.thresholdEmissionsRatio&&this.cma[t].droppedEmissionsMath.max(20,t.durationHigh)&&(t.slowdownDurationDetected||(this.slowReports.push({type:e,param:"duration",cma:t,cmaDifference:t.durationLow-t.durationHigh,values:i}),t.slowdownDurationDetected=!0))},r.Performance.prototype.flushReport=function(){if(this.slowReports.length){var e=this.Q1.model().undoStack().m_commands;e=e.slice(e.length-20,e.length).reduce(function(e,t){return e+t.text()+"\n"},""),TradingView.logWarn({slowReports:this.slowReports,history:e}),$71.sendReport("slow_page",{slowReports:this.slowReports,history:e},!0,!0),this.slowReports=[]}},r.Performance.prototype.newChartDraw=function(e){var t=e._invalidationLevel,i=this.textLvl(t);for(var r in e._invalidatedPanes)e._invalidatedPanes[r]>t&&(t=e._invalidatedPanes[r],i=this.textLvl(t)+"_partial");this.addStats(i,e._timeCreated,e._timeStart,e._timeEnd,e._documentHidden,e._mergeCount)},r.Performance.prototype.addStats=function(e,t,i,r,n,o){if(!n){var a=this.chartDraw[e];a.totalDuration+=r-i,a.totalWait+=i-t,a.invalidations+=1+o,a.count++}},r.Performance.prototype.draw=function(){if(TradingView.getDisplayFpsLevel()==TradingView.FPS_SHOw_FULL){if(this.fpsCanvas)this.fpsCanvas.width=360;else{if(!this.Q1._jqMainTable)return!1;this.fpsCanvas=TradingView.addCanvasTo(this.Q1._jqMainTable.parent(),new $60(360,80)),this.ctx=this.fpsCanvas.getContext("2d"),$(this.fpsCanvas).css({position:"absolute",bottom:"23px",right:"65px"})}var e=this.ctx;e.font='10px "Lucida Console", monospace';for(var t=["cursor","light","light_partial","full"],i=0,r=0;r"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqPane),this.canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._zoomSelector=$(""),this._zoomSelector.addClass("zoom-selector"),this._zoomSelector.css("display","none"),this._zoomSelector.appendTo(this._dv),this._tooltipSelector=$(" "),this._tooltipSelector.addClass("tooltip tooltip-selector tooltip-selector-hidden"),this._tooltipSelector.appendTo(this._dv),this.legendWidget=new a(this,this._chart.model(),this._chart._jqMainDiv),this.jqRow=$(document.createElement("tr")),this.lhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.jqPane.appendTo(this.jqRow),this.legendWidget.$el.appendTo(this._dv),this.rhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.setCursorForTool(),TradingView.setMouseEventHandler($(this.top_canvas),this,!0);t&&!this._chart.readOnly()&&(this.paneControls=new $50(this,this._chart.model(),this._dv)),this.updateScalesVisibility(),this.actions=[],this.readonlyActions=[],this._onKeyUpListener=this._onKeyUpListener.bind(this),this._lineCancelledCallback=this._lineCancelledCallback.bind(this),$(window).on("keyup.panewidget",this._onKeyUpListener),this._chart.withModel(this,this._lineCancelledCallback),this._overlays={},this._contextMenuX=0,this._contextMenuY=0,this._lockDrawingsProperty=TradingView.drawingState.lockDrawings(),this._chart.withModel(this,function(){var e=this._chart.model();e.onSimpleZoomIn().subscribe(this,this._updateCrosshairOnZoom),e.onSimpleZoomOut().subscribe(this,this._updateCrosshairOnZoom)}),t&&Z75.enabled("move_logo_to_main_pane")&&t._isMainPane&&e.createLogo&&e.createLogo(null,this._dv,!0)}var n=i(5),o=i(74).Study,a=i(174),s=i(175),l=i(359),d=i(153),h=i(152),p=i(13).LineDataSource,c=i(61).ESDStudyBase,u=i(137),_=i(71).BarsMarksContainer,f=i(72),g=i(18).PriceDataSource,v=i(360),m=i(59),y=i(243);r.prototype.destroy=function(){$(window).off("keyup.panewidget",this._onKeyUpListener),this.legendWidget&&(this.legendWidget.$el.remove(),delete this.legendWidget),this.paneControls&&(this.paneControls.jqDiv.remove(),delete this.paneControls),this._chart.withModel({chart:this._chart,instance:this,callback:this._hideTooltip},function(){this.chart.model().lineCancelled().unsubscribe(this.instance,this.callback)});for(var e in this)delete this[e]},r.prototype.cancelZoom=function(){this._zoomSelector.css("display","none"),delete this._firstZoomPoint},r.prototype._onKeyUpListener=function(e){if(27==e.keyCode){this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine(),this._firstZoomPoint&&this.cancelZoom();var t=this._chart.model().model().crossHairSource();t.clearMeasure(),this.setCursorForTool(),this._hideTooltip()}},r.prototype._lineCancelledCallback=function(){try{this._chart.model().lineCancelled().subscribe(this,this._hideTooltip)}catch(e){}},r.prototype.backgroundColor=function(){return this._chart.properties().paneProperties.background.value()},r.prototype.priceAxisByCanvas=function(e){return e===this.lhsPriceAxisWidget.canvas||e===this.lhsPriceAxisWidget.top_canvas?this.lhsPriceAxisWidget:e===this.rhsPriceAxisWidget.canvas||e===this.rhsPriceAxisWidget.canvas?this.rhsPriceAxisWidget:null},r.prototype.updateScalesVisibility=function(){this.lhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showLeftScale.value()),this.rhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showRightScale.value())},r.prototype.chart=function(){return this._chart},r.prototype.state=function(){return this._state},r.prototype.setState=function(e){this._state=e},r.prototype.stretchFactor=function(){return this._state?this._state._stretchFactor:Z73.DEFAULT_STRETCH_FACTOR},r.prototype.setStretchFactor=function(e){this._state&&(this._state._stretchFactor=e)},r.prototype.mouseEnterEvent=function(e){var t=this._chart.model();t&&(t.crossHairSource().visible=!0,"function"==typeof this.onMouseEnter&&this.onMouseEnter(this))},r.prototype.isLineTool=function(e){var t=TradingView[e];return"function"==typeof t&&t.prototype instanceof p},r.prototype.hideInplaceEditor=function(){return this._inplaceEditor?(this._inplaceEditor.remove(),this._inplaceEditor=void 0,!0):!1},r.prototype._processMouseMoveWhileZoom=function(e){var t=this._state.defaultPriceScale(),i=(t.coordinateToPrice(e.localY),Math.floor(this._chart.model().timeScale().coordinateToIndex(e.localX))),r=this._chart.model().timeScale().indexToCoordinate(i)-.5*this._chart.model().timeScale().barSpacing(),n=e.localY,o=Math.abs(r-this._firstZoomPoint.x),a=Math.abs(n-this._firstZoomPoint.y);r=0)&&this._mouseDownEventForLineTool(e,i,l,s));var h=this.dataSourceAtPoint(e.localX,e.localY),c=h&&h.source&&h.source.customization?h.source.customization:{};if(h.hittest&&h.hittest.result()==TradingView.HitTestResult.CUSTOM){var u=h.hittest.data().mouseDownHandler;u&&u()}if(!this._chart.readOnly()){if(h&&!c.disableSelection){var _=h.hittest&&h.hittest.result()>TradingView.HitTestResult.MOVEPOINT_BACKGROUND;_=_||h.hittest&&h.hittest.result()==TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any(),_?t.setSelectedSource(h.source,h.hittest&&h.hittest.data()):t.setSelectedSource(null)}if(h.source&&"eraser"===TradingView.drawingState.tool.value()&&!c.disableErasing&&(TradingView.isInherited(h.source.constructor,p)||TradingView.isInherited(h.source.constructor,o))){var f=h.hittest.eraseMarker();return void(e.ctrlKey&&void 0!==f&&h.source.processErase?h.source.processErase(t,f):t.removeSource(h.source))}var v=h.source&&TradingView.isInherited(h.source.constructor,p)&&h.source.isLocked(),m=this._lockDrawingsProperty.value()||v;if(!m){if(h.source&&h.source.userEditEnabled&&!h.source.userEditEnabled())return;if(h.hittest&&h.hittest.result()===TradingView.HitTestResult.CHANGEPOINT){var n=h.source.priceScale(),s=n.coordinateToPrice(e.localY);return t.startChangingLinetool(h.source,{index:l,price:s},h.hittest.data(),i),void this._updateTooltip(e.localX,e.localY)}if(h.hittest&&this.checkMovepoint(h.hittest.result())){if(h.source.isFixed&&h.source.isFixed())t.startMovingSource(h.source,new MathEx.Point(e.localX,e.localY),h.hittest.data());else{var n=h.source.priceScale(),s=n.coordinateToPrice(e.localY);t.startMovingSource(h.source,{index:l,price:s},h.hittest.data())}return}}if(h.source&&TradingView.isInherited(h.source.constructor,g))return void(this._chart.draggingSource=h.source)}h.hittest&&h.hittest.result()==TradingView.HitTestResult.REGULAR||(this._processing=!0)}},r.prototype.drawRightThere=function(e){if(this.isLineTool(e)){var t=this._chart.model(),i=t.crossHairSource();t.createLineTool(this._state,{index:i.index,price:i.price},e)}},r.prototype._finishTool=function(e){var t=this._chart.model(),i=TradingView.drawingState.tool.value();if(TradingView.drawingState.resetToCursor(),this._hideTooltip(),t.setSelectedSource(e),this._chart.isTextTool(i)){var r=t.createUndoCheckpoint(),n=new s(e,t,r);n.show(),n.focusOnText()}},r.prototype._mouseDownEventForLineTool=function(e,t,i,r){var n=this._chart.model(),o=!1,a=null,s=e.localX,l=e.localY,d=this._chart.model().model().crossHairSource(),h=TradingView.drawingState.tool.value();if(TradingView.drawingState.hideAllDrawings().setValue(!1),TradingView.drawingState.lockDrawings().setValue(!1),TradingView.supportTouch()&&this.isLineTool(h)&&"LineToolBrush"!==h&&!n.lineBeingCreated()&&(this._startTouchPoint=new MathEx.Point(s,l),this._initCrossHairPosition=d.currentPoint(),this._skipFirstMove=!0),!n.lineBeingCreated()||n.lineBeingCreated()instanceof u){if(!TradingView.supportTouch()||"LineToolBrush"==h){var p={index:i,price:r};a=n.createLineTool(this._state,p,h),n.lineBeingCreated()||(o=!0)}}else if(TradingView.supportTouch()){if(this._skipFirstMove=!0,!this._startTouchPoint){this._startTouchPoint=new MathEx.Point(s,l);var c=n.lineBeingCreated().points(),_=c[c.length-1],f=n.timeScale().indexToCoordinate(_.index),r=_.price,g=n.lineBeingCreated().priceScale();if(g.isPercent()){var v=n.lineBeingCreated().ownerSource().firstValue();r=g.priceRange().convertToPercent(r,v)}var m=g.priceToCoordinate(r);return void(this._lastDrawingPoint=new MathEx.Point(f,m))}}else{a=n.lineBeingCreated();var y=n.paneForSource(a);if(y!==this._state){var w=this._dv.offset(),s=e.localX+w.left,l=e.localY+w.top,T=this._chart.paneByState(y);w=T._dv.offset(),s-=w.left,l-=w.top;var r=a.priceScale().coordinateToPrice(l),i=Math.round(n.timeScale().coordinateToIndex(s));o=n.coninueCreatingLine({index:i,price:r},t)}else o=n.coninueCreatingLine({index:i,price:r},t)}n.setSelectedSource(a),o?this._finishTool(a):TradingView.supportTouch()&&"LineToolBrush"!=h||this._updateTooltip(e.localX,e.localY)},r.prototype._equalsCursorCache=function(e,t){return TradingView.drawingState.toolIsCursor(e.tool)?e.tool===t.tool&&e.theme===t.theme&&e.crosshair===t.crosshair:e.tool===t.tool&&e.theme===t.theme},r.prototype._setCursor=function(e){this._cursorCache&&this._equalsCursorCache(this._cursorCache,e)||(this._cursorCache=e,TradingView.drawingState.toolIsCursor(e.tool)?this.jqPane.css("cursor",e.crosshair):this.jqPane.css("cursor",TradingView.cursorCss(e.state.name,e.state.hotspot,e.theme)))},r.prototype.setCursorForTool=function(e,t){var i={_default:{name:"cursor_cross",hotspot:"11 11"},zoom:{name:"zoom",hotspot:"5 5"},pointer:{name:"cursor_pointinghand",hotspot:"13 7"},dragger:{name:"cursor_closed_hand",hotspot:"8 8"}},r=TradingView.drawingState.tool.value();TradingView.drawingState.toolIsCursor(r)&&(this._chart.draggingSource||this._isScrolling||this._chart.model()&&this._chart.model().sourceBeingMoved()?r="dragger":e&&(r="pointer")),this._chart.model()&&this._chart.model().lineBeingEdited()?r=this._chart.model().lineBeingEdited()._constructor:t==TradingView.HitTestResult.CHANGEPOINT&&(r=e._constructor);var n=i._default;r in i&&(n=i[r]);var o="light";this._setCursor({tool:r,theme:o,state:n,crosshair:this.defaultPaneCursor(o)})},r.prototype.setDragToAnotherPaneCursor=function(){var e="light";this._setCursor({tool:"dragger",theme:e,state:{name:"cursor_closed_hand_move",hotspot:"8 8"},crosshair:this.defaultPaneCursor(e)})},r.prototype.defaultPaneCursor=function(e){var t={cursor:{name:"cursor_cross",hotspot:"11 11"},dot:{name:"cursor_dot",hotspot:"11 11"},crosshair:{name:"cursor_cross",hotspot:"11 11"},eraser:{name:"cursor_eraser",hotspot:"5 5"}},i=t[TradingView.drawingState.tool.value()];return i||(i=t[TradingView.drawingState.cursorTool.value()]),i?TradingView.cursorCss(i.name,i.hotspot,e):"default"},r.prototype.gestureStartEvent=function(e){this._prev_pinch_scale=1,this._pinching=!0},r.prototype.gestureChangeEvent=function(e){var t=(e.originalEvent.pageX||e.originalEvent.offsetX)-5,i=this._chart.paneWidgets()[0].lhsPriceAxisWidget.size.w,r=this._chart.model().timeScale().width();i&&(t=Math.max(0,t-i)),t=Math.min(t,r);var n=2*(t/r-.5),o=5*(e.scale-this._prev_pinch_scale);o>0?this._chart.model().zoomIn(n,o):this._chart.model().zoomOut(n,-o),this._prev_pinch_scale=e.scale},r.prototype.gestureEndEvent=function(e){this._pinching=!1},r.prototype._updateCommonTooltip=function(e){var t=this._lastCommonTooltipData,i=null;if(e&&e.hittest&&e.hittest.result()===TradingView.HitTestResult.CUSTOM){var r=e.hittest.data();r&&(i=r.tooltip||null)}if(null!=t||null!=i){if(null==i)return this._lastCommonTooltipData=null,void TradingView.Tooltip.hide();if(!t||i.text!==t.text||i.rect.x!==t.rect.x||i.rect.y!==t.rect.y||i.rect.w!==t.rect.w||i.rect.h!==t.rect.h){this._lastCommonTooltipData=i;var n=TradingView.clone(i),o=this.jqPane.offset();n.rect.x+=o.left,n.rect.y+=o.top,TradingView.Tooltip.show(n)}}},r.prototype.mouseMoveEvent=function(e){var t=this._chart.model();if(t){var i=e.localX,n=e.localY,o=new r.EvironmentState(e);if(this._firstZoomPoint)return void this._processMouseMoveWhileZoom(e);if(!(this._chart.readOnly()||this._editDialog&&this._editDialog.isVisible())){this.setCursorForTool();var a=TradingView.drawingState.tool.value(),s=null;this._processing||!TradingView.drawingState.toolIsCursor(a)&&"eraser"!==a||(s=this.dataSourceAtPoint(e.localX,e.localY),s.hittest&&s.hittest.result()>TradingView.HitTestResult.MOVEPOINT_BACKGROUND?(this.setCursorForTool(s.source,s.hittest?s.hittest.result():null),!s.source||"eraser"===a&&s.source.constructor===TradingView.Series?t.setHoveredSource(null):t.setHoveredSource(s.source,s.hittest.data())):t.setHoveredSource(null)),this._updateCommonTooltip(s)}if(this._chart.readOnly()){var s=this.dataSourceAtPoint(e.localX,e.localY);t.hoveredSource();null!==s.source?t.setHoveredSource(s.source,s.hittest.data()):t.setHoveredSource(null,null)}if(this._chart.model().lineBeingCreated()){var l=this._chart.model().lineBeingCreated(),d=this._chart.model().paneForSource(l);if(d!==this._state){var h=this._dv.offset();i+=h.left,n+=h.top;var p=this._chart.paneByState(d);return h=p._dv.offset(),i-=h.left,n-=h.top,void t.setCurrentPosition(i,n,d)}}var a=TradingView.drawingState.tool.value();TradingView.supportTouch()&&this.isLineTool(a)||(t.setCurrentPosition(i,n,this._state,o),this._updateTooltip(i,n))}},r.prototype.pressedMouseMoveEvent=function(e){if(!this._pinching){this._skipFirstMove?(delete this._skipFirstMove,delete this._touchMove):this._touchMove=!0;var t=new r.EvironmentState(e),i=this._chart.model(),n=e.localX,o=e.localY;if(this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);var a=TradingView.drawingState.tool.value();if(TradingView.supportTouch()&&this._startTouchPoint&&this.isLineTool(a)&&"LineToolBrush"!==a&&!i.lineBeingCreated()){var s=(this._chart.model().model().crossHairSource(),this._initCrossHairPosition),l=new MathEx.Point(n,o),d=l.substract(this._startTouchPoint),h=s.add(d);return this._chart.model().setCurrentPosition(h.x,h.y,this._state),void this._updateTooltip(h.x,h.y)}if(!TradingView.supportTouch()||!i.lineBeingCreated()||i.lineBeingCreated()instanceof u){i.setCurrentPosition(n,o,this._state,t),this._updateTooltip(n,o);var c=TradingView.drawingState.tool.value();if((!this.isLineTool(c)||"LineToolBrush"===a)&&(0===e.button||Modernizr.touch)){if("LineToolBrush"===c){var _=this._state.defaultPriceScale();if(_.isEmpty())return;if(!this._chart.model().lineBeingCreated())return;var f=_.coordinateToPrice(e.localY),g=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX));return void((!Z75.enabled("charting_library_base")||g>=0)&&this._chart.model().coninueCreatingLine({index:g,price:f}))}if(this._chart.draggingSource){var v=e.target,m=this._chart.paneByCanvas(v);m&&(m!==this?m.setDragToAnotherPaneCursor():m.setCursorForTool());var y=this._chart.priceAxisByCanvas(v);y&&y.jqCell.css("cursor",TradingView.cursorCss("cursor_closed_hand","8 8"));var w=this._chart.timeAxisByCanvas(v);w&&w.jqCell.css("cursor",TradingView.cursorCss("cursor_closed_hand_move","8 8"))}if(i.timeScale().isEmpty())return;if(i.lineBeingEdited()){var g=Math.round(this._chart.model().timeScale().coordinateToIndex(n));return(!Z75.enabled("charting_library_base")||g>=0)&&i.changeLinePoint({x:n,y:o},t),this._updateTooltip(n,o),void this.setCursorForTool()}if(i.sourceBeingMoved()){var _=i.sourceBeingMoved().priceScale();if(_.isEmpty())return;var g=this._chart.model().timeScale().coordinateToIndex(e.localX),f=_.coordinateToPrice(e.localY),T=i.sourceBeingMoved();if(this.setCursorForTool(),Z75.enabled("charting_library_base")&&!i.sourceBeingMoved().onlyYMoving()){var b=T.points().reduce(function(e,t){return t.index | |