',actions:[{name:"ok",type:"primary",text:window.t("Ok"),method:"close",key:[13,32]}]};async function r(e){return(await Promise.all([i.e("dialogs-core"),i.e(60),i.e(0),i.e(32),i.e("create-dialog")]).then(i.bind(null,"YDhE"))).createDialog(Object.assign(Object.assign({},s),e))}function n(e){r(e).then(e=>e.open())}},"bv/X":function(e,t,i){"use strict";var s=i("Ss5c").LineDataSource,r=i("Ocx9").DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e("lt-pane-views").then(i.t.bind(null,"piZW",7)).then(({SineLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Sine Line"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"LX4V"))).CyclicAndSineLinesPatternDefinitionsViewModel}static createProperties(e){var t=new r("linetoolsineline",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolSineLine=n},c2JX:function(e,t,i){"use strict";i.r(t),i.d(t,"renderSpinnerTemplate",(function(){return n})),i.d(t,"Spinner",(function(){return a}));i("SzKR");var s=i("gWrr"),r=i("Owlf");function n(e=""){return'\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\x3c!--\n\t\t\t\t--\x3e
\n\t\t\t
\n\t\t
\n\t'}
const o=Object(s.b)('\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\x3c!--\n\t\t\t\t--\x3e
\n\t\t\t
\n\t\t
\n\t');class a{constructor(e){this._shown=!1,this._el=o.cloneNode(!0),this.setSize(e||r.a)}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach(t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)}),this}setSize(e){const t=void 0!==e?"tv-spinner--size_"+e:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}},c44N:function(e,t,i){"use strict";function s(e,t){return e.pixelRatio===t.pixelRatio}i.r(t),i.d(t,"areEqualPaneRenderParams",(function(){return s}))},cBZt:function(e,t,i){"use strict";function s(e,t){return`${e}@${t}`}function r(e){return e.replace(/(@[^-]+-[^-]+).*$/,"$1")}i.r(t),i.d(t,"studyIdString",(function(){return s})),i.d(t,"extractStudyId",(function(){return r}))},cKqi:function(e,t,i){"use strict";var s=i("aO4+").Point,r=i("qJq3").Series,n=i("GVHu").Study,o=i("k9/m").PlotRowSearchMode,a=i("FBsw").OverlayPriceAxisView,l=i("KtbP").PanePriceAxisView,c=i("x0JF"),h=c.SeriesAreaPaneView,u=c.SeriesLinePaneView,d=c.SeriesHollowCandlesPaneView,p=c.SeriesCandlesPaneView,_=c.SeriesBarsPaneView,m=c.SeriesBaselinePaneView,f=i("biIa").SeriesWaterlinePaneView,g=i("2kV1").StudyStatusView,v=i("JjUe").OverlayDataWindowView,b=i("z8/4").OverlayLegendView,S=i("qXYw").OverlayLegendValuesProvider,y=i("ZsYR").OverlayStatusProvider,w=i("38az").SeriesBarColorer,C=i("l4sv").HorizontalLineRenderer,P=i("Kxc7"),x=i("6sst").OverlayStudyPriceLineAxisView,T=i("Qb4w").PriceRange,M=i("XPit").barFunction,I=i("n5al").createSeriesFormatter,L=i("y/Xm").StudyOverlayBase,O=i("qFKp").CheckMobile.any()&&!1,A=!P.enabled("hide_study_overlay_legend_item"),E=i("txPx").getLogger("Chart.StudyOverlay");class k{constructor(e,t){this._source=e,this._model=t,this._points=[new s(0,0)],this._lineRenderer=new C}update(){if(this._visible=!1,this._source.properties().showPriceLine.value()){var e=this._source.lastValueData(void 0,!0);e.noData||(this._visible=!0,this._points=[new s(0,e.coordinate)],this._color=e.color)}}renderer(){var e={};return e.width=this._model.timeScale().width(),e.height=this._source.priceScale().height(),e.y=this._points[0].y,e.color=this._color,e.linewidth=1,e.linestyle=CanvasEx.LINESTYLE_DOTTED,e.visible=this._visible,this._lineRenderer.setData(e),
this._lineRenderer}}t.study_Overlay=class extends L{constructor(e,t,i,s){super(e,t,i,s),this._formatter=null,this._paneView=null;var r=this;this.properties().minTick.listeners().subscribe(null,(function(){r._recreatePriceFormattingDependencies(),r.updateAllViews(),r._model.fullUpdate()})),this.properties().style.listeners().subscribe(this,this._updateBarFunction),this.properties().lineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().areaStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().baselineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this._updateBarFunction()}_showLastValueOnPriceScale(){return this._model.properties().scalesProperties.showSeriesLastValue.value()}lastValueData(e,t,i){var s={noData:!0};if(this._model.timeScale().isEmpty()||null==this.priceScale()||this.priceScale().isEmpty()||this.data().isEmpty())return s;var n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s;if(!this.properties().visible.value())return s;var a=this.nearestIndex(n.lastBar(),o.NearestLeft,TradingView.OPEN_PLOT);if(null==a)return s;var l=this._lastNonEmptyPlotRow(TradingView.CLOSE_PLOT),c=null!==l&&n.contains(l.index),h=null!==l?l.value:null,u=t||c?h:this.data().valueAt(a);if(null===u)return s;var d=this._barFunction(u);if(!isNumber(d))return s;var p={noData:!1};i&&(p.price=d);var _=this.firstValue();if(!isNumber(_))return s;p.text=this.priceScale().formatPrice(d,_),p.text=this.priceScale().formatPrice(d,_),p.formattedPriceAbsolute=this.priceScale().formatPriceAbsolute(d),p.formattedPricePercentage=this.priceScale().formatPricePercentage(d,_),p.floatCoordinate=this.priceScale().priceToCoordinate(d,_),p.coordinate=p.floatCoordinate,p.item=u;var m=this.properties();switch(m.style.value()){case r.STYLE_BARS:p.color=u[TradingView.OPEN_PLOT]<=u[TradingView.CLOSE_PLOT]?m.barStyle.upColor.value():m.barStyle.downColor.value();break;case r.STYLE_CANDLES:case r.STYLE_HOLLOW_CANDLES:p.color=u[TradingView.OPEN_PLOT]<=u[TradingView.CLOSE_PLOT]?m.candleStyle.upColor.value():m.candleStyle.downColor.value();break;case r.STYLE_LINE:p.color=m.lineStyle.color.value();break;case r.STYLE_AREA:p.color=m.areaStyle.color1.value();break;case r.STYLE_BASELINE:var f=m.baselineStyle,g=this.priceScale(),v=Math.round(g.height()*(Math.abs(100-f.baseLevelPercentage.value())/100));p.color=p.coordinate
0),n?{left:0,right:1,totallySlots:i}:{left:1,right:0,totallySlots:i}}return{left:e,right:t,totallySlots:e+t}}startScrollPrice(e,t,i){e.startScrollPrice(t,i)}scrollPriceTo(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,v.Light))}endScrollPrice(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,v.Light))}setPriceAutoScale(e,t,i){e.setPriceAutoScale(t,i),this.invalidate(this._paneInvalidationMask(e,v.Light))}updateScales(e,t){this._undoModel._chartWidget._updateScalesActions()}mainSeriesScaleRatioProperty(){return this._mainSeriesScaleRatioProperty}mainSeriesScaleRatioPropertyOnChanged(){this._mainSeriesScaleRatioProperty.listeners().fire(this._mainSeriesScaleRatioProperty)}mainSeriesScaleRatio(){return V(this._timeScale,this.m_mainSeries.priceScale())}setMainSeriesScaleRatio(e){this.paneForSource(this.m_mainSeries).applyPriceScaleRatio(this.m_mainSeries.priceScale(),e)}startScrollTime(e){this._timeScale.startScroll(e),this._isTimeScrolling=!0}scrollTimeTo(e){this._timeScale.scrollTo(e),this.recalculateAllPanes(),this.lightUpdate(),this._setScalesResetAvailable(!0)}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate(),this.recalcVisibleRangeStudies(),this._isTimeScrolling=!1}recalcStudyBasedLineTools(){this.dataSources().forEach((function(e){u(e)&&e.recalcStudyIfNeeded&&e.recalcStudyIfNeeded()}))}restoreTimeScaleState(e){this._timeScale.restoreState(e),this.recalculateAllPanes(),this.lightUpdate(),this._setScalesResetAvailable(!0)}restoreFactoryDefaults(e){e.restoreFactoryDefaults(),this.recalcVisibleRangeStudies(!0)}selectionMacro(e){var t=this.selection().allSources();e({
removeSourceFromSelection:X.bind(this),addSourceToSelection:Q.bind(this),clearSelection:Z.bind(this),selection:this.selection.bind(this)});var i=R(t,this.selection().allSources()),s=R(this.selection().allSources(),t);s.concat(t).forEach((function(e){e.updateAllViews()})),i.forEach((function(e){var t=e.hasAlert&&e.hasAlert.value()&&e.getAlertSync();t&&t.set("selected",!1)})),s.forEach((function(e){var t=e.hasAlert&&e.hasAlert.value()&&e.getAlertSync();t&&t.set("selected",!0)})),this.lightUpdate(),this.setHoveredSource(null),(i.length>0||s.length>0)&&this._selectedSourceChanged.fire()}checkLineToolSelection(){this._selection.checkLineToolSelection()}onSelectedSourceChanged(){return this._selectedSourceChanged}selection(){return this._selection}orderedDataSources(e){var t=[];t.push(this.m_crossHairSource);for(var i=0;i0)for(a=this.dataSources(),l=0;lc;this._updateBaseIndex(r,d)}k.logDebug(h),this.recalculateAllPanes(),this.lightUpdate()}updateTimeScaleBaseIndex(e){var t=this.mainSeries().bars();t.isEmpty()||this._updateBaseIndex(r(t.lastIndex()),e&&e.index>0)}_updateBaseIndex(e,t){var i=this.timeScale(),s=i.baseIndex(),r=i.visibleBarsStrictRange(),n=i.logicalRange();if(null!==n&&t){var o=n.contains(s),a=e-s,l=o?null:i.rightOffset()-a;if(!this._options.shiftVisibleRangeOnNewBar&&o){var c=i.indexToCoordinate(s)+i.barSpacing()/2+1,h=s-n.left()+a,u=c/h;if(u>=i.minBarSpacing())i.setBarSpacing(u),l=i.width()/u-h;else r.lastBar()!==s&&(l=i.rightOffset()-a)}null!==l&&i.setRightOffset(l)}i.setBaseIndex(e)}recalculatePane(e){e&&e.recalculate()}recalculateAllPanes(){for(var e=0;e1}lineBeingEdited(){return this._lineBeingEdited}linePointBeingEdited(){return this._linePointBeingEdited}calculateDefaultTags(){for(var e=[],t=this.dataSources(),i=0;i-1&&this._modelIntervals.splice(t,1)}clearIntervals(){for(var e=0;enew s.a(e.title,"")),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}_updateImpl(){const e=this._series.symbolInfo();if(e){const t=[e.name];d||t.push(Object(r.translatedIntervalString)(this._series.interval())),t.push(e.exchange),this._header=t.join(", "),this._title=e.description}else this._header=this._series.symbol();const t=this._model.crossHairSource().appliedIndex(),i=this._valuesProvider.getValues(t)
;for(let s=0;s{this._retries=this._retries-1;this._startLoading().then(e,0!==this._retries?()=>setTimeout(()=>this._tryLoad(e),3e3):void 0)}}load(){return this._cache||(this._cache=new Promise(this._tryLoad)),this._cache}}},cdbK:function(e,t,i){"use strict";function s(e){return Promise.all([i.e("react"),i.e(1),i.e(2),i.e(3),i.e(6),i.e(7),i.e(8),i.e(9),i.e(11),i.e(13),i.e(15),i.e(19),i.e(30),i.e(43),i.e(44),i.e(48),i.e(49),i.e(80),i.e(0),i.e(5),i.e(4),i.e(10),i.e(14),i.e(12),i.e(17),i.e(27),i.e(40),i.e(45),i.e("go-to-date-dialog-impl")]).then(i.bind(null,"uUY/")).then(t=>t.showGoToDateDialog(e))}i.r(t),i.d(t,"showGoToDateDialog",(function(){return s}))},cgFQ:function(e,t,i){"use strict";var s=i("Tmoa"),r=i("ikwP");const n=/[1-9]/g;class o{constructor(){this._data=null}setData(e){this._data=e}draw(e,t,i){if(null===this._data||!this._data.visible||0===this._data.text.length)return;const s=this._data;e.font=t.font;const o=Math.round(t.widthCache.measureText(e,s.text,n));if(o<=0)return;e.save();const a=t.paddingHorizontal,l=o+2*a,c=l/2;let h=s.coordinate,u=Math.floor(h-c)+.5;if(s.alwaysInViewPort){const e=s.width;u<0?(h+=Math.abs(0-u),u=Math.floor(h-c)+.5):u+l>e&&(h-=Math.abs(e-(u+l)),u=Math.floor(h-c)+.5)}const d=u+l,p=Math.ceil(0+t.borderSize+t.tickLength+t.paddingTop+t.fontSize+t.paddingBottom);e.fillStyle=s.background;const _=Math.round(u*i),m=Math.round(0*i),f=Math.round(d*i),g=Math.round(p*i),v=Math.round(2*i);e.beginPath(),e.moveTo(_,m),e.lineTo(_,g-v),e.arcTo(_,g,_+v,g,v),e.lineTo(f-v,g),e.arcTo(f,g,f,g-v,v),e.lineTo(f,m),e.fill();const b=Math.round(s.coordinate*i),S=m,y=Math.round((S+t.tickLength)*i);e.fillStyle=s.color;const w=Math.max(1,Math.floor(i)),C=Math.floor(.5*i);e.fillRect(b-C,S,w,y-S);const P=0+t.borderSize+t.tickLength+t.paddingTop+t.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const x=t.widthCache.yMidCorrection(e,"Apr0");e.translate((u+a)*i,(P+x)*i),Object(r.drawScaled)(e,i,()=>e.fillText(s.text,0,0)),e.restore()}}i.d(t,"a",(function(){return a}));class a{constructor(e){this._renderer=new o,this._rendererData={background:"",color:"",coordinate:0,text:"",visible:!1,width:0,alwaysInViewPort:!0},this._invalidated=!0,this._model=e,this._renderer.setData(this._rendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}coordinate(){return this._rendererData.coordinate}_getAlwaysInViewPort(){return!0}_updateImpl(){const e=this._rendererData;if(e.visible=!1,this._model.timeScale().isEmpty())return;const t=this._getIndex();if(null===t)return
;e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=Object(s.colorFromBackground)(e.background),e.coordinate=this._model.timeScale().indexToCoordinate(t),e.alwaysInViewPort=this._getAlwaysInViewPort();const i=this._model.timeScale().indexToUserTime(t);e.text=null!==i?this._model.dateTimeFormatter().format(i):"",this._invalidated=!1}}},d700:function(e,t,i){"use strict";i.d(t,"b",(function(){return r})),i.d(t,"a",(function(){return n}));var s=i("/3z9");function r(e){if("INPUT"===e.tagName){const t=e.type;return"text"===t||"email"===t||"number"===t||"password"===t||"search"===t||"tel"===t||"url"===t}return"TEXTAREA"===e.tagName||e.isContentEditable}function n(e,t){if(!t)return!1;const i=255&e;if(27===i||i>>>4==7)return!1;switch(e^i){case s.Modifiers.Alt:return(38===i||40===i)&&"SELECT"===t.tagName||r(t);case s.Modifiers.Alt+s.Modifiers.Shift:return r(t);case s.Modifiers.Mod:if(67===i||!s.isMacKeyboard&&45===i){const e=t.ownerDocument&&t.ownerDocument.getSelection();if(e&&!e.isCollapsed)return!0}return r(t);case s.Modifiers.Mod+s.Modifiers.Shift:return i>=33&&i<=40&&r(t);case s.Modifiers.Shift:case 0:return!!(9!==i||t.ownerDocument&&t!==t.ownerDocument.body&&t!==t.ownerDocument.documentElement)&&((13===i||32===i||!function(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){const t=e.type;if("submit"===t||"button"===t||"reset"===t||"checkbox"===t||"radio"===t)return!0}return!1}(t))&&("form"in t||t.isContentEditable))}return!1}},dDSx:function(e,t,i){"use strict";(function(e){var s=i("CW80").isLineTool,r=i("Ss5c").LineDataSource,n=i("FIi8").deepExtend,o=i("//lZ").doAnimate,a=i("onDC").ChartUndoModelBase,l=i("Ocx9").saveDefaultProperties,c=i("GVHu").Study,h=i("8sOK").StudyStub,u=i("vwKG").showTooManyStudiesNotice,d=i("RDU5").UndoCommand,p=i("Ltzl").SaveLineToolStateUndoCommand,_=i("YlKu").ApplyLineToolTemplateUndoCommand,m=i("s9sR").SetResolutionUndoCommand,f=i("8C8C").RestoreFactoryDefaultsUndoCommand,g=i("FKaq").SetPriceScaleSelectionStrategyCommand,v=i("CsKN").SetScaleRatioPropertiesCommand,b=i("/YGI").StudyInserter,S=i("JWMC").trackEvent,y=i("txPx").getLogger("Chart.ChartUndoModel"),w=i("QTwd").RestoreDefaultsPreferencesUndoCommand,C=i("bJYc").SetPropertyUndoCommand,P=i("pOzK").SetPriceScaleModeCommand,x=i("7MWe").PriceScaleChangeUndoCommand,T=i("LxhU").Interval;class M extends d{constructor(e,t,i){super("Move "+t[0].title()+" "+(i>0?"Forward":"Backward")),this._model=e,this._sourcesIds=t.map((function(e){return e.id()})),this._shift=i}undo(){var e=this,t=this._sourcesIds.map((function(t){return e._model.dataSourceForId(t)}));this._shift<0&&t.reverse(),t.forEach((function(t){e._model.changeZOrder(t,-e._shift)}))}redo(){var e=this,t=this._sourcesIds.map((function(t){return e._model.dataSourceForId(t)}));this._shift>0&&t.reverse(),t.forEach((function(t){e._model.changeZOrder(t,e._shift)}))}}class I extends d{constructor(e,t,i){super("Apply Chart Theme"),this._model=e,this._newChartProps=TradingView.factoryDefaults("chartproperties"),
this._newSeriesProps=TradingView.factoryDefaults("chartproperties.mainSeriesProperties"),this._newSessionProps=t.sessions||TradingView.factoryDefaults("sessions"),["candleStyle","hollowCandleStyle","haStyle"].forEach((function(e){t.mainSourceProperties[e].wickUpColor=t.mainSourceProperties[e].wickUpColor||t.mainSourceProperties[e].wickColor,t.mainSourceProperties[e].wickDownColor=t.mainSourceProperties[e].wickDownColor||t.mainSourceProperties[e].wickColor})),t.chartProperties.paneProperties.vertGridProperties=t.chartProperties.paneProperties.vertGridProperties||t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.horzGridProperties=t.chartProperties.paneProperties.horzGridProperties||t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.legendProperties=this._model.properties().state().paneProperties.legendProperties,this._newChartProps=n({},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.showBidAskLabels,delete this._newChartProps.scalesProperties.showPrePostMarketPriceLabel,delete this._newChartProps.scalesProperties.showStudyPlotLabels,delete this._newChartProps.scalesProperties.showFundamentalNameLabel,delete this._newChartProps.scalesProperties.showFundamentalLastValue,delete this._newChartProps.scalesProperties.seriesLastValueMode,e.timeScale().preserveBarSpacing()&&delete this._newChartProps.scalesProperties.barSpacing,this._newSeriesProps=n({},this._newSeriesProps,t.mainSourceProperties),this._oldChartProps=e.properties().state(),delete this._oldChartProps.paneProperties.topMargin,delete this._oldChartProps.paneProperties.bottomMargin,this._oldSeriesProps=e.mainSeries().properties().state(),this._oldSessionsProps=this._model.sessions().properties().state(),i||(delete this._oldSeriesProps.style,delete this._oldSeriesProps.symbol,delete this._oldSeriesProps.interval,delete this._oldSeriesProps.extendedHours,delete this._newSeriesProps.style,delete this._newSeriesProps.symbol,delete this._newSeriesProps.interval,delete this._newSeriesProps.currencyId,delete this._newSeriesProps.unitId,delete this._newSeriesProps.extendedHours,delete this._newSeriesProps.showCountdown,delete this._newSeriesProps.bidAsk.visible,delete this._newSeriesProps.prePostMarket.visible,delete this._newSeriesProps.highLowAvgPrice)}_merge(e,t,i){var s=this._model;l(!0),e&&(s.properties().paneProperties.mergeAndFire(e.paneProperties),s.properties().scalesProperties.mergeAndFire(e.scalesProperties)),s.mainSeries().priceScale().setMode({autoScale:t.priceAxisProperties.autoScale,percentage:t.priceAxisProperties.percentage,log:t.priceAxisProperties.log,lockScale:t.priceAxisProperties.lockScale}),
s.mainSeries().properties().mergeAndFire(t),s.mainSeries().properties().saveDefaults(),s.mainSeries().createPaneView(),s.mainSeries().invalidateBarStylesCache(),s._version=t.version,s.recalculateAllPanes(),s.fullUpdate(),s.properties().saveDefaults(),s.sessions().restoreState({properties:i}),l(!1)}undo(){this._merge(this._oldChartProps,this._oldSeriesProps,this._oldSessionsProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()}redo(){this._merge(this._newChartProps,this._newSeriesProps,this._newSessionProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()}}class L extends d{constructor(e,t){super("Stop Sincing Drawing"),this._model=e,this._sourceId=t.id(),this._linkKey=t.linkKey}redo(){delete this._model.dataSourceForId(this._sourceId).linkKey}undo(){this._model.dataSourceForId(this._sourceId).linkKey=this._linkKey}}t.ChartUndoModel=class extends a{constructor(t,i,s,r,n,o,a,l,c){super(t,i,s,r,n,o,a,l,c),this._onSimpleZoomIn=new e,this._onSimpleZoomOut=new e,this.beginUndoMacro=a.beginUndoMacro.bind(a),this.endUndoMacro=a.endUndoMacro.bind(a),this.createUndoCheckpoint=a.createUndoCheckpoint.bind(a),this.undoToCheckpoint=a.undoToCheckpoint.bind(a)}version(){return this.m_model._version}onData(e){switch(e.method){case"timescale_update":var t=e.params;this.m_model.updateTimeScale(t.index,t.zoffset,t.changes,t.index_diff,t.baseIndex,t.marks,t.clear);break;case"timescale_completed":var i=e.params[0];this.m_model.timeScale().onTimeScaleCompleted(i)}}paneForSource(e){return this.m_model.paneForSource(e)}createPane(e){return this.m_model.createPane(e)}readOnly(){return this.m_model.readOnly()}restart(){this.m_model.restart()}disconnect(){this.m_model.disconnect()}studiesMetaData(){return this.m_model.studiesMetaData()}studyVersioning(){return this.m_model.studyVersioning()}chartModel(){return this._model()}_model(){return this.m_model}pushUndoCommand(e){this._pushUndoCommand(e)}_pushUndoCommand(e){this._undoHistory.pushUndoCommand(e)}startScrollPrice(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this.chartModel().startScrollPrice(e,t,i))}scrollPriceTo(e,t,i){t.isAutoScale()||(this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this.pushUndoCommand(new x(this.m_model,e,t,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(e,t,i))}endScrollPrice(e,t){t.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(e,t))}setPriceAutoScale(e,t,i){this.pushUndoCommand(new x(this.m_model,e,t,t.state())),this.chartModel().setPriceAutoScale(e,t,i)}setWidth(e){this.m_model.setWidth(e)}setPaneHeight(e,t){this.m_model.setPaneHeight(e,t)}gridSource(){return this.m_model.gridSource()}watermarkSource(){return this.m_model.watermarkSource()}addAlertsSource(e){return this.m_model.addAlertsSource(e)}alertsSources(){
return this.m_model.alertsSources()}publishedChartsTimelineSource(){return this.m_model.publishedChartsTimelineSource()}barsMarksSources(){return this.m_model.barsMarksSources()}crossHairSource(){return this.m_model.crossHairSource()}model(){return this.m_model}chartWidget(){return this._chartWidget}mainSeries(){return this.m_model.m_mainSeries}mainSeriesScaleRatioProperty(){return this.m_model.mainSeriesScaleRatioProperty()}panes(){return this.m_model.panes()}timeScale(){return this.m_model.timeScale()}selectionMacro(e){return this.m_model.selectionMacro(e)}setHoveredSource(e,t){this.m_model.setHoveredSource(e,t)}selection(){return this.m_model.selection()}onSelectedSourceChanged(){return this.m_model.onSelectedSourceChanged()}hoveredSource(){return this.m_model.hoveredSource()}activeStrategySource(){return this.m_model.activeStrategySource()}invalidate(e){this.m_model.invalidate(e)}setCurrentPosition(e,t,i,s){this.m_model.setCurrentPosition(e,t,i,s)}setAndSaveCurrentPosition(e,t,i,s){this.m_model.setAndSaveCurrentPosition(e,t,i,s)}canCreateStudy(e){return this.model().chartApi().chartApi().isCanCreateStudy(e)}_isCountedStudy(e){throw new Error("Not implemented")}checkIfFeatureAvailable(e,t){var i=this.canCreateStudy(),s=t&&t instanceof c;return!this.readOnly()&&s&&(i=this.canCreateStudy(!0)),!!i||(s||u(),!1)}insertStudyWithoutCheck(e){return this._insertStudy(e)}createStudyInserter(e,t,i){var s=this,r=null,n={createStudy:function(e,t,i,n,o,a,l,c,h,u,d){return s.checkIfFeatureAvailable(e,a)?(S("studies","Study_"+e.id),"Compare@tv-basicstudies"===e.id&&S("compare","symbol:"+t.symbol),s._insertStudy(e,t,n,o,a,l,c,h,u,r,d)):(y.logNormal("Cannot insert study "+e.id),null)}};void 0!==i&&(n.createStub=function(){var e=s.m_model.insertStudyStub(i);return r={targetPaneId:s.m_model.paneForSource(e).id(),targetZOrder:e.zorder()},e.id()},n.removeStub=function(e){return s.m_model.removeStudyStub(e)});var o=new b(e,this.m_model._studiesMetaInfoRepository,n);return o.setParentSource(t),o}setProperty(e,t,i,s){if(e&&e.value()!==t){var r=new C(e,t,i,this.m_model,s);this.pushUndoCommand(r),this.emitEvent("setProperty")}}setProperties(e,t,i){var s=this;this.beginUndoMacro(i),this.m_model.selectionMacro((function(){for(var r=0;r[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]]]),r=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}]]);function n(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,n=new Set;s.forEach((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data){const t=e(s);for(const e of t)i.set(e,-1),n.add(e)}});const o=Array.from(n).sort((e,t)=>e-t);return o.forEach((e,t)=>i.set(e,t)),r.forEach((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data)e(s,i)}),o}},dfhE:function(e,t,i){"use strict";i.r(t),i.d(t,"STATUS_OFFLINE",(function(){return s})),i.d(t,"STATUS_RESOLVING",(function(){return r})),i.d(t,"STATUS_LOADING",(function(){return n})),i.d(t,"STATUS_READY",(function(){return o})),i.d(t,"STATUS_INVALID_SYMBOL",(function(){return a})),i.d(t,"STATUS_SNAPSHOT",(function(){return l})),i.d(t,"STATUS_EOD",(function(){return c})),i.d(t,"STATUS_PULSE",(function(){return h})),i.d(t,"STATUS_DELAYED",(function(){return u})),i.d(t,"STATUS_DELAYED_STREAMING",(function(){return d})),i.d(t,"STATUS_NO_BARS",(function(){return p})),i.d(t,"STATUS_REPLAY",(function(){return _})),i.d(t,"SERIES_STATUS_TEXT",(function(){return m})),i.d(t,"STYLE_LINE_TYPE_MARKERS",(function(){return f})),i.d(t,"STYLE_LINE_TYPE_STEP",(function(){return g})),i.d(t,"STYLE_LINE_TYPE_SIMPLE",(function(){return v})),i.d(t,"STYLE_BARS",(function(){return b})),i.d(t,"STYLE_CANDLES",(function(){return S})),i.d(t,"STYLE_LINE",(function(){return y})),i.d(t,"STYLE_AREA",(function(){return w})),i.d(t,"STYLE_RENKO",(function(){return C})),i.d(t,"STYLE_KAGI",(function(){return P})),i.d(t,"STYLE_PNF",(function(){return x})),i.d(t,"STYLE_PB",(function(){return T})),i.d(t,"STYLE_HEIKEN_ASHI",(function(){return M})),i.d(t,"STYLE_HOLLOW_CANDLES",(function(){return I})),i.d(t,"STYLE_BASELINE",(function(){return L})),i.d(t,"STYLE_RANGE",(function(){return O})),i.d(t,"STYLE_HILO",(function(){return A})),i.d(t,"STYLE_SHORT_NAMES",(function(){return E})),i.d(t,"SYMBOL_STRING_DATA",(function(){return k}));const s=0,r=1,n=2,o=3,a=4,l=5,c=6,h=7,u=8,d=9,p=10,_=11,m={[s]:"connecting",[r]:"loading",[n]:"loading",[o]:"realtime",[a]:"invalid",[l]:"snapshot",[c]:"endofday",[h]:"endofday",[u]:"delayed",[d]:"delayed_streaming",[p]:"forbidden",[_]:"replay"},f=0,g=1,v=2,b=0,S=1,y=2,w=3,C=4,P=5,x=6,T=7,M=8,I=9,L=10,O=11,A=12,E={0:"bar",1:"candle",9:"hollowCandle",2:"line",3:"area",4:"renko",7:"pb",5:"kagi",6:"pnf",8:"ha",10:"baseline",11:"range",12:"hilo"},k={4:{type:"BarSetRenko@tv-prostudies",basicStudyVersion:40},7:{type:"BarSetPriceBreak@tv-prostudies",basicStudyVersion:34},5:{type:"BarSetKagi@tv-prostudies",basicStudyVersion:34},6:{type:"BarSetPnF@tv-prostudies",basicStudyVersion:34},8:{type:"BarSetHeikenAshi@tv-basicstudies",
basicStudyVersion:60},11:{type:"BarSetRange@tv-basicstudies",basicStudyVersion:72}}},di4O:function(e,t,i){"use strict";i.r(t),i.d(t,"watermarkProperty",(function(){return h})),i.d(t,"restoreWatermarkPropertyDefaults",(function(){return u}));var s=i("eJTA"),r=i("Vdly"),n=i("tc+8"),o=i.n(n);const a={visibility:!1,color:"rgba(80, 83, 94, 0.25)"};function l(){const e=r.getJSON("symbolWatermark");let t=Object.assign({},a,e);if(void 0===e){if(void 0!==r.getJSON("chartproperties")){const e=r.getJSON("chartproperties").symbolWatermarkProperties;if(void 0!==e){const i=Object(s.tryParseRgba)(e.color);t=Object.assign(t,e),null!==i&&(0!==i[3]?t.visibility=!0:(i[3]=.25,t.color=Object(s.rgbaToString)(i)))}}delete t.transparency}return t}let c=null;function h(){return null===c&&(c=new o.a(l()),r.onSync.subscribe(null,()=>{null!==c&&c.mergeAndFire(l())}),c.listeners().subscribe(null,()=>{null!==c&&r.setJSON("symbolWatermark",c.state())})),c}function u(){null!==c&&c.mergeAndFire(a)}},dmHa:function(e,t){e.exports=''},e1Hy:function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var s=i("EYFt");class r extends s.a{constructor(e,t){super(e,t),this._showStudyValues=t.properties().paneProperties.legendProperties.showStudyValues}getValues(e){const t=super.getValues(e),i=this._showStudyValues.value();for(const s of t)s.visible=s.visible&&i;return t}}},e1ZQ:function(e,t,i){"use strict";i.d(t,"b",(function(){return p})),i.d(t,"a",(function(){return _})),i.d(t,"c",(function(){return m}));var s=i("YFKU"),r=i("kcTO");const n={1:()=>s.t("Jan"),2:()=>s.t("Feb"),3:()=>s.t("Mar"),4:()=>s.t("Apr"),5:()=>s.t("May"),6:()=>s.t("Jun"),7:()=>s.t("Jul"),8:()=>s.t("Aug"),9:()=>s.t("Sep"),10:()=>s.t("Oct"),11:()=>s.t("Nov"),12:()=>s.t("Dec")},o=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,a=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),l=(e,t)=>Object(r.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),c=(e,t)=>n[o(e,t)](),h=(e,t)=>Object(r.numberToStringWithLeadingZero)(o(e,t),2),u=(e,t)=>Object(r.numberToStringWithLeadingZero)(a(e,t)%100,2),d=(e,t)=>Object(r.numberToStringWithLeadingZero)(a(e,t),4),p={
"dd MMM 'yy":(e,t)=>`${l(e,t)} ${c(e,t)} '${u(e,t)}`,"MMM dd, yyyy":(e,t)=>`${c(e,t)} ${l(e,t)}, ${d(e,t)}`,"MMM dd":(e,t)=>`${c(e,t)} ${l(e,t)}`,"yyyy-MM-dd":(e,t)=>`${d(e,t)}-${h(e,t)}-${l(e,t)}`,"yy-MM-dd":(e,t)=>`${u(e,t)}-${h(e,t)}-${l(e,t)}`,"yy/MM/dd":(e,t)=>`${u(e,t)}/${h(e,t)}/${l(e,t)}`,"yyyy/MM/dd":(e,t)=>`${d(e,t)}/${h(e,t)}/${l(e,t)}`,"dd-MM-yyyy":(e,t)=>`${l(e,t)}-${h(e,t)}-${d(e,t)}`,"dd-MM-yy":(e,t)=>`${l(e,t)}-${h(e,t)}-${u(e,t)}`,"dd/MM/yy":(e,t)=>`${l(e,t)}/${h(e,t)}/${u(e,t)}`,"dd/MM/yyyy":(e,t)=>`${l(e,t)}/${h(e,t)}/${d(e,t)}`,"MM/dd/yy":(e,t)=>`${h(e,t)}/${l(e,t)}/${u(e,t)}`,"MM/dd/yyyy":(e,t)=>`${h(e,t)}/${l(e,t)}/${d(e,t)}`},_=Object.keys(p),m=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},"e3/o":function(e,t,i){"use strict";i.r(t),i.d(t,"guid",(function(){return r})),i.d(t,"randomHash",(function(){return n})),i.d(t,"randomHashN",(function(){return o}));const s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function r(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function n(){return o(12)}function o(e){let t="";for(let i=0;ii?i:Math.round(t)}function n(e,t,i){return s.isNaN(t)||ti?i:Math.round(1e4*t)/1e4}function o(e){return r(0,e,255)}function a(e){return r(0,e,255)}function l(e){return r(0,e,255)}function c(e){return n(0,e,1)}function h(e){return n(0,e,1)}function u(e){return n(0,e,1)}function d(e){return n(0,e,1)}function p(e){return n(0,e,1)}function _(e){return n(0,e,1)}function m(e){var t=e[0]/255,i=e[1]/255,s=e[2]/255,r=Math.min(t,i,s),n=Math.max(t,i,s),o=0,a=0,l=(r+n)/2;if(r===n)o=0,a=0;else{var c=n-r;switch(a=l>.5?c/(2-n-r):c/(n+r),n){case t:o=((i-s)/c+(i1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}function g(e){var t,i,s,r=e[0],n=e[1],c=e[2];if(0===n)t=i=s=c;else{var h=c<.5?c*(1+n):c+n-c*n,u=2*c-h;t=f(u,h,r+1/3),i=f(u,h,r),s=f(u,h,r-1/3)}return[o(255*t),a(255*i),l(255*s)]}t.normalizeRedComponent=o,t.normalizeGreenComponent=a,t.normalizeBlueComponent=l,t.normalizeAlphaComponent=c,
t.rgb=function(e,t,i){return[o(e),a(t),l(i)]},t.areEqualRgb=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.rgba=function(e,t,i,s){if(Array.isArray(e)){var r=e;return s=t,[r[0],r[1],r[2],c(s)]}var n=t;return i=i||0,s=s||0,[o(e),a(n),l(i),c(s)]},t.areEqualRgba=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},t.normalizeHue=h,t.normalizeHslSaturation=u,t.normalizeHsvSaturation=d,t.normalizeLightness=p,t.normalizeValue=_,t.hsl=function(e,t,i){return[h(e),u(t),p(i)]},t.areEqualHsl=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.hsv=function(e,t,i){return[h(e),d(t),_(i)]},t.areEqualHsv=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.rgbToHsl=m,t.hslToRgb=g,t.rgbToHsv=function(e){var t=e[0],i=e[1],s=e[2],r=t/255,n=i/255,o=s/255,a=Math.min(r,n,o),l=Math.max(r,n,o),c=l-a,h=0,u=0===l?0:c/l,d=l;if(l===a)h=0;else switch(l){case t:h=((n-o)/c+(n255)throw new Error("invalid threshold value, valid values are [0, 255]");return b(e)>=t?"white":"black"},t.tryParseRgb=k,t.parseRgb=function(e){var t=k(e);if(null!==t)return t;throw new Error("Passed color string does not match any of the known color representations")},t.tryParseRgba=D,t.parseRgba=V},ePL1:function(e,t,i){"use strict";i.r(t),i.d(t,"types",(function(){return s}));const s={ECONOMIC:"economic",QUANDL:"quandl"}},ehkz:function(e,t,i){"use strict";i.d(t,"a",(function(){return p}));var s=i("aO4+"),r=i("Eyy1"),n=i("Kxc7"),o=i("Tmoa"),a=i("o2pV"),l=i("k9/m"),c=i("VdBB"),h=i("23IT"),u=i("i6cO"),d=i("UAFa");class p{constructor(e,t,i,s){this._bars=[],this._invalidated=!1,this._isMarkersEnabled=n.enabled("source_selection_markers"),this._selectionData=null,this._ohlcPlotIndexes=new Map,this._study=e,this._series=t,this._model=i,this._plotName=s,this._isMarkersEnabled=n.enabled("source_selection_markers"),this._colorProvider=Object(d.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new a.SelectionIndexes(i.timeScale());const r=this._study.metaInfo().plots;for(let n=0;nn)return
;i=Math.max(a,i);const h=this._study.data(),d=this._study.firstValue();if(null===d)return;const p=h.rangeIterator(i,n),_=this._study.properties().ohlcPlots[this._plotName],m=new Map,f=(e,t)=>{const i=e+"@"+t;if(!m.has(i)){const s=Object(o.generateColor)(e,t);return m.set(i,s),s}return m.get(i)},g=Object(u.createEmptyStyle)();for(;p.hasNext();){const e=p.next();let t=e.index;const i=e.value;t=Math.floor(t);let s=!0;const n=new Map;for(let r=1;r<=4;++r){const e=this._ohlcPlotIndexes.get(r);if(void 0===e){s=!1;break}const t=i[e+1];if(null==t){s=!1;break}n.set(r,t)}if(!s)continue;const o=Object(r.ensureDefined)(n.get(1)),a=Object(r.ensureDefined)(n.get(4)),l=Object(r.ensureDefined)(n.get(2)),c=Object(r.ensureDefined)(n.get(3)),h=Math.max(o,l,c,a),d=Math.min(o,l,c,a);let m=Object(r.ensureDefined)(f(_.color.value(),0));const v=this._colorProvider.getPlotPointStyle(i,g);void 0!==v.colors[u.ColorerType.Main]&&(m=Object(r.ensureDefined)(v.colors[u.ColorerType.Main]));const b={time:Math.round(t),open:o,high:h,low:d,close:a,color:m,wickColor:v.colors[u.ColorerType.Wick],borderColor:v.colors[u.ColorerType.Border],hollow:null};this._bars.push(b)}if(e.barPricesToCoordinates(this._bars,d),this._model.timeScale().barIndexesToCoordinates(this._bars),this._model.selection().isSelected(this._study)){const t=this._selectionIndexer.indexes();this._selectionData={points:[],hittestResult:c.HitTestResult.REGULAR,bgColors:[],visible:!0,barSpacing:this._model.timeScale().barSpacing()};const i=Object(r.ensureNotNull)(this._model.paneForSource(this._study)).height(),n=Object(r.ensureDefined)(this._ohlcPlotIndexes.get(4));for(let r=0;r0===t.isPositive},
t.pointInTriangle=function(e,t,i,r){var n=t.add(i).scaled(.5).add(r).scaled(.5),o=s.intersectLineSegments(t,i,n,e);return null===o&&(null===(o=s.intersectLineSegments(i,r,n,e))&&null===(o=s.intersectLineSegments(r,t,n,e)))},t.pointInBox=function(e,t){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},t.pointInPolygon=function(e,t){for(var i=t.length-1,s=!1,r=e.x,n=e.y,o=0;o=n||l.y=n)&&a.x+(n-a.y)/(l.y-a.y)*(l.x-a.x)=t.length||e.endIndex>=t.length)return null;const i=t[e.startIndex],n=t[e.endIndex];return i===r.a||n===r.a?null:(Object(s.assert)(i<=n,"startIndex should not exceed endIndex"),{startIndex:i,endIndex:n,level:e.level,extendLeft:e.extendLeft,extendRight:e.extendRight})}function a(e,t,i){const s=Object(n.ensureTimePointIndexIndex)(i.indexOf(e.startIndex)),r=Object(n.ensureTimePointIndexIndex)(i.indexOf(e.endIndex));return Object.assign(Object.assign({id:t},e),{startIndex:s,endIndex:r})}},fJhV:function(e,t,i){"use strict";i.r(t),i.d(t,"LineDataSourceTimeAxisView",(function(){return r}));var s=i("cgFQ");class r extends s.a{constructor(e,t){super(e.model()),this._active=!1,this._source=e,this._pointIndex=t}setActive(e){this._active=e}_getBgColor(){return this._active?"#1565C0":this._model.isDark()?"#1E88E5":"#2196F3"}_getIndex(){if(!this._model.selection().isSelected(this._source))return null;const e=this._source.timeAxisPoints();return e.length<=this._pointIndex?null:e[this._pointIndex].index}}},fPdn:function(e,t,i){"use strict";window.TradingView=window.TradingView||{},window.requireAll=function(e){return e.keys().map(e)},i("6jKD"),i("bZMm"),i("P5fv"),i("YFKU"),i("VUhU"),i("si6p"),i("EsMY"),i("jjqu"),i("OV6q"),i("SpsL"),i("eqD+"),i("iA8Q"),i("32f0"),i("MApU"),i("w9cH").install(),i("QYoC"),i("oA7e"),i("qFKp"),i("1oAu"),i("ogJP"),i("jFln"),i("HbRj"),i("VVxS"),i("CLNU"),i("mZrn"),i("Vdly"),i("+GxX")},fTGZ:function(e,t,i){"use strict";(function(e,s,r){var n=i("Eyy1").ensureNotNull,o=i("Ss5c").LineDataSource,a=i("ogJP").isNumber,l=i("BOPY").BarsMarksContainerPaneView,c=i("BOPY").BarsMarksContainerRenderer,h=i("Bt3k").TooltipRenderer,u=i("LxhU").Interval,d=i("n5al").isPriceSourceStyle,p=i("txPx").getLogger("Chart.BarsMarksContainer");class _ extends o{constructor(t,i){var a=t._undoModel._chartWidget,l=a.onWidget(),c=!1;c=l?a._options&&!a._options.hideIdeas:!!e.enabled("bars_marks")&&TVSettings.getBool("BarsMarksContainer.visibile",!1),i?i.merge({visible:c,frozen:!1}):i=new s({visible:c,frozen:!1}),i.visible.listeners().subscribe(null,(function(t){l||a._containsData||!e.enabled("bars_marks")||TVSettings.setValue("BarsMarksContainer.visibile",!!t.value()),u._tooltip&&u._tooltip.removeAll()})),o._configureProperties(i),super(t,i);var u=this;this.onNeedRepaint=new r,
this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this._model.mainSeries().onSymbolIntervalChanged().subscribe(this,this.clearMarks),this._model.mainSeries().dataEvents().symbolResolved().subscribe(this,this.clearMarks),this._model.mainSeries().dataEvents().completed().subscribe(this,(function(){var e=this._model.mainSeries().data();if(0!==e.size()){var t=n(e.first()).index,i=n(e.last()).index,s=this.timeScale();this.getData({start:s.indexToTimePoint(t),end:s.indexToTimePoint(i)})}})),this._initialize(),this.pinnedTooltips={},this._tooltip=new h(this._createTooltip.bind(this),this)}_initialize(e){throw new Error("Child class must override this member")}onClicked(){throw new Error("Child class must override this member")}_getData(e){throw new Error("Child class must override this member")}_createTooltip(){throw new Error("Child class must override this member")}updateDotData(e,t){return t}updatePlateData(e,t){}isAvailableInFloatingWidget(){return!1}_plateViewData(e){return{}}pinTooltip(e,t){this.pinnedTooltips[e]=t}timeScale(){return this._model.timeScale()}getIntervalInTicks(){var e=this._model.mainSeries().properties().interval.value(),t=u.parse(e);if(!t.isValid())throw new TypeError("Unexpected interval");return t.isRange()?60:t.inMilliseconds()/1e3}getVisibleTickMarksRange(){if(this.timeScale().isEmpty())return{start:0,end:0};var e,t=this.timeScale().visibleBarsStrictRange();return t.lastBar()>this.timeScale().points().firstIndex()&&t.firstBar()=t.start&&n<=t.end+i&&e.push(r)}),this),e}getPublishedPlates(){var e={},t=this;return is_authenticated?(this.getVisibleRangePlates().forEach((function(i){i.is_public&&(t.pinnedTooltips[i.id]||i.user__id===user.id)&&(e[i.id]=i)})),e):e}filterDisplayedPlates(e){return e=e.reduce(function(e,t){var i=this._getIndex(t.tickmark);return e[i]=e[i]||[],e[i].push(t),e}.bind(this),{}),e=Object.keys(e).reduce(function(t,i){var s=e[i];return s=(s=s.sort((function(e,t){return t.views_count-e.views_count}))).slice(0,this._maxPlatesPerBar),t.concat(s)}.bind(this),[])}_layout(e){switch(e){default:case 0:return"up";case 1:return"down";case 2:return"up";case 3:case 4:case 5:case 6:return"up"}}_theme(e){switch(e){default:case 0:return"neutral";case 1:return"green";case 2:return"red";case 3:return"yellow";case 4:return"blue";case 5:return"green";case 6:return"red"}}_offset(e,t,i){var s;switch(e){default:case"up":s=null===i?t[TradingView.HIGH_PLOT]:i(t);break;case"down":s=null===i?t[TradingView.LOW_PLOT]:i(t)}
return this.priceScale().priceToCoordinate(s,this.ownerSource().firstValue())}_getIndex(e){return this.timeScale().timePointToIndex(e)}getViewData(){return{barWidth:this.barWidth(),plates:this.getPlatesViewData(),tooltip:this._tooltip}}barWidth(){return this.timeScale().barSpacing()}getPlatesViewData(){var e=this._model.mainSeries();if(e.data().isEmpty())return[];for(var t=d(e.style())?e.barFunction():null,i=this.filterDisplayedPlates(this.getVisibleRangePlates()),s=this,r={},n=this._model.lastHittestData(),o=(i=(i=i.map(function(e){var i=this._getIndex(e.tickmark),o=this._getBar(i);if(null===o)return!1;var a,l=this._layout(e.direction),c=this._theme(e.direction),h=n&&n.id===e.id,u=this.timeScale().indexToCoordinate(i),d=this._offset(l,o,t),p=this.priceScale().isInverted();return i in r||(r[i]={up:0,down:0}),a=r[i][l]++,TradingView.merge({id:e.id,x:u,y:d,yInverted:p,order:a,direction:l,theme:c,hovered:h,pinned:!0===s.pinnedTooltips[e.id],user__id:e.user__id,label:e.label,labelFontColor:e.labelFontColor||"#444",minSize:e.minSize||5},this._plateViewData(e))}.bind(this))).filter((function(e){return!!e}))).filter((function(e){return!0===e.hovered})),a=0;athis._loadedRange.end&&(e.start=this._loadedRange.end)),e}_rangeUnion(e,t){return e=Object.assign({},e),t&&(e.start=Math.min(t.start,e.start),e.end=Math.max(t.end,e.end)),e}_pushGetDataStack(e){a(e.start)&&a(e.end)?(this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(e,this._collectedRange),this._getDataTimeout=setTimeout(function(){this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null}.bind(this),300)):p.logError("Wrong tickmark range")}roundRange(e){return{start:Math.round(e.start),end:Math.round(e.end)}}refreshData(){this.getData(this._lastRange)}getData(e){a(e.start)&&a(e.end)?(this._lastRange=e,(e=Object.assign({},e)).end=this._maxDate,this._pushGetDataStack(e)):p.logError("Wrong range")}_abortAllRequests(){this._requests.forEach((function(e){e.abort()})),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null}clearMarks(){this._abortAllRequests(),this._marks={},this._loadedRange=null}}_.prototype._maxDate=Math.round(new Date(2037,0,1).getTime()/1e3),_.prototype._maxPlatesPerBar=10,t.BarsMarksContainer=_}).call(this,i("Kxc7"),i("tc+8"),i("aIyQ"))},fZEr:function(e,t,i){"use strict";async function s(e,t){
const s=await Promise.all([i.e("react"),i.e(1),i.e(2),i.e(3),i.e(6),i.e(13),i.e(15),i.e(18),i.e(91),i.e(0),i.e(5),i.e(12),i.e("simple-dialog")]).then(i.bind(null,"EcUf"));return s.showSimpleDialog(e,s.renameModule,t)}async function r(e,t){const s=await Promise.all([i.e("react"),i.e(1),i.e(2),i.e(3),i.e(6),i.e(13),i.e(15),i.e(18),i.e(91),i.e(0),i.e(5),i.e(12),i.e("simple-dialog")]).then(i.bind(null,"EcUf"));return s.showSimpleDialog(e,s.confirmModule,t)}i.d(t,"b",(function(){return s})),i.d(t,"a",(function(){return r}))},fgLi:function(e,t,i){"use strict";i.r(t),i.d(t,"DataSource",(function(){return l}));var s=i("hY0g"),r=i.n(s),n=i("e3/o"),o=i("aIyQ"),a=i.n(o);class l{constructor(){this.hasAlert=new r.a(!1),this._zorder=0,this.m_priceScale=null,this._id=Object(n.randomHashN)(6),this._ownerSource=null,this._userEditEnabled=!0,this._onPriceScaleChanged=new a.a,this._isSelectionEnabled=!0,this._ownerSourceChanged=new a.a,this._zOrderChanged=new a.a}id(){return this._id}preferNoScale(){return!1}idForAlert(){return this._id}setId(e){this._id=e}zorder(){return this._zorder}setZorder(e){"number"==typeof e&&this._zorder!==e&&(this._zorder=e,this._zOrderChanged.fire(e))}title(){throw new Error("Implement this fun in a subclass")}priceScale(){return this.m_priceScale}setPriceScale(e){this.m_priceScale=e,this._onPriceScaleChanged.fire()}ownerSource(){return this._ownerSource}setOwnerSource(e){this._ownerSource=e,this._ownerSourceChanged.fire()}ownerSourceChanged(){return this._ownerSourceChanged}zOrderChanged(){return this._zOrderChanged}isSavedInChart(e){return!0}isSavedInStudyTemplates(){return!0}isRemovedByStudyTemplates(){return!0}hasContextMenu(){return!0}showInObjectTree(){return!0}setUserEditEnabled(e){this._userEditEnabled=e}userEditEnabled(){return this._userEditEnabled}canBeHidden(){return this.userEditEnabled()}isUserDeletable(){return this.userEditEnabled()}canHasAlert(){return!1}properties(){throw new Error("Implement this fun in a subclass")}isVisible(){return this.properties().visible.value()}statusView(){return null}dataWindowView(){return null}legendView(){return null}marketStatusModel(){return null}dataUpdatedModeModel(){return null}dataProblemModel(){return null}priceAxisViews(e,t){return null}timeAxisViews(){return null}updateAllViews(){}paneViews(){return null}labelPaneViews(){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}canHaveChildren(){return!1}onClickOutside(){}getSourceIcon(){return null}state(e){throw new Error("Implement this fun in a subclass")}onPriceScaleChanged(){return this._onPriceScaleChanged}doesMovingAffectsUndo(){return!0}isMultiPaneAvailable(){return!1}isMultiPaneEnabled(){return!1}copiable(){return!1}cloneable(){return!1}movable(){return!1}isIncludedInAutoScale(){return!1}isHoveredEnabled(){return this.isSelectionEnabled()}isSelectionEnabled(){return this._isSelectionEnabled}setSelectionEnabled(e){this._isSelectionEnabled=e}priceRange(e,t){return null}autoScaleInfo(e,t){return{range:this.priceRange(e,t)}}}},
fs3R:function(e,t){e.exports=''},g5Qf:function(e,t,i){"use strict";i.r(t),i.d(t,"getFavoriteDrawingToolbarPromise",(function(){return o})),i.d(t,"createFavoriteDrawingToolbar",(function(){return a}));i("YFKU");var s=i("yMne");let r=null,n=null;function o(){return n}function a(){null===n&&(n=Promise.all([i.e("react"),i.e(1),i.e(2),i.e(7),i.e(11),i.e(15),i.e(16),i.e(18),i.e(20),i.e(22),i.e(24),i.e(28),i.e(42),i.e(47),i.e(50),i.e(63),i.e(69),i.e(79),i.e(0),i.e(4),i.e(25),i.e(32),i.e(38),i.e("line-tools-icons"),i.e(52),i.e(55),i.e("floating-toolbars")]).then(i.bind(null,"gmn6")).then(({FavoriteDrawingToolbar:e})=>(r=null!==r?r:new e({left:window.innerWidth/2,top:s.b+61}),r)))}},gASG:function(e,t,i){"use strict";i.r(t);var s=i("Eyy1"),r=i("Ocx9"),n=i("jvrd"),o=i("Ss5c"),a=i("tc+8"),l=i.n(a),c=i("mMWL"),h=i("+FzY"),u=i("aIyQ"),d=i.n(u);class p{constructor(e){this._image=null,this._currentImageURL=null,this._imageReady=!1,this._ready=new d.a,this._source=e,this.updateImage()}updateImage(){const e=this.imageURL();this._currentImageURL!==e&&(this._currentImageURL=e,this._image=null,this._imageReady=!1,null!==this._currentImageURL&&(this._image=new Image,this._image.onload=()=>{this._imageReady=!0,this._ready.fire()},this._image.crossOrigin="anonymous",this._image.src=this._currentImageURL))}itemIndex(){return 1}labelIndex(){return 0}image(){return this._imageReady&&this.showPlate()?this._image:null}showPlate(){return this._props().childs().showImage.value()}backgroundPlateColor(e){return this._props().childs().plateColor.value()}ready(){return this._ready}type(){return this._props().childs().itemType.value()}category(){return 1}time(){return 0}index(){const e=this._source.points();return 0===e.length?null:e[0].index}imageURL(){const e=this._props().childs().emoji.value();return Object(h.a)(e,"png")||null}sourceImage(){return null}additionalImageURL(){return null}additionalImageSource(){return null}name(){return""}headline(){return this._props().childs().text.value()}text(){return""}fullTextAst(){return null}position(){return this._props().childs().position.value()}fontSize(){return this._props().childs().fontSize.value()}fontBold(){return this._props().childs().bold.value()}fontItalic(){return this._props().childs().italic.value()}sourceLabel(){return null}_props(){return this._source.properties()}}class _ extends l.a{constructor(e){super(),this._source=e,e.pointAdded().subscribe(this,()=>this.listeners().fire(this)),e.pointChanged().subscribe(this,()=>this.listeners().fire(this))}value(){const e=this._source.properties().childs().position.value();return parseFloat(e.toFixed(2))}setValue(e){this._source.properties().childs().position.setValue(e),this._source.model().updateSource(this._source),
this.listeners().fire(this),this._source.syncMultichartState({pricesChanged:!1,indexesChanged:!1}),this._source.updateLastUpdateTime()}}var m=i("j8de");class f extends m.a{constructor(e,t){super(e,t),this._source=e}_setPointImpl(e){this._source.setPointAndChangeIndex(this._pointIndex,e)}}var g=i("j3hX");i.d(t,"LineToolSignpost",(function(){return v}));class v extends o.LineDataSource{constructor(e,t){const s=t||v.createProperties();super(e,s),this._item=new p(this),this._startMovingAnchorY=NaN,this.properties().childs().emoji.subscribe(this,()=>this._item.updateImage()),this._item.ready().subscribe(this,()=>this._model.updateSource(this)),i.e("lt-pane-views").then(i.bind(null,"KFbh")).then(t=>{this._setPaneViews([new t.SignpostPaneView(this,e)])})}isItemHovered(e){return!1}isItemSelected(e){return!1}isHidden(e){return!1}items(){return[this.customEvent()]}priceSource(){return this.ownerSource()}pointsCount(){return 1}addPoint(e,t,i){return super.addPoint(this._updatePositionAndCorrectPoint(e),t,i)}setPoint(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!this.isPhantom()),i),this._syncPosition()}setPointAndChangeIndex(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!1),i),this._syncPosition()}startMoving(e,t,i,r){r||(this._startMovingAnchorY=Object(s.ensureNotNull)(this._anchorYCoordinate())),super.startMoving(e,t,i)}move(e,t,i,r){var n;if(!r&&0===t){const t=this._points[0],i=Object(s.ensureDefined)(Object(s.ensureNotNull)(this.startMovingPoint()).logical),r=Object(s.ensureDefined)(e.logical),o=r.index-i.index,a=Object(s.ensureNotNull)(this.priceScale()),l=Object(s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),c=a.priceToCoordinate(r.price,l)-a.priceToCoordinate(i.price,l),h=this._startMovingAnchorY+c,u=a.coordinateToPrice(h,l);this._updatePositionAndCorrectPoint({index:t.index+o,price:u})}super.move(e,t,i),r||this._syncPosition()}properties(){return super.properties()}name(){return"Signpost"}customEvent(){return this._item}showInObjectTree(){return!this.isPhantom()&&super.showInObjectTree()}isPhantom(){return this._model.isPhantomLine(this)}clonePositionOffset(){return{barOffset:1,xCoordOffset:0,yCoordOffset:0}}template(){const e=super.template(),t=this.properties().childs();return e.text=t.text.value(),e.position=t.position.value(),e}static createProperties(e){const t=new r.DefaultProperty("linetoolsignpost",e);return v._configureProperties(t),t.hasChild("text")||t.addChild("text",new l.a(window.t("Text"))),t.hasChild("position")||t.addChild("position",new l.a(50)),t.addExclusion("text"),t.addExclusion("position"),t.addChild("backgroundsColors",new g.LineToolColorsProperty([t.childs().plateColor])),t}_createPointProperty(e){super._createPointProperty(e);const t=this._pointsProperty.childs().points[e];t.removeProperty("price"),t.removeProperty("bar"),t.addChild("price",new _(this)),t.addChild("bar",new f(this,0))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text),
this.properties().childs().position.setValue(e.position)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"zb1A")).then(e=>e.SignpostDefinitionsViewModel)}static _configureProperties(e){o.LineDataSource._configureProperties(e)}_updatePositionAndCorrectPoint(e,t){t&&(e.index=this._points[0].index);const i=this.priceSource();if(null===i)return e;const s=i.priceScale(),r=i.firstValue();if(null===s||s.isEmpty()||null===r)return e;const o=s.height();let a=o/2,l=e.price>=s.coordinateToPrice(a,r)?1:-1;const c=this._model.mainSeries();if(i===c){const t=c.data().search(e.index);if(null!==t){const i=Object(n.e)(c,t,-1),o=Object(n.e)(c,t,1);l=e.price>=i?1:-1,a=s.priceToCoordinate(1===l?o:i,r),e.price=1===l?Math.max(o,e.price):e.price}}const h=1===(-1===l!==s.isInverted()?-1:1)?a:o-a,u=s.priceToCoordinate(e.price,r),d=Math.min(o,Math.abs(u-a)),p=Math.max(0,Math.min(100,100*d/h))*l;return this.properties().childs().position.setValue(p),e}_syncPosition(){if(this.linkKey){const e={position:this.properties().childs().position.value()};Object(c.changeLineStyle)({linkKey:this.linkKey,state:e,model:this._model})}}_anchorYCoordinate(){const e=this.priceSource();if(null===e)return null;const t=e.priceScale(),i=e.firstValue();if(null===t||t.isEmpty()||null===i)return null;const s=this._model.mainSeries(),r=this.customEvent();let o=null;if(e===s&&(o=Object(n.d)(s,r)),null===o&&(o=Object(n.a)(r,t,i)),null===o)return null;const a=r.position(),l=t.priceToCoordinate(o.price,i);return Object(n.b)(a,t.height(),l,Object(n.c)(a,t.isInverted()))}}v.supportPhantomMode=!0},gAom:function(e,t,i){"use strict";i.r(t),i.d(t,"clearRectWithGradient",(function(){return o})),i.d(t,"fillRectInnerBorder",(function(){return a})),i.d(t,"drawHorizontalLine",(function(){return l})),i.d(t,"drawVerticalLine",(function(){return c})),i.d(t,"drawRoundRect",(function(){return u})),i.d(t,"drawRoundRectWithInnerBorder",(function(){return d})),i.d(t,"fillRectWithBorder",(function(){return p}));var s=i("aO4+"),r=i("jFln"),n=i("972a");function o(e,t,i,s,r,n,o){e.save(),e.globalCompositeOperation="copy";const a=e.createLinearGradient(0,0,0,r);a.addColorStop(0,n),a.addColorStop(1,o),e.fillStyle=a,e.fillRect(t,i,s,r),e.restore()}function a(e,t,i,s,r,n){e.fillRect(t+n,i,s-2*n,n),e.fillRect(t+n,i+r-n,s-2*n,n),e.fillRect(t,i,n,r),e.fillRect(t+s-n,i,n,r)}function l(e,t,i,s){e.beginPath();const r=e.lineWidth%2?.5:0;e.moveTo(i,t+r),e.lineTo(s,t+r),e.stroke()}function c(e,t,i,s){e.beginPath();const r=e.lineWidth%2?.5:0;e.moveTo(t+r,i),e.lineTo(t+r,s),e.stroke()}function h(e,t){return Array.isArray(e)?e.map(e=>0===e?e:e+t):e+t}function u(e,t,i,s,r,n){let o,a,l,c;if(Array.isArray(n))if(2===n.length){const e=Math.max(0,n[0]),t=Math.max(0,n[1]);o=e,a=e,l=t,c=t}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");o=Math.max(0,n[0]),a=Math.max(0,n[1]),l=Math.max(0,n[2]),c=Math.max(0,n[3])}else{const e=Math.max(0,n);o=e,a=e,l=e,c=e}e.beginPath(),e.moveTo(t+o,i),
e.lineTo(t+s-a,i),0!==a&&e.arcTo(t+s,i,t+s,i+a,a),e.lineTo(t+s,i+r-l),0!==l&&e.arcTo(t+s,i+r,t+s-l,i+r,l),e.lineTo(t+c,i+r),0!==c&&e.arcTo(t,i+r,t,i+r-c,c),e.lineTo(t,i+o),0!==o&&e.arcTo(t,i,t+o,i,o)}function d(e,t,i,s,o,a,l=0,c=0,d="",p=n.LineStyle.Solid){if(e.save(),!c||!d||d===a)return u(e,t,i,s,o,l),e.fillStyle=a,e.fill(),void e.restore();const _=c/2;if("transparent"!==a){const r="transparent"!==d&&p!==n.LineStyle.Solid;u(e,r?t:t+c,r?i:i+c,r?s:s-2*c,r?o:o-2*c,r?l:h(l,-c)),e.fillStyle=a,e.fill()}if("transparent"!==d){u(e,t+_,i+_,s-c,o-c,h(l,-_)),e.lineWidth=c,e.strokeStyle=d,Object(r.setLineStyle)(e,p),e.closePath(),e.stroke()}e.restore()}function p(e,t,i,n,o,a,l,c,h,u,d,p,_,m,f){const g=u?0:t,v=d?_:n;if(void 0!==a&&(e.fillStyle=a,e.fillRect(g,i,v-g+m,o-i)),void 0!==l&&c>0){if(e.beginPath(),Object(r.setLineStyle)(e,h),void 0!==f){const t=f.map(e=>e*c);Object(r.setLineDash)(e,t)}let a=Object(s.point)(0,0),u=Object(s.point)(0,0),d=Object(s.point)(0,0),_=Object(s.point)(0,0);switch(p){case"outer":{const e=.5*c;d=Object(s.point)(0,e),_=Object(s.point)(0,e),a=Object(s.point)(e,-c),u=Object(s.point)(e,-c);break}case"center":{const e=c%2?.5:0,t=c%2?.5:m;d=Object(s.point)(.5*c-e,-e),_=Object(s.point)(t+.5*c,-e),a=Object(s.point)(-e,e+.5*c),u=Object(s.point)(t,e+.5*c);break}case"inner":{const e=.5*c;d=Object(s.point)(0,-e),_=Object(s.point)(1,-e),a=Object(s.point)(-e,c),u=Object(s.point)(1-e,c);break}}e.lineWidth=c,e.strokeStyle=l,e.moveTo(g-d.x,i-d.y),e.lineTo(v+_.x,i-_.y),e.moveTo(n+u.x,i+u.y),e.lineTo(n+u.x,o-u.y),e.moveTo(g-d.x,o+d.y),e.lineTo(v+_.x,o+_.y),e.moveTo(t-a.x,i+a.y),e.lineTo(t-a.x,o-a.y),e.stroke()}}},gBDZ:function(e,t,i){"use strict";i.d(t,"a",(function(){return s})),i.d(t,"c",(function(){return r})),i.d(t,"b",(function(){return c}));var s,r,n=i("Eyy1"),o=i("XlJ7"),a=i("c44N"),l=i("ikwP");!function(e){e.Left="left",e.Right="right",e.Center="center"}(s||(s={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(r||(r={}));class c{constructor(e,t,i,s,r,a="center"){this._cacheRenderParams=null,this._canvasesMap={},this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return Object(o.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,s,r),this._fontSize=r,this._verticalPadding=~~(r/6),this._textAlign=a;const c=Object(l.createDisconnectedCanvas)(document,new l.Size(0,0),1),h=Object(n.ensureNotNull)(c.getContext("2d"));h.font=this._font;let u=0;for(const n of this._lines){const e=h.measureText(n).width;u=Math.max(u,e)}this.textImageWidth=u+1,this.textImageHeight=this._lines.length*r+this._verticalPadding}paintTo(e,t,i,s,r,n,o){const a=this._getTextImage(i,t);if(0===a.width||0===a.height)return;const c=function(e,t,i){let s=e;switch(t){case"left":break;case"right":s-=i;break;case"center":s-=i/2}return Math.round(s)}(s,n,this.textImageWidth),h=function(e,t,i){let s=e;switch(t){case"top":break;case"bottom":s-=i;break;case"middle":s-=i/2}return Math.round(s)}(r,o,this.textImageHeight);Object(l.drawScaled)(e,t.pixelRatio,()=>{
e.drawImage(a,c,h,this.textImageWidth,this.textImageHeight)})}_getTextImage(e,t){if(null!==this._cacheRenderParams&&Object(a.areEqualPaneRenderParams)(this._cacheRenderParams,t)||(this._canvasesMap={},this._cacheRenderParams=t),this._canvasesMap[e])return this._canvasesMap[e];{const t=Object(l.createDisconnectedCanvas)(document,new l.Size(this.textImageWidth,this.textImageHeight),this._cacheRenderParams.pixelRatio),i=Object(n.ensureNotNull)(t.getContext("2d"));let s;switch(i.textBaseline="top",i.font=this._font,i.fillStyle=e,this._textAlign){case"left":s=0,i.textAlign="left";break;case"right":s=this.textImageWidth-1,i.textAlign="right";break;default:s=this.textImageWidth/2,i.textAlign="center"}let r=this._verticalPadding;return Object(l.drawScaled)(i,this._cacheRenderParams.pixelRatio,()=>{for(const e of this._lines)i.fillText(e,s,r),r+=this._fontSize}),this._canvasesMap[e]=t,t}}}},gLxC:function(e,t,i){"use strict";var s=i("Ss5c").LineDataSource,r=i("tc+8"),n=i("Ocx9").DefaultProperty;class o extends s{constructor(e,t){super(e,t||o.createProperties()),this.version=o.version,i.e("lt-pane-views").then(i.bind(null,"Dz+H")).then(({NotePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 1}name(){return"Note"}getTooltipWidth(){return o.TOOLTIP_WIDTH}getTooltipPadding(){return o.TOOLTIP_PADDING}getTooltipLineSpacing(){return o.TOOLTIP_LINESPACING}template(){var e=s.prototype.template.call(this);return e.text=this.properties().childs().text.value(),e}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static createProperties(e){void 0!==e&&void 0!==e.markerColor&&void 0===e.borderColor&&(e.borderColor=e.markerColor);var t=new n("linetoolnote",e);return o._configureProperties(t),t}state(e){var t=s.prototype.state.call(this,e);return e&&(t.state.fixedSize=!1),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"74nv"))).NoteDefinitionsViewModel}static _configureProperties(e){s._configureProperties(e),e.hasChild("text")||e.addChild("text",new r(window.t("Text"))),e.addExclusion("text")}}o.TOOLTIP_WIDTH=300,o.TOOLTIP_PADDING=10,o.TOOLTIP_LINESPACING=5,o.version=1;class a extends o{constructor(e,t){super(e,t||a.createProperties())}title(){return window.t("Anchored Note")}name(){return"Anchored Note"}isFixed(){return!0}hasEditableCoordinates(){return!1}static createProperties(e){var t=new n("linetoolnoteabsolute",e);return a._configureProperties(t),t}static _configureProperties(e){o._configureProperties(e)}}t.LineToolNote=o,t.LineToolNoteAbsolute=a},gMX9:function(e,t,i){"use strict";var s=i("Eyy1"),r=i("Tmoa"),n=i("cPgM");class o{constructor(){this._items=[],this._actualLength=0,this._invalidations=0}push(e){this._items.length===this._actualLength?this._items.push(e):this._items[this._actualLength]!==e&&(this._items[this._actualLength]=e),this._actualLength+=1}newItem(){const e=this._items.length>this._actualLength?this._items[this._actualLength]:null
;return null!==e&&Boolean(e.invalidateCache)&&e.invalidateCache(),e}invalidateCache(){this._invalidations+=1,3e3===this._invalidations&&(this._items.splice(this._actualLength),this._invalidations=0),this._actualLength=0}at(e){return this._items[e]}data(){return this._items}length(){return this._actualLength}}class a{constructor(){this._map=new Map,this._usedKeys=new Set,this._invalidations=0}invalidateCache(){this._invalidations+=1,50===this._invalidations&&(this._deleteUnused(),this._invalidations=0),this._usedKeys.clear(),this._map.forEach((e,t)=>e.invalidateCache())}get(e){const t=this._map.get(e);return void 0!==t&&this._usedKeys.add(e),t}set(e,t){this._usedKeys.add(e),this._map.set(e,t)}forEach(e){this._map.forEach((t,i)=>{this._usedKeys.has(i)&&e(t,i)})}delete(e){const t=this._map.get(e);void 0!==t&&t.invalidateCache(),this._usedKeys.delete(e)}_deleteUnused(){const e=[];this._map.forEach((t,i)=>{this._usedKeys.has(i)||e.push(i)});for(const t of e)this._map.delete(t)}}class l extends o{constructor(){super(),this.points1=new o,this.points2=new o,this.push(this.points1),this.push(this.points2)}addPoints1Point(e,t){let i=this.points1.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points1.push(i)}addPoints2Point(e,t){let i=this.points2.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points2.push(i)}invalidateCache(){this.points1.invalidateCache(),this.points2.invalidateCache()}}class c extends n.ScaledPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e,t){return null}_drawImpl(e,t){if(null===this._data)return;const i=.25*this._data.barSpacing,s=this._data.transparency;this._data.colorAreas.forEach((t,n)=>{e.beginPath();for(let s=0;s=0;t--)e.lineTo(r.points2.at(t).x,r.points2.at(t).y)}else{const t=r.points2.at(0).x,s=r.points2.at(0).y;e.lineTo(n+i,o),e.lineTo(t+i,s),e.lineTo(t-i,s),e.lineTo(n-i,o)}}e.closePath(),e.fillStyle=Object(r.generateColor)(n,s),e.fill()})}}var h=i("k9/m"),u=i("ogJP"),d=i("Zp/P"),p=i("ZJKN");i.d(t,"a",(function(){return m}));class _ extends o{constructor(){super(...arguments),this._startIndex=0}setStartIndex(e){this._startIndex=e}at(e){const t=e-this._startIndex;for(;t>=this._actualLength;){if(this._items.length<=t)this._items.push({plot1Value:void 0,plot2Value:void 0,colorIndex:void 0});else{const e=this._items[this._actualLength];e.plot1Value=void 0,e.plot2Value=void 0,e.colorIndex=void 0}this._actualLength+=1}return this._items[t]}}class m{constructor(e,t=!1){this._isHlineFill=!1,this._bandAKey=null,this._bandBKey=null,this._colorPlotIndex=null,this._colorValues=[],this._colors=new o,this._areaRenderer=new c,this._invalidated=!0,this._plIndex1=null,this._plIndex2=null,this._level1=0,this._level2=0,this._studyValuesCache=new _,
this._points1=new o,this._points2=new o,this._timePoints=new o,this._colorAreas=new a,this._source=e,this._fillGaps=t}update(){this._invalidated=!0}renderer(e,t){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._areaRenderer}_correctVisibleRange(e){const t=this._source.data(),i=t.search(e.firstBar(),h.PlotRowSearchMode.NearestLeft,this._plotIndex1()),s=t.search(e.firstBar(),h.PlotRowSearchMode.NearestLeft,this._plotIndex2()),r=t.search(e.lastBar(),h.PlotRowSearchMode.NearestRight,this._plotIndex1()),n=t.search(e.lastBar(),h.PlotRowSearchMode.NearestRight,this._plotIndex2()),o=null!==i?i.index:e.firstBar(),a=null!==s?s.index:e.firstBar(),l=null!==r?r.index:e.lastBar(),c=null!==n?n.index:e.lastBar();return[Math.min(o,a),Math.max(l,c)]}_plotNames(){return this._source.metaInfo().plots.map(e=>e.id)}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImpl(){var e,t,i;if(this._areaRenderer.setData(null),!this._visible())return;const r=this._source.priceScale(),n=this._source.model(),o=n.timeScale();if(!r||r.isEmpty()||o.isEmpty())return;if(n.mainSeries().bars().isEmpty())return;const a=this._source.firstValue();if(null===a)return;if(this._isHlineFill){const e=this._source.properties().bands[Object(s.ensureNotNull)(this._bandAKey)],t=this._source.properties().bands[Object(s.ensureNotNull)(this._bandBKey)];this._level1=r.priceToCoordinate(e.value.value(),a),this._level2=r.priceToCoordinate(t.value.value(),a)}const l=o.visibleBarsStrictRange();if(null===l)return;this._timePoints.invalidateCache(),this._points1.invalidateCache(),this._points2.invalidateCache(),null===(e=this._colors)||void 0===e||e.invalidateCache(),this._colorAreas.invalidateCache();const[c,h]=this._correctVisibleRange(l),d=this._isPerBarColoringSupported()?this._colors:null,_=this._source.offset(this._plotAId()),m=this._source.offset(this._plotBId()),f=Math.min(_,m),g=Math.max(_,m),v=this._plotIndex1(),b=this._plotIndex2(),S=this._source.data();if(S.isEmpty())return;let y,w;const C=Object(s.ensureNotNull)(S.firstIndex()),P=Object(s.ensureNotNull)(S.lastIndex()),x=C-Math.max(0,-f),T=P+Math.max(0,g),M=Math.max(c-1,x),I=Math.min(h+1,T),L=this._studyValuesCache;L.invalidateCache();const O=M-g,A=S.rangeIterator(O,I-f),E=Math.max(l.firstBar()-1,Math.min(O-g-1,O-1+f));L.setStartIndex(E);const k=new p.BarsRange(l.firstBar()-1,l.lastBar()+1);for(;A.hasNext();){const e=A.next(),t=e.index,i=e.value,r=i[v],n=i[b],o=t+_,a=t+m;if(o===a&&k.contains(o)){const e=L.at(o);e.plot1Value=r,e.plot2Value=n}else{if(k.contains(o)){L.at(o).plot1Value=r}if(k.contains(a)){L.at(a).plot2Value=n}}if(null!==d){const e=t-1+f;if(l.contains(e)){const t=i[Object(s.ensureNotNull)(this._colorPlotIndex)+1];L.at(e).colorIndex=t}}}const D=this._timePoints,V=this._points1,B=this._points2;let R=null;const N=E+L.length();for(let s=E;s<=N;s++){if(!this._fillGaps&&(null===y||null===w)){
const e=s-1;D.push(e),V.push(NaN),B.push(NaN),null==d||d.push(null)}const e=L.at(s);if(null!==d){const t=e.colorIndex;R=null==t?null:this._getColorByPlotValue(t)}if(this._isHlineFill){D.push(s),null!==d&&d.push(R);continue}const r=null!==(t=e.plot1Value)&&void 0!==t?t:null,n=null!==(i=e.plot2Value)&&void 0!==i?i:null;(null!==r||null!==n||Number.isFinite(y)||Number.isFinite(w))&&(y=r,w=n,V.push(r),B.push(n),D.push(s),null!==d&&d.push(R))}r.pricesArrayToCoordinates(V.data(),a,V.length()),r.pricesArrayToCoordinates(B.data(),a,B.length()),o.indexesToCoordinates(D.data(),D.length());const j=this._transparency();let F=Object(u.isNumber)(j)?j:50;F=Math.min(F,100),F=Math.max(F,0);const W={barSpacing:this._source.model().timeScale().barSpacing(),transparency:F,colorAreas:this._getFilledAreas(D,V,B,d)};this._areaRenderer.setData(W)}_getFilledAreas(e,t,i,s){const r=this._isHlineFill;if(!r&&(0===t.length()||0===i.length()))return new a;const n=this._colorAreas;let c=null,h=null;const u=this._color();for(let a=0;at.code?1:0}class B{constructor(e){this._convertibleItems=e,this._idsToItems=new Map;for(const t of e)this._idsToItems.set(t.id,t)}convertible(e){return void 0!==this._idsToItems.get(e)}size(){return this._convertibleItems.length}filterConvertible(e,t){const i=this._convertibleItems.filter(function(e,t){return i=>!e.has(i.id)&&t(i.id)}(e,t));return i.sort(V),i}}class R{
constructor(e){this._allGroups=new Set,this._idToName=new Map,this._idToDescription=new Map,this._groupedUnitIds=new Map,this._groupedUnits=new Map,this._groupById=new Map,this._size=0,this._units=e;for(const t in e)if(e.hasOwnProperty(t)){this._allGroups.add(t),this._groupedUnitIds.set(t,new Set(e[t].map(e=>e.id))),this._groupedUnits.set(t,e[t]);for(const i of e[t])this._size++,this._idToName.set(i.id,i.name),this._idToDescription.set(i.id,i.description),this._groupById.set(i.id,t)}}unitsChanged(e){return this._units!==e}size(){return this._size}name(e){return this._idToName.get(e)||e}description(e){return this._idToDescription.get(e)||e}unitGroupById(e){return this._groupById.get(e)||null}allGroups(){return new Set(this._allGroups)}unitsByGroups(e){const t=[];return e.forEach(e=>{const i=this._groupedUnits.get(e);void 0!==i&&t.push({name:e,units:i})}),t}convertible(e,t){for(const i of t){const t=this._groupedUnitIds.get(i);if(void 0!==t&&t.has(e))return!0}return!1}}var N=i("ivNn");class j{constructor(e){this._source=null,this._sourcePane=null,this._currentToolSupportsPhantomMode=!1,this._model=e}destroy(){this._source=null,this._sourcePane=null}source(){return this._source}onToolChanged(){this._removeSource();const e=this._model.currentTool();this._currentToolSupportsPhantomMode=Object(L.isLineToolName)(e)&&Object(L.supportsPhantomMode)(e)}onCursorPositionUpdated(){if(!this._currentToolSupportsPhantomMode)return;const e=this._model.crossHairSource();if(this._sourcePane!==e.pane&&this._removeSource(),null===e.pane||!Object(N.isNumber)(e.index)||!Object(N.isNumber)(e.price))return void this._removeSource();const t={index:e.index,price:e.price};null!==this._source?this._source.setPoint(0,t):(this._source=this._model.createLineTool(e.pane,t,this._model.currentTool(),void 0,null),this._sourcePane=e.pane)}_removeSource(){null!==this._source&&(this._model.removeSource(this._source),this._source=null,this._sourcePane=null)}}var F=i("k9/m"),W=i("4o++"),H=i("zL3Q");class z{align(e,t,i){let r=e;if(!Object(H.a)().value())return r;const n=i.mainDataSource();if(null===n)return r;const o=n.model().mainSeries();if(n!==o)return r;const a=o.priceScale(),l=o.bars();if(a.isEmpty()||!l.contains(t))return r;const c=l.valueAt(t);if(null===c)return r;const h=[];null!==o.priceSource()?h.push(o.barFunction()(c)):h.push(c[1],c[2],c[3],c[4]);const u=Object(s.ensure)(o.firstValue()),d=h.map(e=>({y:a.priceToCoordinate(e,u),price:e})),p=a.priceToCoordinate(e,u);d.sort((e,t)=>Math.abs(e.y-p)-Math.abs(t.y-p));const _=d[0];return(Object(H.b)().value()===W.MagnetMode.StrongMagnet||Math.abs(_.y-p)<50)&&(r=_.price),r}}var U=i("Qb4w");i.d(t,"ChartModelBase",(function(){return K}));const G=Object(I.getLogger)("Chart.ChartModel");function q(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}const Y={isSnapshot:!1,readOnly:!1,watermarkEnabled:!0,shiftVisibleRangeOnNewBar:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0};class K{constructor(e,t,i,s,r,o,a,l){this._onRearrangePanes=new f.a,
this._lineToolsGroupModel=new T.LineToolsGroupModel,this._sourcesBeingMoved=[],this._lineItemBeingMoved=null,this._lineBeingEdited=null,this._linePointBeingEdited=null,this._linePointBeingChanged=null,this._customSourceBeingMovedHitTestData=null,this._dataSourceCollectionChanged=new f.a,this._sourceProperitesChanged=new f.a,this._sourceZOrderChanged=new f.a,this._sessions=null,this._currentTool="",this._lineBeingCreated=null,this._paneBeingCreatedLineOn=null,this._lineCancelled=new f.a,this._phantomSourceContainer=new j(this),this._destroyed=!1,this._isSettingsExternalPosition=!1,this._isTimeScrolling=!1,this._magnet=new z,this._panes=[],this._tagsChanged=new f.a,this._strategySources=[],this._strategySourcesChange=new f.a,this._activeStrategySource=new v.a(null),this._panesCollectionChanged=new f.a,this._scrollEnabled=S.enabled("chart_scroll"),this._zoomEnabled=S.enabled("chart_zoom"),this._isScalesResetAvailableChanged=new f.a,this._isScalesResetAvailable=!1,this._esdWatcher=null,this._alertsWatcher=null,this._hoveredSource=null,this._hoveredSourceChanged=new f.a,this._lastHittestData=null,this._topmostCustomSources=[],this._fgCustomSources=[],this._bgCustomSources=[],this._allCustomSources=[],this._customSourcesMap=new Map,this._multiPaneSources=[],this._showLegendProperty=new d.a,this._id=Object(O.guid)(),this._chartSaveTime=null,this._availableCurrenciesList=null,this._availableCurrencies=new B([]),this._availableUnitsObject=null,this._availableUnits=new R({}),this._shouldBeSavedEvenIfHidden=!1,this._watchedThemeSpawn=n.watchedTheme.spawn(),this._gradientColorsCache=null,this._recalcVRStudiesParams={timerId:null,force:!1,oldEndVisibleIndex:NaN,oldStartVisibleIndex:NaN},this._width=0,this._resetScales=new f.a,this._chartApi=e,this._invalidateHandler=t,this._undoModel=o,this._properties=i,this._options=Object(A.merge)(Object(A.clone)(Y),l),this._studiesMetaInfoRepository=r,this._readOnly=this._options.readOnly,this._isSnapshot=this._options.isSnapshot,this._chartSaveTime=(new Date).valueOf(),this._backgroundColor=new v.a(this._getBackgroundColor()),this._backgroundTopColor=new v.a(this._getBackgroundColor(!0)),this._properties.childs().paneProperties.childs().background.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundType.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.subscribe(this,this._updateBackgroundColor),this._watchedThemeSpawn.subscribe(this._updateBackgroundColor.bind(this))}chartSaveTime(){return this._chartSaveTime}setChartSaveTime(e){this._chartSaveTime=e}destroy(){this._phantomSourceContainer.destroy(),this._hoveredSourceChanged.destroy(),null!==this._watermarkSource&&(this._watermarkSource.destroy(),this._watermarkSource=null),Array.from(this._customSourcesMap.keys()).forEach(this._removeCustomSource,this),
Object(s.assert)(0===this._topmostCustomSources.length),Object(s.assert)(0===this._fgCustomSources.length),Object(s.assert)(0===this._bgCustomSources.length),Object(s.assert)(0===this._allCustomSources.length),Object(s.assert)(0===this._customSourcesMap.size),null!==this._esdWatcher&&(this._esdWatcher.destroy(),this._esdWatcher=null),null!==this._alertsWatcher&&(this._alertsWatcher.destroy(),this._alertsWatcher=null),this._properties.childs().paneProperties.childs().background.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundType.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.unsubscribeAll(this),this._watchedThemeSpawn.destroy(),this._destroyed=!0}undoModel(){return this._undoModel}addStrategySource(e){-1===this._strategySources.indexOf(e)&&(this._strategySources.push(e),this._strategySourcesChange.fire(),this.setActiveStrategySource(e))}removeStrategySource(e){const t=this._strategySources.indexOf(e);if(-1!==t){if(this._strategySources.splice(t,1)[0]===this._activeStrategySource.value()&&this.unsetActiveStrategySource(),this._strategySources.length>0){const e=this._strategySources[this._strategySources.length-1];this.setActiveStrategySource(e)}this._strategySourcesChange.fire()}}setActiveStrategySource(e){-1!==this._strategySources.indexOf(e)&&this._activeStrategySource.setValue(e)}unsetActiveStrategySource(){this._activeStrategySource.setValue(null)}activeStrategySource(){return this._activeStrategySource}strategySources(){return this._strategySources}strategySourcesChange(){return this._strategySourcesChange}setScrollEnabled(e){this._scrollEnabled=e}scrollEnabled(){return this._scrollEnabled}setZoomEnabled(e){this._zoomEnabled=e}zoomEnabled(){return this._zoomEnabled}zoomToViewport(e,t,i,s,r){this.setTimeViewport(e,t);let n=Math.min(i,s),o=Math.max(i,s);const a=r.defaultPriceScale();a.isPercentage()||a.setMode({autoScale:!1}),a.isLog()&&(n=a.priceToLogical(n),o=a.priceToLogical(o)),a.setPriceRange(new U.PriceRange(n,o)),this.recalculateAllPanes(),this.invalidate(this._paneInvalidationMask(r,b.InvalidationLevel.Light)),this._setScalesResetAvailable(!0)}setTimeViewport(e,t){this.timeScale().zoomToBarsRange(e,t),this.recalculateAllPanes(),this.recalcVisibleRangeStudies(),this.lightUpdate()}onTagsChanged(){return this._tagsChanged}canZoomIn(){return this._timeScale.canZoomIn()&&this._zoomEnabled}canZoomOut(){return this._timeScale.canZoomOut()&&this._zoomEnabled}onPaneTagsChanged(){this._tagsChanged.fire()}panesCollectionChanged(){return this._panesCollectionChanged}dataSourceCollectionChanged(){return this._dataSourceCollectionChanged}sourceProperitesChanged(){return this._sourceProperitesChanged}sourceZOrderChanged(){return this._sourceZOrderChanged}updateCrosshairPositionByOriginCoords(){const e=this.crossHairSource(),t=e.pane;let i=e.originX(),r=e.originY();if(Number.isFinite(i)||(i=e.x,r=e.y),
null!==t&&Number.isFinite(i)&&Number.isFinite(r)){const e=Math.round(this._timeScale.coordinateToIndex(i));let n=NaN;const o=t.defaultPriceScale();if(!o.isEmpty()){const e=Object(s.ensureNotNull)(t.mainDataSource()).firstValue();null!==e&&(n=o.coordinateToPrice(r,Object(s.ensureNotNull)(e)))}this.crossHairSource().setPosition(e,n,t)&&this._undoModel.chartWidget().isActive()&&this._syncCrosshair()}}zoomTime(e,t,i){if(!this._zoomEnabled)return;const s=this.timeScale();if(s.isEmpty()||0===t)return;const r=s.width();e=Math.max(1,Math.min(e,r-2)),s.zoom(e,t,i),this.recalculateAllPanes(),this.lightUpdate(),this.recalcVisibleRangeStudies(),this._setScalesResetAvailable(!0)}linePointBeingEdited(){return this._linePointBeingEdited}linePointBeingChanged(){return this._linePointBeingChanged}dataSources(){const e=[this.crossHairSource()];for(const t of this._panes)for(const i of t.dataSources())e.push(i);return e}priceDataSources(){const e=[];for(const t of this._panes)for(const i of t.priceDataSources())e.push(i);return e}lineToolsGroupModel(){return this._lineToolsGroupModel}restoreLineToolsGroups(e){this._lineToolsGroupModel=T.LineToolsGroupModel.fromState(this,e)}realignLineTools(){for(const e of this._panes)e.realignLineTools()&&this._dataSourceCollectionChanged.fire(e)}updateSource(e){const t=this._invalidationMaskForSource(e);null!==t&&this.invalidate(t)}updateSourcePriceScale(e){const t=this._invalidationMaskForSourcePriceScale(e);null!==t&&this.invalidate(t)}replaceStudyStub(e,t){const i=this.paneForSource(e);if(null===i)return!1;const s=e.priceScale(),r=e.zorder(),n=e.ownerSource();return this.paneForSource(e)===i?i.replaceSource(e,t,s):(i.insertDataSource(t,s,r),this.removeSource(e)),t.setOwnerSource(n),this.dataSources().forEach(i=>{i.ownerSource()===e&&i.setOwnerSource(t)}),t.start(),this.recalculatePane(i),this.fullUpdate(),!0}insertStudyStub(e){const t=this.mainSeries(),i=Object(s.ensureNotNull)(this.paneForSource(t)),r=new c.StudyStub(this,null,e),n=i.createPriceScaleAtPosition("overlay");return i.addDataSource(r,n,!1),this.recalculatePane(i),this.fullUpdate(),r}removeStudyStub(e){const t=this.dataSourceForId(e);return null===t?(G.logNormal("StudyStub id="+e+" is not found in chart model"),!1):(this.removeSource(t),!0)}setHoveredSource(e,t){const i=this._hoveredSource!==e;if(!i&&this._lastHittestData===t)return;this._lastHittestData=t;let s=null;if(this._hoveredSource){this._hoveredSource.updateAllViews(),s=new b.InvalidationMask(b.InvalidationLevel.Cursor);const e=this._invalidationMaskForSource(this._hoveredSource,b.InvalidationLevel.Light);null!==e&&s.merge(e)}if(this._hoveredSource=e,e){e.updateAllViews(),s||(s=new b.InvalidationMask(b.InvalidationLevel.Cursor));const t=this._invalidationMaskForSource(e,b.InvalidationLevel.Light);null!==t&&s.merge(t)}s&&this.invalidate(s),i&&this._hoveredSourceChanged.fire(e)}hoveredSource(){return this._hoveredSource}hoveredSourceChanged(){return this._hoveredSourceChanged}lastHittestData(){return this._lastHittestData}paneForSource(e){if(function(e){return!("id"in e)
}(e))return Array.from(this._customSourcesMap.values()).includes(e)?this.paneForSource(this.mainSeries()):null;for(let t=this._panes.length-1;t>=0;t--)if(this._panes[t].hasDataSource(e))return this._panes[t];return e instanceof k.BarsMarksContainer?this.paneForSource(this.mainSeries()):null}allStudies(e){const t=e?e=>Object(_.isStudy)(e)&&!Object(_.isESDStudy)(e):_.isStudy;return this._getAllSources(t)}findNonOverlayStudyWithGroupingKey(e,t){const i=void 0!==t?[t]:this._panes;for(const s of i){const t=s.dataSources().find(t=>Object(_.isStudy)(t)&&t.metaInfo().groupingKey===e&&!s.isOverlay(t));if(void 0!==t)return{pane:s,study:t}}return null}movePaneUp(e){this.movePane(e,e-1)}movePaneDown(e){this.movePane(e,e+1)}movePane(e,t){const i=this._panes[e];this._panes.splice(e,1),this._panes.splice(t,0,i),this._panesCollectionChanged.fire(this._panes),this._onRearrangePanes.fire(),this.invalidate(b.InvalidationMask.panesOrder())}backgroundColor(){return this._backgroundColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(e){const t=this.backgroundColor().value(),i=this.backgroundTopColor().value();if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==i||this._gradientColorsCache.bottomColor!==t)this._gradientColorsCache={topColor:i,bottomColor:t,colors:new Map};else{const t=this._gradientColorsCache.colors.get(e);if(void 0!==t)return t}const s=Object(E.gradientColorAtPercent)(i,t,e/100);return this._gradientColorsCache.colors.set(e,s),s}defaultResolutions(){return this.chartApi().defaultResolutions()}availableCurrencies(){const e=this._getAvailableCurrencies();return e.length!==this._availableCurrencies.size()&&(this._availableCurrencies=new B(e)),this._availableCurrencies}currencyConversionEnabled(){return this._options.currencyConversionEnabled}availableUnits(){const e=this._getAvailableUnits();return this._availableUnits.unitsChanged(e)&&(this._availableUnits=new R(e)),this._availableUnits}unitConversionEnabled(){return this._options.unitConversionEnabled}onResetScales(){return this._resetScales}startMovingSources(e,t,i,r,n,o){if(this._sourcesBeingMoved=e,this._lineItemBeingMoved=i,this._sourcesBeingMoved.forEach(e=>{const a=Object(s.ensureNotNull)(this.paneForSource(e));if(Object(L.isLineTool)(e)&&e.isFixed()&&e.linkKey&&r.has(e.linkKey)){const t=Object(s.ensureDefined)(r.get(e.linkKey)),l={screen:this._percentPositionToPoint(t,a)};e.startMoving(l,i,n,o)}else e.startMoving(t,i,n,o);const l=this._paneInvalidationMask(a,b.InvalidationLevel.Light);this.invalidate(l)}),!o){const r=e.filter(e=>e.linkKey&&e.isSynchronizable()).map(e=>e.linkKey);if(r.length&&t.logical){const o=this.externalTimeStamp(t.logical.index),a={linkKeys:r,model:this,symbol:this.mainSeries().symbol(),point:{price:t.logical.price,timeStamp:o},itemIndex:null!==i?i:void 0,envState:n,pointPositionPercents:new Map};e.forEach(e=>{if(e.linkKey&&e.isSynchronizable()&&e.isFixed()){const i=Object(s.ensureNotNull)(this.paneForSource(e))
;a.pointPositionPercents.set(e.linkKey,this._pointToPercentPosition(Object(s.ensureDefined)(t.screen),i))}}),Object(M.startMovingLineTool)(a)}}M.isToolMovingNow.setValue(!0)}moveSources(e,t,i,r){if(this._sourcesBeingMoved.filter(e=>!e.isLocked||!e.isLocked()).forEach(n=>{if(n.linkKey&&t.has(n.linkKey)){const e=Object(s.ensureNotNull)(this.paneForSource(n)),o=Object(s.ensureDefined)(t.get(n.linkKey)),a={screen:this._percentPositionToPoint(o,e)};n.move(a,this._lineItemBeingMoved,i,r)}else n.move(e,this._lineItemBeingMoved,i,r)}),this.lightUpdate(),!r&&e.logical){const t=this._sourcesBeingMoved.filter(e=>e.isSynchronizable()&&!!e.linkKey).map(e=>e.linkKey),r=this.externalTimeStamp(e.logical.index),n={linkKeys:t,model:this,point:{price:e.logical.price,timeStamp:r},envState:i,pointPositionPercents:new Map};this._sourcesBeingMoved.forEach(t=>{if(t.linkKey&&t.isSynchronizable()&&t.isFixed()){const i=Object(s.ensureNotNull)(this.paneForSource(t));n.pointPositionPercents.set(t.linkKey,this._pointToPercentPosition(Object(s.ensureDefined)(e.screen),i))}}),Object(M.moveLineTool)(n)}}endMovingSources(e,t){const i=this._sourcesBeingMoved.map(i=>{const r=Object(s.ensureNotNull)(this.paneForSource(i)),n=i.endMoving(e,t),o=this._paneInvalidationMask(r,b.InvalidationLevel.Light);return o.invalidateAll(b.InvalidationLevel.Light),this.invalidate(o),n}),r=this._sourcesBeingMoved.filter(e=>e.isSynchronizable()&&!!e.linkKey).map(e=>e.linkKey),n=this._sourcesBeingMoved.filter(e=>e.isSynchronizable()&&!!e.linkKey).map(e=>{const t={points:e.normalizedPoints(),interval:this.mainSeries().interval()};return e.isFixed()&&(t.pointPositionPercents=e.calcPositionPercents()),t});r.length&&Object(M.finishMovingLineTool)({linkKeys:r,model:this,finalStates:n,changes:i}),this._sourcesBeingMoved=[],this._lineItemBeingMoved=null,M.isToolMovingNow.setValue(!1)}sourcesBeingMoved(){return this._sourcesBeingMoved}setCustomSourceMovingHitTestData(e){this._customSourceBeingMovedHitTestData=null!==e?Object.assign({beingMoved:!1},e):null}processingCustomSourceMove(){null!==this._customSourceBeingMovedHitTestData&&(this._customSourceBeingMovedHitTestData.beingMoved=!0)}customSourceMovingHitTestData(){return this._customSourceBeingMovedHitTestData}width(){return this._width}setWidth(e,t){this._width=e,this._timeScale.setWidth(e,t);for(const i of this._panes)i.setWidth(e);this.recalculateAllPanes(),this.recalcVisibleRangeStudies()}setPaneHeight(e,t){e.setHeight(t),this.recalculateAllPanes(),this.lightUpdate()}isScalesResetAvailableChanged(){return this._isScalesResetAvailableChanged}isScalesResetAvailable(){return this._isScalesResetAvailable}panes(){return this._panes}paneForId(e){return this._panes.find(t=>t.id()===e)||null}createPane(e,t,i){const s=this._undoModel.chartWidget();s.isMaximizedPane()&&s.toggleMaximizePane();const r=this._properties.childs().paneProperties;t&&r.merge(t);const n=new y.Pane(this._timeScale,r,this,i);return void 0!==e?this._panes.splice(e,0,n):this._panes.push(n),n.onTagsChanged().subscribe(this,K.prototype.onPaneTagsChanged),
n.dataSourcesCollectionChanged().subscribe(this,()=>this._dataSourceCollectionChanged.fire(n)),n.sourcePropertiesChanged().subscribe(this,e=>this._sourceProperitesChanged.fire(n,e)),n.sourceZOrderChanged().subscribe(this,e=>this._sourceZOrderChanged.fire(n,e)),this._panesCollectionChanged.fire(this._panes),this.invalidate(b.InvalidationMask.panesOrder()),n}removePane(e){const t=this._undoModel.chartWidget();t.isMaximizedPane()&&t.toggleMaximizePane();const i=e;i.destroy();const s=this._panes.indexOf(i);-1!==s&&(this._panes.splice(s,1),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.sourcePropertiesChanged().unsubscribeAll(this),e.onTagsChanged().unsubscribeAll(this));this.crossHairSource().pane===e&&this.clearCurrentPosition(),this._panesCollectionChanged.fire(this._panes),this.invalidate(b.InvalidationMask.panesOrder())}changePanesHeight(e,t){if(this._panes.length<2)return;Object(s.assert)(e>=0&&ee+t.stretchFactor(),0),n=this._panes.reduce((e,t)=>e+t.height(),0),o=n-30*(this._panes.length-1);t=Math.min(o,Math.max(30,t));const a=r/n,l=i.height();i.setStretchFactor(t*a);let c=t-l,h=this._panes.length-1;for(const s of this._panes)if(s!==i){const e=Math.min(o,Math.max(30,s.height()-c/h));c-=s.height()-e,h-=1;const t=e*a;s.setStretchFactor(t)}this.fullUpdate()}clearCurrentPosition(){const e=this.crossHairSource();e.clearPosition(),Object(s.ensureNotNull)(e.dataWindowView()).update();const t=this._panes;for(let s=t.length;s--;){const e=t[s].dataSources();for(let t=e.length;t--;){const i=e[t].dataWindowView();i&&i.update();const s=e[t].legendView();s&&s.update()}}this.invalidate(b.InvalidationMask.cursor());const i=this._undoModel.chartWidget();i.chartWidgetCollection().syncCrosshair(null,i),this._phantomSourceContainer.onCursorPositionUpdated()}setAndSaveCurrentPosition(e,t,i,s){this.crossHairSource().saveOriginCoords(e,t),this.setCurrentPosition(e,t,i,s)}setCurrentPosition(e,t,i,r){let n=NaN,o=Math.round(this._timeScale.coordinateToIndex(e));const a=this.timeScale().visibleBarsStrictRange();null===a||a.contains(o)||(o=Math.min(Math.max(a.firstBar(),o),a.lastBar()));const l=i.defaultPriceScale();let c=null;l.isEmpty()||(c=Object(s.ensureNotNull)(i.mainDataSource()).firstValue(),null!==c&&(n=l.coordinateToPrice(t,Object(s.ensureNotNull)(c))));const h=this.crossHairSource(),u=this.currentTool();if(!this._isSettingsExternalPosition&&(this._lineBeingCreated||this._lineBeingEdited||Object(L.isLineToolName)(u)||Object(M.toolIsMeasure)(u))&&(n=this._magnet.align(n,o,i),null!==c&&h.saveOriginCoords(h.originX(),l.priceToCoordinate(n,c))),this._isTimeScrolling)return void h.setPosition(h.index,n,i);h.setOnHoveredChartWidget(!0),h.setPosition(o,n,i),Object(s.ensureNotNull)(h.dataWindowView()).update();const d=this._panes;for(let s=d.length;s--;){const e=d[s].dataSources();for(let t=e.length;t--;){const i=e[t].dataWindowView();i&&i.update();const s=e[t].legendView();s&&s.update()}}const p=this.mainSeries().syncModel()
;if(this.crossHairSource().startMeasurePoint()||this._lineBeingCreated?this.lightUpdate():this.invalidate(b.InvalidationMask.cursor()),this._lineBeingCreated){const e=this._lineBeingCreated.linkKey;if(!this._isSettingsExternalPosition){this._lineBeingCreated.setLastPoint({index:o,price:n},r),this._lineBeingCreated.updateAllViews();const t=Object(s.ensureNotNull)(this._lineBeingCreated.lastPoint());if(t.price!==n||t.index!==o){h.setPosition(t.index,t.price,i);const e=this._timeScale.indexToCoordinate(t.index),r=l.priceToCoordinate(t.price,Object(s.ensureNotNull)(c));h.saveOriginCoords(e,r)}if(p&&e){const i=this._timeScale.points().roughTime(t.index,p.projectTime.bind(p));Object(M.setLineToolLastPoint)({model:this,linkKey:e,point:{timeStamp:Object(s.ensureNotNull)(i),price:t.price}})}}}if(!this._isSettingsExternalPosition&&null!==this._lineBeingEdited&&null!==this._linePointBeingEdited){this.changeLinePoint({index:o,price:n},r);const e=this._lineBeingEdited.getPoint(this._linePointBeingEdited);if(null!==e){h.setPosition(e.index,e.price,i);const t=this._timeScale.indexToCoordinate(e.index),r=l.priceToCoordinate(e.price,Object(s.ensureNotNull)(c));h.saveOriginCoords(t,r)}}this._syncCrosshair(r)}setExternalPosition(e,t){let i;const r=this.crossHairSource();if(r.setOnHoveredChartWidget(!1),null!==e&&Object(A.isNumber)(e.timeStamp)){const t=this.mainSeries().syncModel();if(t){const s=this.createSyncPoint(e.syncModel,t).sourceTimeToTargetTime(e.timeStamp);i=this._timeScale.points().roughIndex(s,t.distance.bind(t))}}if(null!==e&&null!=i&&Number.isFinite(i)&&void 0!==e.price&&Number.isFinite(e.price)){this._isSettingsExternalPosition=!0;const n=Object(s.ensureNotNull)(this.paneForSource(this.mainSeries())),o=this._timeScale.indexToCoordinate(i),a=Object(s.ensureNotNull)(n.mainDataSource()).firstValue();if(null!==a){const i=this.mainSeries().priceScale().priceToCoordinate(e.price,a);r.clearOriginCoords(),this.setCurrentPosition(o,i,n,t)}return r.setOnHoveredChartWidget(!1),void(this._isSettingsExternalPosition=!1)}null!=i&&Number.isFinite(i)?(r.clearOriginCoords(),r.setPosition(i,NaN,null)):(r.clearPosition(),Object(s.ensureNotNull)(r.dataWindowView()).update());const n=this.dataSources();for(let s=n.length;s--;){const e=n[s].dataWindowView();e&&e.update();const t=n[s].legendView();t&&t.update()}this.invalidate(b.InvalidationMask.cursor())}startScaleTime(e){this._timeScale.startScale(e)}scaleTimeTo(e){this._timeScale.scaleTo(e),this.recalculateAllPanes(),this.lightUpdate(),this._setScalesResetAvailable(!0)}endScaleTime(){this._timeScale.endScale(),this.lightUpdate(),this.recalcVisibleRangeStudies()}resetTimeScale(){this._timeScale.restoreDefault(),this.recalculateAllPanes(),this.recalcVisibleRangeStudies(),this.lightUpdate(),this._resetScales.fire(),this._setScalesResetAvailable(!1)}startScalePrice(e,t,i){e.startScalePrice(t,i)}scalePriceTo(e,t,i){e.scalePriceTo(t,i),this.mainSeries().priceScale().isLockScale()?this.lightUpdate():this.invalidate(this._paneInvalidationMask(e,b.InvalidationLevel.Light)),
this._setScalesResetAvailable(!0)}endScalePrice(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,b.InvalidationLevel.Light))}resetPriceScale(e,t){this._setScalesResetAvailable(!1),e.resetPriceScale(t),this.invalidate(this._paneInvalidationMask(e,b.InvalidationLevel.Light))}restorePriceScaleState(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,b.InvalidationLevel.Light))}currentTool(){return this._currentTool}setCurrentTool(e){this._currentTool!==e&&(Object(L.isLineToolName)(e)&&this.selectionMacro(e=>{e.clearSelection()}),this._currentTool=e,this._phantomSourceContainer.onToolChanged())}onRearrangePanes(){return this._onRearrangePanes}finishLineTool(e){Object(M.drawOnAllCharts)().value()&&e.linkKey&&e.isSynchronizable()&&Object(M.finishLineTool)({linkKey:e.linkKey,model:this})}startChangingLinetool(e,t,i,r,n){this._lineBeingEdited=e,this._linePointBeingChanged=t||null,this._linePointBeingEdited=void 0===i?null:i,M.isToolEditingNow.setValue(!0),this._lineBeingEdited.startChanging(i,t,n);const o=Object(s.ensureNotNull)(this.paneForSource(e));this._lineBeingEdited.startDragPoint&&void 0!==i&&void 0!==t&&this._lineBeingEdited.startDragPoint(i,t),n||void 0===i||void 0===t||this._lineBeingEdited.setPoint(i,t,r,n),this._lineBeingEdited.updateAllViews();const a=this._paneInvalidationMask(o,b.InvalidationLevel.Light);if(this.invalidate(a),e.linkKey&&e.isSynchronizable()&&void 0!==i&&void 0!==t){const n=Object(s.ensureNotNull)(this.externalTimeStamp(t.index));Object(M.startChangingLineTool)({linkKey:e.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:n},pointIndex:i,envState:r||null})}}createLineTool(e,t,i,n,a,l){if(Object(s.assert)(Object(L.isLineToolName)(i),"Cannot create unknown line tool: "+i),"LineToolExecution"!==i&&Object(o.trackEvent)("drawings","Study_Drawing_"+i),n){const e=n.state();n=Object(L.createLineToolProperties)(i,e)}const c=Object(L.createLineTool)(i,this,n,null),h=!c.linkKey&&!a;Object(M.drawOnAllCharts)().value()?c.linkKey=a||Object(O.randomHash)():c.linkKey=a,l=l||Object(s.ensureNotNull)(e.mainDataSource()),n||(c.properties().currencyId.setValue(Object(s.ensureNotNull)(l.symbolSource()).currency()),c.properties().unitId.setValue(Object(s.ensureNotNull)(l.symbolSource()).unit())),c.setOwnerSource(l);const u=e.defaultPriceScale();let d;if(e.addDataSource(c,u,!1),c.isFixed()){const i=Object(s.ensureNotNull)(Object(s.ensureNotNull)(e.mainDataSource()).firstValue()),n=this._timeScale.indexToCoordinate(t.index),o=u.priceToCoordinate(t.price,i);d=c.addFixedPoint(new r.Point(n,o))}else d=c.addPoint(t);return d||(this._lineBeingCreated=c,this._paneBeingCreatedLineOn=e,M.isToolCreatingNow.setValue(!0)),h&&c.enableCurrentIntervalVisibility(),this.fullUpdate(),c}endChangingLinetool(e,t){const i=Object(s.ensureNotNull)(this._lineBeingEdited),r=i.endChanging(!1,e);this._lineBeingEdited=null,M.isToolEditingNow.setValue(!1),this._linePointBeingEdited=null,this._linePointBeingChanged=null,this.lightUpdate();const n={
points:i.normalizedPoints(),interval:this.mainSeries().interval()};i.linkKey&&i.isSynchronizable()&&Object(M.finishChangingLineTool)({model:this,linkKey:i.linkKey,symbol:this.mainSeries().symbol(),finalState:n,changes:r})}continueCreatingLine(e,t,i,r){const n=Object(s.ensureNotNull)(this._lineBeingCreated),o=n.addPoint(e,t,i);n.updateAllViews();const a=new b.InvalidationMask(b.InvalidationLevel.Light);return o&&(this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,M.isToolCreatingNow.setValue(!1)),this.invalidate(a),o}cancelCreatingLine(){if(!this._lineBeingCreated)return;const e=this._lineBeingCreated;this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire(),M.isToolCreatingNow.setValue(!1),Object(M.drawOnAllCharts)().value()&&e.isSynchronizable()&&Object(M.cancelLineTool)({model:this})}lineBeingCreated(){return this._lineBeingCreated}paneBeingCreatedLineOn(){return this._paneBeingCreatedLineOn}lineCancelled(){return this._lineCancelled}isPhantomLine(e){return this._phantomSourceContainer.source()===e}changeLinePoint(e,t,i){const r=Object(s.ensureNotNull)(this._lineBeingEdited),n=Object(s.ensureNotNull)(this._linePointBeingEdited);let o=e.price,a=e.index;if(r.setPoint(n,e,t),!i){const e=r.getPoint(n);null!==e&&(a=e.index,o=e.price)}if(r.updateAllViews(),this.lightUpdate(),!i&&r.linkKey&&r.isSynchronizable()){const e=Object(s.ensureNotNull)(this._linePointBeingChanged),i={indexesChanged:a!==e.index,pricesChanged:o!==e.price},l=r.getChangePointForSync(n);if(null!==l){const e=this.externalTimeStamp(a);null!==e&&(o=l.price,Object(M.changeLineTool)({linkKey:r.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:o,timeStamp:e},envState:t,changes:i}))}}}changeLinePoints(e,t,i){const r=e.points();!i&&e.linkKey&&e.isSynchronizable()&&t.forEach((t,i)=>{const n=r[i],o=n.price!==t.price,a=n.index!==t.index;if(e.getChangePointForSync(i)){const i=Object(s.ensureNotNull)(this.externalTimeStamp(t.index));Object(M.changeLineTool)({linkKey:Object(s.ensureDefined)(e.linkKey),model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:i},changes:{pricesChanged:o,indexesChanged:a}})}}),e.setPoints(t),e.updateAllViews(),this.lightUpdate()}addCustomSource(e,t,i=a.a.Foreground){this._customSourcesMap.has(e)&&G.logWarn(`Attempt to add the same custom source multiple time "${e}"`),G.logNormal(`Adding custom source "${e}"`);const s=t(e,this);switch(i){case a.a.Background:this._bgCustomSources.push(s);break;case a.a.Foreground:this._fgCustomSources.push(s);break;case a.a.Topmost:this._topmostCustomSources.push(s);break;default:throw new Error("Unknown custom sources layer "+i)}this._allCustomSources.push(s),this._customSourcesMap.set(e,s),this.lightUpdate()}removeCustomSource(e){this._removeCustomSource(e),this.lightUpdate()}hasCustomSource(e){return this._customSourcesMap.has(e)}customSourceForName(e){return this._customSourcesMap.get(e)||null}customSourceName(e){let t=null;return this._customSourcesMap.forEach((i,s)=>{i===e&&(t=s)}),t}customSources(e){switch(e){
case a.a.Background:return this._bgCustomSources;case a.a.Foreground:return this._fgCustomSources;case a.a.Topmost:return this._topmostCustomSources;default:return this._allCustomSources}}addMultiPaneSource(e){this._multiPaneSources.push(e),this.lightUpdate()}removeMultiPaneSource(e){const t=this._multiPaneSources.indexOf(e);-1===t?G.logWarn("Attempt to remove multi-pane source which does not exist in the model"):this._multiPaneSources.splice(t,1),this.lightUpdate()}multiPaneSources(e){return this._multiPaneSources.filter(t=>!e.hasDataSource(t))}dateTimeFormatter(){return this._dateTimeFormatter}dateFormatter(){return this._dateFormatter}timeFormatter(){return this._timeFormatter}sessions(){return Object(s.ensureNotNull)(this._sessions)}createSessions(e){Object(s.assert)(null===this._sessions,"Sessions are already created"),this.addCustomSource("sessions",(t,i)=>(this._sessions=new p.Sessions(t,i,e),this._sessions.start(),this._sessions),a.a.Background)}createPrePostMarket(e){this.addCustomSource("prePostMarket",(t,i)=>new PrePostMarket(t,i,e))}theme(){const e=this.properties().paneProperties.state();delete e.topMargin,delete e.bottomMargin;const t=this.mainSeries().state().state;delete t.symbol,delete t.interval,delete t.currencyId,delete t.unitId;const i={mainSourceProperties:t,sessions:this.sessions().properties().state(),chartProperties:{paneProperties:e,scalesProperties:this.properties().scalesProperties.state()}};return i.version=this.version(),i}shouldBeSavedEvenIfHidden(){return this._shouldBeSavedEvenIfHidden}setShouldBeSavedEvenIfHidden(e){this._shouldBeSavedEvenIfHidden=e}externalTimeStamp(e){const t=this.mainSeries().syncModel();return this.timeScale().points().roughTime(e,t&&t.projectTime.bind(t))}syncESD(){null!==this._esdWatcher&&this._esdWatcher.syncESDStudies()}recalcVisibleRangeStudies(e){null!==this._recalcVRStudiesParams.timerId&&clearTimeout(this._recalcVRStudiesParams.timerId),this._recalcVRStudiesParams.force=this._recalcVRStudiesParams.force||Boolean(e),this._recalcVRStudiesParams.timerId=setTimeout(()=>this._recalcVisibleRangeStudiesImpl(this._recalcVRStudiesParams),500)}alertsWatcher(){return this._alertsWatcher}showLegend(){return this._showLegendProperty}id(){return this._id}recalculatePriceRangeOnce(){const e=this.mainSeries();for(const t of this._panes)for(const i of t.priceDataSources())i.symbolSource()===e&&i.disablePriceRangeReady()}invalidate(e){var t;null===(t=this._invalidateHandler)||void 0===t||t.call(this,e)}appliedTimeFrame(){return this._appliedTimeFrame.appliedTimeFrame()}_createESDWatcher(){}_updateDateTimeFormatter(){const e=P.dateFormatProperty.value(),t=new C.DateFormatter(e);if(this._dateFormatter=t,this.mainSeries().isDWM())this._dateTimeFormatter=t,this._timeFormatter=new x.TimeFormatter("%h:%m");else{const t=h.Interval.parse(this.mainSeries().interval()),i=t.isSeconds()||t.isTicks()?"%h:%m:%s":"%h:%m";this._dateTimeFormatter=new w.a({dateFormat:e,timeFormat:i,dateTimeSeparator:" "}),this._timeFormatter=new x.TimeFormatter(i)}}_setScalesResetAvailable(e){
this._isScalesResetAvailable!==e&&(this._isScalesResetAvailable=e,this._isScalesResetAvailableChanged.fire())}_invalidationMaskForSource(e,t=b.InvalidationLevel.Light){if(e===this.crossHairSource())return b.InvalidationMask.cursor();if(this._watermarkSource===e)return this._paneInvalidationMask(Object(s.ensureNotNull)(this.paneForSource(this.mainSeries())),t);if(-1!==this._allCustomSources.indexOf(e)){const e=new b.InvalidationMask;return e.invalidateAll(t),e}if(!Object(l.a)(e))return null;if(e.isMultiPaneEnabled())return new b.InvalidationMask(t);const i=this.paneForSource(e);return null!==i?this._paneInvalidationMask(i,t):null}_paneInvalidationMask(e,t=b.InvalidationLevel.Light){const i=new b.InvalidationMask,s=this._panes.indexOf(e);return i.invalidateAllPane(s,t),i}_invalidationMaskForSourcePriceScale(e,t=b.InvalidationLevel.Light){if(!Object(l.a)(e))return new b.InvalidationMask(t);const i=this.paneForSource(e);if(null===i)return null;let s=e.priceScale();if(null===s)return null;const r=this._panes.indexOf(i);let n=i.priceScalePosition(s);if("overlay"===n){const e=this._panes[r].defaultPriceScale();s=e,n=i.priceScalePosition(e)}const o=i.priceScaleIndex(s,n);if(void 0===o)return null;const a=new b.InvalidationMask;return a.invalidatePriceScale(r,n,o,t),a}_removeCustomSource(e){const t=this._customSourcesMap.get(e);if(void 0===t)return void G.logWarn(`Attempt to remove custom source which does not exist in the model - "${e}"`);G.logNormal(`Removing custom source "${e}"`),this.selectionMacro(e=>{e.removeSourceFromSelection(t)});const i=q(this._bgCustomSources,t),r=q(this._fgCustomSources,t),n=q(this._topmostCustomSources,t),o=q(this._allCustomSources,t);Object(s.assert)(i||r||n,"Source should be presented in one of the layers"),Object(s.assert)(o,"Source should be presented in the array"),this._customSourcesMap.delete(e),t.destroy()}_updateShowLegendProperty(){const e=this._properties.childs().paneProperties.childs().legendProperties.childs().showLegend,t=this._showLegendProperty;if(e.value())t.setValue(!0);else{for(const e of this._panes){let i=0;for(const s of e.dataSources())if(s!==this.mainSeries()&&null!==s.statusView()&&(i++,i>1))return void t.setValue(!1)}t.setValue(!0)}}_pointToPercentPosition(e,t){return{x:e.x/this._timeScale.width(),y:e.y/Object(s.ensureNotNull)(Object(s.ensureNotNull)(t.mainDataSource()).priceScale()).height()}}_percentPositionToPoint(e,t){const i=e.x*this._timeScale.width(),n=e.y*Object(s.ensureNotNull)(Object(s.ensureNotNull)(t.mainDataSource()).priceScale()).height();return new r.Point(i,n)}_recalcVisibleRangeStudiesImpl(e){if(e.timerId=null,this.timeScale().isEmpty())return;const t=this.timeScale().visibleBarsStrictRange();if(null===t)return;const i=this.mainSeries().nearestData(t.firstBar(),F.PlotRowSearchMode.NearestRight),s=this.mainSeries().nearestData(t.lastBar(),F.PlotRowSearchMode.NearestLeft),r=this.mainSeries().bars().lastIndex(),n=i?i.index:void 0,o=s?s.index:void 0,a=n===e.oldStartVisibleIndex,l=o===e.oldEndVisibleIndex;if(a&&l&&!e.force)return;e.force=!1,
e.oldStartVisibleIndex=void 0!==n?n:NaN,e.oldEndVisibleIndex=void 0!==o?o:NaN;const c={first_visible_bar_time:1e3*Math.floor(i&&i.value?i.value[0]:0),last_visible_bar_time:1e3*Math.floor(s&&s.value?s.value[0]:0),subscribeRealtime:s&&s.index===r},h=e.studies||this.priceDataSources();e.studies=void 0;for(const u of h)if(Object(_.isStudy)(u)){const e=u.metaInfo().inputs,t=[];for(const s of e)c.hasOwnProperty(s.id)&&t.push(s.id);const i=u.properties().inputs;for(const s of t)i[s].setValueSilently(c[s]);t.length>0&&i.listeners().fire(i)}}_getAllSources(e){const t=[];for(const i of this._panes){const s=i.sourcesByGroup().all();for(const i of s)e(i)&&t.push(i)}return t}_getAvailableCurrencies(){return this._options.currencyConversionEnabled?Object(A.isArray)(this._availableCurrenciesList)?this._availableCurrenciesList:(null!==this._availableCurrenciesList||(this._availableCurrenciesList=this.chartApi().availableCurrencies(),this._availableCurrenciesList.then(e=>{this._destroyed||(this._availableCurrenciesList=e,this.lightUpdate())}).catch(e=>{G.logWarn("An error occurred while getting currencies config: "+e)})),[]):[]}_getAvailableUnits(){return this._options.unitConversionEnabled?this._availableUnitsObject instanceof Promise||null===this._availableUnitsObject?(null!==this._availableUnitsObject||(this._availableUnitsObject=this.chartApi().availableUnits(),this._availableUnitsObject.then(e=>{this._destroyed||(this._availableUnitsObject=e,this.lightUpdate())}).catch(e=>{G.logWarn("An error occurred while getting units config: "+e)})),{}):this._availableUnitsObject:{}}_getBackgroundColor(e){const t=this._properties.childs().paneProperties.childs();if(t.backgroundType.value()===D.ColorType.Gradient){const i=t.backgroundGradientStartColor.value(),s=t.backgroundGradientEndColor.value();return e?i:s}return t.background.value()}_updateBackgroundColor(){this._backgroundColor.setValue(this._getBackgroundColor()),this._backgroundTopColor.setValue(this._getBackgroundColor(!0))}_syncCrosshair(e){if(!this._isSettingsExternalPosition){const t=this._undoModel.chartWidget(),i=this._undoModel.mainSeries(),s=i.syncModel(),r=this._undoModel.crossHairSource(),n=r.pane;if(null!==s&&null!==n){const o={timeStamp:this._timeScale.points().roughTime(r.index,s.projectTime.bind(s)),syncModel:s};n.mainDataSource()===i&&(o.price=r.price,o.symbol=i.symbol()),o.syncModel=s;let a=this._lineBeingCreated||null!==this._linePointBeingEdited||Boolean(this._sourcesBeingMoved.length);a=a&&Object(M.drawOnAllCharts)().value(),t.chartWidgetCollection().syncCrosshair(o,t,a,e)}this._phantomSourceContainer.onCursorPositionUpdated()}}}},gQ5K:function(e,t,i){"use strict";i.r(t),i.d(t,"DateFormatter",(function(){return n}));var s=i("kcTO"),r=i("e1ZQ");class n{constructor(e="yyyy-MM-dd"){this._dateFormatFunc=r.b[e]}format(e){return s.customFormatters&&s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!1)}formatLocal(e){
return s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.formatLocal?s.customFormatters.dateFormatter.formatLocal(e):s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!0)}}},gWck:function(e,t,i){"use strict";i.r(t),i.d(t,"SeriesLegendView",(function(){return o}));var s=i("cXAR"),r=i("C2K+");const n=window.t("At close");class o extends s.SeriesDataWindowView{constructor(e,t){super(e,t),this._showBarChange=t.properties().paneProperties.legendProperties.showBarChange,this._showSeriesOHLC=t.properties().paneProperties.legendProperties.showSeriesOHLC,this._showBarChange.subscribe(this,this.update),this._showSeriesOHLC.subscribe(this,this.update)}isValuesVisible(){return this._showSeriesOHLC.value()||this._showBarChange.value()}additional(){return null}marketTitle(){const e=this._series.marketStatusModel().status().value();return this._showLastPriceAndChangeOnly()&&("pre_market"===e||"post_market"===e)?n+":":""}destroy(){this._showBarChange.unsubscribeAll(this),this._showSeriesOHLC.unsubscribeAll(this)}_createValuesProvider(e,t){return new r.a(e,t)}}},gWrr:function(e,t,i){"use strict";i.d(t,"a",(function(){return r})),i.d(t,"b",(function(){return n}));const s=new WeakMap;function r(e,t){let i,r;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(r=s.get(i)),r||(r=i.ownerDocument.createRange(),r.selectNodeContents(i),s&&s.set(i,r)),r.createContextualFragment(e)}function n(e,t){const i=r(e,t);let s;if("firstElementChild"in i)s=i.firstElementChild;else{s=null;for(let e=0;e2;){var d=Math.round((u+h)/2);this.items[d].x<=e.x?h=d:u=d}h=Math.max(1,h-1),u=Math.min(this.items.length-1,u+1);for(var p=h;p<=u;++p)if(t=this.items[p-1],i=this.items[p],a=t.x,l=i.x,r(new s(a,t.y),new s(l,i.y),new s(e.x,e.y)).distance<=c)return this.hittest?this.hittest:new o(o.REGULAR);return null}}},gzUS:function(e,t,i){"use strict";i.r(t),i.d(t,"PointsetsManager",(function(){return o}));var s=i("LxhU"),r=i("txPx");const n=Object(r.getLogger)("ChartApi.PointsetsManager");class o{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,r){let o=this._pointsetsDataBySymbol.get(t);void 0===o&&(o=new Map,this._pointsetsDataBySymbol.set(t,o));const a=[];for(const l of s){const[t,i]=l;"number"!=typeof t||Number.isNaN(t)?n.logWarn(`Pointset time is invalid: id=${e}, ${t} of type ${typeof t}`):a.push({point:l,extrapolation:r.extrapolateTimeWithOffsetToTime(1e3*t,i)})}s.length===a.length&&o.set(e,{resolution:i,points:a})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach((i,s)=>{i.delete(e),0===i.size&&t.push(s)});for(const i of t)this._pointsetsDataBySymbol.delete(i)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach((e,i)=>{if(s.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)})}getUpdatesForSymbol(e,t,i,s){const r=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach((e,n)=>{const o=this._refreshPointsetData(e,t,i,s);null!==o&&r.set(n,o)}),
r}_refreshPointsetData(e,t,i,r){if(s.Interval.isEqual(e.resolution,t))for(let s=0;s ${t}`),null;o.push({index:s,value:[a.index,a.timeMs/1e3]})}return o}}},h24c:function(e,t,i){"use strict";i.r(t),i.d(t,"parseIntervalValue",(function(){return c})),i.d(t,"intervalIsSupported",(function(){return h})),i.d(t,"canShowSpreadActions",(function(){return u})),i.d(t,"globalKeypressMatches",(function(){return d})),i.d(t,"skipAccept",(function(){return p})),i.d(t,"syncSymbolSearch",(function(){return _})),i.d(t,"setLinkingResolution",(function(){return m}));var s=i("Kxc7"),r=i("pPtI"),n=i("PT1i"),o=i("LxhU"),a=i("ePL1");const l=new RegExp("^"+a.types.QUANDL,"i");function c(e){let t;t=/^[,\s]*(\d*)\s*([hdwmst]?)\s*$/i;const i=t.exec(e)||[],s=~~i[1],r=i[2]&&i[2].toUpperCase()||null,n={qty:!s&&r?1:s,unit:r};return n.error=!s&&!r,n.intraday=!(n.error||n.unit&&"H"!==n.unit&&"S"!==n.unit&&"T"!==n.unit),n}function h(e){if(s.enabled("allow_supported_resolutions_set_only")){const t=o.Interval.normalize(e);return null!==t&&Object(r.isAvailable)(t)}{const t=c(e);if(t.error)return!1;if(t.intraday)return n.linking.intraday.value();{const e=n.linking.supportedResolutions.value();return!e||null!==t.unit&&!!~e.indexOf(t.unit)}}}function u(){let e=!1;return s.enabled("show_spread_operators")&&(e=!0),e}function d(e){return!e.ctrlKey&&(!e.metaKey&&(!!e.charCode&&(!(!e.which||e.which<=32)&&(null===e.target||!/^(input|textarea)$/i.test(e.target.tagName)))))}function p(e,t){return!t&&(e===n.linking.symbol.value()||e===n.linking.seriesShortSymbol.value())}function _(e,t){let i=n.linking.symbol.value()||"";i=function(e,t){if(!t)return e;if(l.test(e)){const t=e.split(/\//);t.length&&(e=t[t.length-1])}else e=n.linking.seriesShortSymbol.value()||e;return e}(i,t),e.val(i)}function m(e){Object(r.setLastUsedResolution)(e),n.linking.interval.setValue(e)}},hBTJ:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=i("Eyy1"),r=i("aO4+"),n=i("GEp6"),o=i("f6yo");function a(e,t){var i=e.A,s=t.A,n=e.B,o=t.B,a=e.C,l=t.C,c=i*o-s*n;if(Math.abs(c)<1e-6)return null;var h=(n*l-o*a)/c,u=(s*a-i*l)/c;return new r.Point(h,u)}function l(e,t,i,s){var r=function(e,t,i,s){var r=t.subtract(e),n=s.subtract(i),o=r.x*n.y-r.y*n.x;if(Math.abs(o)<1e-6)return null;var a=e.subtract(i);return(a.y*n.x-a.x*n.y)/o}(e,t,i,s);if(null===r)return null;var o=t.subtract(e).scaled(r).add(e),a=n.distanceToSegment(i,s,o);return Math.abs(a.distance)<1e-6?r:null}function c(e,t){for(var i=0,s=e;i0&&r.equalPoints(e[e.length-1],t))&&(e.push(t),!0)}function u(e,t){for(var i=[],s=0;s=3?i:null}t.intersectLineSegmentAndBox=function(e,t){var i=e[0].x,s=e[0].y,n=e[1].x,o=e[1].y,a=t.min.x,l=t.min.y,c=t.max.x,h=t.max.y;function u(e,t,i,s,r,n){var o=0;return er&&(o|=2),tn&&(o|=8),o}for(var d=u(i,s,a,l,c,h),p=u(n,o,a,l,c,h),_=!1,m=0;;){if(m>1e3)throw new Error("Cohen - Sutherland algorithm: infinity loop");if(m++,!(d|p)){_=!0;break}if(d&p)break;var f=d||p,g=void 0,v=void 0;8&f?(g=i+(n-i)*(h-s)/(o-s),v=h):4&f?(g=i+(n-i)*(l-s)/(o-s),v=l):2&f?(v=s+(o-s)*(c-i)/(n-i),g=c):(v=s+(o-s)*(a-i)/(n-i),g=a),f===d?d=u(i=g,s=v,a,l,c,h):p=u(n=g,o=v,a,l,c,h)}return _?r.equalPoints(r.point(i,s),r.point(n,o))?r.point(i,s):r.lineSegment(r.point(i,s),r.point(n,o)):null},t.intersectLines=a,t.intersectLineSegments=l,t.intersectLineAndBox=function(e,t){var i=t.min.x,n=t.min.y,o=t.max.x,a=t.max.y;if(0===e.A){var l=-e.C/e.B;return n<=l&&l<=a?r.lineSegment(r.point(i,l),r.point(o,l)):null}if(0===e.B){var h=-e.C/e.A;return i<=h&&h<=o?r.lineSegment(r.point(h,n),r.point(h,a)):null}var u=[],d=function(t){var i=function(e,t){return-(e.C+e.A*t)/e.B}(e,t);n<=i&&i<=a&&c(u,new r.Point(t,i))},p=function(t){var s=function(e,t){return-(e.C+e.B*t)/e.A}(e,t);i<=s&&s<=o&&c(u,new r.Point(s,t))};switch(d(i),p(n),d(o),p(a),u.length){case 0:return null;case 1:return u[0];case 2:return r.equalPoints(u[0],u[1])?u[0]:r.lineSegment(u[0],u[1])}return s.assert(!1,"We should have at most two intersection points"),null},t.intersectRayAndBox=function(e,t,i){var s=l(e,t,i.min,new r.Point(i.max.x,i.min.y)),n=l(e,t,new r.Point(i.max.x,i.min.y),i.max),a=l(e,t,i.max,new r.Point(i.min.x,i.max.y)),c=l(e,t,new r.Point(i.min.x,i.max.y),i.min),h=[];if(null!==s&&s>=0&&h.push(s),null!==n&&n>=0&&h.push(n),null!==a&&a>=0&&h.push(a),null!==c&&c>=0&&h.push(c),0===h.length)return null;h.sort((function(e,t){return e-t}));var u=o.pointInBox(e,i)?h[0]:h[h.length-1];return e.addScaled(t.subtract(e),u)},t.intersectPolygonAndHalfplane=u,t.intersectPolygons=function(e,t){for(var i=e,s=0;s{this._setPaneViews([new t.PolylinePaneView(this,e)])})}pointsCount(){return-1}properties(){return super.properties()}name(){return"Polyline"}hasEditableCoordinates(){return!1}addPoint(e,t,i){var n;const a=Object(s.ensureNotNull)(this.priceScale()),l=this._model.timeScale().indexToCoordinate(e.index),c=e.price,h=Object(s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),u=a.priceToCoordinate(c,h),d=Object(o.interactionTolerance)().minDistanceBetweenPoints;if(this._points.length>0){const e=this._points[this._points.length-1],t=this._model.timeScale().indexToCoordinate(e.index),i=e.price,s=a.priceToCoordinate(i,h);if(new r.Point(l,u).subtract(new r.Point(t,s)).length()e.PolylinesDefinitionsViewModel)}static _configureProperties(e){a.LineDataSource._configureProperties(e),e.addExclusion("filled")}}},hY0g:function(e,t,i){"use strict";(function(e){var t=i("txPx").getLogger("Common.WatchedValue");function s(){}function r(e){if(!(this instanceof r))return new r(e);arguments.length>0&&(this._value=e),this._listeners=[]}
r.prototype.value=function(){return this._owner?this._owner._value:this._value},r.prototype.setValue=function(e,i){var s=this._owner?this._owner:this;if("function"==typeof s.hook&&(e=s.hook(e)),s.writeLock)return s._value;if(!i&&s._value===e&&s.hasOwnProperty("_value"))return e;s._value=e;for(var r=s._listeners.slice(),n=0,o=0;o=1&&t.multiplier()<=15?"1D":"1W";case r.ResolutionKind.Seconds:case r.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily":return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const h={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,
pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:2,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots"},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN}init(e,t){const i=t(0),r=t(1),n=t(2),a=t(3);this._data=new o,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=r,this._historicalPivotsToKeep=a,this._pivTimeFrame=n,this._isValidResolution=function(e,t){return(!s.Std.isdaily(e)||"Daily"!==t)&&((!s.Std.isweekly(e)||"Daily"!==t&&"Weekly"!==t)&&(!s.Std.ismonthly(e)||"Daily"!==t&&"Weekly"!==t&&"Monthly"!==t))}(e,this._pivTimeFrame),this._isValidResolution||s.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=c(e,this._pivTimeFrame)),e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e){if(!this._isValidResolution)return null;if(e.symbol.time)return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const t=e.new_var(s.Std.open(e)),i=e.new_var(s.Std.high(e)),r=e.new_var(s.Std.low(e)),o=e.new_var(s.Std.close(e)),a=e.new_var(s.Std.time(e)),c=this._data,h=t.get(0),u=a.get(0),d=t.get(1),p=i.get(1),_=r.get(1),m=o.get(1),f=e.symbol.isLastBar;if(0!==c.pivots.length&&e.symbol.isNewBar){const e=c.pivots[c.pivots.length-1];e.endIndex__t!==u&&(e.endIndex__t=u)}if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const g=function(e,t,i,r,o,a,l,c){const h=new n;let u=NaN;const d=i-r;switch(c){case 0:u=(i+r+o)/3,h.p=u,h.r1=2*u-r,h.s1=2*u-i,h.r2=u+(i-r),h.s2=u-(i-r),h.r3=2*u+(i-2*r),h.s3=2*u-(2*i-r),h.r4=3*u+(i-3*r),h.s4=3*u-(3*i-r),h.r5=4*u+(i-4*r),h.s5=4*u-(4*i-r);break;case 1:u=(i+r+o)/3,h.p=u,h.r1=u+.382*d,h.s1=u-.382*d,h.r2=u+.618*d,h.s2=u-.618*d,h.r3=u+d,h.s3=u-d;break;case 2:u=(i+r+2*e)/4,h.p=u,h.r1=2*u-r,h.s1=2*u-i,h.r2=u+d,h.s2=u-d,h.r3=i+2*(u-r),h.s3=r-2*(i-u),h.r4=h.r3+d,h.s4=h.s3-d;break;case 3:u=(i+r+o)/3,h.p=u,h.r1=2*u-r,h.s1=2*u-i,h.r2=u+d,h.s2=u-d,h.r3=u+2*d,h.s3=u-2*d,h.r4=u+3*d,h.s4=u-3*d;break;case 4:let n=NaN;n=s.Std.equal(t,o)?i+r+2*o:s.Std.greater(o,t)?2*i+r+o:2*r+i+o,u=n/4,h.p=u,h.r1=n/2-r,h.s1=n/2-i;break;case 5:u=(i+r+o)/3,h.p=u,h.r1=o+1.1*d/12,h.s1=o-1.1*d/12,h.r2=o+1.1*d/6,h.s2=o-1.1*d/6,h.r3=o+1.1*d/4,
h.s3=o-1.1*d/4,h.r4=o+1.1*d/2,h.s4=o-1.1*d/2;break;default:throw new Error("Unknown kind")}return h.startIndex__t=a,h.endIndex__t=l,h}(h,d,p,_,m,u,l(e,u),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(c.pivots=[]),c.pivots.push(g),c.pivots.length>this._historicalPivotsToKeep&&c.pivots.shift(),f?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex(e=>e.startIndex__t>this._firstMainSeriesBarTime)-1,0);e>0&&this._data.pivots.splice(0,e)}}}},"i/Bj":function(e,t,i){"use strict";function s(e){if(void 0===e)return null;const t=e.match(/(delayed_streaming)_([\d]{1,4})/);return null===t?null:{mode:t[1],interval:parseInt(t[2])}}i.r(t),i.d(t,"parseUpdateMode",(function(){return s}))},i126:function(e,t,i){"use strict";i.r(t),i.d(t,"StudyColorRotatorFactory",(function(){return h}));var s=i("eJTA"),r=i("Tmoa"),n=i("HGP3"),o=i("3ClC");const a=["color-sky-blue-400","color-banana-yellow-700","color-deep-blue-500","color-grapes-purple-a700","color-iguana-green-500","color-minty-green-a700","color-ripe-red-a200","color-berry-pink-200","color-tv-blue-a100","color-tan-orange-a200","color-sky-blue-a400","color-deep-blue-a100","color-grapes-purple-400","color-iguana-green-a700","color-minty-green-200","color-ripe-red-200","color-berry-pink-a200","color-ripe-red-500","color-grapes-purple-500","color-deep-blue-400","color-tv-blue-a200","color-sky-blue-500","color-iguana-green-400","color-minty-green-400","color-banana-yellow-600","color-tan-orange-500","color-berry-pink-400","color-ripe-red-300","color-grapes-purple-300","color-deep-blue-300","color-tv-blue-300","color-sky-blue-300","color-iguana-green-300","color-minty-green-300","color-banana-yellow-400","color-tan-orange-300","color-berry-pink-300","color-tan-orange-a700"];class l{constructor(e){this._offset=0,this._offset=e}getColor(e){if(0===this._offset)return e;const t=a[(this._offset-1)%a.length],i=n.a[t],o=Object(r.isHexColor)(e)?1:Object(s.parseRgba)(e)[3];return Object(r.generateColor)(i,Object(r.alphaToTransparency)(o))}}class c{constructor(e,t){this._offset=e,this._modelStartOffset=t}getColor(e){if(Object(r.isHexColor)(e)){const t=Object(s.parseRgb)(e);return Object(s.rgbToHexString)(Object(s.shiftRgb)(t,this._offset,this._modelStartOffset))}{const t=Object(s.parseRgba)(e);return Object(s.rgbaToString)(Object(s.shiftRgba)(t,this._offset,this._modelStartOffset))}}}class h{constructor(e){this._chartModel=e}getColorRotator(e){const t=Object(o.studyColorRotationMode)(e);if(null===t)return null;const i=this._calcDefaultColorsOffset(e);switch(t){case"loop":return new l(i);case"shift":{const e=this._chartModel.getStudyShiftColorStartOffset();return new c(i,e)}}}_calcDefaultColorsOffset(e){let t=0;return this._chartModel.dataSources().filter(o.isStudy).forEach(i=>{const s=i.metaInfo().id===e.id,r=(n=i.metaInfo(),o=e,(n.pine?n.pine.version:void 0)===(o.pine?o.pine.version:void 0));var n,o;s&&r&&t++}),t}}},
i6cO:function(e,t,i){"use strict";var s;function r(e){e.lineWidth=void 0,e.lineStyle=void 0;for(let t=0;t{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Fib Spiral"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"nBUU"))).FibSpiralDefinitionsViewModel}static createProperties(e){var t=new r("linetoolfibspiral",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolFibSpiral=n},iDOr:function(e,t,i){"use strict";(function(e){var s=i("Y7w9").moveToHead,r=i("704P").ExecutionsPositionController,n=i("Ss5c").LineDataSource,o=i("7ktv").PriceDataSource,a=i("CW80").isLineTool,l=i("s1Gx").isSpeciallyZOrderedSource,c=i("1Wlv").PriceScale,h=i("MWAT").createPriceScaleSelectionStrategy,u=i("yfAl").PaneBase,d=i("s1Gx").sortSources;class p extends u{constructor(t,i,s,r){super(t,i,s,r),this.m_timeScale=t,this.m_height=0,this.m_width=0,this.m_mainDataSource=null,this._properties=i,this._model=s,this._destroyed=new e,s.properties().priceScaleSelectionStrategyName.listeners().subscribe(null,function(e){this._priceScaleSelectionStrategy=h(e.value()),this._priceScaleSelectionStrategy.apply(this)}.bind(this)),this.m_timeScale.barSpacingChanged().subscribe(this,function(){this.m_mainDataSource===this._model.mainSeries()&&this._recalculatePriceScaleByScaleRatio(this.m_mainDataSource.priceScale())}.bind(this)),i.topMargin.listeners().subscribe(this,p.prototype._updateMargins),i.bottomMargin.listeners().subscribe(this,p.prototype._updateMargins),this._updateMargins(),this._maximized=!1,this._isMainPane=!1}destroy(){this._properties.topMargin.listeners().unsubscribe(this,p.prototype._updateMargins),this._properties.bottomMargin.listeners().unsubscribe(this,p.prototype._updateMargins),this._model.properties().priceScaleSelectionStrategyName.listeners().unsubscribeAll(this),this.m_timeScale.barSpacingChanged().unsubscribeAll(this),this._leftPriceScales.concat(this._rightPriceScales).forEach((function(e){e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this)}),this);for(var e=0;ee.left){var t=s(this._leftPriceScales,this.mainDataSource().priceScale());return t.splice(e.left),t}return this._leftPriceScales}visibleRightPriceScales(){var e=this._model.priceScaleSlotsCount();if(this._rightPriceScales.length>e.right){var t=s(this._rightPriceScales,this.mainDataSource().priceScale());return t.splice(e.right),t}return this._rightPriceScales}timeScale(){return this.m_timeScale}_processMainSourceChange(){var e;if(null===this.m_mainDataSource)for(var t=0;te)&&(e=s)}}return null===e&&(e=this.getZOrderMinMax().minZOrder-1),this.m_dataSources.forEach((function(t){t.zorder()>e&&t.setZorder(t.zorder()+1)})),e+1}beginInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!0,this._lastLineDataSourceZOrder=null}endInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null}startScrollPrice(e,t){e.startScroll(t)}scrollPriceTo(e,t){e.scrollTo(t),this.updateAllViews()}endScrollPrice(e){e.endScroll()}setPriceAutoScale(e,t){e.setMode({autoScale:t}),this.timeScale().isEmpty()||this.recalculatePriceScale(e)}defaultPriceScale(){
var e=this.m_mainDataSource?this.m_mainDataSource.priceScale():null;return null===e&&(e=new c(this._model.properties().scalesProperties)),e}_priceScaleIsPrice(e){var t=e.mainSource();return!!t&&(!!TradingView.isInherited(t.constructor,TradingView.Series)||!!TradingView.isInherited(t.constructor,TradingView.Study)&&t.metaInfo().is_price_study)}findSuitableScale(e,t,i){return this._priceScaleSelectionStrategy.findSuitableScale(this,e,t,i)}createNewPriceScaleIfPossible(){return this._priceScaleSelectionStrategy.createNewPriceScaleIfPossible(this)}canCreateNewPriceScale(){return this._priceScaleSelectionStrategy.canCreateNewPriceScale(this)}mainDataSource(){return this.m_mainDataSource}recalculate(){this.recalculatePriceScale(this.m_rightPriceScale),this.recalculatePriceScale(this.m_leftPriceScale);for(var e=0;e0&&t<0){var o=i[s-1].zorder(),a=e.zorder();i[s-1].setZorder(a),e.setZorder(o)}else if(s0){var l=i[s+1].zorder();a=e.zorder();i[s+1].setZorder(a),e.setZorder(l)}this._invalidateSourcesCache(),this._dataSourcesCollectionChanged.fire()}onDestroyed(){return this._destroyed}clearSeries(e){for(var t=this.m_dataSources.length-1;t>=0;t--)TradingView.isInherited(this.m_dataSources[t].constructor,TradingView.Series)&&this._removeSourceFromCollections(t,e)}nonOverlayPricesSourcesCount(){return this.m_dataSources.filter((function(e){return(!e.properties().linkedToSeries||!e.properties().linkedToSeries.value())&&(TradingView.isInherited(e.constructor,o)&&e.showInObjectTree()&&!this.isOverlay(e))}),this).length}canHaveMoreNoScaleSources(){return this.nonOverlayPricesSourcesCount()>1}actionNoScaleIsEnabled(e){return!(!this.isOverlay(e)&&TradingView.isInherited(e.constructor,o))||this.canHaveMoreNoScaleSources()}executionsPositionController(){return this._executionsPositionController||(this._executionsPositionController=new r(this,this._model.timeScale())),this._executionsPositionController}isLast(){var e=this._model.panes();return e[e.length-1]===this}setMaximized(e){this._maximized=e}isMaximized(){return this._maximized}isMainPane(){var e=this._model.mainSeries(),t=!1;return this.m_dataSources.forEach((function(i){t||(t=i===e)})),this._isMainPane=t,t}properties(){return this._properties}priceScaleRatio(){
return this._currentPriceScaleRatio}getPriceScaleById(e){var t=this.m_dataSources.find((function(t){return null!==t.priceScale()&&t.priceScale().id()===e}));return void 0===t?null:t.priceScale()}setPriceScaleSelectionStrategy(e){this._priceScaleSelectionStrategy=e,e.apply(this)}priceScaleIndex(e,t){switch(t){case"left":return this.leftPriceScales().indexOf(e);case"right":return this.rightPriceScales().indexOf(e)}}}p.DEFAULT_STRETCH_FACTOR=1e3,p.PANE_ANIMATION_DURATION=500,t.Pane=p}).call(this,i("aIyQ"))},iPBr:function(e,t,i){"use strict";i.r(t),i.d(t,"TimeAxisWidget",(function(){return y}));var s=i("Eyy1"),r=i("XlJ7"),n=i("S8xo"),o=i("ikwP"),a=i("H0vP"),l=i("ogJP"),c=i("u+0B"),h=i("zDbI"),u=i("aIyQ"),d=i.n(u),p=i("mE5r"),_=i("8OdW"),m=i("7KDR"),f=i("3/8U"),g=i("GxN8"),v=i("JWMC"),b=i("5VQP");i("xrEm");const S={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0};class y{constructor(e,t,i,s,r){this._rendererOptions=null,this._onLabelHovered=new d.a,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=Object(l.merge)(Object(l.clone)(S),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("tr"),this._backgroundBasedTheme=r;const a=()=>this.backgroundColor(),c=()=>{throw new Error("Time axis does not support real price scales")},h={titlesProvider:i,stubContextMenuProvider:(e,t)=>{const i=this.getContextMenuActions(!0);let r=s(e,t);if(r[r.length-1]===this.chart.actions().scalesProperties){const e=[new m.Separator].concat(i);Array.prototype.splice.apply(r,[r.length-2,0,...e])}else r.push(new m.Separator),r=r.concat(i);return r},backgroundBasedTheme:r,rendererOptionsProvider:e.model().model().rendererOptionsProvider(),getBackgroundTopColor:a,getBackgroundBottomColor:a,showHorizontalBorder:!0};this._lhsStubContainer=new p.a(this._properties,"left",c,h,this._options.priceAxisLabelsOptions),this._lhsStubContainer.onLabelHovered().subscribe(this,(e,t)=>{this._onLabelHovered.fire(e,t)}),this._rhsStubContainer=new p.a(this._properties,"right",c,h,this._options.priceAxisLabelsOptions),this._rhsStubContainer.onLabelHovered().subscribe(this,(e,t)=>{this._onLabelHovered.fire(e,t)}),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("td"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=Object(o.createBoundCanvas)(this._dv,new o.Size(16,16)),this._canvasBinding.subscribeCanvasConfigured(this._canvasConfiguredHandler);const u=this._canvasBinding.canvas;u.style.position="absolute",u.style.zIndex="1",u.style.left="0",u.style.top="0",this._topCanvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),
this._topCanvasBinding=Object(o.createBoundCanvas)(this._dv,new o.Size(16,16)),this._topCanvasBinding.subscribeCanvasConfigured(this._topCanvasConfiguredHandler);const f=this._topCanvasBinding.canvas;f.style.position="absolute",f.style.zIndex="2",f.style.left="0",f.style.top="0",this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=_.MINUTE_SPAN,this._mouseEventHandler=new n.MouseEventHandler(this._topCanvasBinding.canvas,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1}),this.size=new o.Size(0,0)}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeCanvasConfigured(this._topCanvasConfiguredHandler),this._topCanvasBinding.destroy(),this._canvasBinding.unsubscribeCanvasConfigured(this._canvasConfiguredHandler),this._canvasBinding.destroy(),this._rhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.destroy(),this._rhsStubContainer.destroy(),this.chart.properties().childs().paneProperties.childs().background.unsubscribeAll(this)}setCursor(e){let t="";"grabbing"!==e&&"ew-resize"!==e||(t="time-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}restoreDefaultCursor(){this.setCursor("")}getElement(){return this._element}optimalHeight(){const e=this.rendererOptions();return Math.ceil(e.borderSize+e.tickLength+e.fontSize+e.paddingTop+e.paddingBottom+e.labelBottomOffset)}setSizes(e,t,i){this.size&&this.size.equals(e)||(this.size=e,this._canvasBinding.resizeCanvas({width:e.w,height:e.h}),this._topCanvasBinding.resizeCanvas({width:e.w,height:e.h}),this._cell.style.width=e.w+"px",this._cell.style.height=e.h+"px"),this._lhsStubContainer.setSizes(e.h,t),this._rhsStubContainer.setSizes(e.h,i)}hardResetCanvas(){this.size&&(Object(o.hardResizeCanvas)(this._canvasBinding,this.size),Object(o.hardResizeCanvas)(this._topCanvasBinding,this.size))}rendererOptions(){if(!this._rendererOptions||this._rendererOptions.fontSize!==this.fontSize()){const e=this.fontSize();this._rendererOptions={borderSize:1,tickLength:5,fontSize:e,font:Object(r.makeFont)(e,h.CHART_FONT_FAMILY,""),widthCache:new c.a,paddingTop:3*e/12,paddingBottom:3*e/12,paddingHorizontal:9*e/12,labelBottomOffset:4*e/12}}return this._rendererOptions}backgroundColor(){return this.chart.model().model().backgroundColor().value()}lineColor(){return this._properties.childs().lineColor.value()}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return Object(r.makeFont)(this.fontSize(),h.CHART_FONT_FAMILY)}baseBoldFont(){return Object(r.makeFont)(this.fontSize(),h.CHART_FONT_FAMILY,"","bold")}hasCanvas(e){return this._canvasBinding.canvas===e||this._topCanvasBinding.canvas===e}onLabelHovered(){return this._onLabelHovered}
getScreenshotData(){return{content:this._canvasBinding.canvas.toDataURL(),canvas:this._canvasBinding.canvas,contentWidth:this.size.w,contentHeight:this.size.h,lhsStub:this._lhsStubContainer.getScreenshotData(),rhsStub:this._rhsStubContainer.getScreenshotData()}}getContextMenuActions(e){const t=this.chart;t.updateActions();const i=t.actions(),s=[];return e||s.push(i.timeScaleReset,new m.Separator),this._options.timezoneMenuEnabled&&s.push(i.applyTimeZone),s.push(i.sessionBreaks),s}update(){if(!this.chart.model())return;const e=this.chart.model().timeScale().marks();if(e){this._minVisibleSpan=_.YEAR_SPAN;for(const t of e)this._minVisibleSpan=Math.min(t.span,this._minVisibleSpan)}}updatePriceAxisStubs(){const e=this.chart.model().model(),t=this.chart.isMaximizedPane()?Object(s.ensureNotNull)(this.chart.maximizedPaneWidget()).state():e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount();this._lhsStubContainer.setScales([],i.left,t.leftPriceScales().length,i.left+i.right),this._rhsStubContainer.setScales([],i.right,t.rightPriceScales().length,i.left+i.right)}paint(e){if(e===a.InvalidationLevel.None)return;const t=Object(o.getContext2D)(this._topCanvasBinding.canvas);if(e>a.InvalidationLevel.Cursor){const i=Object(o.getContext2D)(this._canvasBinding.canvas),s=this._canvasBinding.pixelRatio;this.drawBackground(i,s),this.chart.model()&&(this.drawBorder(i,s),this.drawTickMarks(i,s),this.drawBackLabels(i,s),this.drawCrossHairLabel(t,s)),this._lhsStubContainer.paintStubs(e),this._rhsStubContainer.paintStubs(e)}this.drawCrossHairLabel(t,this._topCanvasBinding.pixelRatio)}drawBackground(e,t){Object(o.clearRect)(e,0,0,Math.ceil(this.size.w*t)+1,Math.ceil(this.size.h*t)+1,this.backgroundColor());const i=this.chart.model();if(!i)return;if(!i.timeScale().isEmpty()){const s=i.model().selection().lineDataSources().reduce((e,t)=>{const i=t.timeAxisPoints();return 0===i.length?e:e.concat(i)},[]);s.length>0&&this._hightlightBackground(e,s,t)}const s=i.model().crossHairSource();s.startMeasurePoint()&&this._hightlightBackground(e,s.measurePoints(),t)}drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t)),s=Math.ceil(this.size.w*t);e.fillRect(0,0,s+1,i),e.restore()}drawTickMarks(e,t){const i=this.chart.model().timeScale().marks();if(!i||0===i.length)return;let s=i.reduce((e,t)=>e.span>t.span?e:t,i[0]).span;s>30&&s<40&&(s=30),e.save(),e.strokeStyle=this.lineColor();const r=this.rendererOptions(),n=r.borderSize+r.tickLength+r.paddingTop+r.fontSize/2;e.textAlign="center",e.textBaseline="middle",e.fillStyle=this.lineColor();const a=Math.max(1,Math.floor(t)),l=Math.floor(.5*t),c=Math.round(r.tickLength*t);e.beginPath();for(let o=i.length;o--;){const s=Math.round(i[o].coord*t);e.rect(s-l,0,a,c)}e.fill(),e.fillStyle=this.textColor(),Object(o.drawScaled)(e,t,()=>{e.font=this.baseFont();for(let t=0;t=s&&e.fillText(r.label,r.coord,n)}}),e.restore()}drawBackLabels(e,t){e.save();const i=new Set,s=this.chart.model().model();let r=s.dataSources();const n=s.selection().allSources();for(const l of n)i.add(l);s.hoveredSource()&&i.add(s.hoveredSource());for(const l of s.sourcesBeingMoved())i.add(l);const o=s.lineBeingEdited()||s.lineBeingCreated();o&&i.add(o),i.add(this.chart.model().crossHairSource()),r=r.concat(s.customSources());const a=this.rendererOptions();for(let l=0;l=s&&(s=a,n=o),a<=i&&(i=a,r=o)}}return n&&t.push(n),r&&t.push(r),t}
_zoomAvailable(){return!this.chart.model().timeScale().isEmpty()&&this.chart.model().model().zoomEnabled()&&this._options.pressedMouseMoveScale}_mouseDownOrTouchStartEvent(e){if(this._mousedown||!this._zoomAvailable())return;this._mousedown=!0;const t=this.chart.model();t.timeScale().isEmpty()||t.startScaleTime(e.localX)}_pressedMouseOrTouchMoveEvent(e){this._zoomAvailable()&&this.chart.model().scaleTimeTo(e.localX)}_mouseUpOrTouchEndEvent(e){this._zoomAvailable()&&(this._mousedown=!1,this.chart.model().endScaleTime(),this.restoreDefaultCursor())}_contextMenuOrTouchContextMenuEvent(e){this._options.contextMenuEnabled&&this._createContextMenu().then(t=>t.show(e))}_mouseOrTouchEnterEvent(e){this._zoomAvailable()&&this.setCursor("ew-resize")}_mouseOrTouchLeaveEvent(e){this.restoreDefaultCursor()}_mouseDoubleClickOrDoubleTapEvent(e){Object(v.trackEvent)("GUI","Double click time scale"),this.chart.model().resetTimeScale()}_createContextMenu(){return b.ContextMenuManager.createMenu(this.getContextMenuActions(),{statName:"TimeScaleContextMenu"})}}},icPo:function(e,t,i){"use strict";i.r(t),i.d(t,"LineToolIcon",(function(){return o}));var s=i("Ocx9"),r=i("Ss5c"),n=i("j3hX");class o extends r.LineDataSource{constructor(e,t){super(e,t||o.createProperties()),this._sizeScale=NaN,this.version=1,document.fonts&&document.fonts.check&&document.fonts.load&&!document.fonts.check("12px FontAwesome")&&document.fonts.load("12px FontAwesome","☺").then(()=>{this._isDestroyed||e.updateSource(this)}),i.e("lt-pane-views").then(i.bind(null,"8GeE")).then(t=>{this._setPaneViews([new t.IconPaneView(this,e)])})}pointsCount(){return 1}name(){return"Icon"}hasEditableCoordinates(){return!1}getAnchorLimit(){return 80}applyTemplate(e){delete e.icon,super.applyTemplate(e)}startChanging(e,t){super.startChanging(e,t);const i=this.properties().childs();i.size.value()<80?this._sizeScale=i.size.value()/80:this._sizeScale=1}getChangePointForSync(e){return null}setPoint(e,t,i){const s=Object.assign({},t),r=this.pointToScreenPoint(this.points()[0])[1],n=this.pointToScreenPoint(s)[1],o=this.properties().childs();if(0===e||1===e){const t=n.subtract(r).normalized(),i=-t.x;let s=Math.acos(i);Math.asin(t.y)>0&&(s=2*Math.PI-s),0===e&&(s+=Math.PI),o.angle.setValue(s)}else{let e=2*n.subtract(r).length();e*=this._sizeScale,o.size.setValue(e),o.scale.setValue(1)}}endChanging(e,t){const i=super.endChanging(e,t);return this._sizeScale=NaN,i}properties(){return super.properties()}getSourceIcon(){return{type:"text",text:String.fromCharCode(this.properties().childs().icon.value())}}static createProperties(e){const t=new s.DefaultProperty("linetoolicon",e);return o._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"XCOO")).then(e=>e.IconsDefinitionsViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().color])),e.addExclusion("angle"),e.addExclusion("scale")}}},
ijBy:function(e,t,i){"use strict";i.r(t),i.d(t,"SetChartLayoutCommand",(function(){return n}));var s=i("RDU5"),r=i("VNzU");class n extends s.UndoCommand{constructor(e,t){super("Change Chart Layout to "+r.layouts[t].title),this._chartWidgetCollection=e,this._newLayoutType=t,this._oldLayoutType=e.layout.value()}redo(){this._chartWidgetCollection.layout.setValue(this._newLayoutType)}undo(){this._chartWidgetCollection.layout.setValue(this._oldLayoutType)}}},ikwP:function(e,t,i){"use strict";i.r(t),i.d(t,"Size",(function(){return o})),i.d(t,"getCanvasDevicePixelRatio",(function(){return a})),i.d(t,"getContext2D",(function(){return l})),i.d(t,"getPrescaledContext2D",(function(){return c})),i.d(t,"getPretransformedContext2D",(function(){return h})),i.d(t,"hardResizeCanvas",(function(){return u})),i.d(t,"resizeCanvasPreservingContent",(function(){return d})),i.d(t,"fillRect",(function(){return p})),i.d(t,"clearRect",(function(){return _})),i.d(t,"drawScaled",(function(){return m})),i.d(t,"createDisconnectedCanvas",(function(){return f})),i.d(t,"createDisconnectedBoundCanvas",(function(){return g})),i.d(t,"createBoundCanvas",(function(){return b})),i.d(t,"calcTextHorizontalShift",(function(){return S})),i.d(t,"disableSelection",(function(){return y}));var s=i("f2KN"),r=i("Eyy1"),n=i("Ialn");class o{constructor(e,t){this.w=e,this.h=t}equals(e){return this.w===e.w&&this.h===e.h}}function a(e){var t,i;return Math.max(1,(null===(i=null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===i?void 0:i.devicePixelRatio)||1)}function l(e){const t=Object(r.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function c(e){const t=Object(r.ensureNotNull)(e.getContext("2d")),i=a(e);return t.setTransform(i,0,0,i,0,0),t}function h(e){const t=Object(r.ensureNotNull)(e.canvas.getContext("2d"));return t.setTransform(e.pixelRatio,0,0,e.pixelRatio,0,0),t.translate(.5,.5),t}function u(e,t){e.resizeCanvas({width:0,height:0}),e.resizeCanvas({width:t.w,height:t.h})}function d(e,t){const i=g(document,t),s=c(i.canvas);return s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(e.canvas,0,0,e.canvasSize.width*e.pixelRatio,e.canvasSize.height*e.pixelRatio),s.restore(),i}function p(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function _(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function m(e,t,i){e.save(),e.scale(t,t),i(),e.restore()}function f(e,t,i){const s=v(e);return void 0===i&&(i=a(s)),s.width=t.w*i,s.height=t.h*i,s}function g(e,t){const i=v(e),r=Object(s.a)(i,{allowDownsampling:!1});return r.resizeCanvas({width:t.w,height:t.h}),r}function v(e){const t=e.createElement("canvas");return y(t),t}function b(e,t){const i=v(Object(r.ensureNotNull)(e.ownerDocument));e.appendChild(i);const n=Object(s.a)(i,{allowDownsampling:!1});return n.resizeCanvas({width:t.w,height:t.h}),n}function S(e,t){
return"center"===e.textAlign?0:Object(n.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function y(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}},isVH:function(e,t,i){"use strict";var s=i("Ss5c").LineDataSource,r=i("Ocx9").DefaultProperty,n=i("j3hX").LineToolColorsProperty;class o extends s{constructor(e,t){super(e,t||o.createProperties()),i.e("lt-pane-views").then(i.t.bind(null,"D4q4",7)).then(({TrianglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 3}name(){return"Triangle"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"Zd1D"))).GeneralFiguresDefinitionsViewModel}static createProperties(e){var t=new r("linetooltriangle",e);return o._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e),e.addChild("linesColors",new n([e.childs().color]))}}t.LineToolTriangle=o},it7y:function(e,t,i){"use strict";i.r(t),i.d(t,"StudyDataWindowView",(function(){return n}));var s=i("4miz"),r=i("EYFt");class n extends s.b{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map(e=>new s.a(e.title,"")),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}_updateImpl(){this._header=this._study.title(!0),this._title=this._study.title();const e=this._valueProvider.getValues(this._currentIndex());for(let t=0;t0)},t.fixComputationError=s,t.alignTo=function(e,t){var i=e/t,r=Math.floor(i),n=i-r;return n>2e-10?s(n>.5?(r+1)*t:r*t):e}},j3hX:function(e,t,i){"use strict";i.r(t),i.d(t,"LineToolMultiplePropertyBaseImpl",(function(){return l})),i.d(t,"LineToolCollectedProperty",(function(){return c})),i.d(t,"LineToolWidthsProperty",(function(){return h})),i.d(t,"LineToolColorsProperty",(function(){return u})),i.d(t,"MultipleLineWidthsProperty",(function(){return p})),i.d(t,"MultipleLineColorsProperty",(function(){return _}));var s=i("txPx"),r=i("aIyQ"),n=i.n(r);const o=Object(s.getLogger)("Chart.LineToolCollectedProperty");class a{applyValue(e,t){
e.setValue(t)}}class l{constructor(e,t){this._onChange=new n.a,this._properties=e,e.forEach(e=>e.subscribe(this,()=>{this._onChange.fire(this)})),this._showIfProperty=t}visible(){var e;return!this._showIfProperty||(null===(e=this._showIfProperty)||void 0===e?void 0:e.value())}value(){if(0===this._properties.length)return o.logError("Incorrect call, should not request value of 0 properties"),"mixed";const e=this._properties[0].value();return 1===this._properties.length||this._properties.every(t=>t.value()===e)?e:"mixed"}state(){}merge(){}destroy(){this._properties.forEach(e=>e.unsubscribeAll(this))}subscribe(e,t){this._onChange.subscribe(e,t)}unsubscribe(e,t){this._onChange.unsubscribe(e,t)}unsubscribeAll(e){this._onChange.unsubscribeAll(e)}}class c extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach(t=>s.applyValue(t,e))}}class h extends c{}class u extends c{firstColor(){return this._properties[0].value()}}class d extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach(t=>t.setValue(e,void 0,s))}}class p extends d{}class _ extends d{}},j8de:function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var s=i("tc+8"),r=i.n(s);class n extends r.a{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t}value(){return this._lineSource.points()[this._pointIndex].index}setValue(e){const t=this._lineSource.points()[this._pointIndex];t.index=e,this._lineSource.startChanging(this._pointIndex,t),this._setPointImpl(t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this);const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i),this._lineSource.properties().lastUpdateTime.setValue((new Date).valueOf())}_setPointImpl(e){this._lineSource.setPoint(this._pointIndex,e)}}},jA0t:function(e,t,i){"use strict";var s=function(){var e={};function t(e){return e.is_price_study}function i(e,t){var i=t.slice(0).toLowerCase();if(e){for(var s=0;st){if((r=n-1)0&&e-t[s-1]<=r)return r;return 0},r.prototype.is_valid=function(){return!this._invalid},r._offset=function(e,t,i){var s=n(e,i);return-1===s?0:t[s]};var o=function(e){return 0|e},a=function(e){return 60*e*1e3},l=function(e,t){return c(e)-c(t)},c=function(e){return e<0?o(e/1e3)-(e%1e3!=0?1:0):o(e/1e3)};function h(e){return e%4==0&&(e%100!=0||e%400==0)}var u={0:0,1:31,2:59,3:90,4:120,5:151,6:181,7:212,8:243,9:273,10:304,11:334},d={SUNDAY:1,MONDAY:2,TUESDAY:3,WEDNESDAY:4,THURSDAY:5,FRIDAY:6,SATURDAY:7,JANUARY:0,FEBRUARY:1,MARCH:2,APRIL:3,MAY:4,JUNE:5,JULY:6,AUGUST:7,SEPTEMBER:8,OCTOBER:9,NOVEMBER:10,DECEMBER:11,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,MINUTE:12,SECOND:13,minutesPerDay:1440,secondsPerDay:a(1440),get_minutes_from_hhmm:function(e){return-1!==e.indexOf(":")&&(e=e.split(":").join("")),e%100+60*o(e/100)},get_year:function(e){return e.getUTCFullYear()},get_month:function(e){return e.getUTCMonth()},get_hours:function(e){return e.getUTCHours()},get_minutes:function(e){return e.getUTCMinutes()},get_seconds:function(e){return e.getUTCSeconds()},get_day_of_month:function(e){return e.getUTCDate()},get_day_of_week:function(e){return e.getUTCDay()+1},get_day_of_year:function(e){var t=e.getUTCMonth(),i=u[t];return t>d.JANUARY+1&&h(e.getUTCFullYear())&&(i+=1),i+e.getUTCDate()},get_week_of_year:function(e){var t=new Date(Date.UTC(e.getUTCFullYear(),0,1)).getUTCDay(),i=0===t?1:8-t,s=d.get_day_of_year(e)-i;return Math.ceil(s/7)+1},get_minutes_from_midnight:function(e){return 60*d.get_hours(e)+d.get_minutes(e)},set_hms:function(e,t,i,s,r,n){e.setUTCHours(t),e.setUTCMinutes(i),e.setUTCSeconds(s),e.setUTCMilliseconds(r),d.correct_time(e,n)},correct_time:function(e,t){var i=e.getTime(),s=t.correction_loc(i);e.setTime(i+s)},add_days_considering_dst:function(e,t,i){var s=e.offset_utc(t),r=this.clone(t);this.add_date(r,i);var n=e.offset_utc(r);return r.setTime(r.getTime()+s-n),r},add_date:function(e,t){e.setTime(e.getTime()+t*d.secondsPerDay)},add_minutes:function(e,t){e.setTime(e.getTime()+a(t))},clone:function(e){return new Date(e.getTime())},get_days_per_year:function(e){var t=e.getUTCFullYear();return this.days_per_year(t)},days_per_year:function(e){return h(e)?366:365},get_part:function(e,t){switch(t){case d.YEAR:return d.get_year(e);case d.MONTH:return d.get_month(e);case d.DAY_OF_MONTH:return d.get_day_of_month(e);case d.WEEK_OF_YEAR:return d.get_week_of_year(e)
;case d.DAY_OF_WEEK:return d.get_day_of_week(e);case d.HOUR_OF_DAY:return d.get_hours(e);case d.MINUTE:return d.get_minutes(e);case d.DAY_OF_YEAR:return d.get_day_of_year(e);case d.SECOND:return d.get_seconds(e);default:return e.getTime()}},time_minutes:a,time_seconds:function(e){return 1e3*e},time_minutes_diff:function(e,t){return o(l(e,t)/60)},time_seconds_diff:l,utc_to_cal:function(e,t){return new Date(d.utc_to_cal_ts(e,t))},utc_to_cal_ts:function(e,t){return t+e.offset_utc(t)},get_cal:function(e,t,i,s,r,n,o){var a=new Date(Date.UTC(t,i,s,r||0,n||0,o||0)),l=e.offset_utc(+a);return new Date(a.valueOf()-l)},get_cal_from_unix_timestamp_ms:function(e,t){return new Date(t+e.offset_utc(t))},get_cal_utc:function(e,t,i){return new Date(Date.UTC(e,t,i))},cal_to_utc:function(e,t){var i=t.getTime();return i-e.offset_loc(i)},get_timezone:function(e){return new r(e)},shift_day:function(e,t){var i=e-1;return(i+=t)>6?i%=7:i<0&&(i=(7+i%7)%7),i+1}};e.exports=d},jFln:function(e,t,i){"use strict";var s=i("Hr11"),r=s.greaterThan,n=s.lessThan,o=window.CanvasEx=i("8Uy/");o.computeDashPattern=function(e){return[[e.lineWidth,2*e.lineWidth],[5*e.lineWidth,6*e.lineWidth],[6*e.lineWidth,6*e.lineWidth],[e.lineWidth,4*e.lineWidth],[2*e.lineWidth,e.lineWidth]][e.lineStyle-1]},o.drawLine=function(e,t,i,s,r){isFinite(t)&&isFinite(s)&&isFinite(i)&&isFinite(r)&&(e.lineStyle!==o.LINESTYLE_SOLID?o.drawDashedLine(e,t,i,s,r):o.drawSolidLine(e,t,i,s,r))},o.drawArrow=function(e,t,i,s,r,n){if(isFinite(t)&&isFinite(s)&&isFinite(i)&&isFinite(r)){var o=Math.round(n/2),a=t+o,l=s+o;e.beginPath(),e.moveTo(l,r),e.lineTo(a,i),e.moveTo(t,i+o),e.lineTo(a,i),e.lineTo(t+n,i+o),e.stroke()}},o.drawSolidLine=function(e,t,i,s,r){e.beginPath(),e.moveTo(t,i),e.lineTo(s,r),e.stroke()},o.setLineStyle=function(e,t){e.lineStyle=t;var i=[];t!==o.LINESTYLE_SOLID&&(i=o.computeDashPattern(e)),o.setLineDash(e,i)},o.setLineDash=function(e,t){"function"==typeof e.setLineDash?e.setLineDash(t):void 0!==e.mozDash?e.mozDash=t:void 0!==e.webkitLineDash&&(e.webkitLineDash=t)},o.drawPoly=function(e,t,i){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var s=0;s0&&(c.thereYet=n,c.cap=Math.max),t-s>0&&(l.thereYet=n,l.cap=Math.max),e.moveTo(t,i);for(var h=t,u=i,d=0,p=!0;!l.thereYet(h,s)||!c.thereYet(u,o);){var _=Math.atan2(o-i,s-t),m=a[d];h=l.cap(s,h+Math.cos(_)*m),u=c.cap(o,u+Math.sin(_)*m),p?e.lineTo(h,u):e.moveTo(h,u),d=(d+1)%a.length,p=!p}},o.setFont=function(e,t){if(e.font!==t)try{e.font=t}catch(i){}},"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.setFont=function(e){o.setFont(this,e)},CanvasRenderingContext2D.prototype.lineStyle=o.LINESTYLE_SOLID),e.exports=o},jJ9X:function(e,t,i){},jRfx:function(e,t,i){"use strict";i.d(t,"c",(function(){return o})),i.d(t,"a",(function(){return a})),i.d(t,"b",(function(){return l}));var s=i("Eyy1"),r=i("3u3j");class n extends r.a{constructor(e,t,i){super(e,t,i),this._restorePane=!1}redo(){const e=this._chartModel.panes().length,t=this._chartModel.panes()[this._targetPaneIndex()],i=Object(s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),r=Object(s.ensureNotNull)(this._chartModel.paneForSource(i)),n=this._chartModel.children(i,!0);r.bulkActionMacro(()=>{n.forEach(e=>this._chartModel.detachSource(e)),this._restorePane=this._chartModel.detachSource(i)});const o="overlay"===this._initialPriceScalePosition?this._initialPriceScalePosition:void 0,a=t.findSuitableScale(i,void 0,o),l=0===a.dataSources().length;if(t.bulkActionMacro(()=>{t.addDataSource(i,a,!1),n.forEach(e=>t.addDataSource(e,a,!1))}),i===this._chartModel.mainSeries()){const e=t.priceScalePosition(a);t.movePriceScale(a,e,0)}if(l){Object(s.ensureNotNull)(i.priceScale()).restoreState(this._newPriceScaleState(t.isOverlay(i)))}this._chartModel.fullUpdate(),e!==this._chartModel.panes().length&&this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){let e;e=this._restorePane?this._chartModel.createPane(this._initialPaneIndex):this._chartModel.panes()[this._initialPaneIndex];const t=Object(s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=Object(s.ensureNotNull)(this._chartModel.paneForSource(t)),r=this._chartModel.children(t,!0);i.bulkActionMacro(()=>{r.forEach(e=>this._chartModel.detachSource(e)),this._chartModel.detachSource(t)});let n=e.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),e.bulkActionMacro(()=>{e.addDataSource(t,n,!0),r.forEach(t=>e.addDataSource(t,n,!1))}),Object(s.ensureNotNull)(t.priceScale()).restoreState(this._originalPriceScaleState()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex-1}}class a extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex+1}}class l extends n{constructor(e,t,i,s){super(e,t,s),this._targetPane=i}_targetPaneIndex(){return this._targetPane}}},jTis:function(e,t,i){"use strict";var s;i.r(t),i.d(t,"CalloutConsts",(function(){return s})),function(e){e[e.RoundRadius=8]="RoundRadius",e[e.TextMargins=2]="TextMargins",
e[e.MinWidth=100]="MinWidth"}(s||(s={}))},jeZR:function(e,t,i){"use strict";i.r(t),i.d(t,"AppliedTimeFrame",(function(){return r}));var s=i("QfUd");class r{constructor(e){this._appliedTimeFrame=new s.a(null),this._appliedTimeFrameInfo=null,this._appliedTimeFrameChangedBound=this._appliedTimeFrameChanged.bind(this),this._model=e,e.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),this._appliedTimeFrame.subscribe(this._appliedTimeFrameChangedBound)}destroy(){this._appliedTimeFrame.unsubscribe(this._appliedTimeFrameChangedBound),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.mainSeries().dataEvents().seriesTimeFrame().unsubscribeAll(this)}appliedTimeFrame(){return this._appliedTimeFrame}_appliedTimeFrameChanged(){this._model.timeScale().logicalRangeChanged().unsubscribe(this,this._invalidateAppliedTimeFrame)}_onSeriesTimeFrame(e,t,i,s){if(s){const e=this._model.timeScale();this._appliedTimeFrameInfo={logicalRange:e.logicalRange(),baseIndex:e.baseIndex()},e.logicalRangeChanged().subscribe(this,this._invalidateAppliedTimeFrame)}}_invalidateAppliedTimeFrame(){if(null===this._appliedTimeFrameInfo)return;const e=this._model.timeScale(),t=e.logicalRange(),i=e.baseIndex(),s=this._appliedTimeFrameInfo.logicalRange,r=this._appliedTimeFrameInfo.baseIndex;(null===t||null===s||Math.abs(i-t.left()-(r-s.left()))>=.01||Math.abs(i-t.right()-(r-s.right()))>=.01)&&this._appliedTimeFrame.setValue(null)}}},jenN:function(e,t,i){"use strict";i.r(t);var s=i("txPx"),r=i("7Fue"),n=i("xWfy"),o=i("qySK"),a=i("KcY8");class l extends a.a{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.priceScale(),r=this._source.properties().visible.value();if(!s||s.isEmpty()||!r)return;const n=this._source.properties().graphics[this._data.lineType][this._data.styleId];if(!(n.visible&&n.visible.value()&&n.showPrice&&n.showPrice.value()))return;const o=this._source.firstValue();if(null===o)return;const a=this._data.line.level,l=n.color.value();i.background=l,i.textColor=this.generateTextColor(l),i.coordinate=s.priceToCoordinate(a,o),e.text=s.formatPrice(a,o),e.visible=!0}}i.d(t,"createGraphicsPaneViews",(function(){return d})),i.d(t,"createGraphicsPriceAxisViews",(function(){return _})),i.d(t,"isStudyGraphicsEmpty",(function(){return r.a})),i.d(t,"StaticStudyGraphics",(function(){return n.a})),i.d(t,"emptyStudyGraphics",(function(){return n.b})),i.d(t,"loadStudyGraphics",(function(){return n.c})),i.d(t,"saveStudyGraphics",(function(){return n.d})),i.d(t,"LiveStudyGraphics",(function(){return o.a}));const c=Object(s.getLogger)("Chart.StudyGraphics"),h=new Set(["dwgtablecells"]);async function u(e,t,s,r){switch(e){case"hhists":return new((await i.e("study-pane-views").then(i.bind(null,"Gj0v"))).HHistPaneView)(t,s,r);case"horizlines":return new((await i.e("study-pane-views").then(i.bind(null,"1sos"))).HorizLinePaneView)(t,s,r);case"vertlines":return new((await i.e("study-pane-views").then(i.bind(null,"psYU"))).VertLinePaneView)(t,s,r)}
return null}async function d(e,t,i){const s=[],r=Object.keys(e.graphicsInfo());r.sort((e,t)=>p(e)-p(t));for(const n of r){const r=await u(n,e,t,i);null!==r?s.push(r):h.has(n)||c.logWarn(n+" is not supported by this build of graphics subsystem, skipping")}return s}function p(e){switch(e){case"polygons":return-100;case"trendchannels":return-90;default:return 0}}function _(e){const t=Object.keys(e.graphicsInfo()),i=[];for(const s of t)switch(s){case"hlines":e.graphics().hlines().forEach((t,r)=>{t.forEach(t=>{void 0!==t.level&&i.push(new l(e,{line:{level:t.level},styleId:r,lineType:s}))})});break;case"horizlines":e.graphics().horizlines().forEach((t,r)=>{t.forEach(t=>{void 0!==t.level&&i.push(new l(e,{line:{level:t.level},styleId:r,lineType:s}))})})}return i}},jkoZ:function(e,t,i){"use strict";var s=i("XlJ7").makeFont,r=i("XlJ7").parseFont,n=(0,i("txPx").getLogger)("Model.ChartTradingUtils"),o={_fontHeightCache:{},_parsedColorCache:{},_parseColor:function(e){if(this._parsedColorCache[e])return this._parsedColorCache[e];var t=document.createElement("div");t.style.color=e;var i=t.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||t.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)$/i),s={r:i[1],g:i[2],b:i[3],a:i[4]||"1"};return this._parsedColorCache[e]=s,s},getColorFromProperties:function(e,t){var i=1-t.value()/100,s=this._parseColor(e.value());return"rgba("+s.r+","+s.g+","+s.b+","+i+")"},setColorToProperties:function(e,t,i){var s=this._parseColor(e);t.setValue("rgb("+s.r+","+s.g+","+s.b+")");var r=100*(1-s.a);i.setValue(Math.max(0,Math.min(r,100)))},getFontFromProperties:function(e,t,i,r){return s(t.value(),e.value(),r.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,o){var a=r(e);null!==a?(a.family.length>0&&t.setValue(a.family),i.setValue(a.size),s.setValue(a.bold),o.setValue(a.italic)):n.logError("Invalid font: "+e)},fontHeight:function(e){if(!this._fontHeightCache[e]){var t=document.createElement("span");t.appendChild(document.createTextNode("height")),document.body.appendChild(t),t.style.cssText="font: "+e+"; white-space: nowrap; display: inline;";var i=t.offsetHeight;document.body.removeChild(t),this._fontHeightCache[e]=Math.ceil(i)}return this._fontHeightCache[e]},drawPolyHoverOrPress:function(e,t,i,s){s?(e.save(),e.fillStyle="rgba(0, 0, 0, 0.15)",CanvasEx.drawPoly(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",CanvasEx.drawPoly(e,t,!0),e.restore())},repaint:function(e){e.lightUpdate()},roundToMinTick:function(e,t){var i=1/e.mainSource().base();return i*Math.round(t/i)}};e.exports=o},jofe:function(e,t,i){"use strict";function s(){let e,t;return{promise:new Promise((i,s)=>{e=i,t=s}),reject:t,resolve:e}}i.r(t),i.d(t,"createDeferredPromise",(function(){return s}))},jpZi:function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));var s=i("Eyy1"),r=(i("YFKU"),i("HbRj"),i("RDU5"));const n=window.t("Exclude line tools from group {group}");class o extends r.UndoCommand{constructor(e,t,i){super(n.format({
group:t.name()})),this._model=e,this._groupId=t.id,this._groupName=t.name(),this._lineToolsIds=i.map(e=>e.id())}redo(){const e=Object(s.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map(e=>this._model.dataSourceForId(e));e.excludeLineTools(t),0===e.lineTools().length&&this._model.lineToolsGroupModel().removeGroup(e)}undo(){const e=this._lineToolsIds.map(e=>this._model.dataSourceForId(e)),t=this._model.lineToolsGroupModel().groupForId(this._groupId);null!==t?t.addLineTools(e):this._model.lineToolsGroupModel().createGroup(e,this._groupName,this._groupId)}}},jvrd:function(e,t,i){"use strict";i.d(t,"e",(function(){return r})),i.d(t,"c",(function(){return o})),i.d(t,"b",(function(){return a})),i.d(t,"a",(function(){return l})),i.d(t,"d",(function(){return c}));var s=i("k9/m");function r(e,t,i){const s=e.barFunction();switch(e.style()){case 3:case 10:case 2:return s(t.value);default:return t.value[-1===i?3:2]}}function n(e){return e>=0?1:-1}function o(e,t){return-1===n(e)!==t?-1:1}function a(e,t,i,s){const r=Math.min(t,Math.max(0,1===s?i:t-i));return i-s*Math.abs(r*e/100)}function l(e,t,i){if(void 0===e.index)return null;const s=e.index();return null===s?null:{index:s,price:t.coordinateToPrice(t.height()/2,i)}}function c(e,t){const i=e.data().bars(),o=i.first(),a=i.last();if(null===o||null===a)return null;let l;if(void 0===t.index){const e=t.time(),r=o.value[0],n=a.value[0];if(en)return null;l=i.searchByTime(e,s.PlotRowSearchMode.NearestRight,4)}else{const e=t.index();if(null===e)return null;l=i.search(e)}return null===l?null:{index:l.index,price:r(e,l,n(t.position()))}}},jy4L:function(e,t,i){"use strict";i.r(t),i.d(t,"makeNextSymbolId",(function(){return r})),i.d(t,"makeNextStudyId",(function(){return o}));let s=0;function r(){return s++,"ss_"+s}let n=0;function o(){return n++,"st"+n}},k4w6:function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var s=i("2ijp");class r extends s.a{constructor(e){super(),this._series=e,this._model=e.model()}}},"k9/m":function(e,t,i){"use strict";i.r(t),i.d(t,"PlotRowSearchMode",(function(){return l})),i.d(t,"PlotList",(function(){return u})),i.d(t,"mergeMinMax",(function(){return d})),i.d(t,"mergePlotRows",(function(){return p}));var s=i("Eyy1"),r=i("Y7w9"),n=i("tqok"),o=i("txPx");const a=Object(o.getLogger)("Chart.PlotList");var l;!function(e){e[e.NearestLeft=-1]="NearestLeft",e[e.Exact=0]="Exact",e[e.NearestRight=1]="NearestRight"}(l||(l={}));function c(e){return e.index}function h(e){return e.value[0]}class u{constructor(e=null,t=null){this._items=[],this._start=0,this._end=0,this._shareRead=!1,this._minMaxCache=new Map,this._rowSearchCacheByIndex=new Map,this._rowSearchCacheByIndexWithoutEmptyValues=new Map,this._rowSearchCacheByTime=new Map,this._rowSearchCacheByTimeWithoutEmptyValues=new Map,this._plotFunctions=e||new Map,this._emptyValuePredicate=t}clear(){this._items=[],this._start=0,this._end=0,this._shareRead=!1,this._minMaxCache.clear(),this._invalidateSearchCaches()}first(){
return this.size()>0?this._items[this._start]:null}last(){return this.size()>0?this._items[this._end-1]:null}firstIndex(){return this.size()>0?this._indexAt(this._start):null}lastIndex(){return this.size()>0?this._indexAt(this._end-1):null}size(){return this._end-this._start}isEmpty(){return 0===this.size()}contains(e){return null!==this.search(e,l.Exact)}valueAt(e){const t=this.search(e);return null!==t?t.value:null}add(e,t){if(this._shareRead)return a.logDebug("add: readonly collection modification attempt"),!1;const i={index:e,value:t},s=this._nonCachedSearch(e,l.Exact,c);return this._invalidateSearchCaches(),null===s?(this._items.splice(this._lowerbound(e,c),0,i),this._start=0,this._end=this._items.length,!0):(this._items[s]=i,!1)}search(e,t=l.Exact,i){return this._searchImpl(e,t,this._rowSearchCacheByIndex,this._rowSearchCacheByIndexWithoutEmptyValues,c,i)}searchByTime(e,t=l.Exact,i){return this._searchImpl(e,t,this._rowSearchCacheByTime,this._rowSearchCacheByTimeWithoutEmptyValues,h,i)}fold(e,t){let i=t;for(let s=this._start;s