initial commit with charts and assistant chat

This commit is contained in:
2026-03-02 00:08:19 -04:00
commit d907c5765e
1828 changed files with 50054 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9378],{18348:(e,t,o)=>{o.d(t,{AbstractFilledAreaPaneView:()=>_});var i=o(50151),r=o(10555),l=o(48892),n=o(12217),s=o(3156),a=o(97126),d=o(50516);function c(e,t){return Array.from({length:e},((e,o)=>({timePointIndex:o+t})))}function u(e,t,o){let i,r;const l=e.length;for(let n=t;n>=0&&n<l;n+=o){const t=e[n];if(void 0===i&&void 0!==t.plot1Value&&(i=n),void 0===r&&void 0!==t.plot2Value&&(r=n),void 0!==i&&void 0!==r)return n}return null}function h(e){return 0===e.type?`${e.color}`:`${e.color1}:${e.color2}:${e.coordinate1}:${e.coordinate2}`}const p={type:0,color:""};class _{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,s.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 r=this._source.offset(this._plotAId()),l=this._source.offset(this._plotBId()),s=Math.min(r,l),a=Math.max(r,l);let d=e.firstIndex;const u=o+(a-s)+1,h=this._plotIndex1(),p=this._plotIndex2();u!==this._items.length&&(void 0===d||0===this._items.length||d<this._items[0].timePointIndex+s?(d=void 0,this._items=c(u,1e10)):this._items=this._items.concat(c(u-this._items.length,1e10+this._items.length)));const _=this._colorPlotIndex,v=this._transparency(),m=void 0===d?t.fullRangeIterator():t.rangeIterator(d,(0,i.ensureNotNull)(t.lastIndex()));let I=void 0!==d?(0,
n.lowerbound)(this._items,d+s,((e,t)=>e.timePointIndex<t))-s:-s;for(const e of m){const t=e.index+r,o=e.index+l,i=this._items[I+r],n=this._items[I+l];if(i.timePointIndex=t,n.timePointIndex=o,this._isHlineFill||(i.plot1Value=e.value[h]??void 0,n.plot2Value=e.value[p]??void 0),null!==_){const t=I+s-1;if(t>=0&&t<this._items.length){const o=this._items[t];let i;i=0===_.type?{type:0,colorIndexOrRgba:e.value[_.colorIndexOrRgba+1]}:{type:1,colorIndexOrRgba1:void 0===_.colorIndexOrRgba1?void 0:e.value[_.colorIndexOrRgba1+1],colorIndexOrRgba2:void 0===_.colorIndexOrRgba2?void 0:e.value[_.colorIndexOrRgba2+1],value1:void 0===_.valueIndex1?void 0:e.value[_.valueIndex1+1],value2:void 0===_.valueIndex2?void 0:e.value[_.valueIndex2+1]};const r=o.color=this._getColorByPlotValue(i)??void 0;void 0!==r&&(1===r.type?(r.color1=r.color1&&this._generateColor(r.color1,v),r.color2=r.color2&&this._generateColor(r.color2,v)):r.color=this._generateColor(r.color,v))}}I+=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 r=this._source.properties().bands[(0,i.ensureNotNull)(this._bandAKey)],l=this._source.properties().bands[(0,i.ensureNotNull)(this._bandBKey)];o={level1:e.priceToCoordinate(r.value.value(),t),level2:e.priceToCoordinate(l.value.value(),t)}}const s=this._model.timeScale(),d=s.visibleBarsStrictRange();if(null===d)return;const c=e.priceToCoordinateFn(t),_=this._transparency(),v=this._minFirstBarIndex(),m=Math.max(v,d.firstBar()),I=(0,n.lowerbound)(this._items,m,((e,t)=>e.timePointIndex<t));if(I>=this._items.length)return;const x=Math.min(this._items.length-1,(0,n.lowerbound)(this._items,d.lastBar(),((e,t)=>e.timePointIndex<t)));let f,g;this._isHlineFill?(f=v===m?I:Math.max(0,I-1),g=Math.min(this._items.length-1,x+1)):(f=v===m?I:u(this._items,I-1,-1)??I,g=u(this._items,x+1,1)??x);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 r.Point(P.xCoordinate,P.plot1Coordinate),n=new r.Point(P.xCoordinate,P.plot2Coordinate),s=new r.Point(o,e),a=new r.Point(o,t),d=(0,l.intersectLineSegments)(i,s,n,a);if(null!==d){const e=i.add(i.subtract(s).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}},A=this._commonColor();let B;1===A.type?(A.coordinate1=c(A.value1),A.coordinate2=c(A.value2),
A.color1=A.color1&&this._generateColor(A.color1,_),A.color2=A.color2&&this._generateColor(A.color2,_)):A.color=this._generateColor(A.color,_);for(let e=f;e<=g;e+=1){const t=this._items[e],i=t.timePointIndex;let r,l;!this._fillGaps&&void 0!==B&&i-B>1&&(C=null),void 0!==o?(r=o.level1,l=o.level2):(r=t.plot1Coordinate=void 0===t.plot1Value?void 0:c(t.plot1Value),l=t.plot2Coordinate=void 0===t.plot2Value?void 0:c(t.plot2Value));const n=t.xCoordinate=s.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!==r||void 0!==l:void 0!==r&&void 0!==l){const o=null!==this._colorPlotIndex?t.color||p:A;if(V(r,l,n),R=o,!(null===(S=w)||null===R?S===R:0===S.type&&0===R.type?S.color===R.color:1===S.type&&1===R.type&&S.color1===R.color1&&S.color2===R.color2&&S.coordinate1===R.coordinate1&&S.coordinate2===R.coordinate2)||null===C){if(null!==C&&(void 0!==r&&C.addPoints1Point(n,r),void 0!==l&&C.addPoints2Point(n,l)),e===g)continue;w=o;const t=h(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!==r&&C.addPoints1Point(n,r),void 0!==l&&C.addPoints2Point(n,l)}else this._fillGaps||(w=null,C=null,y=null);B=i,P=t}var S,R;b.delete(h(p));const k={barSpacing:this._model.timeScale().barSpacing(),colorAreas:b};this._areaRenderer.setData(k)}}},5605:(e,t,o)=>{o.d(t,{AreaBackgroundPaneView:()=>l});var i=o(50151),r=o(18348);class l extends r.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()}}},63670:(e,t,o)=>{o.d(t,{StudyPriceAxisView:()=>n});var i=o(50151),r=o(36281),l=o(52859);class n extends r.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t,this._isForceOverlay=!!this._source.metaInfo().isPlotForceOverlay(this._data.plotIndex)}update(e){"hover-change"!==e.type&&super.update(e)}_updateRendererData(e,t,o){e.visible=!1,t.visible=!1;const r=this._source.model(),n=this._isForceOverlay?r.mainSeries().priceScale():this._source.priceScale();if(null===n)return;if(!r.isPriceScaleVisible(n))return;const s=this._source.lastValueData(this._data.plotIndex,!1);if(s.noData)return;const a=r.timeScale().visibleBarsStrictRange(),d=r.mainSeries().bars().lastIndex();if(null!==a&&null!==d){if(d<=a.lastBar()){o.background=(0,l.resetTransparency)(s.color);let i=s.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 n=r.backgroundColorAtYPercentFromTop(s.coordinate/(0,i.ensureNotNull)(r.paneForSource(this._source)).height());o.background=n,o.textColor=(0,l.resetTransparency)(s.color),o.borderColor=(0,l.resetTransparency)(o.textColor),e.borderVisible=!0,t.borderVisible=!0}o.coordinate=s.coordinate,o.floatCoordinate=s.floatCoordinate,this._showAxisLabel()&&(e.text=s.text,e.visible=!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.plotIndex,4)}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},89323:(e,t,o)=>{function i(e,t){return r(e,t,t?["&amp;"]:["&"])}function r(e,t,o){const i=[["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#039;"],["'","&#39;"]];t&&i.forEach((e=>e.reverse()));let r=e;if(!e||!e.replace)return r;for(const e of i){const[t,i]=e;o&&-1!==o.indexOf(t)||(r=r.replace(new RegExp(t,"g"),i))}return r}o.d(t,{clean:()=>r,cleanButAmpersand:()=>i})},3156:(e,t,o)=>{o.d(t,{generateColorCached:()=>n});var i=o(59332),r=o(52859),l=o(16659);function n(e=1e3){const t=i.default.Cache;i.default.Cache=l.CircularCacheBuffer.bind(l.CircularCacheBuffer,e);const o=(0,i.default)(r.generateColor,((e,t,o)=>`${e}_${t}_${o}`));return i.default.Cache=t,o}}}]);