Files
ai/charting_library/bundles/311.947f88643d737f1f3163.js

4 lines
11 KiB
JavaScript

"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[311],{4865:(e,t,o)=>{function i(e,t){return e?.studyIds.has(t)??!1}o.d(t,{highlightContainsSource:()=>i})},97411:(e,t,o)=>{o.d(t,{AbstractFilledAreaPaneView:()=>p});var i=o(85842),l=o(57415),r=o(78792),s=o(21515),n=o(33812),a=o(59557),d=o(54025);function c(e,t){return Array.from({length:e},((e,o)=>({timePointIndex:o+t})))}function h(e,t,o){let i,l;const r=e.length;for(let s=t;s>=0&&s<r;s+=o){const t=e[s];if(void 0===i&&void 0!==t.plot1Value&&(i=s),void 0===l&&void 0!==t.plot2Value&&(l=s),void 0!==i&&void 0!==l)return s}return null}function u(e){return 0===e.type?`${e.color}`:`${e.color1}:${e.color2}:${e.coordinate1}:${e.coordinate2}`}const _={type:0,color:""};class p{constructor(e,t,o){this._isHlineFill=!1,this._bandAKey=null,this._bandBKey=null,this._colorPlotIndex=null,this._areaRenderer=new a.AreaBackgroundRenderer,this._dataInvalidated=null,this._viewportInvalidated=!1,this._plIndex1=null,this._plIndex2=null,this._items=[],this._colorAreas=new a.CachedMap,this._generateColor=(0,n.generateColorCached)(),this._source=e,this._model=t,this._fillGaps=!!o?.fillgaps,this._fillToIntersection=!!o?.fillToIntersection}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{e.sourceId===this._source.id()&&(this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData}))}}renderer(){return this._dataInvalidated?this._updateImplFull(this._dataInvalidated)&&(this._dataInvalidated=null,this._viewportInvalidated=!1):this._viewportInvalidated&&(this._updateImplLight(),this._viewportInvalidated=!1),this._areaRenderer}_minFirstBarIndex(){return-1/0}_priceScale(){return this._source.priceScale()}_firstValue(){return this._source.firstValue()}_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}_updateImplFull(e){if(this._areaRenderer.setData(null),this._dataInvalidated?.clearData&&(this._items=[]),!this._visible())return!1;if(null===this._priceScale())return!1;if(null===this._firstValue())return!1;const t=this._source.plots().plottableRange(),o=t.size();if(0===o)return!1;const l=this._source.offset(this._plotAId()),r=this._source.offset(this._plotBId()),n=Math.min(l,r),a=Math.max(l,r);let d=e.firstIndex;const h=o+(a-n)+1,u=this._plotIndex1(),_=this._plotIndex2();h!==this._items.length&&(void 0===d||0===this._items.length||d<this._items[0].timePointIndex+n?(d=void 0,this._items=c(h,1e10)):this._items=this._items.concat(c(h-this._items.length,1e10+this._items.length)))
;const p=this._colorPlotIndex,v=this._transparency(),m=void 0===d?t.fullRangeIterator():t.rangeIterator(d,(0,i.ensureNotNull)(t.lastIndex()));let g=void 0!==d?(0,s.lowerbound)(this._items,d+n,((e,t)=>e.timePointIndex<t))-n:-n;for(const e of m){const t=e.index+l,o=e.index+r,i=this._items[g+l],s=this._items[g+r];if(i.timePointIndex=t,s.timePointIndex=o,this._isHlineFill||(i.plot1Value=e.value[u]??void 0,s.plot2Value=e.value[_]??void 0),null!==p){const t=g+n-1;if(t>=0&&t<this._items.length){const o=this._items[t];let i;i=0===p.type?{type:0,colorIndexOrRgba:e.value[p.colorIndexOrRgba+1]}:{type:1,colorIndexOrRgba1:void 0===p.colorIndexOrRgba1?void 0:e.value[p.colorIndexOrRgba1+1],colorIndexOrRgba2:void 0===p.colorIndexOrRgba2?void 0:e.value[p.colorIndexOrRgba2+1],value1:void 0===p.valueIndex1?void 0:e.value[p.valueIndex1+1],value2:void 0===p.valueIndex2?void 0:e.value[p.valueIndex2+1]};const l=o.color=this._getColorByPlotValue(i)??void 0;void 0!==l&&(1===l.type?(l.color1=l.color1&&this._generateColor(l.color1,v),l.color2=l.color2&&this._generateColor(l.color2,v)):l.color=this._generateColor(l.color,v))}}g+=1}return this._updateImplLight(),!0}_updateImplLight(){if(!this._visible())return;const e=this._priceScale();if(null===e)return;const t=this._firstValue();if(null===t)return;if(0===this._items.length)return;let o;if(this._isHlineFill){const l=this._source.properties().bands[(0,i.ensureNotNull)(this._bandAKey)],r=this._source.properties().bands[(0,i.ensureNotNull)(this._bandBKey)];o={level1:e.priceToCoordinate(l.value.value(),t),level2:e.priceToCoordinate(r.value.value(),t)}}const n=this._model.timeScale(),d=n.visibleBarsStrictRange();if(null===d)return;const c=e.priceToCoordinateFn(t),p=this._transparency(),v=this._minFirstBarIndex(),m=Math.max(v,d.firstBar()),g=(0,s.lowerbound)(this._items,m,((e,t)=>e.timePointIndex<t));if(g>=this._items.length)return;const I=Math.min(this._items.length-1,(0,s.lowerbound)(this._items,d.lastBar(),((e,t)=>e.timePointIndex<t)));let f,x;this._isHlineFill?(f=v===m?g:Math.max(0,g-1),x=Math.min(this._items.length-1,I+1)):(f=v===m?g:h(this._items,g-1,-1)??g,x=h(this._items,I+1,1)??I);const b=this._colorAreas;b.invalidateCache();let P,C=null,y=null,w=null;const V=(e,t,o)=>{if(this._model.timeScale().barSpacing()<1||!this._fillToIntersection||void 0===P||void 0===P.xCoordinate||void 0===P.plot1Coordinate||void 0===P.plot2Coordinate||null===y||null===C||0===C.points1.length()||void 0===e||void 0===t)return;const i=new l.Point(P.xCoordinate,P.plot1Coordinate),s=new l.Point(P.xCoordinate,P.plot2Coordinate),n=new l.Point(o,e),a=new l.Point(o,t),d=(0,r.intersectLineSegments)(i,n,s,a);if(null!==d){const e=i.add(i.subtract(n).scaled(-d));y.addPoints1Point(C.points1.at(C.points1.length()-1).x,C.points1.at(C.points1.length()-1).y),y.addPoints2Point(C.points2.at(C.points1.length()-1).x,C.points2.at(C.points1.length()-1).y),y.addPoints1Point(e.x,e.y),y.addPoints1Point(e.x,e.y),C.points1.at(C.points1.length()-1).x=e.x,C.points1.at(C.points1.length()-1).y=e.y,C.points2.at(C.points2.length()-1).x=e.x,
C.points2.at(C.points2.length()-1).y=e.y}},S=this._commonColor();let A;1===S.type?(S.coordinate1=c(S.value1),S.coordinate2=c(S.value2),S.color1=S.color1&&this._generateColor(S.color1,p),S.color2=S.color2&&this._generateColor(S.color2,p)):S.color=this._generateColor(S.color,p);for(let e=f;e<=x;e+=1){const t=this._items[e],i=t.timePointIndex;let l,r;!this._fillGaps&&void 0!==A&&i-A>1&&(C=null),void 0!==o?(l=o.level1,r=o.level2):(l=t.plot1Coordinate=void 0===t.plot1Value?void 0:c(t.plot1Value),r=t.plot2Coordinate=void 0===t.plot2Value?void 0:c(t.plot2Value));const s=t.xCoordinate=n.indexToCoordinate(t.timePointIndex);if(t.color&&1===t.color.type&&(t.color.coordinate1=c(t.color.value1),t.color.coordinate2=c(t.color.value2)),this._fillGaps?void 0!==l||void 0!==r:void 0!==l&&void 0!==r){const o=null!==this._colorPlotIndex?t.color||_:S;if(V(l,r,s),R=o,!(null===(B=w)||null===R?B===R:0===B.type&&0===R.type?B.color===R.color:1===B.type&&1===R.type&&B.color1===R.color1&&B.color2===R.color2&&B.coordinate1===R.coordinate1&&B.coordinate2===R.coordinate2)||null===C){if(null!==C&&(void 0!==l&&C.addPoints1Point(s,l),void 0!==r&&C.addPoints2Point(s,r)),e===x)continue;w=o;const t=u(o),i=b.get(t)??new a.AreaBackgroundItemsGroup(o);y=C,C=i.newItem()??new a.AreaBackgroundItem,i.push(C),b.set(t,i)}void 0!==l&&C.addPoints1Point(s,l),void 0!==r&&C.addPoints2Point(s,r)}else this._fillGaps||(w=null,C=null,y=null);A=i,P=t}var B,R;b.delete(u(_));const k={barSpacing:this._model.timeScale().barSpacing(),colorAreas:b};this._areaRenderer.setData(k)}}},61874:(e,t,o)=>{o.d(t,{AreaBackgroundPaneView:()=>r});var i=o(85842),l=o(97411);class r extends l.AbstractFilledAreaPaneView{constructor(e,t){super(e,t)}_plotAId(){return(0,i.ensureDefined)(this._source.metaInfo().area)[0].name}_plotBId(){return(0,i.ensureDefined)(this._source.metaInfo().area)[1].name}_commonColor(){return{type:0,color:this._source.properties().areaBackground.backgroundColor.value()}}_transparency(){return this._source.properties().areaBackground.transparency?.value()??0}_visible(){return this._source.properties().areaBackground.fillBackground.value()}_getColorByPlotValue(e){return this._commonColor()}}},40180:(e,t,o)=>{o.d(t,{StudyPriceAxisView:()=>s});var i=o(85842),l=o(15269),r=o(82347);class s extends l.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t,this._isForceOverlay=!!this._source.metaInfo().isPlotForceOverlay(this._data.plotName)}update(e){"hover-change"!==e.type&&super.update(e)}isPlotHighlighted(){return!!this._source.hasHighlightedPlots()&&(0,i.ensureNotNull)(this._model.highlightedPlotInfo()).plotId===this._data?.plotName}_updateRendererData(e,t,o){e.visible=!1,t.visible=!1;const l=this._source.model(),s=this._isForceOverlay?l.mainSeries().priceScale():this._source.priceScale();if(null===s)return;if(!l.isPriceScaleVisible(s))return;const n=this._source.lastValueData(this._data.plotName,!1);if(n.noData)return;const a=l.timeScale().visibleBarsStrictRange(),d=l.mainSeries().bars().lastIndex();if(null===a||null===d)return;let c
;if(d<=a.lastBar()){o.background=(0,r.resetTransparency)(n.color),c=o.background;let i=n.color;"transparent"===i&&(i=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),o.textColor=this.generateTextColor(i),o.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1}else{const s=l.backgroundColorAtYPercentFromTop(n.coordinate/(0,i.ensureNotNull)(l.paneForSource(this._source)).height());o.background=s,o.textColor=(0,r.resetTransparency)(n.color),o.borderColor=(0,r.resetTransparency)(o.textColor),c=o.borderColor,e.borderVisible=!0,t.borderVisible=!0}o.coordinate=n.coordinate,this._showAxisLabel()&&(e.text=n.text,e.visible=!0),e.selectedMarkColor=this._model.selection().isSelected(this._source)&&!this._source.hasHighlightedPlots()||this.isPlotHighlighted()?c:void 0,this._updatePaneRendererData(t)}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotName,4)}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotName,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotName),e.visible=!0)}}},59793:(e,t,o)=>{function i(e,t){return l(e,t,t?["&amp;"]:["&"])}function l(e,t,o){const i=[["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#039;"],["'","&#39;"]];t&&i.forEach((e=>e.reverse()));let l=e;if(!e||!e.replace)return l;for(const e of i){const[t,i]=e;o&&-1!==o.indexOf(t)||(l=l.replace(new RegExp(t,"g"),i))}return l}o.d(t,{clean:()=>l,cleanButAmpersand:()=>i})},33812:(e,t,o)=>{o.d(t,{generateColorCached:()=>s});var i=o(4003),l=o(82347),r=o(19050);function s(e=1e3){const t=i.default.Cache;i.default.Cache=r.CircularCacheBuffer.bind(r.CircularCacheBuffer,e);const o=(0,i.default)(l.generateColor,((e,t,o)=>`${e}_${t}_${o}`));return i.default.Cache=t,o}}}]);