"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[96969],{995310:(t,e,s)=>{s.d(e,{BarBuilderBase:()=>a,SessionInfo:()=>o});var i=s(988124),r=s(987571),n=s(44031);class o{constructor(t,e,s,i){this.init(t,e,s,i),this._state={timezone:t,spec:e,holidays:s,corrections:i}}init(t,e,s,r){this.timezone=i.get_timezone(t),this.spec=new n.SessionSpec(t,e,s,r)}state(){return this._state}static fromState(t){return new o(t.timezone,t.spec,t.holidays,t.corrections)}}class a{alignTime(t){if(isNaN(t))return NaN;let e=this.indexOfBar(t);return e===r.SessionStage.POST_SESSION&&(this.moveTo(t),e=this.indexOfBar(t)),e<0?NaN:this.startOfBar(e)}}},364615:(t,e,s)=>{s.d(e,{LineToolAnchoredVolumeProfile:()=>I});var i=s(650151),r=s(526075),n=s(853965),o=s(807218),a=s(389137),l=s(268008),d=s(590713),u=s(964824),p=s(837202);class c extends p.LineToolPriceAxisView{_updateRendererData(t,e,s){super._updateRendererData(t,e,s);const i=this._source.model().properties().childs().scalesProperties.childs(),r=this._source.properties().showLabelsOnPriceScale.value();e.visible=t.visible&&r&&i.showStudyPlotLabels.value(),t.visible=t.visible&&r&&i.showStudyLastValue.value(),e.text=this._data.title}}var h=s(742391),_=s(806960),y=s(932167);class S extends y.StudyPriceAxisView{_showPaneLabel(){const t=this._model.properties().childs().scalesProperties.childs();return this._visible()&&t.showStudyPlotLabels.value()}_showAxisLabel(){const t=this._model.properties().childs().scalesProperties.childs();return this._visible()&&t.showStudyLastValue.value()}_visible(){const t=this._source.properties().childs().styles.childs()[this._data.plotIndex].childs().display.value();return this._source.properties().childs().showLabelsOnPriceScale.value()&&Boolean(4&t)}}var m=s(347710),P=s(832733);const g=(0,i.ensureDefined)(P.lineToolsStudyIds.LineToolAnchoredVolumeProfile),f=[{styleId:"pocLines",title:"POC"},{styleId:"vahLines",title:"VAH"},{styleId:"valLines",title:"VAL"}];class I extends _.StudyLineDataSourceWithPlots{constructor(t,e,s,r,n){const o=s||(0,a.clone)((0,m.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:g})),l=null!=e?e:I.createProperties(t);super(t,o,"vbpanchored_",l,r,n),this._priceAxisPointsInvalidated=!0;const d=(0,i.ensureDefined)(l.childs().graphics.childs().horizlines).childs(),p=this._createPlotPriceAxisViews();this._priceAxisViews=f.map(((t,e)=>new c(this,{pointIndex:e,title:t.title,backgroundPropertyGetter:()=>d[t.styleId].childs().color.value()}))).concat(p),this._priceAxisPoints=f.map(((t,e)=>({price:NaN,index:0}))),this._paneLabelsPaneViews=this._priceAxisViews.map((t=>new h.PanePriceAxisView(t,this,this._model))),this._createPaneViews().then((t=>{this._setPaneViews([...this._paneLabelsPaneViews,...t]),t.forEach((t=>t.update((0,u.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))))}))}pointsCount(){return 1}isForcedDrawPriceAxisLabel(){return!0}isSynchronizable(){return this._ownerSource===this._model.mainSeries()}priceAxisPoints(){return this._priceAxisPointsInvalidated&&(this._updatePriceLabels(), this._priceAxisPointsInvalidated=!1),this._priceAxisPoints}static createProperties(t,e){const s=r.StudyMetaInfo.getStudyPropertyRootNameById(g),o=(0,i.ensureNotNull)((0,m.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:g})),l=(0,n.createDefaultsState)(!0,s,[],t.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(o,o,(0,a.merge)((0,a.clone)(l),null!=e?e:{}),t.studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(t,e,s,i){const r=(0,o.prepareStudyPropertiesForLoadChart)(t,e,s,i);return this._configureProperties(r),r}_updateAllPaneViews(t){super._updateAllPaneViews(t),this._updateAnchors(),this._priceAxisPointsInvalidated=!0}_updateAnchors(){var t;if(0===this._points.length)return;const e=this.priceScale();if(!e)return;const s=null===(t=this._ownerSource)||void 0===t?void 0:t.firstValue();if(null==s)return;const r=this.graphics().horizlines();let n=null;const o=(0,i.ensureDefined)(this.properties().childs().graphics.childs().horizlines).childs();for(const t of f)if(o[t.styleId].childs().visible.value()){const e=r.get(t.styleId);(null==e?void 0:e.size)&&(n=e.values().next().value.level);break}if(null===n){const t=e.height()/2;n=e.coordinateToPrice(t,s)}this._points[0].price=n}_updatePriceLabels(){const t=(0,i.ensureDefined)(this.properties().childs().graphics.childs().horizlines).childs(),e=this.graphics().horizlines();f.forEach(((s,i)=>{if(this._priceAxisPoints[i].price=NaN,t[s.styleId].childs().visible.value()){const t=e.get(s.styleId);(null==t?void 0:t.size)&&(this._priceAxisPoints[i].price=t.values().next().value.level)}}))}_studyInputs(t){(0,i.assert)(1===t.length,"the line tool point should be defined");const e=t[0],s=this._getPointTime(e,!0);if(null===s)return this._subscribeApplyInputsOnSeriesCompleted(),null;if(!this._model.mainSeries().data().last())return null;return{...this.properties().childs().inputs.state(),first_bar_time:1e3*s}}async _createPaneViews(){var t;const e=this._metaInfo,i=e.graphics,r=[],n=!0;if(i.hhists){const{HHistPaneView:e}=await Promise.all([s.e(77028),s.e(20507)]).then(s.bind(s,670751)),i=null===(t=this.properties().childs().graphics.childs().polygons)||void 0===t?void 0:t.childs();r.push(new e(this,this._model,void 0,null==i?void 0:i.histBoxBg,n,!0))}if(i.horizlines){const{HorizLinePaneView:t}=await Promise.all([s.e(77028),s.e(20507)]).then(s.bind(s,722669));r.push(new t(this,this._model,void 0,n))}return e.plots.forEach((t=>{r.push(this._createStudyPlotPaneView(t.id,n))})),r}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([s.e(88601),s.e(96461),s.e(76169),s.e(97732),s.e(30154),s.e(82375),s.e(47924),s.e(60607)]).then(s.bind(s,762155))).StudyLineDataSourceDefinitionsViewModel}_isReady(){return!(0,d.isStudyGraphicsEmpty)(this.graphics())}_createStudyPlotPaneView(t,e){return new l.StudyPlotPaneView(this,this._model.mainSeries(),this._model,t,e)}_createPlotPriceAxisViews(){return this.metaInfo().plots.map((t=>new S(this,{plotIndex:t.id})))}static _configureProperties(t){super._configureProperties(t), t.removeProperty("showLegendValues")}}},975630:(t,e,s)=>{s.d(e,{LineToolAnchoredVWAP:()=>B});var i=s(650151),r=s(526075),n=s(389137),o=s(173948),a=s(855611),l=s(223284),d=s(811630),u=s(190973),p=s(807218),c=s(291784),h=s(31712),_=s(932167);class y extends _.StudyPriceAxisView{_showPaneLabel(){return!1}_showAxisLabel(){const t=this._model.properties().childs().scalesProperties.childs();return this._visible()&&"VWAP"===this._data.plotIndex&&t.showStudyLastValue.value()}_visible(){const t=this._source.properties().childs().styles.childs()[this._data.plotIndex].childs().display.value();return this._source.properties().childs().axisLabelVisible.value()&&Boolean(4&t)}}var S=s(342308),m=s(329007),P=s(86441),g=s(268008);class f extends g.StudyPlotPaneView{constructor(t,e,s,i){super(t,e,s,i),this._line=t}_makeSureRendererIsValid(){(this._dataInvalidated||this._viewportInvalidated)&&this._updateImplFull(this._viewportInvalidated)&&(this._dataInvalidated=null),this._viewportInvalidated=!1}_updateRenderer(t,e){super._updateRenderer(t,e),this._addAlertsRenderer()}_addAlertsRenderer(){if(window.TradingView.printing||!this._line.hasAlert().value()||this._model.readOnly()||this._model.isInReplay())return!1;const t=this._series.data().bars().lastIndex(),e=this._series.model().timeScale().visibleBarsStrictRange();if(null===t||null===e||!e.contains(t))return!1;const s=this._items;if(!this._renderer.isEmpty()&&s.length>0){const t=s[s.length-1],e=this._model.timeScale().width();return!(isNaN(t.center)||t.center<0||s[0].center>e)&&(this._renderer.append(new S.PaneRendererClockIcon({points:[new P.Point(t.center,t.y)],color:this._line.getAlertIsActive()?this._lineColor:m.Constants.DrawingIconColor,horzMargin:-16})),!0)}return!1}}var I=s(201089),v=s(853965),w=s(552698),b=s(1584),A=s(461794),x=s(964824),V=s(806960),D=s(742391),C=s(347710),L=s(832733);const M=(0,I.getLogger)("Chart.AnchoredVWAP"),T=(0,i.ensureDefined)(L.lineToolsStudyIds.LineToolAnchoredVWAP);function F(t,e,s,r){return"calculate_stDev"in(0,i.ensureDefined)(t.inputs)||void 0===r.inputs.find((t=>"calculate_stDev"===t.id))||((0,i.ensureDefined)(e.inputs).calculate_stDev=!1),e.styles&&(R(e.styles.VWAP),R(e.styles.UpperBand),R(e.styles.LowerBand),R(e.styles.UpperBand_2),R(e.styles.LowerBand_2),R(e.styles.UpperBand_3),R(e.styles.LowerBand_3)),e}function R(t){void 0!==t&&void 0!==t.visible&&(t.display=t.visible?15:0,delete t.visible)}class B extends V.StudyLineDataSourceWithPlots{constructor(t,e,s,r,n){s=s||(0,i.ensureNotNull)((0,C.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:T}));const o=null!=e?e:B.createProperties(t);super(t,s,"anchoredvwap",o,r,n);const[a,l,d,u,p,c,h]=this.metaInfo().plots,_=t.mainSeries(),S=[new f(this,_,t,a.id)];l&&d&&(S.push(new g.StudyPlotPaneView(this,_,t,l.id)),S.push(new g.StudyPlotPaneView(this,_,t,d.id))),u&&p&&c&&h&&(S.push(new g.StudyPlotPaneView(this,_,t,u.id)),S.push(new g.StudyPlotPaneView(this,_,t,p.id)),S.push(new g.StudyPlotPaneView(this,_,t,c.id)),S.push(new g.StudyPlotPaneView(this,_,t,h.id))), this._properties.childs().areaBackground&&S.splice(0,0,new b.AreaBackgroundPaneView(this,t)),this._priceAxisViews=this.metaInfo().plots.map((t=>new y(this,{plotIndex:t.id}))),S.push(...this._priceAxisViews.map((t=>new D.PanePriceAxisView(t,this,this._model)))),this._anchorPriceCalculated=!1,this._onInputsReadyCallbacks=[],this._setPaneViews(S),t.properties().childs().scalesProperties.childs().showStudyLastValue.subscribe(this,this._onShowStudyLastValueChanged),o.onRestoreFactoryDefaults().subscribe(this,this._onRestoreFactoryDefaults),this._hasAlert.subscribe(this.processHibernate.bind(this),{callWithLast:!0})}destroy(){this.properties().onRestoreFactoryDefaults().unsubscribeAll(this),this.model().properties().childs().scalesProperties.childs().showStudyLastValue.unsubscribeAll(this),this._onInputsReadyCallbacks=[],super.destroy()}canHasAlert(){return!0}pointsCount(){return 1}updateAllViews(t){super.updateAllViews(t),this._priceAxisViews.forEach((e=>e.update(t)))}firstValue(){return this._model.mainSeries().firstValue()}priceRange(t,e){if(!this._isReady()||this.isSourceHidden())return null;const s=this.plots().minMaxOnRangeCached(t,e,[{name:this.metaInfo().plots[0].id,offset:0}]);if(null===s)return null;const r=(0,i.ensureNotNull)(this.priceScale());return r.isLog()?new c.PriceRange(r.priceToLogical(s.min),r.priceToLogical(s.max)):new c.PriceRange(s.min,s.max)}isIncludedInAutoScale(){return!0}restoreData(t){super.restoreData(t),void 0!==t.data&&(this._anchorPriceCalculated=!0)}properties(){return super.properties()}sourceId(){return this._studyId()}hasStateForAlert(){return d.alertsAvailable&&null!==this._inputs}stateForAlert(){const t=this.metaInfo(),e=(0,l.plotsForAlert)(t,this.offset.bind(this),["VWAP"]),s=(0,l.collectDepsForAlert)([this],this.id()),i=s.idForAlert,r=s.studyDependencies,n=s.inputsForAlert,d=(this.priceScale()||this.model().mainSeries().priceScale()).formatter(),u=d?a.FormattersSerializer.serialize(d):null;return{id:i,uniqueId:i,type:w.StateForAlertType.StudyLineTool,title:(0,A.clean)(this.translatedType(),!0),shortTitle:(0,A.clean)(this.translatedType(),!0),shortDescription:(0,A.clean)(t.shortDescription||"Study",!0),interval:this._model.mainSeries().interval(),fullId:t.fullId,isTVScript:Boolean(t.isTVScript),isTVScriptStrategy:Boolean(t.isTVScriptStrategy),isTVLibrary:Boolean(t.isTVLibrary),hasAlertFunction:Boolean(t.hasAlertFunction),plots:e,inputs:n,alerts:t.alerts,scriptIdPart:t.scriptIdPart,scriptVersion:t.pine?t.pine.version:"-1",callStudyDependencies:(0,o.formatCallstudyArg)((0,l.dependenciesForAlerts)([],(0,C.studyMetaInfoRepository)())),studyDependencies:r,formatter:u}}inputsForAlertState(){null===this._inputs&&M.logError("Could not get inputsForAlertState if VWAP has no inputs");const{start_time:t,source:e}=this.inputs();return{start_time:t,source:e}}inputs(){return(0,i.ensureNotNull)(this._inputs)}idForAlert(){return(0,l.collectDepsForAlert)([this],this.id()).idForAlert}defaultPlotIdForAlert(){return this.metaInfo().plots[0].id}canBeHibernated(){ return super.canBeHibernated()&&!this._hasAlert.value()}static createProperties(t,e){const s=r.StudyMetaInfo.getStudyPropertyRootNameById(T),o=(0,i.ensureNotNull)((0,C.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:T})),a=(0,v.createDefaultsState)(!0,s,[],t.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(o,o,(0,n.merge)((0,n.clone)(a),null!=e?e:{}),t.studyVersioning())}static studyId(){return T}static createPropertiesFromStudyMetaInfoAndState(t,e,s,i){const r=(0,p.prepareStudyPropertiesForLoadChart)(t,e,s,i,F);return this._configureProperties(r),r}_onPointsetUpdated(t){super._onPointsetUpdated(t),this._onStudyInputsMayChange()}_studyInputs(t){(0,i.assert)(1===t.length,"all the line tool points should be defined");const e=t[0],s=this._getPointTime(e,!1);return null===s?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(["start_time"]),start_time:1e3*s}}_isReady(){return super._isReady()&&(null!==this._inputs||this._anchorPriceCalculated)&&this.model().lineBeingEdited()!==this}_onDataCleared(){super._onDataCleared(),this._anchorPriceCalculated=!1}_onInputsChanged(){if(super._onInputsChanged(),this._updateAlertCreationAvailable(),null!==this._inputs){for(const t of this._onInputsReadyCallbacks)try{t(this._inputs)}catch(t){M.logError(t.stack||t.message)}this._onInputsReadyCallbacks=[]}}_clearAllDataExceptPointsetPoints(){super._clearAllDataExceptPointsetPoints(),this._updateAlertCreationAvailable()}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([s.e(96461),s.e(82790),s.e(30154),s.e(82375),s.e(18537)]).then(s.bind(s,865993))).AnchoredVWAPDefinitionsViewModel}_updateAnchorsPrice(t){if(!t&&(this._anchorPriceCalculated||!this.isActualSymbol()))return;const e=this.firstValue(),s=this.points();if(null===e||0===s.length)return;const i=s[0].index,r=this.plots().valueAt(i);if(null===r)return;const n=r[1];null!=n&&(this._points[0].price=n,this._timePoint[0].price=n,this._anchorPriceCalculated=!0)}_synchronizeAlert(t){this._onInputsReady((()=>super._synchronizeAlert(t)))}static _configureProperties(t){super._configureProperties(t),t.hasChild("axisLabelVisible")||t.addChild("axisLabelVisible",new u.default(true));const e=t.childs().styles.childs().VWAP.childs().linewidth,s=t.childs().styles.childs().VWAP.childs().color;t.addChild("linesWidths",new h.LineToolWidthsProperty([e])),t.addChild("linesColors",new h.LineToolColorsProperty([s]))}_onInputsReady(t){null!==this._inputs?t(this._inputs):this._onInputsReadyCallbacks.push(t)}_onShowStudyLastValueChanged(){this._priceAxisViews.forEach((t=>t.update((0,x.sourceChangeEvent)(this.id())))),this.model().updateSource(this)}_onRestoreFactoryDefaults(){this.properties().childs().axisLabelVisible.setValue(true)}}},928890:(t,e,s)=>{s.d(e,{LineToolFixedRangeVolumeProfile:()=>h});var i=s(650151),r=s(224153),n=s(526075),o=s(2122),a=s(853965),l=s(389137),d=s(807218),u=s(347710),p=s(832733);const c=(0,i.ensureDefined)(p.lineToolsStudyIds.LineToolFixedRangeVolumeProfile) ;class h extends r.LineToolVbPFixed{constructor(t,e,s,i,r){super(t,e,s||(0,u.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:c}),i,r)}calcIsActualSymbol(){o.StudyLineDataSource.prototype.calcIsActualSymbol.apply(this)}boundToSymbol(){return!0}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}static studyId(){return c}static createProperties(t,e){const s=n.StudyMetaInfo.getStudyPropertyRootNameById(c),r=(0,i.ensureNotNull)((0,u.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:c})),o=(0,a.createDefaultsState)(!0,s,[],t.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(r,r,(0,l.merge)((0,l.clone)(o),null!=e?e:{}),t.studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(t,e,s,i){const r=(0,d.prepareStudyPropertiesForLoadChart)(t,e,s,i);return this._configureProperties(r),r}}},832733:(t,e,s)=>{s.d(e,{lineToolsStudyIds:()=>i});const i={LineToolAnchoredVWAP:"AnchoredVWAP@tv-basicstudies",LineToolRegressionTrend:"RegressionTrend@tv-basicstudies",LineToolFixedRangeVolumeProfile:"VbPFixed@tv-basicstudies",LineToolVbPFixed:"VbPFixed@tv-volumebyprice"};{const t={LineToolAnchoredVolumeProfile:"VbPAnchored@tv-basicstudies",LineStudyMtpAnalysis:"mtp_tsanalysis@mtp-mtpredictor",LineStudyMtpDecisionPoint:"mtp_decisionpoint@mtp-mtpredictor",LineStudyMtpElliotWaveMain:"mtp_ew_main@mtp-mtpredictor",LineStudyMtpElliotWaveMajor:"mtp_ew_major@mtp-mtpredictor",LineStudyMtpElliotWaveMinor:"mtp_ew_minor@mtp-mtpredictor",LineStudyMtpRiskReward:"mtp_riskreward@mtp-mtpredictor",LineStudyMtpDownWave1OrA:"mtp_wpt_down1ora@mtp-mtpredictor",LineStudyMtpDownWave2OrB:"mtp_wpt_down2orb@mtp-mtpredictor",LineStudyMtpDownWave3:"mtp_wpt_down3@mtp-mtpredictor",LineStudyMtpDownWave4:"mtp_wpt_down4@mtp-mtpredictor",LineStudyMtpDownWave5:"mtp_wpt_down5@mtp-mtpredictor",LineStudyMtpDownWaveC:"mtp_wpt_downc@mtp-mtpredictor",LineStudyMtpUpWave1OrA:"mtp_wpt_up1ora@mtp-mtpredictor",LineStudyMtpUpWave2OrB:"mtp_wpt_up2orb@mtp-mtpredictor",LineStudyMtpUpWave3:"mtp_wpt_up3@mtp-mtpredictor",LineStudyMtpUpWave4:"mtp_wpt_up4@mtp-mtpredictor",LineStudyMtpUpWave5:"mtp_wpt_up5@mtp-mtpredictor",LineStudyMtpUpWaveC:"mtp_wpt_upc@mtp-mtpredictor"};for(const[e,s]of Object.entries(t))i[e]=s}},484775:(t,e,s)=>{s.r(e),s.d(e,{LineStudyMtpAnalysis:()=>h,LineStudyMtpDecisionPoint:()=>y,LineStudyMtpDownWave1OrA:()=>V,LineStudyMtpDownWave2OrB:()=>C,LineStudyMtpDownWave3:()=>M,LineStudyMtpDownWave4:()=>F,LineStudyMtpDownWave5:()=>B,LineStudyMtpDownWaveC:()=>E,LineStudyMtpElliotWaveMain:()=>f,LineStudyMtpElliotWaveMajor:()=>v,LineStudyMtpElliotWaveMinor:()=>b,LineStudyMtpRiskReward:()=>m,LineStudyMtpUpWave1OrA:()=>O,LineStudyMtpUpWave2OrB:()=>k,LineStudyMtpUpWave3:()=>H,LineStudyMtpUpWave4:()=>$,LineStudyMtpUpWave5:()=>q,LineStudyMtpUpWaveC:()=>X});var i=s(650151),r=s(827523),n=s(484812),o=s(2122),a=s(943994),l=s(807218),d=s(347710);function u(t){return(0,r.studyIdString)(t,"mtp-mtpredictor")}class p extends o.StudyLineDataSource{constructor(t,e,s,i,r,o){const l=u(i),c=s||(0, d.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:l}),h=e||p._createPropertiesFromStudyMetaInfo(c,t.studyVersioning());super(t,c,i,h,r,o),this._formatter=new a.VolumeFormatter,(0,n.createGraphicsPaneViews)(this,t).then(this._setPaneViews.bind(this))}formatter(){return this._formatter}static _createPropertiesFromMtpStudyShortIdAndState(t,e){return super._createPropertiesFromStudyIdAndState(u(t),e)}static _createPropertiesFromStudyMetaInfo(t,e){const s=(0,l.prepareStudyProperties)(t,{},null,e,[]);return super._configureProperties(s),s}}const c="mtp_tsanalysis";class h extends p{constructor(t,e,s,i,r){super(t,e,s,c,i,r)}pointsCount(){return 1}static createProperties(t){return super._createPropertiesFromMtpStudyShortIdAndState(c,t)}static studyId(){return u(c)}_studyInputs(t){(0,i.assert)(1===t.length,"all the line tool points should be defined");const e=this._getPointTime(t[0],!0);return null===e?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),bar:1e3*e}}}const _="mtp_decisionpoint";class y extends p{constructor(t,e,s,i,r){super(t,e,s,_,i,r),this._symbolIntervalChanged=!1,this._model.mainSeries().onSymbolIntervalChanged().subscribe(this,this._onSymbolIntervalChanged)}destroy(){this._model.mainSeries().onSymbolIntervalChanged().unsubscribeAll(this),super.destroy()}pointsCount(){return 1}onData(t){super.onData(t),this._symbolIntervalChanged=!1}static createProperties(t){return super._createPropertiesFromMtpStudyShortIdAndState(_,t)}static studyId(){return u(_)}_studyInputs(t){(0,i.assert)(1===t.length,"all the line tool points should be defined");const e=this._getPointTime(t[0],!0);return null===e?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),symbolIntervalChanged:this._symbolIntervalChanged,bar:1e3*e}}_onSymbolIntervalChanged(){this._symbolIntervalChanged=!0}}const S="mtp_riskreward";class m extends p{constructor(t,e,s,i,r){super(t,e,s,S,i,r)}pointsCount(){return 3}static createProperties(t){return super._createPropertiesFromMtpStudyShortIdAndState(S,t)}static getTooltipText(t){return t&&0!==t._points.length?1===t._points.length?"Select Stop Bar":2===t._points.length?"Select Target Point":null:"Select Entry Setup Bar"}static studyId(){return u(S)}_studyInputs(t){(0,i.assert)(3===t.length,"all the line tool points should be defined");const e=this._getPointTime(t[0],!0),s=this._getPointTime(t[1],!0),r=this._getPointTime(t[2],!0);return null===e||null===s||null===r?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),entry_bar:1e3*e,stop_bar:1e3*s,target_bar:1e3*r,target_price:t[2].price}}}class P extends p{pointsCount(){return 1}_studyInputs(t){(0,i.assert)(1===t.length,"all the line tool points should be defined");const e=this._getPointTime(t[0],!0);return null===e?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),bar:1e3*e}}}const g="mtp_ew_main";class f extends P{constructor(t,e,s,i,r){super(t,e,s,g,i,r)} static createProperties(t){return super._createPropertiesFromMtpStudyShortIdAndState(g,t)}static studyId(){return u(g)}}const I="mtp_ew_major";class v extends P{constructor(t,e,s,i,r){super(t,e,s,I,i,r)}static createProperties(t){return super._createPropertiesFromMtpStudyShortIdAndState(I,t)}static studyId(){return u(I)}}const w="mtp_ew_minor";class b extends P{constructor(t,e,s,i,r){super(t,e,s,w,i,r)}static createProperties(t){return super._createPropertiesFromMtpStudyShortIdAndState(w,t)}static studyId(){return u(w)}}class A extends p{_studyInputs(t){(0,i.assert)(t.length===this.pointsCount(),"all the line tool points should be defined");const e={...this.properties().childs().inputs.state()};for(let s=0;s{s.d(e,{LineToolRegressionTrend:()=>m});var i=s(650151),r=s(732149),n=s(526075),o=s(2122),a=s(807218),l=s(31712),d=s(389137),u=s(853965),p=s(347710),c=s(832733);const h=(0,i.ensureDefined)(c.lineToolsStudyIds.LineToolRegressionTrend);function _(t){return void 0!==t.startPrice&&void 0!==t.endPrice}function y(t,e,s,i){return e.styles&&(S(e.styles.baseLine),S(e.styles.downLine),S(e.styles.upLine)),e}function S(t){void 0!==t&&void 0!==t.visible&&(t.display=t.visible?15:0,delete t.visible)}class m extends o.StudyLineDataSource{constructor(t,e,r,n,o){super(t,r=null!=r?r:(0,i.ensureNotNull)((0,p.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:h})),"linreg_",null!=e?e:m.createProperties(t),n,o),this.version=2,this._trendData=null,Promise.all([s.e(88548),s.e(6744),s.e(42244),s.e(63240),s.e(77028),s.e(51583)]).then(s.bind(s,13105)).then((t=>{this._setPaneViews([new t.RegressionTrendPaneView(this,this._model)])}))}formatter(){throw new Error("This method should never be called")}pointsCount(){return 2}clearData(){this._trendData=null,super.clearData()}state(t){var e;const s=super.state(t);return t?{...s,nonseriesdata:null!==(e=this._trendData)&&void 0!==e?e:void 0}:s}restoreData(t){var e;super.restoreData(t),this._trendData=null!==(e=t.nonseriesdata)&&void 0!==e?e:null}startIndex(){if(null===this._trendData||null===this._indexes)return null;const t=this._indexes[this._trendData.startIndex];return t!==r.INVALID_TIME_POINT_INDEX?t:null} endIndex(){if(null===this._trendData||null===this._indexes)return null;const t=this._indexes[this._trendData.endIndex];return t!==r.INVALID_TIME_POINT_INDEX?t:null}baseLine(){return null===this._trendData?null:this._trendData.baseLine}downLine(){return null===this._trendData?null:this._trendData.downLine}upLine(){return null===this._trendData?null:this._trendData.upLine}pearsons(){return null===this._trendData?null:this._trendData.pearsons}recalcStudyIfNeeded(){this._onStudyInputsMayChange()}cloneable(){return!1}static createProperties(t,e){const s=n.StudyMetaInfo.getStudyPropertyRootNameById(h),r=(0,i.ensureNotNull)((0,p.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:h})),o=(0,u.createDefaultsState)(!0,s,[],t.studyVersioning());return this.createRegressionTrendPropertiesFromStudyMetaInfoAndState(r,r,(0,d.merge)((0,d.clone)(o),null!=e?e:{}),t.studyVersioning())}static createRegressionTrendPropertiesFromStudyMetaInfoAndState(t,e,s,i){const r=(0,a.prepareStudyPropertiesForLoadChart)(t,e,s,i,y);return this._configureProperties(r),r}static studyId(){return h}_studyInputs(t){(0,i.assert)(2===t.length,"all the line tool points should be defined");const[e,s]=t;if(e.index===s.index)return null;const r=this._getPointTime(e.index<=s.index?e:s,!0),n=this._getPointTime(s.index>=e.index?s:e,!0);return null===r||null===n?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),"first bar time":1e3*r,"last bar time":1e3*n}}_onDataUpdated(t,e,s){null!==e&&(e.indexes_replace||(this._trendData=e.data),"nochange"!==s&&(this._indexes=s),super._onDataUpdated(t,e,s))}_isReady(){return null!==this._trendData&&void 0!==this._trendData.startIndex&&void 0!==this._trendData.endIndex&&_(this._trendData.upLine)&&_(this._trendData.baseLine)&&_(this._trendData.downLine)}_updateAnchorsPrice(){if(!this._trendData||(0,d.isNaN)(this._trendData.baseLine.startPrice)||(0,d.isNaN)(this._trendData.baseLine.endPrice))return;const{startPrice:t,endPrice:e}=this._trendData.baseLine;2===this._points.length&&(this._points[0].price=(0,i.ensureDefined)(t),this._points[1].price=(0,i.ensureDefined)(e),this._timePoint[0].price=(0,i.ensureDefined)(t),this._timePoint[1].price=(0,i.ensureDefined)(e))}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([s.e(88601),s.e(96461),s.e(76169),s.e(97732),s.e(30154),s.e(82375),s.e(47924),s.e(60607)]).then(s.bind(s,422026))).RegressionTrendDefinitionsViewModel}static _configureProperties(t){super._configureProperties(t);const e=t.childs().styles.childs(),s=[e.upLine.childs().linewidth,e.downLine.childs().linewidth,e.baseLine.childs().linewidth];t.addChild("linesWidths",new l.LineToolWidthsProperty(s))}}},806960:(t,e,s)=>{s.d(e,{StudyLineDataSourceWithPlots:()=>a});var i=s(203308),r=s(650151),n=s(2122),o=s(534741);class a extends n.StudyLineDataSource{lastValueData(t,e,s){const n={noData:!0},a=this.priceScale();if(this._model.timeScale().isEmpty()||null===this.priceScale()||null===a||a.isEmpty()||this.plots().isEmpty())return n ;const l=this._model.timeScale().visibleBarsStrictRange();if(null===l)return n;const d=this._studyProps();if(!d.childs().visible.value())return n;const u=this.plots().search(l.lastBar(),o.PlotRowSearchMode.NearestLeft,1);if(null===u)return n;const p=l.contains(u.index),c=!e&&p?u:(0,r.ensureNotNull)(this.plots().last()),h=this.metaInfo().plots.findIndex((e=>e.id===t));if(h<0||!c||!(0,i.default)(c.value[h+1]))return n;const _=c.value[h+1];if(null==_)return n;const y=(0,r.ensureDefined)(d.childs().styles.child(t)),S=(0,r.ensureNotNull)(this.firstValue()),m=a.priceToCoordinate(_,S);return{...a.getFormattedValues(_,S),noData:!1,price:_,color:y.childs().color.value(),coordinate:m,floatCoordinate:m,index:c.index}}priceLabelText(t){const e=(0,r.ensureDefined)(this._metaInfo.styles);return(0,r.ensureDefined)(e[t]).title}offset(t){return 0}getMinFirstBarIndexForPlot(){return-1/0}isPlotVisibleAt(t,e){return(this._studyProps().childs().styles.childs()[t].childs().display.value()&e)===e}_studyProps(){return this.properties()}}},2122:(t,e,s)=>{s.d(e,{StudyLineDataSource:()=>b});var i=s(650151),r=s(389137),n=s(195447),o=s(821979),a=s(853965),l=s(526075),d=s(484812),u=s(62745),p=s(114315),c=s(799567),h=s(989709),_=s(807218),y=s(988124),S=s(242558),m=s(964824),P=s(7288),g=s(985715);class f extends g.StatusProviderBase{constructor(t){super(t.model().properties().childs().scalesProperties.childs().textColor),this._source=t}color(){return"#ff0000"}errorStatus(){const t=this._source.status();return t.type===P.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,P.studyStatusSolutionId)(t),title:(0,P.studyStatusTitle)(t),studyFeature:(0,P.studyStatusFeature)(t)}:null}getSplitTitle(){return this._source.titleInParts()}text(){return this._source.translatedType()}sourceStatusText(){return(0,P.convertStudyStatusToString)(this._source.status(),!0)}}var I=s(572230),v=s(833642);class w extends v.StatusView{constructor(t){super(t.statusProvider({}))}getSplitTitle(){return this._statusProvider.getSplitTitle()}}class b extends o.LineDataSource{constructor(t,e,i,r,n,o){super(t,r,n,o),this._indexes=null,this._inputs=null,this._definitionsViewModel=null,this._pointsetPoints=null,this._loadedPlots=null,this._loadedGraphics=null,this._beingCreatedPaneView=null,this._anchorsPaneView=null,this._isLegendDisplayed=!1,this._alignerCache=null,Promise.all([Promise.all([s.e(88548),s.e(6744),s.e(42244),s.e(63240),s.e(77028),s.e(51583)]).then(s.bind(s,67663)),Promise.all([s.e(88548),s.e(6744),s.e(42244),s.e(63240),s.e(77028),s.e(51583)]).then(s.bind(s,199258))]).then((e=>{const{LineToolBeingCreatedPaneView:s}=e[0],{StudyLineDataSourceAnchorsPaneView:i}=e[1];this._beingCreatedPaneView=new s(this,t),this._anchorsPaneView=new i(this,this.model()),this._model.lightUpdate()})),this._metaInfo=e,this._dataSource=new p.ExtendedStudyDataSource(t.chartApi(),t.mainSeries(),i,e),this._dataSource.dataCleared().subscribe(this,this._onDataCleared),this._dataSource.dataUpdated().subscribe(this,this._onDataUpdated), this._dataSource.studyStatusChanged().subscribe(this,this._onStudyStatusChanged),this._statusProvider=new f(this),this._statusView=new w(this),this._showStudyArgumentsProperty=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments}isDisplayedInLegend(){return this._isLegendDisplayed}titleInParts(){const t=[];if(this._showStudyArgumentsProperty.value()&&this._inputs)for(const e of this._metaInfo.inputs){if(!0===e.isHidden||"bool"===e.type)continue;const s=this._inputs[e.id];t.push(s.toString())}return[this.name(),t]}destroy(){this._dataSource.dataUpdated().unsubscribeAll(this),this._dataSource.dataCleared().unsubscribeAll(this),this._dataSource.studyStatusChanged().unsubscribeAll(this),this._dataSource.destroy(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._unsubscribeApplyInputsOnSeriesCompleted(),this._isDestroyed=!0,super.destroy()}stop(){super.stop(),this._isDestroyed||(this._dataSource.stop(),this.clearData())}start(){super.start(),this._isDestroyed||null===this._inputs||this._dataSource.start()}metaInfo(){return this._metaInfo}graphicsInfo(){return this._metaInfo.graphics}series(){return this._model.mainSeries()}translatedType(){return this._metaInfo.description}name(){return this._metaInfo.description}studyId(){return this._metaInfo.id}setPoint(t,e,s){super.setPoint(t,this._preparePoint(e,s))}move(t){}clearData(){this._clearAllDataExceptPointsetPoints(),this._pointsetPoints=null,this.updateAllViews((0,m.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),super.clearData()}data(){return this.plots()}plots(){return this._loadedPlots||this._dataSource.plots()}graphics(){return this._loadedGraphics||this._dataSource.graphics()}valueAt(t,e){var s,i;return null!==(i=null===(s=this.ownerSource())||void 0===s?void 0:s.symbolSource().valueAt(t,e))&&void 0!==i?i:null}firstValue(){return this._model.mainSeries().firstValue()}state(t){const e=super.state(t);let s;this.metaInfo()instanceof l.StudyMetaInfo?s=this.metaInfo().state():(s=(0,r.clone)(this.metaInfo()),s.id=l.StudyMetaInfo.parseIdString(s.id+(s.version?"-"+s.version:"")).fullId);const i={...e,metaInfo:s};return t&&(i.data=this.plots().state(),i.nonseriesindexes=this._indexes,i.graphics=(0,d.saveStudyGraphics)(this.graphics(),null)),i}restoreData(t){var e;void 0!==t.data&&(this._loadedPlots=new n.PlotList((0,h.studyPlotFunctionMap)(this._metaInfo),h.studyEmptyPlotValuePredicate),this._loadedPlots.restoreState(t.data)),this._indexes=null!==(e=t.nonseriesindexes)&&void 0!==e?e:this._indexes,this._loadedGraphics=t.graphics?(0,d.loadStudyGraphics)(t.graphics):this._loadedGraphics}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then((t=>null===t||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new t(this._model.undoModel(),this)),this._definitionsViewModel))):Promise.resolve(this._definitionsViewModel)}paneViews(t){let e=[] ;if(this.isSourceHidden())return e;if(this._isReady()&&this._changeStatesStack.isEmpty()){const s=super.paneViews(t);null!==s&&(e=e.concat(s))}else null!==this._beingCreatedPaneView&&e.push(this._beingCreatedPaneView);return null!==this._anchorsPaneView&&e.push(this._anchorsPaneView),e}propertiesChanged(t){super.propertiesChanged(t),this._onStudyInputsMayChange()}dataAndViewsReady(){return super.dataAndViewsReady()&&this._isReady()}endChanging(t,e){const s=super.endChanging(t,e);return s.indexesChanged?this.clearData():this._updateAnchorsPrice(!0),s}moveData(t){this._dataSource.moveData(t)}restorePoints(t,e,s){super.restorePoints(t,e,s),this._updateAnchorsPrice(!0)}realign(){super.realign(),null===this._model.mainSeries().symbolInfo()&&(this._alignerCache=null)}statusProvider(t){return this._statusProvider}statusView(){return this._statusView}legendView(){return null}dataProblemModel(){return null}dataUpdatedModeModel(){return null}marketStatusModel(){return null}onStatusChanged(){return this._dataSource.studyStatusChanged()}status(){return this._dataSource.studyStatus()}recalcStudyIfNeeded(){}static createPropertiesFromStudyMetaInfoAndState(t,e,s,i){const r=(0,_.prepareStudyPropertiesForLoadChart)(t,e,s,i);return this._configureProperties(r),r}_onStudyStatusChanged(t,e){let s;switch(e.type){case c.StudyStatusType.Error:s=!0;break;case c.StudyStatusType.Completed:s=!1;break;default:return}if(s===this._isLegendDisplayed)return;this._isLegendDisplayed=s;const i=this._model.paneForSource(this);if(i){const t=this._model.panes().indexOf(i),e=I.InvalidationMask.invalidateLegendWidgetLayout(t);this.model().invalidate(e)}}_studyId(){return this._dataSource.studyId()}_isReady(){return!0}_updateAllPaneViews(t){var e,s;super._updateAllPaneViews(t),null===(e=this._beingCreatedPaneView)||void 0===e||e.update(),null===(s=this._anchorsPaneView)||void 0===s||s.update(t)}_getPointTime(t,e){const s=t.index,i=this._model.timeScale().indexToTimePoint(s);if(null!==i)return i;if(e||void 0===t.time)return null;const r=this._model.mainSeries().symbolInfo();if(null===r)return null;let n=this._model.properties().childs().timezone.value();"exchange"===n&&(n=r.timezone);const o=(0,y.cal_to_utc)((0,y.get_timezone)(n),t.time);return this._getStartBarAligner()(o)/1e3}_updateAnchorsPrice(t){}_onPointsetUpdated(t){super._onPointsetUpdated(t),this._pointsetPoints=this._points.map((t=>({price:t.price,index:t.index,time:t.time}))),this._onStudyInputsMayChange()}_onDataCleared(){this.updateAllViews((0,m.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._model.updateSource(this)}_onDataUpdated(t,e,s){var i;this._updateAnchorsPrice(),this.updateAllViews((0,m.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null===(i=t[0])||void 0===i?void 0:i.index})),this._model.updateSource(this)}_onStudyInputsMayChange(){let t=null;if(null!==this._pointsetPoints&&this._pointsetPoints.length===this.pointsCount()&&(t=this._studyInputs(this._pointsetPoints),null===t&&(this._clearAllDataExceptPointsetPoints(),this.updateAllViews((0, m.sourceChangeEvent)(this.id())))),null!==t){const e=this.metaInfo().inputs.map((t=>t.id)),s=Object.keys(t);for(const i of s)e.includes(i)||delete t[i]}this._areInputsEqual(this._inputs,t)||this._applyStudyInputs(t)}_preparePoint(t,e){return super._preparePoint(this._alignPointToRangeOfActualData(t),e)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_subscribeApplyInputsOnSeriesCompleted(){this._unsubscribeApplyInputsOnSeriesCompleted(),this._model.mainSeries().dataEvents().completed().subscribe(this,(()=>this._onStudyInputsMayChange()),!0)}_unsubscribeApplyInputsOnSeriesCompleted(){this._model.mainSeries().dataEvents().completed().unsubscribeAll(this)}_onInputsChanged(){this.hasAlert().value()&&(this._localAndServerAlertsMismatch=!0)}_clearAllDataExceptPointsetPoints(){this._inputs=null,this._dataSource.clearData(),this._loadedPlots=null,this._indexes=null,this._loadedGraphics=null}static _createPropertiesFromStudyIdAndState(t,e){const s=l.StudyMetaInfo.getStudyPropertyRootNameById(t),i=new a.DefaultProperty(s,e);return this._configureProperties(i),i}static _configureProperties(t){super._configureProperties(t),t.removeExclusion("intervalsVisibilities")}_areInputsEqual(t,e){return null===e?null===t:null!==t&&(0,u.areStudyInputsEqual)(this._metaInfo.inputs,t,e)}_applyStudyInputs(t){const e=this._inputs;this._inputs=t,null!==t&&(this._unsubscribeApplyInputsOnSeriesCompleted(),this._dataSource.setInputs(t),null===e&&this.isStarted()&&!this._dataSource.isStarted()&&this._dataSource.start()),this._onInputsChanged()}_getStartBarAligner(){const t=this._model.mainSeries().interval();return null!==this._alignerCache&&this._alignerCache.resolution===this._model.mainSeries().interval()||(this._alignerCache={resolution:t,aligner:(0,S.createTimeToBarTimeAligner)(t,(0,i.ensureNotNull)(this._model.mainSeries().symbolInfo()))}),this._alignerCache.aligner}}},224153:(t,e,s)=>{s.d(e,{LineToolVbPFixed:()=>P});var i=s(277973),r=s(650151),n=s(526075),o=s(2122),a=s(484812),l=s(268008),d=s(964824),u=s(389137),p=s(853965),c=s(807218),h=s(347710),_=s(832733);const y=(0,r.ensureDefined)(_.lineToolsStudyIds.LineToolVbPFixed);function S(t,e,s,i){return e.styles&&(m(e.styles.developingPoc),m(e.styles.developingVAHigh),m(e.styles.developingVALow)),e}function m(t){void 0!==t&&void 0!==t.visible&&(t.display=t.visible?15:0,delete t.visible)}class P extends o.StudyLineDataSource{constructor(t,e,s,i,r){super(t,s||(0,h.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:y}),"vbpfixed_",null!=e?e:P.createProperties(t),i,r),this._createPaneViews().then((t=>{this._setPaneViews(t),t.forEach((t=>t.update((0,d.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))))})),this.clearData()}pointsCount(){return 2}boundToSymbol(){return!1}offset(t){return 0}getMinFirstBarIndexForPlot(){return-1/0}calcIsActualSymbol(){this._isActualSymbol=!0,this._isActualCurrency=!0,this._isActualUnit=!0,this.calcIsActualInterval()}cloneable(){return!1}isSynchronizable(){return!1}isPlotVisibleAt(t,e){ return(this.properties().childs().styles.childs()[t].childs().display.value()&e)===e}preferredZOrder(){return 0}static createProperties(t,e){const s=n.StudyMetaInfo.getStudyPropertyRootNameById(y),i=(0,r.ensureNotNull)((0,h.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:y})),o=(0,p.createDefaultsState)(!0,s,[],t.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(i,i,(0,u.merge)((0,u.clone)(o),null!=e?e:{}),t.studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(t,e,s,i){const r=(0,c.prepareStudyPropertiesForLoadChart)(t,e,s,i,S);return this._configureProperties(r),r}static studyId(){return y}_studyInputs(t){(0,r.assert)(2===t.length,"all the line tool points should be defined");const[e,s]=t,i=Math.max(e.index,s.index),n=this._model.mainSeries().bars().lastIndex(),o=this._getPointTime(e.index<=s.index?e:s,!0),a=this._getPointTime(s.index>=e.index?s:e,!0);if(null===o||null===a)return this._subscribeApplyInputsOnSeriesCompleted(),null;return{...this.properties().childs().inputs.state(),first_bar_time:1e3*o,last_bar_time:1e3*a,subscribeRealtime:n===i,mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_isReady(){return!(0,a.isStudyGraphicsEmpty)(this.graphics())}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([s.e(88601),s.e(96461),s.e(76169),s.e(97732),s.e(30154),s.e(82375),s.e(47924),s.e(60607)]).then(s.bind(s,762155))).StudyLineDataSourceDefinitionsViewModel}_onDataUpdated(){this._updateAnchors(),this.updateAllViews((0,d.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_updateAnchors(){const t=this._calculateAnchors();if(!t)return;const[{index:e,price:s},{index:i,price:r}]=t;if(this._timePoint.length&&(this._timePoint[0].price=s,this._timePoint[1].price=r),this._points.length){const t=this.model().timeScale(),n=t.indexToTimePoint(e),o=t.indexToTimePoint(e);this._points[0]={index:e,price:s,time:(0,u.isNumber)(n)?new Date(1e3*n):void 0},this._points[1]={index:i,price:r,time:(0,u.isNumber)(o)?new Date(1e3*o):void 0}}}_calculateAnchors(){let t=null,e=null,s=null,r=null;if(this.graphics().hhists().forEach((i=>{i.forEach((i=>{const{priceLow:n,priceHigh:o,firstBarTime:a,lastBarTime:l}=i;(!t||ne)&&(e=o),(!s||ar)&&(r=l)}))})),!((0,i.default)(t)||(0,i.default)(e)||(0,i.default)(r)||(0,i.default)(s)))return[{price:e,index:s},{price:t,index:r}]}_updateAnchorsPrice(){const t=this._calculateAnchors();if(!t)return;const[{price:e},{price:s}]=t;this._timePoint.length&&(this._timePoint[0].price=e,this._timePoint[1].price=s),this._points.length&&(this._points[0].price=e,this._points[1].price=s)}async _createPaneViews(){var t;const e=this._metaInfo,i=e.graphics,r=[],n=this._needExtendToBarsEnding();if(i.hhists){const{HHistPaneView:e}=await Promise.all([s.e(77028),s.e(20507)]).then(s.bind(s,670751)),i=null===(t=this.properties().childs().graphics.childs().polygons)||void 0===t?void 0:t.childs();r.push(new e(this,this._model,void 0,null==i?void 0:i.histBoxBg,n))}if(i.horizlines){ const{HorizLinePaneView:t}=await Promise.all([s.e(77028),s.e(20507)]).then(s.bind(s,722669));r.push(new t(this,this._model,void 0,n))}return e.plots.length>0&&r.push(this._createStudyPlotPaneView(e.plots[0].id,n)),e.plots.length>1&&r.push(this._createStudyPlotPaneView(e.plots[1].id,n)),e.plots.length>2&&r.push(this._createStudyPlotPaneView(e.plots[2].id,n)),r}_createStudyPlotPaneView(t,e){return new l.StudyPlotPaneView(this,this._model.mainSeries(),this._model,t,e)}_needExtendToBarsEnding(){var t;return void 0!==(null===(t=this.metaInfo().defaults.inputs)||void 0===t?void 0:t.mapRightBoundaryToBarStartTime)}}},342308:(t,e,s)=>{s.d(e,{PaneRendererClockIcon:()=>l});var i=s(315801),r=s(710455);const n=Math.sqrt(3),o=new Path2D("M3.72 0 .5 3.3l.72.7L4.43.7 3.72 0ZM12.28 0l3.22 3.3-.72.7L11.56.7l.72-.7Z"),a=new Path2D("M14 8A6 6 0 1 1 2 8a6 6 0 0 1 12 0ZM9 5v4H6V8h2V5h1Z");class l extends r.MediaCoordinatesPaneRenderer{constructor(t){super(),this.update(t)}update(t){var e;const s=t.points[0],i=null!==(e=t.points[1])&&void 0!==e?e:t.points[0],r=s.x-i.x,o=s.y-i.y;let a=t.horzMargin;void 0===a&&(a=r>0?10:-25),this._x=s.x+a,this._y=s.y+(0!==o&&Math.abs(r)*n<=Math.abs(o)?-7:o>0?-25:11),this._color=t.color}hitTest(t){return t.xthis._x+16||t.ythis._y+16?null:new i.HitTestResult(i.HitTarget.Regular)}_drawImpl(t){const e=t.context;e.translate(this._x,this._y+1),e.fillStyle=this._color,e.fill(o),e.fill(a,"evenodd")}}},329007:(t,e,s)=>{var i;s.d(e,{Constants:()=>i}),function(t){t.DrawingIconColor="rgba( 170, 170, 170, 1)"}(i||(i={}))}}]);