"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[5695],{57296:(e,t,i)=>{i.r(t),i.d(t,{LineToolFixedRangeVolumeProfile:()=>p});var s=i(50151),o=i(71112),r=i(19844),n=i(35107),l=i(78176),a=i(87465),c=i(23502),d=i(72972),h=i(91111);const u=(0,s.ensureDefined)(h.lineToolsStudyIds.LineToolFixedRangeVolumeProfile);class p extends o.LineToolVbPFixed{constructor(e,t,i,s,o){super(e,t,i||(0,d.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:u}),s,o)}calcIsActualSymbol(){n.StudyLineDataSource.prototype.calcIsActualSymbol.apply(this)}boundToSymbol(){return!0}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}static studyId(){return u}static createProperties(e,t){const i=r.StudyMetaInfo.getStudyPropertyRootNameById(u),o=(0,s.ensureNotNull)((0,d.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:u})),n=(0,l.createDefaultsState)(!0,i,[],(0,d.studyMetaInfoRepository)().studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(o,o,(0,a.merge)((0,a.clone)(n),t??{}),(0,d.studyMetaInfoRepository)().studyVersioning(),e)}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s,o){const r=(0,c.prepareStudyPropertiesForLoadChart)(e,t,i,s,void 0,o);return this._configureProperties(r),r}}},71112:(e,t,i)=>{i.r(t),i.d(t,{LineToolVbPFixed:()=>v});const s=function(e){return null===e};var o=i(50151),r=i(19844),n=i(35107),l=i(45530),a=i(96025),c=i(40472),d=i(87465),h=i(78176),u=i(23502),p=i(85082),y=i(72972),g=i(91111);const m=(0,o.ensureDefined)(g.lineToolsStudyIds.LineToolVbPFixed);function _(e,t,i,s){return t.styles&&(S(t.styles.developingPoc),S(t.styles.developingVAHigh),S(t.styles.developingVALow)),t}function S(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}function f(e){return!!e.childs().inputs.childs().extendToRight?.value()}class v extends n.StudyLineDataSource{constructor(e,t,i,s,o){super(e,i||(0,y.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:m}),"vbpfixed_",t??v.createProperties(e.backgroundTheme().spawnOwnership()),s,o),this._onVisibleBarsStrictRangeChanged=()=>{if(f(this.properties()))return;const e=this._getPointsetPoints();!this._isDataSourceStarted()&&null!==e&&this._isInVisibleTimeRange(e)&&this._onStudyInputsMayChange()},this._createPaneViews().then((e=>{this._setPaneViews(e),e.forEach((e=>e.update((0,c.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))))})),this.clearData(),this._model.timeScale().visibleBarsStrictRangeChanged().subscribe(this,this._onVisibleBarsStrictRangeChanged)}destroy(){this._model.timeScale().visibleBarsStrictRangeChanged().unsubscribe(this,this._onVisibleBarsStrictRangeChanged),super.destroy()}pointsCount(){return 2}boundToSymbol(){return!1}offset(e){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(e,t){
return(this.properties().childs().styles.childs()[e].childs().display.value()&t)===t}preferredZOrder(){return 0}static createProperties(e,t){const i=r.StudyMetaInfo.getStudyPropertyRootNameById(m),s=(0,o.ensureNotNull)((0,y.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:m})),n=(0,h.createDefaultsState)(!0,i,[],(0,y.studyMetaInfoRepository)().studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(s,s,(0,d.merge)((0,d.clone)(n),t??{}),(0,y.studyMetaInfoRepository)().studyVersioning(),e)}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s,o){const r=(0,u.prepareStudyPropertiesForLoadChart)(e,t,i,s,_,o);return this._configureProperties(r),r}static studyId(){return m}_studyInputs(e){if((0,o.assert)(2===e.length,"all the line tool points should be defined"),!this._isDataSourceStarted()&&!f(this.properties())&&!this._isInVisibleTimeRange(e))return null;const t=[...e].sort(((e,t)=>e.index-t.index)).map((e=>this._getPointTime(e,!1)));if(t.some(s))return null;const[i,r]=t,n=this.properties().childs(),l=this._model.mainSeries().bars().lastIndex(),[a,c]=e,d=Math.max(a.index,c.index);return{...n.inputs.state(),first_bar_time:1e3*i,last_bar_time:1e3*r,subscribeRealtime:l===d,mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_isReady(){return!(0,l.isStudyGraphicsEmpty)(this.graphics())}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(1861),i.e(5410),i.e(2745),i.e(7903),i.e(607)]).then(i.bind(i,34108))).StudyLineDataSourceDefinitionsViewModel}_onDataUpdated(){this._updateAnchors(),this.updateAllViews((0,c.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_updateAnchors(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}_calculateAnchors(){let e=null,t=null,i=null,o=null;if(this.graphics().hhists().forEach((s=>{s.forEach((s=>{const{priceLow:r,priceHigh:n,firstBarTime:l,lastBarTime:a}=s;(null===e||r<e)&&(e=r),(null===t||n>t)&&(t=n),null!==l&&(null===i||l<i)&&(i=l),(null===o||a>o)&&(o=a)}))})),!(s(e)||s(t)||s(o)||s(i)))return[{price:t,index:i},{price:e,index:o}]}_updateAnchorsPrice(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}async _createPaneViews(){const e=this._metaInfo,t=e.graphics,s=[],o=this._needExtendToBarsEnding();if(t.hhists){const{HHistPaneView:e}=await i.e(507).then(i.bind(i,70588)),t=this.properties().childs().graphics.childs().polygons?.childs();s.push(new e(this,this._model,void 0,t?.histBoxBg,o,(()=>this._getLeftIndex())))}if(t.horizlines){const{HorizLinePaneView:e}=await i.e(507).then(i.bind(i,65212));s.push(new e(this,this._model,void 0,o,(()=>this._getLeftIndex())))}return e.plots.length>0&&s.push(this._createStudyPlotPaneView(e.plots[0].id,o)),
e.plots.length>1&&s.push(this._createStudyPlotPaneView(e.plots[1].id,o)),e.plots.length>2&&s.push(this._createStudyPlotPaneView(e.plots[2].id,o)),s}_createStudyPlotPaneView(e,t){return new a.StudyPlotPaneView(this,this._model.mainSeries(),this._model,e,t)}_needExtendToBarsEnding(){return void 0!==this.metaInfo().defaults.inputs?.mapRightBoundaryToBarStartTime}static _configureProperties(e){super._configureProperties(e),e.setThemedColors((0,p.volumeProfileThemedColors)(e.childs().graphics.childs().polygons?.hasChild("histBoxBg")))}_getLeftIndex(){const e=this._getPointsetPoints();if(null===e)return null;const[t,i]=e;return t.index<i.index?t.index:i.index}_isInVisibleTimeRange(e){const t=this._model.timeScale().visibleBarsStrictRange();if(!t)return!1;if(e.some((e=>t.contains(e.index))))return!0;const[i,s]=e.sort(((e,t)=>e.index-t.index));return i.index<=t.firstBar()&&s.index>=t.lastBar()}}},85082:(e,t,i)=>{i.d(t,{volumeProfileThemedColors:()=>p});var s=i(49156);const{colorColdGray200:o,colorColdGray900:r,colorBerryPink400Alpha50:n,colorBerryPink400Alpha75:l,colorSkyBlue400Alpha50:a,colorSkyBlue400Alpha5:c,colorSkyBlue400Alpha75:d,colorSkyBlue500:h}=s.colors,u={val:[r,o],poc:[r,o],vah:[r,o],developingPoc:[r,o],developingVA:[h,h],valuesColor:[r,o],volumeColorUp:[a,a],volumeColorDown:[n,n],valueAreaColorUp:[d,d],valueAreaColorDown:[l,l],histogramBoxColor:[c,c]};function p(e){const t="graphics.horizlines",i="graphics.hhists",s=[{path:`${t}.pocLines.color`,colors:u.poc},{path:`${t}.vahLines.color`,colors:u.vah},{path:`${t}.valLines.color`,colors:u.val},{path:`${i}.histBars2.colors.0`,colors:u.volumeColorUp},{path:`${i}.histBars2.colors.1`,colors:u.volumeColorDown},{path:`${i}.histBars2.valuesColor`,colors:u.valuesColor},{path:`${i}.histBarsVA.colors.0`,colors:u.valueAreaColorUp},{path:`${i}.histBarsVA.colors.1`,colors:u.valueAreaColorDown},{path:`${i}.histBarsVA.valuesColor`,colors:u.valuesColor},{path:"styles.developingPoc.color",colors:u.developingPoc},{path:"styles.developingVAHigh.color",colors:u.developingVA},{path:"styles.developingVALow.color",colors:u.developingVA}];return e&&s.push({path:"graphics.polygons.histBoxBg.color",colors:u.histogramBoxColor}),s}}}]);