diff --git a/charting_library/ar-tv-locale.e012cb8f.js b/charting_library/ar-tv-locale.f0c7bba9.js similarity index 100% rename from charting_library/ar-tv-locale.e012cb8f.js rename to charting_library/ar-tv-locale.f0c7bba9.js diff --git a/charting_library/bundles/library.a70ecf079f22e76a3ae6.js b/charting_library/bundles/library.087f6aeafe9a1f8bd541.js similarity index 90% rename from charting_library/bundles/library.a70ecf079f22e76a3ae6.js rename to charting_library/bundles/library.087f6aeafe9a1f8bd541.js index 00297150..488fe99b 100644 --- a/charting_library/bundles/library.a70ecf079f22e76a3ae6.js +++ b/charting_library/bundles/library.087f6aeafe9a1f8bd541.js @@ -460,7 +460,7 @@ level6:r(1,Te,!0),level7:r(1.618,T,!1),level8:r(2.618,q,!1),level9:r(3.618,N,!1) style:l.Inside,median:{visible:!0,color:q,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},extendLines:!1,level0:r(.25,me,!1),level1:r(.382,ue,!1),level2:r(.5,pe,!0),level3:r(.618,le,!1),level4:r(.75,"#64b5f6",!1),level5:r(1,T,!0),level6:r(1.5,ee,!1),level7:r(1.75,ne,!1),level8:r(2,j,!1)},linetoolregressiontrend:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,styles:{upLine:{visible:!0,color:I,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2},downLine:{visible:!0,color:I,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2},baseLine:{visible:!0,color:Y,linestyle:CanvasEx.LINESTYLE_DASHED,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}},Re(TradingView.defaultProperties.chartproperties),Fe()}if(void 0===TradingView.defaultProperties["study_MA@tv-basicstudies"]&&(TradingView.defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{visible:!0,color:T,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0,title:"MA"}}}),void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={fontsize:10,borderColor:T,backColor:P,textColor:Le}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:!0,"S1/R1":!0,"S2/R2":!0,"S3/R3":!0,"S4/R4":!0,"S5/R5":!0},colors:{P:ve,"S1/R1":ve,"S2/R2":ve,"S3/R3":ve,"S4/R4":ve,"S5/R5":ve},widths:{P:1,"S1/R1":1,"S2/R2":1,"S3/R3":1,"S4/R4":1,"S5/R5":1}}}}if(void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:T,linewidth:2}),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t(z,!1),level1:t("#008000",!1),level2:t("#0000ff",!1),level3:t("#ff00ff",!1),level4:t("#0080ff",!0),level5:t(z,!0),level6:t("#008000",!0),level7:t("#0000ff",!0),level8:t("#ff00ff",!0)}),void 0===TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]&&(TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]={styles:{upLine:{visible:!0,color:I,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:I,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:Y,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba(153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_Compare@tv-basicstudies"]&&(TradingView.defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"}),void 0===TradingView.defaultProperties["study_Overlay@tv-basicstudies"]){TradingView.defaultProperties["study_Overlay@tv-basicstudies"]={style:a.STYLE_LINE,allowExtendTimeScale:!1,showPriceLine:!1,minTick:"default", candleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",wickUpColor:"#737375",wickDownColor:"#737375",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",wickUpColor:"#737375",wickDownColor:"#737375",barColorsOnPrevClose:!1},barStyle:{upColor:"#6ba583",downColor:"#d75442",barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},lineStyle:{color:be,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,priceSource:"close",styleType:a.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:T,color2:T,linecolor:T,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,priceSource:"close",transparency:95},baselineStyle:{baselineColor:Ae,topFillColor1:ke,topFillColor2:ke,bottomFillColor1:Ve,bottomFillColor2:Ve,topLineColor:Ee,bottomLineColor:De,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},columnStyle:{upColor:n(le,50),downColor:n(q,50),barColorsOnPrevClose:!0,priceSource:"close"},styles:{open:{visible:!0,color:z,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0},high:{visible:!0,color:z,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0},low:{visible:!0,color:z,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0},close:{visible:!0,color:z,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0}}}}for(var Oe=e.split("."),We=TradingView.defaultProperties,He=0;He1?h(e[r],t.slice(1),i):(e[r]&&e[r].setValue?e[r].setValue(i):e[r]=i,!0))}function d(e){i||y.logWarn("Path `"+e+"` does not exist.")}}function Re(e,t,i,s){window.__defaultsOverrides&&Ne(e,t,i,window.__defaultsOverrides,s)}function Oe(e,t){window.__settingsOverrides&&Ne(e,null,!1,window.__settingsOverrides,t)}function Fe(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach((function(t){e.test(t)&&Re(TradingView.defaultProperties[t],null,!1,t)}))}function We(e,t){return t?function(e,t){var i=Be(e);if(!window._UNIT_TESTS){var s=TradingView.clone(TVSettings.getJSON(e,null));if(function(e){var t=new Set(["linetoolregressiontrend"]);return e.startsWith("study_")||t.has(e)}(e)&&s&&function(e){if(!e)return!1;e=e.toString();var t=new RegExp("\\d+").exec(e);return null!==t&&t[0]===e}(s.version)){var r=s.inputs,n=t.updateStudyInputs(s.id,s.version,"last",r,null);s.inputs=n;var o=t.updateStudyState(s,s);s=o}TradingView.merge(i,s),Oe(i,e)}return i}(e,t):function(e){var t=Be(e) ;if(!window._UNIT_TESTS){var i=TradingView.clone(TVSettings.getJSON(e,null));if(i){TradingView.merge(t,i);const s=e.split(".");Oe(t,void 0===s[1]?e:s[1])}}return t}(e)}We.create=function(e,t){if(t){var i=Be(e);TradingView.defaultProperties[e]=Object.assign(t,i)}},We.remove=function(e){TradingView.defaultProperties[e]=void 0},TradingView.saveDefaults=function(e,t){void 0===t?TVSettings.remove(e):TVSettings.setJSON(e,t)},TradingView.factoryDefaults=Be,window.applyDefaultOverridesToLinetools=Fe,window.applyDefaultsOverrides=Re,window.applyPropertiesOverrides=Ne,window.defaults=We,t.applyDefaultOverridesToLinetools=Fe,t.applyDefaultsOverrides=Re,t.applyPropertiesOverrides=Ne,t.defaults=We,t.factoryDefaults=Be,t.saveDefaults=TradingView.saveDefaults},85733:(e,t,i)=>{"use strict";i.r(t),i.d(t,{toolIsCursor:()=>p,toolIsMeasure:()=>_,resetToCursor:()=>m,lockTimeAxisTime:()=>w,tool:()=>C,iconTool:()=>P,cursorTool:()=>T,isToolCreatingNow:()=>x,isToolEditingNow:()=>I,isToolMovingNow:()=>M,isDirectionalMovementActive:()=>L,createdLineTool:()=>A,continuedLineTool:()=>E,cancelledLineTool:()=>k,beenSetLineToolLastPoint:()=>D,startedMovingLineTool:()=>V,movedLineTool:()=>B,finishedMovingLineTool:()=>N,startedChangingLineTool:()=>R,changedLineTool:()=>O,finishedChangingLineTool:()=>F,removedLineTool:()=>W,finishedLineTool:()=>H,changedLineStyle:()=>z,copiedLineTool:()=>U,restoredLineTool:()=>j,restoredLineToolState:()=>G,isPointSelectedNow:()=>q,isStudyEditingNow:()=>Y,createLineTool:()=>X,continueLineTool:()=>Z,cancelLineTool:()=>J,setLineToolLastPoint:()=>Q,startMovingLineTool:()=>ee,moveLineTool:()=>te,finishMovingLineTool:()=>ie,startChangingLineTool:()=>se,changeLineTool:()=>re,finishChangingLineTool:()=>ne,removeLineTool:()=>oe,finishLineTool:()=>ae,changeLineStyle:()=>le,copyLineTool:()=>ce,restoreLineTool:()=>he,restoreLineToolState:()=>de,init:()=>_e,runOnDrawingStateReady:()=>me,properties:()=>ge,hideAllDrawings:()=>fe,hideAllIndicators:()=>ve,lockDrawings:()=>Se,hideMarksOnBars:()=>ye,drawOnAllCharts:()=>be,drawOnAllChartsMode:()=>we,lockTimeAxis:()=>Ce});var s=i(88537),r=i(32255),n=i(88564),o=i(59803),a=i(52714),l=i.n(a),c=i(2872),h=i.n(c),d=i(56840),u=i(76422);function p(e){return"cursor"===e||"arrow"===e||"dot"===e}function _(e){return"measure"===e}function m(e=!1){if(!e&&g){if(g.childs().stayInDrawingMode.value())return}C.setValue(T.value())}let g=null,f=null,v=null,S=null,y=null,b=null;const w=new(l()),C=new(l()),P=new(l()),T=new(l()),x=new(l())(!1),I=new(l())(!1),M=new(l())(!1),L=new(l())(!1),A=new(h()),E=new(h()),k=new(h()),D=new(h()),V=new(h()),B=new(h()),N=new(h()),R=new(h()),O=new(h()),F=new(h()),W=new(h()),H=new(h()),z=new(h()),U=new(h()),j=new(h()),G=new(h()),q=new(l())(!1),Y=new(l())(!1);function K(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}const $={value:!1},X=K(A,$),Z=K(E,$),J=K(k,$),Q=K(D,$),ee=K(V),te=K(B),ie=K(N),se=K(R),re=K(O),ne=K(F),oe=K(W),ae=K(H),le=K(z,$),ce=K(U,$),he=K(j),de=K(G);let ue=!1,pe=[];function _e(){ -ue||(C.setValue(d.getValue("chart.cursorPreference","cursor")),C.subscribe(e=>p(e)&&T.setValue(e),{callWithLast:!0}),T.subscribe(e=>{e&&d.setValue("chart.cursorPreference",e)}),g=new n.DefaultProperty("drawings"),f=(0,r.createPrimitiveProperty)(),v=(0,r.createPrimitiveProperty)(),S=(0,r.createPrimitiveProperty)(),y=(0,r.createPrimitiveProperty)(),b=(0,r.createPrimitiveProperty)(),f.setValue(!1),v.setValue(!1),S.setValue(!1),y.setValue(!1),b.setValue(!1),C.subscribe(()=>{(0,u.emit)("onSelectedLineToolChanged")}),P.subscribe(()=>{(0,o.saveDefaults)("linetoolicon",{...(0,o.defaults)("linetoolicon"),icon:P.value()})}),ue=!0,pe.forEach(e=>e()),pe=[])}function me(e){ue?e():pe.push(e)}function ge(){return(0,s.ensureNotNull)(g)}function fe(){return(0,s.ensureNotNull)(f)}function ve(){return(0,s.ensureNotNull)(v)}function Se(){return(0,s.ensureNotNull)(S)}function ye(){return(0,s.ensureNotNull)(y)}function be(){return ge().childs().drawOnAllCharts}function we(){return ge().childs().drawOnAllChartsMode}function Ce(){return(0,s.ensureNotNull)(b)}},77216:(e,t,i)=>{"use strict";i.d(t,{EnvironmentState:()=>r});var s=i(49483);class r{constructor(e,t=!1){this._shift=!1,this._mod=!1,this._alt=!1,void 0!==e&&(this._shift=Boolean(e.shiftKey),this._mod=Boolean((0,s.isMac)()?e.metaKey:e.ctrlKey),this._alt=Boolean(e.altKey)),this._isApiEvent=t}shift(){return this._shift}mod(){return this._mod}alt(){return this._alt}shiftOnly(){return this._shift&&!this._mod&&!this._alt}modOnly(){return this._mod&&!this._shift&&!this._alt}altOnly(){return this._alt&&!this._shift&&!this._mod}modShift(){return this._shift&&this._mod&&!this._alt}isApiEvent(){return this._isApiEvent}static create(e=!1,t=!1,i=!1){return new r({shiftKey:e,ctrlKey:t,metaKey:t,altKey:i})}}},19234:(e,t,i)=>{"use strict";function s(e){return"="+JSON.stringify(function e(t){return Object.keys(t).sort().reduce((i,s)=>("[object Object]"===Object.prototype.toString.call(t[s])?i[s]=e(t[s]):i[s]=t[s],i),{})}(e))}function r(e){return s(e)}function n(e){return"="===e[0]}function o(e){if(!n(e))return{symbol:e};try{return JSON.parse(e.slice(1))}catch(t){return{symbol:e}}}function a(e){return"string"==typeof e?e:a(e.symbol)}i.r(t),i.d(t,{encodeExtendedSymbolOrGetSimpleSymbolString:()=>r,isEncodedExtendedSymbol:()=>n,decodeExtendedSymbol:()=>o,unwrapSimpleSymbol:()=>a})},69147:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null}},7043:(e,t,i)=>{"use strict";i.d(t,{dateFormatFunctions:()=>p,availableDateFormats:()=>_,defaultDateFormat:()=>m});var s=i(28353),r=i(97098);const n={1:()=>(0,s.t)("Jan"),2:()=>(0,s.t)("Feb"),3:()=>(0,s.t)("Mar"),4:()=>(0,s.t)("Apr"),5:()=>(0,s.t)("May",{context:"short"}),6:()=>(0,s.t)("Jun"),7:()=>(0,s.t)("Jul"),8:()=>(0,s.t)("Aug"),9:()=>(0,s.t)("Sep"),10:()=>(0,s.t)("Oct"),11:()=>(0,s.t)("Nov"),12:()=>(0,s.t)("Dec")},o=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,a=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),l=(e,t)=>(0, +ue||(C.setValue(d.getValue("chart.cursorPreference","cursor")),C.subscribe(e=>p(e)&&T.setValue(e),{callWithLast:!0}),T.subscribe(e=>{e&&d.setValue("chart.cursorPreference",e)}),g=new n.DefaultProperty("drawings"),f=(0,r.createPrimitiveProperty)(),v=(0,r.createPrimitiveProperty)(),S=(0,r.createPrimitiveProperty)(),y=(0,r.createPrimitiveProperty)(),b=(0,r.createPrimitiveProperty)(),f.setValue(!1),v.setValue(!1),S.setValue(!1),y.setValue(!1),b.setValue(!1),C.subscribe(()=>{(0,u.emit)("onSelectedLineToolChanged")}),P.subscribe(()=>{(0,o.saveDefaults)("linetoolicon",{...(0,o.defaults)("linetoolicon"),icon:P.value()})}),ue=!0,pe.forEach(e=>e()),pe=[])}function me(e){ue?e():pe.push(e)}function ge(){return(0,s.ensureNotNull)(g)}function fe(){return(0,s.ensureNotNull)(f)}function ve(){return(0,s.ensureNotNull)(v)}function Se(){return(0,s.ensureNotNull)(S)}function ye(){return(0,s.ensureNotNull)(y)}function be(){return ge().childs().drawOnAllCharts}function we(){return ge().childs().drawOnAllChartsMode}function Ce(){return(0,s.ensureNotNull)(b)}},77216:(e,t,i)=>{"use strict";i.d(t,{EnvironmentState:()=>r});var s=i(49483);class r{constructor(e,t=!1){this._shift=!1,this._mod=!1,this._alt=!1,void 0!==e&&(this._shift=Boolean(e.shiftKey),this._mod=Boolean((0,s.isMac)()?e.metaKey:e.ctrlKey),this._alt=Boolean(e.altKey)),this._isApiEvent=t}shift(){return this._shift}mod(){return this._mod}alt(){return this._alt}shiftOnly(){return this._shift&&!this._mod&&!this._alt}modOnly(){return this._mod&&!this._shift&&!this._alt}altOnly(){return this._alt&&!this._shift&&!this._mod}modShift(){return this._shift&&this._mod&&!this._alt}isApiEvent(){return this._isApiEvent}static create(e=!1,t=!1,i=!1){return new r({shiftKey:e,ctrlKey:t,metaKey:t,altKey:i})}}},19234:(e,t,i)=>{"use strict";function s(e){return"="+JSON.stringify(function e(t){return Object.keys(t).sort().reduce((i,s)=>("[object Object]"===Object.prototype.toString.call(t[s])?i[s]=e(t[s]):i[s]=t[s],i),{})}(e))}function r(e){return s(e)}function n(e){return"="===e[0]}function o(e){if(!n(e))return{symbol:e};try{return JSON.parse(e.slice(1))}catch(t){return{symbol:e}}}function a(e){return"string"==typeof e?e:a(e.symbol)}i.r(t),i.d(t,{encodeExtendedSymbolOrGetSimpleSymbolString:()=>r,isEncodedExtendedSymbol:()=>n,decodeExtendedSymbol:()=>o,unwrapSimpleSymbol:()=>a})},69147:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null,studyFormatterFactory:null}},7043:(e,t,i)=>{"use strict";i.d(t,{dateFormatFunctions:()=>p,availableDateFormats:()=>_,defaultDateFormat:()=>m});var s=i(28353),r=i(97098);const n={1:()=>(0,s.t)("Jan"),2:()=>(0,s.t)("Feb"),3:()=>(0,s.t)("Mar"),4:()=>(0,s.t)("Apr"),5:()=>(0,s.t)("May",{context:"short"}),6:()=>(0,s.t)("Jun"),7:()=>(0,s.t)("Jul"),8:()=>(0,s.t)("Aug"),9:()=>(0,s.t)("Sep"),10:()=>(0,s.t)("Oct"),11:()=>(0,s.t)("Nov"),12:()=>(0,s.t)("Dec")},o=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,a=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),l=(e,t)=>(0, r.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),c=(e,t)=>n[o(e,t)](),h=(e,t)=>(0,r.numberToStringWithLeadingZero)(o(e,t),2),d=(e,t)=>(0,r.numberToStringWithLeadingZero)(a(e,t)%100,2),u=(e,t)=>(0,r.numberToStringWithLeadingZero)(a(e,t),4),p={"dd MMM 'yy":(e,t)=>`${l(e,t)} ${c(e,t)} '${d(e,t)}`,"MMM dd, yyyy":(e,t)=>`${c(e,t)} ${l(e,t)}, ${u(e,t)}`,"MMM dd":(e,t)=>`${c(e,t)} ${l(e,t)}`,"yyyy-MM-dd":(e,t)=>`${u(e,t)}-${h(e,t)}-${l(e,t)}`,"yy-MM-dd":(e,t)=>`${d(e,t)}-${h(e,t)}-${l(e,t)}`,"yy/MM/dd":(e,t)=>`${d(e,t)}/${h(e,t)}/${l(e,t)}`,"yyyy/MM/dd":(e,t)=>`${u(e,t)}/${h(e,t)}/${l(e,t)}`,"dd-MM-yyyy":(e,t)=>`${l(e,t)}-${h(e,t)}-${u(e,t)}`,"dd-MM-yy":(e,t)=>`${l(e,t)}-${h(e,t)}-${d(e,t)}`,"dd/MM/yy":(e,t)=>`${l(e,t)}/${h(e,t)}/${d(e,t)}`,"dd/MM/yyyy":(e,t)=>`${l(e,t)}/${h(e,t)}/${u(e,t)}`,"MM/dd/yy":(e,t)=>`${h(e,t)}/${l(e,t)}/${d(e,t)}`,"MM/dd/yyyy":(e,t)=>`${h(e,t)}/${l(e,t)}/${u(e,t)}`},_=Object.keys(p),m=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},1860:(e,t,i)=>{"use strict";i.d(t,{DateFormatter:()=>n});var s=i(69147),r=i(7043);class n{constructor(e="yyyy-MM-dd"){this._dateFormatFunc=r.dateFormatFunctions[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)}}},95792:(e,t,i)=>{"use strict";i.d(t,{DateTimeFormatter:()=>o});var s=i(64806),r=i(1860);const n={dateFormat:"yyyy-MM-dd",timeFormat:"%h:%m:%s",dateTimeSeparator:" "};class o{constructor(e={}){const t=Object.assign({},n,e);this._dateFormatter=new r.DateFormatter(t.dateFormat),this._timeFormatter=new s.TimeFormatter(t.timeFormat),this._separator=t.dateTimeSeparator}format(e){return`${this._dateFormatter.format(e)}${this._separator}${this._timeFormatter.format(e)}`}formatLocal(e){return`${this._dateFormatter.formatLocal(e)}${this._separator}${this._timeFormatter.formatLocal(e)}`}}},51264:(e,t,i)=>{"use strict";i.d(t,{LimitedPrecisionNumericFormatter:()=>r});var s=i(80643);class r{constructor(e=1){this._precision=e}format(e){(0,s.isNumber)(e)||(e=parseFloat(e));const t=e.toFixed(this._precision),i=Math.pow(10,-this._precision);return Math.max(parseFloat(t),i)+""}parse(e){const t=parseFloat(e);return isNaN(t)?{res:!1}:{res:!0,value:t,suggest:this.format(t)}}}},95505:(e,t,i)=>{"use strict";i.d(t,{NumericFormatter:()=>n});var s=i(97098),r=i(60521);class n{constructor(e){this._precision=e}format(e){return(void 0!==this._precision?e.toFixed(this._precision):n.formatNoE(e)).replace(".",s.formatterOptions.decimalSign)}parse(e){const t=e.replace(s.formatterOptions.decimalSign,".");let i=parseFloat(t);return this._precision&&(i=+i.toFixed(this._precision)),i}static formatNoE(e){if(!Number.isFinite(e))return String(e);const t=new r.Big(e);return t.lt(1)?t.toFixed():t.toString()}}},26811:(e,t,i)=>{ "use strict";i.d(t,{PercentageFormatter:()=>n});var s=i(97098),r=i(62820);class n extends s.PriceFormatter{constructor(e){super(e),this.type="percentage"}state(){const e=s.PriceFormatter.prototype.state.call(this);return e.percent=!0,e}parse(e){return e=e.replace("%",""),super.parse(e)}format(e,t,i,s,n=!0){const o=super.format(e,t,i,s,!1)+"%";return n?(0,r.forceLTRStr)(o):o}static serialize(e){return e.state()}static deserialize(e){return new n(e.priceScale)}}},97645:(e,t,i)=>{"use strict";i.d(t,{PipFormatter:()=>r});var s=i(97098);class r extends s.PriceFormatter{constructor(e,t,i,s){t||(t=1),"forex"!==i&&"cfd"!==i||!s?(super(1),this._isForex=!1):(super(s),this._isForex=!0),this._pipPriceScale=e,this._pipMinMove=t,this._pipMinMove2=s}format(e,t,i){let s=this._isForex?this._pipMinMove2:this._pipMinMove;return void 0===s&&(s=NaN),super.format(e*this._pipPriceScale/s,t,i)}}},97098:(e,t,i)=>{"use strict";i.r(t),i.d(t,{formatterOptions:()=>l,numberToStringWithLeadingZero:()=>c,isFormatterHasForexAdditionalPrecision:()=>h,PriceFormatter:()=>d});var s=i(28353),r=i(80643),n=i(62820);const o=(0,i(98125).getLogger)("Chart.PriceFormatter"),a=new RegExp(/^(-?)[0-9]+$/),l={decimalSign:".",decimalSignFractional:"'"};function c(e,t){if(!(0,r.isNumber)(e))return"n/a";if(!(0,r.isInteger)(t))throw new TypeError("invalid length");if(t<0||t>16)throw new TypeError("invalid length");if(0===t)return e.toString();return("0000000000000000"+e.toString()).slice(-t)}function h(e){return"hasForexAdditionalPrecision"in e}class d{constructor(e,t,i,n){if(this.type="price",this._formatterErrors={custom:(0,s.t)("Price format is invalid."),fraction:(0,s.t)("Fraction part is invalid."),secondFraction:(0,s.t)("Second fraction part is invalid.")},t||(t=1),(0,r.isNumber)(e)&&(0,r.isInteger)(e)||(e=100),e<0)throw new TypeError("invalid base");this._priceScale=e,this._minMove=t,this._minMove2=n,i&&void 0!==n&&n>0&&2!==n&&4!==n&&8!==n?o.logDebug("invalid minmove2"):(this._fractional=i,this.calculateDecimal())}isFractional(){return!!this._fractional}state(){return{fractional:this._fractional,fractionalLength:this._fractionalLength,minMove:this._minMove,minMove2:this._minMove2,priceScale:this._priceScale}}calculateDecimal(){if(this._fractionalLength=0,this._priceScale>0&&this._minMove>0){let e=this._priceScale;for(this._fractional&&this._minMove2&&(e/=this._minMove2);e>1;)e/=10,this._fractionalLength++}}format(e,t,i,s=!0,r=!0){let o,a="";return e<0?(a=!1===s?"":"−",e=-e):e&&!0===t&&(a="+"),o=this._fractional?a+this._formatAsFractional(e,i):a+this._formatAsDecimal(e,i),r?(0,n.forceLTRStr)(o):o}parse(e){return e=(e=(0,n.stripLTRMarks)(e)).replace("−","-"),this._fractional?this._minMove2?this._parseAsDoubleFractional(e):this._parseAsSingleFractional(e):this._parseAsDecimal(e)}hasForexAdditionalPrecision(){return!this._fractional&&10===this._minMove2}static serialize(e){return e.state()}static deserialize(e){return new d(e.priceScale,e.minMove,e.fractional,e.minMove2)}_formatAsDecimal(e,t){let i;t=t||0, i=this._fractional?Math.pow(10,this._fractionalLength||0):Math.pow(10,t)*this._priceScale/this._minMove;const s=1/i;let r;if(i>1)r=Math.floor(e);else{const t=Math.floor(Math.round(e/s)*s);r=0===Math.round((e-t)/s)?t:t+s}let n="";if(i>1){let s=parseFloat((Math.round(e*i)-r*i).toFixed(this._fractionalLength));s>=i&&(s-=i,r+=1);const o=void 0!==this._fractionalLength?this._fractionalLength:NaN;n=l.decimalSign+c(parseFloat(s.toFixed(this._fractionalLength))*this._minMove,o+t),n=this._removeEndingZeros(n,t)}return r.toString()+n}_getFractPart(e,t,i){const s=[0,5],r=[0,2,5,7],n=[0,1,2,3,5,6,7,8];return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===r[e]?-1:r[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}_formatAsFractional(e,t){const i=this._priceScale/this._minMove;let s=Math.floor(e),r=t?Math.floor(e*i)-s*i:Math.round(e*i)-s*i;r===i&&(r=0,s+=1);let n="";if(t){let o=(e-s-r/i)*i;o=Math.round(o*Math.pow(10,t)),n=c(o,t),n=this._removeEndingZeros(n,t)}if(!this._fractionalLength)throw new Error("_fractionalLength is not calculated");let o="";if(this._minMove2){const e=r%this._minMove2;r=(r-e)/this._minMove2;const t=c(r,this._fractionalLength),i=this._getFractPart(e,2,this._minMove2);o=t+l.decimalSignFractional+i}else r=this._getFractPart(r,1,this._priceScale),o=c(r*this._minMove,this._fractionalLength);return s.toString()+l.decimalSignFractional+o+n}_removeEndingZeros(e,t){for(let i=0;i=s||r<0)return{error:this._formatterErrors.fraction,res:!1};let n=i+r/s;return e&&(n=-n),{value:n,res:!0,suggest:this.format(n)}}return{error:this._formatterErrors.custom,res:!1}}_parseAsDoubleFractional(e){let t=a.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.format(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+l.decimalSignFractional+"([0-9]+)\\"+l.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=void 0!==this._minMove2?this._minMove2:NaN,r=this._priceScale/s,n=this._minMove2,o=this._patchFractPart(parseInt(t[3]),1,r),a=this._patchFractPart(parseInt(t[4]),2,n);if(o>=r||o<0)return{error:this._formatterErrors.fraction,res:!1};if(void 0!==n&&a>=n||a<0)return{error:this._formatterErrors.secondFraction,res:!1};let l=void 0!==n?i+o/r+a/(r*n):NaN @@ -681,7 +681,7 @@ items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this ;this._javaStudiesMetaInfo=this._javaStudiesMetaInfo.sort((e,t)=>{const i=e.description_localized||e.description,s=t.description_localized||t.description;return i>s?1:i{this._metaInfoQueryQueue.push({studyDescriptor:e,resolver:t})})}_enqueueJavaMetaInfoQuery(){return new Promise(e=>{this._javaMetaInfoQueryQueue.push({resolver:e})})}_processPendingMetaInfoQueries(){for(;this._metaInfoQueryQueue.length;){const e=this._metaInfoQueryQueue.shift();this.findById(e.studyDescriptor).then(e.resolver)}}_processPendingFullMetaInfoQueries(){for(;this._javaMetaInfoQueryQueue.length;){this._javaMetaInfoQueryQueue.shift().resolver(this._javaStudiesMetaInfo)}}_findStudyMetaInfo(e){return"java"===e.type?this._javaStudiesMetaInfo.find(t=>t.id===e.studyId)||null:this._pineMetaInfoCache.find(t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||(0,r.ensureDefined)(t.pine).version===e.pineVersion))||null}_makeNextRequestId(){return"metadata_"+this._nextRequestNumber++}_compilePine(e){throw new Error("unsupported")}}function d(e){e.description_localized=(0,s.t)(e.description,{context:"study"})}function u(e,t){const i=new(o())(t);(0,a.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex(e=>e.id===i.id);if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?l.Version.parse(t.pine.version):null,o=void 0!==i.pine?l.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1}return s&&i.createDefaults(),i}},45090:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProviderBase:()=>c});var s=i(50338),r=i(13933),n=i(28353);const o={NONE:"Default"},a=(0,n.t)("No volume data"),l=new Map;class c extends s.StatusProviderBase{constructor(e,t){super(t),this._source=e}getSplitTitle(){return this._source.titleInParts(!0,o,void 0,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(!0,o,void 0,!1)}: ${this.sourceStatusText()}`:`${this._source.title(!0,o,void 0,!1)} ${this.sourceStatusText()}`:this._source.title(!0,o,void 0,!1)}sourceStatusText(){return(0,r.convertStudyStatusToString)(this._source.status(),!0)}sourceStatusSolutionId(){const e=this._source.status();if(e.type===r.StudyStatusType.Error)return e.errorDescription.solution_id?e.errorDescription.solution_id:function(e){for(const t of Array.from(l.keys()))if(e.includes(t))return l.get(t)}(e.errorDescription.error)}errorStatus(){if(!this._source.isActualInterval()||this._source.isSymbolInvalid())return null;return this._source.status().type===r.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:this.sourceStatusSolutionId(),title:this.sourceStatusTitle()}:null}sourceStatusTitle(){const e=this._source.status() ;if(e.type===r.StudyStatusType.Error)return-1!==e.errorDescription.error.toLowerCase().indexOf("the data vendor doesn't provide volume data for this symbol.")?a:void 0}}},40529:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProvider:()=>n});var s=i(28353),r=(i(13933),i(45090));(0,s.t)("Fundamental studies are no longer available on charts");class n extends r.StudyStatusProviderBase{constructor(e,t){super(e,t),this._study=e}color(){return this._study.isFailed()||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":super.color()}sourceStatusText(){this._study.status();return super.sourceStatusText()}}},190:(e,t,i)=>{"use strict";i.d(t,{StudyStatusView:()=>r});var s=i(45058);class r extends s.StatusView{constructor(e){super(e.statusProvider())}color(){return this._statusProvider.color()}getSplitTitle(){return this._statusProvider.getSplitTitle()}update(){this._text=this._statusProvider.text()}}},13933:(e,t,i)=>{"use strict";i.r(t),i.d(t,{StudyStatusType:()=>n,convertStudyStatusToString:()=>o});var s=i(28353);const r=(0,s.t)("loading...");var n;function o(e,t){if(e.type===n.Loading)return t?r:"loading...";if(e.type===n.Error){const i=e.errorDescription,r=t?(0,s.t)(i.error):i.error;if(i.ctx){const e={};return Object.entries(i.ctx).forEach(([t,i])=>{e[t]=i.toString()}),r.format(e)}return r}return""}!function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(n||(n={}))},25270:(e,t,i)=>{"use strict";i.d(t,{StudyStub:()=>m});var s=i(190),r=i(22932),n=i(97098),o=i(2872),a=i.n(o),l=i(2015),c=i.n(l),h=i(45090);class d extends h.StudyStatusProviderBase{text(){return this._source.isActualInterval()?`${this._source.title()} ${this.sourceStatusText()}`:this._source.title()}}var u=i(13933);class p{getItems(){return[]}getValues(e){return[]}}const _=new(a());class m extends r.PriceDataSource{constructor(e,t,i){super(e),this._priceStep=.01,this._status={type:u.StudyStatusType.Undefined},this._statusChanged=new(a()),this._formatter=new n.PriceFormatter(100),this._origState=t,this._title=i;this._properties=new(c())({visible:!0}),this._statusView=new s.StudyStatusView(this)}properties(){return this._properties}statusView(){return this._statusView}legendView(){return null}state(e){return this._origState}setStatus(e){this._status=e,this._statusChanged.fire()}formatter(){return this._formatter}name(){return this._title}title(){return this._title}titleInParts(){return[this._title]}isFailed(){return this._status.type===u.StudyStatusType.Error}isLoading(){return this._status.type===u.StudyStatusType.Loading}setFailed(e){this.setStatus({type:u.StudyStatusType.Error,errorDescription:{error:e}}),this._model.updateSource(this)}isSymbolInvalid(){return!1}isActualInterval(){return!0}onIsActualIntervalChange(){return _}start(){}status(){return this._status}onStatusChanged(){return this._statusChanged}firstValue(){return null}currency(){return null}sessionId(){return this._model.mainSeries().sessionId()}sessionIdChanged(){return this._model.mainSeries().sessionIdChanged()}unit(){ return null}symbolSource(){return this._model.mainSeries()}valuesProvider(){return new p}statusProvider(e){return new d(this,this._model.properties().childs().scalesProperties.childs().textColor)}}},89027:(e,t,i)=>{"use strict";i.d(t,{StudyValuesProvider:()=>g});var s=i(93751),r=i(49483),n=i(68906),o=i(67337),a=i(71053),l=i(14291),c=i(85733),h=i(50993),d=i(99220),u=i(88129),p=i(57626);const _=r.CheckMobile.any(),m=o.enabled("hide_last_na_study_output");class g{constructor(e,t){this._emptyValues=[],this._colorProviders=new Map,this._study=e,this._model=t;const i=this._study.metaInfo().plots;i&&i.forEach((e,t)=>{if((0,h.isPlotWithTechnicalValues)(e))return;const i=e.id;this._emptyValues.push(function(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}(t,i,this._study.guiPlotName(i)));const s=(0,h.isOhlcPlot)(e)?e.target:i;this._colorProviders.set(s,(0,d.createStudyPlotColorProvider)(this._study.metaInfo(),this._study.properties(),s))})}getItems(){return this._emptyValues}getValues(e){const t=this._emptyValues.map(e=>({...e}));let i=null;const r=this._study.data().lastIndex();if(null!==r)for(const e of t){if(!this._study.properties().styles[e.id].visible.value())continue;const t=this._study.nearestIndex(r,a.PlotRowSearchMode.NearestLeft,e.index+1);if(void 0===t)continue;const s=t+this._study.offset(e.id);i=null!==i?Math.max(s,i):s}(null===e||null!==i&&e>i)&&(e=i);const o=this._hideValues(),l=this._study.isVisible()&&!o?p.notAvailable:"";for(const e of t)e.value=l;if(o)return t;m&&t.length&&(t[t.length-1].value="");const c=this._study.priceScale();if(!this._study.isVisible()||null===e||null===c||c.isEmpty()||this._model.timeScale().isEmpty())return t;const d=this._study.metaInfo().plots,_=(0,u.getPriceValueFormatterForSource)(this._study),g={};for(const i of t){let t=i.id;const o=this._study.properties().styles[t].visible.value();if(i.visible=o,!o)continue;const l=i.index,c=e-this._study.offset(t),u=null!==r&&c>r?a.PlotRowSearchMode.NearestLeft:a.PlotRowSearchMode.Exact,p=this._study.nearestIndex(c,u);if(void 0===p)continue;let m=g[t];if(void 0===m&&(m=this._study.getMinFirstBarIndexForPlot(t),Number.isFinite(m)&&(g[t]=m)),m>p)continue;const f=this._study.data().last(),v=this._study.data().valueAt(p)||(null!==f?f.value:null);if(null===v)continue;const S=v[l+1];if(!(0,s.isNumber)(S))continue;const y=S>0;i.value=_(S);const b=this._study.properties().styles[t];let w=b.color.value();const C=d[l];(0,h.isOhlcPlot)(C)?(t=C.target||t,w=this._study.properties().ohlcPlots[t].color.value()):(0,h.isArrowsPlot)(C)&&(w=y?b.colorup.value():b.colordown.value());let P=w;const T=this._colorProviders.get(t),x=T&&T.getPlotPointStyle(v);x&&((0,h.isArrowsPlot)(C)?(y&&void 0!==x.colors[5]&&(P=x.colors[5]),y||void 0===x.colors[6]||(P=x.colors[6])):void 0!==x.colors[0]&&(P=x.colors[0])),"transparent"===P&&(P=w),P=(0,n.resetTransparency)(P),i.color=P}return t}_hideValues(){return _&&(null===this._model.crossHairSource().pane||(0,l.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited())}}},69774:(e,t,i)=>{"use strict" -;i.d(t,{StudyBase:()=>ut});var s=i(16230),r=i(88537),n=i(28353),o=i(98125),a=i(49483),l=i(2872),c=i.n(l),h=i(51344),d=i(22932),u=i(69927),p=i(71053),_=i(67072),m=i.n(_),g=i(54376),f=i(95936),v=i(26179),S=i(22458);class y extends v.StudyDataWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update),this._study.properties().showLegendValues.subscribe(this,this.update)}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this),this._study.properties().showLegendValues.unsubscribeAll(this)}_createValuesProvider(e,t){return new S.StudyLegendValuesProvider(e,t)}}var b=i(85733),w=i(190),C=i(19234),P=i(72857),T=i(95836),x=i(40529),I=i(80643),M=i(95505),L=i(50993),A=(i(33266),i(67337)),E=i(86441),k=i(68906),D=i(94804);class V{constructor(e){this._data=e}draw(e,t){}drawBackground(e,t){e.save();const i=this._data,s=t.pixelRatio;let r=null;const n=Math.round(this._data.w*s);for(let t=0;t0){i.items[t-1].index===o.index-1&&null!==r&&(l=r+1)}const c=a+n,h=c-l+1;e.fillRect(l,Math.round(i.y*s),h,Math.round(i.h*s)),r=c}e.restore()}hitTest(e){return null}}var B=i(99220);class N{constructor(e,t,i,s){this._items=[],this._invalidated=!0,this._isMarkersEnabled=A.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=s;const n=this._study.metaInfo().plots;for(let e=0;egt});var s=i(16230),r=i(88537),n=i(28353),o=i(98125),a=i(49483),l=i(2872),c=i.n(l),h=i(51344),d=i(22932),u=i(69927),p=i(71053),_=i(67072),m=i.n(_),g=i(54376),f=i(95936),v=i(26179),S=i(22458);class y extends v.StudyDataWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update),this._study.properties().showLegendValues.subscribe(this,this.update)}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this),this._study.properties().showLegendValues.unsubscribeAll(this)}_createValuesProvider(e,t){return new S.StudyLegendValuesProvider(e,t)}}var b=i(85733),w=i(190),C=i(19234),P=i(72857),T=i(95836),x=i(40529),I=i(80643),M=i(95505),L=i(50993),A=(i(33266),i(67337)),E=i(86441),k=i(68906),D=i(94804);class V{constructor(e){this._data=e}draw(e,t){}drawBackground(e,t){e.save();const i=this._data,s=t.pixelRatio;let r=null;const n=Math.round(this._data.w*s);for(let t=0;t0){i.items[t-1].index===o.index-1&&null!==r&&(l=r+1)}const c=a+n,h=c-l+1;e.fillRect(l,Math.round(i.y*s),h,Math.round(i.h*s)),r=c}e.restore()}hitTest(e){return null}}var B=i(99220);class N{constructor(e,t,i,s){this._items=[],this._invalidated=!0,this._isMarkersEnabled=A.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=s;const n=this._study.metaInfo().plots;for(let e=0;e0?(i-=n,s+=n):(i+=n,s-=n);const o=this._study.getMinFirstBarIndexForPlot(this._plotName);if(o>s)return;i=Math.max(o,i);const a=this._study.data().rangeIterator(i,s);for(;a.hasNext();){const e=a.next();let i=e.index;const s=e.value;i+=n;const o=new E.Point(Math.floor(i)-.5,NaN);let l=(0,I.isNumber)(t)?t:50;l=Math.min(l,100),l=Math.max(l,0);const c=this._colorProvider.getPlotPointStyle(s);void 0!==c.colors[1]&&(o.color=(0,k.generateColor)((0,r.ensureDefined)(c.colors[1]),l)),o.index=i,this._items.push(o)}this._model.timeScale().timedValuesToCoordinates(this._items)}}var R,O,F=i(11372),W=i(41892),H=i(56138),z=i(64514),U=i(84346),j=i(85847),G=i(63948),q=i(31175),Y=i(34026),K=i(40236),$=i(52640),X=i(93435);!function(e){e.Left="left",e.Right="right",e.Center="center"}(R||(R={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(O||(O={}));const Z=(0,X.createDisconnectedCanvas)(document,new X.Size(0,0),1);class J{constructor(e,t,i,s,n,o="center",a=0){this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return(0,$.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,s,n),this._fontSize=n,this._verticalPadding=~~(n/6),this._textAlign=o,this._lineSpacing=a;const l=(0,r.ensureNotNull)(Z.getContext("2d"));l.font=this._font,l.textBaseline="top";let c=0;for(let e=0;e{for(const t of this._lines)e.fillText(t,l,c),c+=this._fontSize,c+=this._lineSpacing}),e.restore()}}class Q extends K.AbstractMapContainer{constructor(e){super(),this._maxSize=e,this._keysQueue=[]}get(e){const{fontSize:t,text:i,align:s,lineSpacing:r=0}=e;if(!i||!t||!s)return null;const n=(0,K.getDefault3)(this._map,r,s,t,new Map);let o=n.get(i);return void 0!==o||(this._size>=this._maxSize?this._deleteFirstKey():++this._size,this._keysQueue.push([t,s,r,i]),o=new J(i,e.bold,e.italic,e.font,t,s,r),n.set(i,o)),o}_deleteFirstKey(){const e=this._keysQueue.shift(),[t,i,s,n]=e,o=(0,r.ensureDefined)(this._map.get(s)),a=(0,r.ensureDefined)(o.get(i)),l=(0,r.ensureDefined)(a.get(t));l.delete(n),0===l.size&&a.delete(t),0===a.size&&o.delete(i), 0===o.size&&this._map.delete(s)}}var ee=i(22799);class te{constructor(e,t={skipRenderingOptimizations:!1}){this._items=[],this._barSpacing=0,this._vertOffset=0,this._textCache=t.textCache||new Q(5e3),this._drawOperation=t.skipRenderingOptimizations?this._drawWithoutOptimizations.bind(this):this._drawWithOptimizations.bind(this),null!==e&&this.setData(e)}draw(e,t){this._preDrawInit(),this._drawOperation(e,t)}hitTest(e){const t=U.HitTestResult.REGULAR;let i=null;for(const s of this._items){if(!s)continue;const r=this._calcBoundingBox(s);if(r&&(0,Y.pointInBox)(e,r)){const e={tooltip:this._getTooltip(s,r)};i=new U.HitTestResult(t,e)}}return i}setData(e){this._height=void 0!==e.height?e.height:e.width,this._width=void 0!==e.width?e.width:e.height,this._color=e.color,this._borderColor=e.borderColor,this._vertOffset=e.vertOffset||0,e.text&&(this._text=e.text,this._fontSize=e.fontSize,this._lineSpacing=e.lineSpacing,this._textColor=e.textColor,this._textAlign=e.textAlign||"center"),void 0!==e.items&&void 0!==e.barSpacing&&this.setItems(e.items,e.barSpacing)}setItems(e,t){this._setBaseData(e,t)}_calcBoundingBox(e){const t=e.vertOffset,i=this._getTextCache(e);if(!i)return;const s=i.textImageWidth,r=i.textImageHeight,n=s/2,o=e.y+t+e.textVertOffset,a=t>0?0:-r,l=t>0?r:0,c=new E.Point(e.x-n,o+a),h=new E.Point(e.x+n,o+l);return(0,E.box)(c,h)}_unionBox(e,t){const i=Math.min(e.min.x,t.min.x),s=Math.max(e.max.x,t.max.x),r=Math.min(e.min.y,t.min.y),n=Math.max(e.max.y,t.max.y),o=new E.Point(i,r),a=new E.Point(s,n);return(0,E.box)(o,a)}_getTooltip(e,t){if(e.tooltip)return{content:{type:"text",data:e.tooltip},tooltipDelay:200,extendMargin:!0,rect:{x:t.min.x,y:t.min.y,w:Math.abs(t.max.x-t.min.x),h:Math.abs(t.max.y-t.min.y)}}}_setBaseData(e,t){this._items.length=0,this._barSpacing=t;for(const t of e){const e=void 0===t.width?(0,r.ensureDefined)(this._width):t.width,i=void 0===t.height?(0,r.ensureDefined)(this._height):t.height,s=void 0===t.vertOffset?this._vertOffset:t.vertOffset,n=s>0?i:-i;this._items.push({width:e,height:i,vertOffset:s,textVertOffset:n,shapeWidth:0,shapeHeight:0,stepX:0,stepY:0,...t})}}_drawItemText(e,t,i){const s=this._getTextCache(i);if(null===s)return;const r=i.x,n=i.vertOffset,o=i.y+n+i.textVertOffset;let a;a=i.style&&void 0!==i.style.textColor?i.style.textColor:this._textColor,s.paintTo(e,t,a,r,o,R.Center,n>0?O.Top:O.Bottom)}_drawWithOptimizations(e,t){let i,s,r=null,n=!1;for(const o of this._items)o.style&&void 0!==o.style.color?(i=o.style.color||"rgba(0, 0, 0, 0)",s=o.style.borderColor||"rgba(0, 0, 0, 0)"):(i=this._color,s=this._borderColor),(r!==i||a.isSafari)&&(r=i,n&&this._endPath(e),this._startPath(e,t,i,s)),this._drawItemShape(e,t,o),n=!0;n&&this._endPath(e);for(const i of this._items)this._drawItemText(e,t,i)}_drawWithoutOptimizations(e,t){let i,s;for(const n of this._items){const o=(0,r.ensureDefined)(n.style);i=o.color||"rgba(0, 0, 0, 0)",s=o.borderColor||"rgba(0, 0, 0, 0)",this._startPath(e,t,i,s),this._drawItemShape(e,t,n),this._endPath(e),this._drawItemText(e,t,n)}}_drawItemShape(e,t,i){(0, X.drawScaled)(e,t.pixelRatio,()=>this._drawItemShapeUsingCSSPixels(e,i))}_drawItemShapeUsingCSSPixels(e,t){}_preDrawInit(){}_startPath(e,t,i,s){}_endPath(e){}_getTextCache(e){var t;const i=e.text||this._text,s=e.fontSize||this._fontSize,r=null!==(t=e.lineSpacing)&&void 0!==t?t:this._lineSpacing,n=e.textAlign||this._textAlign;return this._textCache.get({text:i,bold:!1,italic:!1,font:ee.CHART_FONT_FAMILY,fontSize:s,lineSpacing:r,align:n})}}class ie extends te{_startPath(e,t,i,s){e.beginPath(),e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.strokeStyle=i}_endPath(e){e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(2*e.pixelRatio))}}class se extends te{_startPath(e,t,i,s){e.beginPath(),e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.fillStyle=i,e.strokeStyle=s}_endPath(e){e.fill(),e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(e.pixelRatio))}}class re extends se{constructor(){super(...arguments),this._sign=0,this._thinArrow=!1,this._thinArrowLineWidth=0,this._headHeight=0,this._arrowWidth=0}setItems(e,t){this._setBaseData(e,t)}_drawItemShape(e,t,i){const s=t.pixelRatio,r=this._lineWidth(t)%2?.5:0,n=this._sign,o=this._arrowWidth,a=this._headHeight,l=Math.abs(i.height),c=Math.round(i.x*s)+r,h=i.vertOffset,d=Math.round((i.y+h+n*l/2)*s)+r,u=(0,z.ceiledEven)(o*s),p=u/2,_=Math.round(l*s),m=Math.round(a*s);e.translate(c,d),this._thinArrow?(e.moveTo(0,0),e.lineTo(-p,-p*n),e.moveTo(0,0),e.lineTo(p,-p*n),e.moveTo(0,0),e.lineTo(0,-_*n),e.moveTo(-p,-_*n),e.lineTo(p,-_*n)):(e.moveTo(0,0),_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 s=this._source.priceScale(),n=this._model,o=n.timeScale();if(!s||s.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[(0,r.ensureNotNull)(this._bandAKey)],t=this._source.properties().bands[(0,r.ensureNotNull)(this._bandBKey)];this._level1=s.priceToCoordinate(e.value.value(),a),this._level2=s.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,u=this._source.offset(this._plotAId()),p=this._source.offset(this._plotBId()),_=Math.min(u,p),m=Math.max(u,p),g=this._plotIndex1(),f=this._plotIndex2(),v=this._source.data();if(v.isEmpty())return;let S,y;const b=(0,r.ensureNotNull)(v.firstIndex()),w=(0,r.ensureNotNull)(v.lastIndex()),C=b-Math.max(0,-_),P=w+Math.max(0,m),T=Math.max(c-1,C),x=Math.min(h+1,P),M=this._studyValuesCache;M.invalidateCache();const L=T-m,A=v.rangeIterator(L,x-_),E=Math.max(l.firstBar()-1,Math.min(L-m-1,L-1+_));M.setStartIndex(E);const k=new We.BarsRange(l.firstBar()-1,l.lastBar()+1);for(;A.hasNext();){const e=A.next(),t=e.index,i=e.value,s=i[g],n=i[f],o=t+u,a=t+p;if(o===a&&k.contains(o)){const e=M.at(o);e.plot1Value=s,e.plot2Value=n}else{if(k.contains(o)){M.at(o).plot1Value=s}if(k.contains(a)){ M.at(a).plot2Value=n}}if(null!==d){const e=t-1+_;if(l.contains(e)){const t=i[(0,r.ensureNotNull)(this._colorPlotIndex)+1];M.at(e).colorIndex=t}}}const D=this._timePoints,V=this._points1,B=this._points2;let N=null;const R=E+M.length();for(let e=E;e<=R;e++){if(!this._fillGaps&&(null===S||null===y)){const t=e-1;D.push(t),V.push(NaN),B.push(NaN),null==d||d.push(null)}const s=M.at(e);if(null!==d){const e=s.colorIndex;N=null==e?null:this._getColorByPlotValue(e)}if(this._isHlineFill){D.push(e),null!==d&&d.push(N);continue}const r=null!==(t=s.plot1Value)&&void 0!==t?t:null,n=null!==(i=s.plot2Value)&&void 0!==i?i:null;(null!==r||null!==n||Number.isFinite(S)||Number.isFinite(y))&&(S=r,y=n,V.push(r),B.push(n),D.push(e),null!==d&&d.push(N))}s.pricesArrayToCoordinates(V.data(),a,V.length()),s.pricesArrayToCoordinates(B.data(),a,B.length()),o.indexesToCoordinates(D.data(),D.length());const O=this._transparency();let F=(0,I.isNumber)(O)?O:50;F=Math.min(F,100),F=Math.max(F,0);const W={barSpacing:this._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 Re;const n=this._colorAreas;let o=null,a=null;const l=this._color();for(let c=0;c{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)})}}var Xe=i(13933),Ze=i(36759),Je=i(23653),Qe=i(33291),et=i(52714),tt=i.n(et),it=i(37667),st=i(8175);const rt=(0,o.getLogger)("Chart.Study"),nt=(0,n.t)("Invalid Symbol");const ot={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:A.enabled("dont_show_boolean_study_arguments"),asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!0,priceInputsForDisplay:!1},at=A.enabled("study_symbol_ticker_description"),lt=A.enabled("hide_main_series_symbol_from_indicator_legend");function ct(e,t){const i=e.plots[t];if(!i||!(0,L.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,L.isOhlcPlotStyleBars)(r)||n&&(0,L.isOhlcPlotStyleBars)(n)||!!o&&(0,L.isOhlcPlotStyleBars)(o)}function ht(e,t){const i=e.plots[t];if(!i||!(0,L.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,L.isOhlcPlotStyleCandles)(r)||n&&(0,L.isOhlcPlotStyleCandles)(n)||!!o&&(0,L.isOhlcPlotStyleCandles)(o)}function dt(e,t){(0,r.assert)(void 0!==e,"zOrder must be defined"),(0,r.assert)(!t.has(e),"zOrder must be unique")}class ut extends d.PriceDataSource{constructor(e,t,i,s){super(e),this.onStart=new(c()),this._onHibernationStateChange=new(c()),this._symbolsResolved=new(c()),this._statusChanged=new(c()),this._paneViews=[],this._legendView=null,this._priceAxisViews=[],this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={},this._source=null,this._isChildStudy=!1,this._status={ -type:Xe.StudyStatusType.Undefined},this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._numericFormatter=new M.NumericFormatter,this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._labelPaneViews=[],this._ownFirstValue=null,this._plotOffsets={},this._formatter=null,this._ongoingDataUpdate=Promise.resolve(),this._studyModified=!1,this._isDestroyed=!1,this._graphics=new g.LiveStudyGraphics,this._tagsChanged=new(c()),this._currencySourceSymbolInputProperty=null,this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new(c()),this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new(tt())(0),this._currencySourceSymbolInfo=null,this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),i instanceof ut&&(this._source=i,this._isChildStudy=!0,this._source.setChild(this));const r=this.parentSource();r.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),r.unitChanged().subscribe(this,this._onSourceUnitChanged),r.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),r.formatterChanged().subscribe(this,this._onSourceFormatterChanged),r.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),at&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,()=>{this.invalidateTitleCache(!0)}),this._properties.subscribe(this,this._onPropertiesChanged),this._properties.visible.subscribe(this,this._visibleChanged),this._properties.visible.subscribe(this,this.processHibernate),this._properties.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),this._properties.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offsets&&this._properties.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offset&&this._properties.offset.listeners().subscribe(this,this._updateMaxOffsetValue),this._initializeCurrencySource(),b.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;e=0?e:0}}return this._isChildStudy&&m().patchChildStudyMetaInfoState(l),l}restoreData(e){var t,i -;this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=null!==(t=e.symbols)&&void 0!==t?t:{},this._graphics=e.graphics?(0,g.loadStudyGraphics)(e.graphics):(0,g.emptyStudyGraphics)(),this._postProcessGraphics(),this._plotOffsets=null!==(i=e.plotOffsets)&&void 0!==i?i:{},this._setStatus({type:Xe.StudyStatusType.Completed},!0)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}hasBarColorer(){return(0,r.ensureNotNull)(this._metaInfo).plots.some(L.isBarColorerPlot)}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}isChildStudy(){return this._isChildStudy}hasChildren(){return this._children.length>0}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){if(this._model.collapsed().value()||!this.properties().visible.value()||!this.isActualInterval())return!1;const e=this.metaInfo();if(e.plots.length>0)return!0;for(const t of Object.keys(e.graphics))for(const i of Object.keys(e.graphics[t])){const e=this.properties().graphics[t][i];if(!e.visible||e.visible.value())return!0}return!(!e.isTVScriptStrategy&&!e.hasAlertFunction)}inputs(e){const t=(0,I.merge)((0,I.clone)(ot),e||{});return t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0),this._buildInputs(t)}metaInfo(){return this._metaInfo}status(){return this._status}name(e){return e?this.metaInfo().shortDescription||this._properties.shortDescription&&this._properties.shortDescription.value()||"Study":this.metaInfo().description||this._properties.description&&this._properties.description.value()||"Study"}title(e,t,i,s){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const r=JSON.stringify([e,t,i,s]);if(this._titleStrCache[r])return this._titleStrCache[r];if(this._titleInPartsCache[r])return this._joinTitlesParts(this._titleInPartsCache[r]);const n=this._title(e,t,i,s);return this._titleStrCache[r]=n,n}titleInParts(e,t,i,s){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const r=JSON.stringify([e,t,i,s]);if(this._titleInPartsCache[r])return this._titleInPartsCache[r];const n=this._titleInParts(e,t,i,s);return this._titleInPartsCache[r]=n,n}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e)),this._labelPaneViews.forEach(t=>t.update(e)),null===(t=this._dataWindowView)||void 0===t||t.update(),null===(i=this._legendView)||void 0===i||i.update(),null===(s=this._statusView)||void 0===s||s.update(),this._priceAxisViews.forEach(t=>t.update(e)),this._priceLinesAxisViews.forEach(t=>t.update(e)),null===(r=this._inputsLinesPaneView)||void 0===r||r.update(e),null===(n=this._inputsAnchorsPaneView)||void 0===n||n.update(e),this._inputsTimeAxisPaneViews.forEach(t=>t.update(e)),this._inputsPriceAxisPaneViews.forEach(t=>t.update(e))}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&m().isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}currency(){if(null!==this._currencySourceSymbolInfo)return(0,it.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this.parentSource().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this.parentSource().unit():null}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}inputsForAlertState(){return this.inputs()}sessionId(){return this.parentSource().sessionId()} -sessionIdChanged(){return this.parentSource().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,C.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return new S.StudyLegendValuesProvider(this,this.model())}statusProvider(e){return new x.StudyStatusProvider(this,this._model.properties().childs().scalesProperties.childs().textColor)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&b.hideAllIndicators().value()}paneViews(e){if(this.isSourceHidden()||!e.hasPriceDataSource(this))return null;const t=[];return!this._startMovingPoint&&this._wasCompletedBefore&&t.push(...this._paneViews),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&t.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&t.push(this._inputsAnchorsPaneView),t}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){if(this.properties().oldShowLastValue&&!this.properties().oldShowLastValue.value())return null;let i=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(i=i.concat(this._inputsPriceAxisPaneViews)),e.findTargetPriceAxisViews(this,t,i,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e,this.stop()}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,Qe.dataSourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,this.start(),{indexesChanged:!1,pricesChanged:!1}}clearData(){var e;this._invalidateLastNonEmptyPlotRowCache(),this.data().clear(),this._graphics instanceof g.LiveStudyGraphics&&(null===(e=this._graphics)||void 0===e||e.clear()),this._plotOffsets={},this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,Qe.dataSourceChangeEvent)(this.id(),void 0,!0))}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._isChildStudy&&(0,r.ensureNotNull)(this._source).processHibernate(),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate();this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){ -return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every(e=>e.isHibernationAllowed()))}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,Qe.dataSourceChangeEvent)(this.id())),this._model.updateSource(this)}maxOffset(){return this._maxOffset}_transformData(e){}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,r.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,r.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){throw new Error("Not implemented")}isHibernated(){return!this.isVisible()&&!this.isStarted()}_createViews(){var e,t;this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._paneViews=[],this._labelPaneViews=[];const i=new Set,s=this.metaInfo(),n=Boolean(s.usePlotsZOrder),o=new Map;if(s.plots)for(let t=0;t{const i=this._properties.bands[t];if(i&&i.visible.value()){const t=new qe(i,this),s=n?(0,r.ensureDefined)(e.zorder):o.size;dt(s,o),o.set(s,{paneViews:[t]})}}),this._properties.bandsBackground&&((0,r.assert)(!n,"'usePlotsZOrder' flag does not supported"),o.set(o.size,{paneViews:[new Ke(this)]}));const a=this._paneViews;(0,g.createGraphicsPaneViews)(this,this.model()).then(e=>{for(let t=0;ts.plots.some(t=>(0,L.isColorerPlot)(t)&&t.target===e) -;if(this._properties.filledAreas&&s.filledAreas)for(let e=0;ee-t);for(let e=0;e0){const t=this.barColorer().firstColoredBar(e[0].index);this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);this._model.recalculatePane(r,(0,Qe.dataSourceChangeEvent)(this.id(),null!=s?s:void 0)),this._updateSources()}_updateSources(){this._model.updateSource(this), -this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}_titleInputs(e,t){return this.inputs(this._titleInputsOptions(e,t))}_titleInputsOptions(e,t){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!1,skippedGroups:[],noExchanges:e,noResolution:t,skipColorInputs:!0,skipTimeInputs:!0,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:lt}}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_unsubscribeToSessionId(){this._isSubscribedToSessionId&&(this.sessionIdChanged().unsubscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!1)}_onSessionIdChanged(){this.restart(!0)}_title(e,t,i,s){const r=this._titleInParts(e,t,i,s);return this._joinTitlesParts(r)}_postProcessPriceRange(e){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new u.PriceRange(e.minValue()-t,e.maxValue()+t)}const t=this.priceScale();return t&&t.isLog()&&e?new u.PriceRange(t.priceToLogical(e.minValue()),t.priceToLogical(e.maxValue())):e}_joinTitlesParts(e){const t=e[1]?e[1].join(", "):"";return e[0]+(t.length>0?" ("+t+")":"")}_titleInParts(e,t,i,s){var r;const o=this.name(e);t=t||{};const a=[(0,n.t)(o,{context:"study"})];let l=[];if(!i){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&a.push(i);const n=this.metaInfo(),o=this._titleInputs(s,!0)||[];if(o.length>0){const i={};if(this._isChildStudy)for(let t=0;t=0&&this._source){const t=this._source.metaInfo(),n=this._source.title(e,{},!0,s);if(1===t.plots.length)i[l]=n;else{const e=l.split("$")[1],s=null===(r=t.plots[parseInt(e)])||void 0===r?void 0:r.id,o=t.styles&&t.styles[s],a=o&&o.title||s;i[l]=n+": "+a}}break}l=o.map(e=>{let s=(0,I.isNumber)(e)?this._numericFormatter.format(e):i&&i[e.toString()]||e.toString();return t&&t[s.toString()]&&(s=t[s.toString()]),s})}}return[a.join(" · "),l]}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;t"line"===e.type)}_hasAlertConditions(){if(this.metaInfo().plots.some(L.isAlertConditionPlot))return!0;const e=this.stateForAlert();return Boolean(e.alerts&&e.alerts.conditions)}_hasAlertFunction(){const e=this.metaInfo();return Boolean(e.hasAlertFunction)}_onDataUpdate(e,t){this._studyModified&&(this.clearData(),this._studyModified=!1);const i=(0,h.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then(()=>i,()=>i).then(this._onDataUnpacked.bind(this,e,t.indexes)),this._ongoingDataUpdate}_mergeData(e){var t,i;return this._invalidateLastNonEmptyPlotRowCache(), -null!==(i=null===(t=this.data().merge(e))||void 0===t?void 0:t.index)&&void 0!==i?i:null}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_allSymbolsAreResolved(){const e=this.metaInfo(),t=[];let i=!1;for(let s=0;sthis._symbolsResolved.fire()):e}return Promise.all(t).catch(e=>(this._setStatus({type:Xe.StudyStatusType.Error,errorDescription:{error:nt}}),this.stop(!0),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e))).then(()=>{null!==this._studyId&&this.stop(!0),this.start(!0),this._symbolsResolved.fire(),this._recheckLineToolsActuality()})}_getSymbolForApi(e){return e}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise((i,s)=>{this._onSymbolResolvingStart(),this._chartApi.resolveSymbol((0,P.makeNextSymbolId)(),e,r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":this._setStatus({type:Xe.StudyStatusType.Undefined}),this._resolvedSymbols[e]=r.params[1],this._resolvedSymbolsByInput[t]=r.params[1],this._onSymbolResolved(e,t,r.params[1]),this.invalidateTitleCache(!0),i();break;case"symbol_error":if(this._setStatus({type:Xe.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===T.permissionDenied&&r.params[2])switch(r.params[2]){case T.SymbolErrorPermissionDeniedReason.Symbol:if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i);break;default:return void this._resolveSymbol(r.params[2],t).then(i)}0,s()}})}),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach(e=>{e.ownerSource()===this&&e.calcIsActualSymbol()})}_getSymbolObject(e){const t={symbol:e},i=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){this._onCurrencyMayChange()}_onSymbolResolvingStart(){}_onSymbolError(){}_setStatus(e,t){var i;this._status=e,e.type===Xe.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==Xe.StudyStatusType.Error&&e.type!==Xe.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(e))}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;ivoid 0!==i[e],1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)}_onCurrencyChanged(){"alwaysOff"!==(0,st.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_tryChangeInputs(){const e=(0,r.ensureDefined)((0,I.clone)(this._inputs));this.isStarted()&&this._chartApi.isConnected().value()?this._allInputsAreValid()?this._allSymbolsAreResolved().then(()=>{const t=this.inputs({keepOptionalSymbolsEmpty:!0}),i=JSON.stringify(t)!==JSON.stringify(this._inputs);this._isStopped()?i&&this.disablePriceRangeReady():i&&(this._changeInputsImpl(t,e),this._inputs=t)}).catch(e=>{rt.logError("ERROR: "+this._debugId()+" _tryChangeInputs: cannot modify study, "+e)}):this.stop():(this.stop(!0),this.start(!0)),this._tagsChanged.fire()}_debugId(){const e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,i){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(i),this._transformData(e);const s=this._mergeData(e);null!==i&&(i.indexes_replace?((0,r.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds,this._metaInfo.graphics))),this._onDataUpdated(e,i,t,s),this.priceRangeReady()||this._enablePriceRangeReady()}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._plotOffsets -;this._plotOffsets=e&&e.offsets||{},(0,s.default)(t,this._plotOffsets)||this.updateAllViews((0,Qe.dataSourceChangeEvent)(this.id(),void 0,!0)),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){const r=s.id,n=this.properties().styles[r],o=(0,L.isShapesPlot)(s)||(0,L.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,L.isArrowsPlot)(s);let a=(0,L.isLinePlot)(s)||(0,L.isOhlcPlot)(s);if(o){const e=n.location.value(),t=[f.MarkLocation.Absolute,f.MarkLocation.Top,f.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||o&&t,a=a||e===f.MarkLocation.Absolute}if(!a)return i;const l={name:r,offset:this.offset(r)},c=n.plottype.value();if(!this.properties().skipHistogramBaseOnAutoScale&&[L.LineStudyPlotStyle.Histogram,L.LineStudyPlotStyle.Columns,L.LineStudyPlotStyle.Area].indexOf(c)>=0){const s=n.histogramBase.value(),r=this.data().minMaxOnRangeCached(e,t,[l]);return(0,I.isNumber)(s)&&null!==r&&(i.baseValueMinMax=(0,p.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,p.mergeMinMax)(i.baseValueMinMax,r)),i}return i.fields.push(l),i}_fillPrecalculatedAutoscaleInfo(e,t){return this._metaInfo.plots.filter(e=>!(0,L.isPlotWithTechnicalValues)(e)).filter(e=>{const t=e.id;let i;if((0,L.isOhlcPlot)(e)){const t=e.target;i=this.properties().ohlcPlots[t]}else i=this.properties().styles[t];return i.visible.value()}).reduce((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_buildInputs(e){(0,r.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){rt.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach(i=>{null!=t[i]&&(e[i]=t[i])}),e}{const e=[];return Object.keys(t).forEach(i=>{null!=t[i]&&e.push(t[i])}),e}}_prepareInput(e,t){const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return[]}_dependenciesForAlerts(){throw new Error("Not implemented")}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,Ze.isActualInterval)(this._series.intervalObj(),this.properties().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this.source();if(e instanceof ut){const t=e.metaInfo();return t.is_price_study&&"Compare@tv-basicstudies"!==t.id?e._getNonPriceParent():e}return null}_updateInputValue(e,t){const i=this._properties.inputs;if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){var e;null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=null!==(e=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()])&&void 0!==e?e:null)} -_initializeCurrencySource(){var e,t;const i=this.metaInfo(),s="symbolInputSymbolSource"===(null===(e=i.symbolSource)||void 0===e?void 0:e.type)&&(null===(t=i.symbolSource)||void 0===t?void 0:t.inputId),r=i.inputs.find(e=>e.id===s),n="symbol"===(null==r?void 0:r.type);if("string"==typeof s&&n&&i.is_price_study){const e=this._properties.inputs[s];null!=e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}}},55153:(e,t,i)=>{"use strict";i.d(t,{StudyCompare:()=>N});var s=i(88537),r=i(8175),n=i(66101),o=i(37667),a=i(2015),l=i.n(a),c=i(67337),h=i(3825),d=i(97938),u=i(74477);const p=c.enabled("force_exchange_as_title");class _ extends d.PriceAxisView{constructor(e,t){super(),this._studyCompare=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._studyCompare.priceScale(),r=this._studyCompare.lastValueData(this._data.plotIndex,!1);if(r.noData||null===s||s.isEmpty())return;i.background=r.color,i.textColor=this.generateTextColor(r.color),i.coordinate=r.coordinate,i.floatCoordinate=r.floatCoordinate;const n=this._studyCompare.model().properties().childs().scalesProperties.childs();n.showSeriesLastValue.value()&&(e.text=(0,u.getCurrentModePriceText)(s,r),n.seriesLastValueMode.value()!==h.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,u.getOppositeModePriceText)(s,r),e.visible=!0),t.text="",n.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._studyCompare.symbolInfo();return p?e=(0,o.displayedSymbolExchange)(t):this._studyCompare.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,o.displayedSymbolName)(t)),e}}i(28353);var m=i(26179),g=i(44601),f=i(85733),v=i(49483),S=i(80643),y=i(89027);class b extends y.StudyValuesProvider{constructor(e,t){super(e,t),this._emptyValues[0].title=e.guiPlotName("")}_hideValues(){return!1}}const w=v.CheckMobile.any();class C extends m.StudyDataWindowView{constructor(e,t){super(e,t),this._studyCompare=e}_hideValues(){return!1}_createValuesProvider(e,t){return new b(e,t)}_currentIndex(){const e=this._model.crossHairSource().lockedIndex;let t;return w&&(null===this._model.crossHairSource().pane&&void 0===e||(0,g.isLineToolName)(f.tool.value())||null!==this._model.lineBeingEdited())?t=this._study.data().lastIndex():(t=this._model.crossHairSource().appliedIndex(),(0,S.isNumber)(t)||(t=this._study.data().lastIndex())),t}}class P extends C{constructor(e,t){super(e,t),this._additional=null,this._showSeriesOHLC=t.properties().childs().paneProperties.childs().legendProperties.childs().showSeriesOHLC,this._showSeriesOHLC.subscribe(this,this.update)}areValuesVisible(){return this._showSeriesOHLC.value()}destroy(){this._showSeriesOHLC.unsubscribeAll(this)}additional(){return this._additional}_updateImpl(){super._updateImpl()}}var T=i(190),x=i(40529);class I extends x.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(!0,void 0,!1,!1)}text(){ -return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(!0,void 0,!1,!1)}}var M=i(14791),L=i(52714),A=i.n(L);const E=c.enabled("study_overlay_compare_legend_option"),k=c.enabled("force_exchange_as_title"),D=c.enabled("uppercase_instrument_names"),V=!c.enabled("hide_study_compare_legend_item"),B=c.enabled("hide_unresolved_symbols_in_legend");class N extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new(l())(null)),e.hasChild("unitId")||e.addChild("unitId",new(l())(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._isActingAsSymbolSource=new(A())(!0),this._realignToolsLastParams=null,this.properties().childs().minTick.subscribe(null,()=>this._recreatePriceFormattingDependencies()),this.properties().childs().minTick.subscribe(null,()=>this._model.fullUpdate()),this.properties().childs().currencyId.subscribe(this,this._onCurrencyChanged),this.properties().childs().unitId.subscribe(this,this._onUnitChanged),this.properties().merge({skipHistogramBaseOnAutoScale:!0}),this._symbolResolvingActive=new(A())(!1),this._symbolHibernated=new(A())(!1),e.mainSeries().onIntervalChanged().subscribe(this,()=>e.realignLineTools(this))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}properties(){return super.properties()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}createPriceAxisView(e){return new _(this,{plotIndex:"compare"})}setSymbolParams(e){this._setSymbolCurrencyUnitInternal(e)}symbol(){return this._properties.inputs.symbol.value()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.inputs.symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,M.symbolSameAsCurrent)(e,this.symbol(),this.symbolInfo())}currency(){return this._properties.currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,o.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this._properties.unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,o.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return 2}setStyle(e){}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}state(e,t){const i=super.state(e,t);return this._model.unitConversionEnabled()||delete i.state.unitId,e&&((0,s.ensureDefined)(i.data).symbols={___snapshot:this.symbolInfo()||void 0}),i}symbolTitle(e,t){ -return this.title(!0,{},!1,e)}titleInParts(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return[D?r.toUpperCase():r]}tags(){const e=this.symbol();return e?[e]:[]}statusView(){return V?super.statusView():null}guiPlotName(e){return this.properties().childs().inputs.childs().symbol.value()}canOverrideMinTick(){return!0}canBeHiddenByGlobalFlag(){return!1}valuesProvider(){return new b(this,this.model())}statusProvider(e){return new I(this,this._model.properties().childs().scalesProperties.childs().textColor)}_createViews(){this._legendView||(this._legendView=new P(this,this._model)),this._dataWindowView||(this._dataWindowView=new C(this,this._model)),this._statusView||(this._statusView=new T.StudyStatusView(this)),super._createViews()}_showLastValueOnPriceScale(){return this._model.properties().childs().scalesProperties.childs().showSeriesLastValue.value()}_onUnitChanged(){"alwaysOff"!==(0,r.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_getSymbolForApi(e){return(0,o.symbolForApi)(this._resolvedSymbolsByInput[e]||null,e)}_onSymbolResolvingStart(){super._onSymbolResolvingStart(),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,o.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,o.symbolCurrency)(i),n=(0,o.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolCurrencyUnitInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}_changeInputsImpl(e,t){super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_createStudyOnServer(){super._createStudyOnServer(),this._realignLineToolsIfParamsChanged()}_tryCreateFormatter(){const e=this.symbolInfo();return(0,o.createSeriesFormatter)(e,this.properties().childs().minTick.value())}_titleInParts(e,t,i,s){const r=this.symbolInfo();let n;if(r){const e=(0,o.getStudySymbolExchange)(r);if(k&&e)n=e;else if(n=r.name,E)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":n=r.description;break;case"ticker-and-description":n=`${r.name}, ${r.description}`}else if(e&&!s)return[n,[e]]}else n=B?"":this.properties().childs().inputs.childs().symbol.value();return[n]}_setSymbolCurrencyUnitInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),a=n.inputs.childs().symbol.value(),l=n.currencyId.value(),c=n.unitId.value();if(void 0!==i&&i!==a&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&s!==l&&n.currencyId.setValueSilently(s),void 0!==r&&r!==c&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t, -this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,o.symbolCurrency)(e)),n.unitId.setValueSilently((0,o.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==a&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol),n.currencyId.value()!==l&&n.currencyId.listeners().fire(n.currencyId),n.unitId.value()!==c&&n.unitId.listeners().fire(n.unitId),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){const e=this.symbol(),t=this.interval(),i=this.currency(),s=this.unit();null!==this._realignToolsLastParams&&this._realignToolsLastParams.symbol===e&&this._realignToolsLastParams.interval===t&&this._realignToolsLastParams.currency===i&&this._realignToolsLastParams.unit===s||(this._model.realignLineTools(this),this._realignToolsLastParams={symbol:e,interval:t,currency:i,unit:s})}}},82927:(e,t,i)=>{"use strict";i.d(t,{StudyOverlayBase:()=>le});var s=i(88537),r=i(49483),n=i(98125),o=i(66101),a=i(8175),l=i(63948),c=i(37667),h=i(2015),d=i.n(h),u=i(19234),p=i(67337),_=i(90810),m=i(14791),g=i(59100),f=i(9315),v=i(71053),S=i(80643),y=i(69927),b=i(52714),w=i.n(b),C=i(33291),P=i(190),T=i(42169),x=i(97938),I=i(3825),M=i(74477);const L=p.enabled("force_exchange_as_title");class A extends x.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._source.lastValueData("close",!1);if(s.noData)return;const r=this._source.model(),n=this._source.priceScale();if(null===n)return;if(!r.isPriceScaleVisible(n))return;i.background=s.color,i.textColor=this.generateTextColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate;const o=this._source.model().properties().childs().scalesProperties.childs();o.showSeriesLastValue.value()&&(e.text=(0,M.getCurrentModePriceText)(n,s),o.seriesLastValueMode.value()!==I.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,M.getOppositeModePriceText)(n,s),e.visible=!0),t.text="",o.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.symbolInfo();return L?e=(0,c.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,c.displayedSymbolName)(t)),e}}var E=i(55057);class k extends E.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}var D=i(43891),V=i(40254);class B{constructor(e){this._lineRenderer=new V.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1,!this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0) -;e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:D.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var N=i(93751),R=i(14445),O=i(44601),F=i(85733),W=i(22458);const H=r.CheckMobile.any();class z extends R.DataWindowView{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 R.DataWindowItem(e.title,"")),this.update()}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}update(){this._invalidated=!0}study(){return this._study}_updateImpl(){this._header=this._study.title();let e;this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,N.isNumber)(e)||(e=this._study.data().lastIndex()));const t=this._valueProvider.getValues(e);for(let e=0;ee||t,i.showBarChange,i.showSeriesOHLC),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new U.OverlayLegendValuesProvider(e,t)}}var q=i(28978),Y=i(66919),K=i(85224),$=i(33837),X=i(34041),Z=i(35251),J=i(30076),Q=i(59153);const ee=r.CheckMobile.any()&&!1,te=p.enabled("uppercase_instrument_names"),ie=p.enabled("study_overlay_compare_legend_option"),se=p.enabled("secondary_series_extend_time_scale"),re=p.enabled("hide_unresolved_symbols_in_legend"),ne=!p.enabled("hide_study_overlay_legend_item"),oe=(0,n.getLogger)("Chart.StudyOverlay");function ae(e,t){return null==e[t]}class le extends o.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new(d())(null)),e.hasChild("unitId")||e.addChild("unitId",new(d())(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._quotesProvider=new _.QuotesProvider,this._seriesSource=null,this._symbolResolvingActive=new(w())(!1),this._symbolHibernated=new(w())(!1),this._styleToRecover=null,this._isActingAsSymbolSource=new(w())(!0),this._realignToolsLastParams=null,this.m_data=new v.PlotList((0, -l.seriesPlotFunctionMap)(),ae),ee&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const r=this.properties().childs();r.currencyId.subscribe(this,this._onCurrencyChanged),r.unitId.subscribe(this,this._onUnitChanged),r.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),r.style.subscribe(this,this._onChartStyleChanged),r.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),this._formatter=null,e.mainSeries().onIntervalChanged().subscribe(this,()=>e.realignLineTools(this))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}properties(){return this._properties}setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.inputs.symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}supportsPressedChunks(){return!1}pressedChunks(e,t){throw new Error("Pressed chunks are not supported")}data(){return null===this._seriesSource?super.data():this._seriesSource.data().bars()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,m.symbolSameAsCurrent)(e,this.symbol(),this.symbolInfo())}priceSource(){switch(this._properties.style.value()){case 2:return this._properties.lineStyle.priceSource.value();case 3:return this._properties.areaStyle.priceSource.value();case 10:return this._properties.baselineStyle.priceSource.value();case 13:return this._properties.columnStyle.priceSource.value()}return null}barFunction(){return this._barFunction}quotes(){return this._quotesProvider.quotes()}currency(){return this._properties.currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,c.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this._properties.unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,c.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}state(e,t){const i=super.state(e,t);return this._model.unitConversionEnabled()||delete i.state.unitId,e&&((0,s.ensureDefined)(i.data).symbols={ -___snapshot:this.symbolInfo()||void 0}),i}symbolTitle(e,t){return this.title(!0,{},!1,e)}title(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return te?r.toUpperCase():r}titleInParts(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return[te?r.toUpperCase():r]}isStarted(){return null===this._seriesSource?super.isStarted():this._seriesSource.isStarted()}sourceId(){return null===this._seriesSource?super.sourceId():(0,s.ensureNotNull)(this._seriesSource.instanceId())}moveData(e){null===this._seriesSource?super.moveData(e):this._seriesSource.moveData(e)}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const i=this.data().search(t,v.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==i?this._barFunction(i.value):null,this._ownFirstValue}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s;const o=this.properties().childs();if(!o.visible.value())return s;const a=this.nearestIndex(n.lastBar(),v.PlotRowSearchMode.NearestLeft,1);if(void 0===a)return s;const l=this.firstValue();if(null===l)return s;const c=this._lastNonEmptyPlotRow(4),h=null!==c&&n.contains(c.index),d=null!==c?c.value:null,u=t||h?d:this.data().valueAt(a);if(null===u)return s;const p=this._barFunction(u);if(!(0,S.isNumber)(p))return s;const _=r.priceToCoordinate(p,l);let m;switch(o.style.value()){case 0:m=u[1]<=u[4]?o.barStyle.childs().upColor.value():o.barStyle.childs().downColor.value();break;case 1:case 9:m=u[1]<=u[4]?o.candleStyle.childs().upColor.value():o.candleStyle.childs().downColor.value();break;case 13:m=u[1]<=u[4]?o.columnStyle.childs().upColor.value():o.columnStyle.childs().downColor.value();break;case 2:m=o.lineStyle.childs().color.value();break;case 3:m=o.areaStyle.childs().color1.value();break;case 10:{const e=o.baselineStyle.childs();m=_(0,s.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}}r&&this._paneViews.push(r),null!==i&&this._paneViews.push(i),this._paneViews.push(new B(this)),this._dataWindowView||(this._dataWindowView=new z(this,this._model)),this._legendView||(this._legendView=new G(this,this._model)),this._statusView||(this._statusView=new P.StudyStatusView(this)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new q.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){null===this._seriesSource?super._createStudyOnServer():this._modifyStudyOnServer((0,s.ensureDefined)(this._inputs)),this._realignLineToolsIfParamsChanged()}_modifyStudyOnServer(e){null===this._seriesSource?super._modifyStudyOnServer(e):(this._seriesSource.modifySeries((0,u.decodeExtendedSymbol)(e.symbol),(0,f.getServerInterval)(this._series.properties().childs().interval.value())),this._seriesSource.isStarted()||this._seriesSource.start())}_stopStudyOnServer(){null===this._seriesSource?super._stopStudyOnServer():this._seriesSource.stop()}_titleInParts(e,t,i,s){const r=this.symbolInfo();let n;if(r){if(n=r.name,ie)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":n=r.description;break;case"ticker-and-description":n=`${r.name}, ${r.description}`}const e=!s&&(0,c.getStudySymbolExchange)(r);if(e)return[n,[e]]}else n=re?"":this.properties().childs().inputs.childs().symbol.value();return[n]}_onAllowExtendTimeScaleChanged(){const e=this.isStarted();if(e&&this.stop(!0),se&&this.properties().childs().allowExtendTimeScale.value()){this._seriesSource=new g.SeriesDataSource(this._model.chartApi(),"st_o_");const e=this._seriesSource.dataEvents();e.seriesError().subscribe(this,e=>{this._onStudyError(this._convertSeriesErrorToStudy(e))}),e.loading().subscribe(this,this._onStudyLoading),e.completed().subscribe(this,(e,t)=>{this._onStudyCompleted(t)}),e.dataUpdated().subscribe(this,()=>{this._studyModified=!1;const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,C.dataSourceChangeEvent)(this.id())),this._updateSources(),this.priceRangeReady()||this._enablePriceRangeReady()})}else{if(null!==this._seriesSource){const e=this._seriesSource.dataEvents();e.seriesError().unsubscribeAll(this),e.loading().unsubscribeAll(this),e.completed().unsubscribeAll(this),e.dataUpdated().unsubscribeAll(this),this._seriesSource.destroy()}this._seriesSource=null}e&&this.start(!0)}_convertSeriesErrorToStudy(e){return{error:e.error,ctx:e.ctx,solution_id:e.solution_id}}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),l=o.currencyId.value(),h=o.unitId.value(),d=o.style.value();if(void 0!==i&&i!==a&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&s!==l&&o.currencyId.setValueSilently(s),void 0!==r&&r!==h&&o.unitId.setValueSilently(r), -void 0!==n&&o.style.setValueSilently(n),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,c.symbolCurrency)(e)),o.unitId.setValueSilently((0,c.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol),o.currencyId.value()!==l&&o.currencyId.listeners().fire(o.currencyId),o.unitId.value()!==h&&o.unitId.listeners().fire(o.unitId),o.style.value()!==d&&o.style.listeners().fire(o.style),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){var e;const t=null!==(e=this.priceSource())&&void 0!==e?e:"close";this._barFunction=(0,l.barFunction)(t)}_onChartStyleChanged(){var e;this._updateBarFunction(),(null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,c.isCloseBasedSymbol)(this.symbolInfo())?(0,c.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){const e=this.symbol(),t=this.interval(),i=this.currency(),s=this.unit();null!==this._realignToolsLastParams&&this._realignToolsLastParams.symbol===e&&this._realignToolsLastParams.interval===t&&this._realignToolsLastParams.currency===i&&this._realignToolsLastParams.unit===s||(this._model.realignLineTools(this),this._realignToolsLastParams={symbol:e,interval:t,currency:i,unit:s})}}},41855:(e,t,i)=>{"use strict";i.d(t,{StudyPriceAxisView:()=>r});var s=i(97938);class r extends s.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._source.model(),r=this._source.priceScale();if(null===r)return;if(!s.isPriceScaleVisible(r))return;const n=this._source.lastValueData(this._data.plotIndex,!1);if(n.noData)return;i.background=n.color;let o=n.color;"transparent"===o&&(o=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(o),i.coordinate=n.coordinate,i.floatCoordinate=n.floatCoordinate,this._showAxisLabel()&&(e.text=n.text,e.visible=!0),this._updatePaneRendererData(t)}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().showLabelsOnPriceScale.value()}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().showLabelsOnPriceScale.value()}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},59572:(e,t,i)=>{"use strict";i.d(t,{applyOverridesToStudy:()=>c,applyOverridesToStudyDefaults:()=>h}) -;var s=i(88537),r=i(50993);const n=(0,i(98125).getLogger)("Chart.Model.StudyPropertiesOverrider");var o,a;function l(e,t,i,s){const r=i.split(".");if(0===r.length||0===r[0].length)return;const l=function(e){const t=e.split(":");return{name:t[0],type:2===t.length?t[1]:null}}(r[0]),c=l.name,h=l.type,d=null!==h,u=!d||"band"===h,p=!d||"area"===h,_=!d||"input"===h,m=!d||"plot"===h?a.getPlotIdByTitle(e,c):null,g=u?a.getBandIndexByName(e,c):null,f=p?a.getFilledAreaIdByTitle(e,c):null,v=_?a.getInputByName(e,c):null,S=t.hasOwnProperty(c);if((null!==m?1:0)+(null!==g?1:0)+(null!==f?1:0)+(null!==v?1:0)+(S?1:0)>1)return void n.logWarn(`Study '${e.description}' has ambiguous identifier '${c}'`);const y=r[1];if(null!==m){if(1===r.length)return void n.logWarn(`Path of sub-property of '${c}' plot for study '${e.description}' must be not empty`);const i=r.slice(1);o.applyPlotProperty(e,t,m,i,s)}else if(null!==v)o.applyInputValue(t,v,s);else if(null!==g){if(void 0===y)return void n.logWarn(`Property name of '${c}' band for study '${e.description}' must be set`);o.applyBandProperty(t,g,y,s)}else if(null!==f){if(void 0===y)return void n.logWarn(`Property name of '${c}' area for study '${e.description}' must be set`);o.applyFilledAreaProperty(t,f,y,s)}else S?o.setRootProperty(t,r,s):n.logWarn(`Study '${e.description}' has no plot or input '${c}'`)}function c(e,t){const i=e.properties(),s=i.state();for(const i in t)t.hasOwnProperty(i)&&l(e.metaInfo(),s,i,t[i]);i.mergeAndFire(s)}function h(e,t,i){for(const s in e){if(!e.hasOwnProperty(s))continue;const r=s.indexOf(".");if(-1===r)continue;const o=s.substring(0,r),c=a.getMetaInfoByDescription(t,o);if(null===c){n.logWarn("There is no such study "+o);continue}const h=i(c);null!==h?l(c,h,s.substring(r+1),e[s]):n.logWarn("Cannot apply overrides for study "+o)}}!function(e){const t={line:r.LineStudyPlotStyle.Line,histogram:r.LineStudyPlotStyle.Histogram,cross:r.LineStudyPlotStyle.Cross,area:r.LineStudyPlotStyle.Area,columns:r.LineStudyPlotStyle.Columns,circles:r.LineStudyPlotStyle.Circles,line_with_breaks:r.LineStudyPlotStyle.LineWithBreaks,area_with_breaks:r.LineStudyPlotStyle.AreaWithBreaks};e.applyPlotProperty=function(e,i,o,a,l){if(void 0===i.styles)return void n.logWarn("Study does not have styles");const c=a[0];if("color"===c){return void function(e,t,i,r,o){if(void 0!==e.styles)if(null===t&&!isNaN(r)&&r>0)n.logWarn("Study plot does not have color #"+r);else{if(0===r||isNaN(r)){(0,s.ensureDefined)(e.styles[i]).color=String(o),r=0}null!==t&&((0,s.ensureDefined)(t.colors[r]).color=String(o))}else n.logWarn("Study does not have styles")}(i,function(e,t,i){if(void 0===e.plots)return null;for(const s of e.plots){if(!(0,r.isColorerPlot)(s)||void 0===t.palettes)continue;const e=t.palettes[s.palette];if(s.target===i&&void 0!==e)return e}return null}(e,i,o),o,a.length>1?parseInt(a[1]):NaN,l)}const h=i.styles[o];if(void 0!==h&&h.hasOwnProperty(c)){if("plottype"===c){const e=t[String(l)];if(void 0===e)return void n.logWarn("Unsupported plot type for plot: "+l);l=e}h[c]=l -}else n.logWarn(`Study plot does not have property '${c}'`)},e.applyBandProperty=function(e,i,s,r){if(void 0===e.bands)return void n.logWarn("Study does not have bands");const o=e.bands[i];if(void 0!==o&&o.hasOwnProperty(s)){if("plottype"===s){const e=t[String(r)];if(void 0===e)return void n.logWarn("Unsupported plot type for band: "+r);r=e}o[s]=r}else n.logWarn(`Study band does not have property '${s}'`)},e.applyFilledAreaProperty=function(e,t,i,s){if(void 0===e.filledAreasStyle)return void n.logWarn("Study does not have areas");const r=e.filledAreasStyle[t];void 0!==r&&r.hasOwnProperty(i)?r[i]=s:n.logWarn(`Study area does not have property '${i}'`)},e.applyInputValue=function(e,t,i){void 0!==e.inputs&&e.inputs.hasOwnProperty(t)?e.inputs[t]=i:n.logWarn(`Study does not have input '${t}'`)},e.setRootProperty=function(e,t,i){if(0===t.length)return;let s=e;for(const e of t.slice(0,-1)){if(null==s||!s.hasOwnProperty(e))break;s=s[e]}const r=t[t.length-1];null!=s&&s.hasOwnProperty(r)?s[r]=i:n.logWarn("Study does not have property "+t.join("."))}}(o||(o={})),function(e){e.getInputByName=function(e,t){if(void 0===e.inputs)return null;t=t.toLowerCase();for(const i of e.inputs)if(i.name.toLowerCase()===t)return i.id;return null},e.getPlotIdByTitle=function(e,t){if(void 0===e.styles)return null;t=t.toLowerCase();for(const i in e.styles){const s=e.styles[i];if((void 0!==s&&void 0!==s.title?s.title:i).toLowerCase()===t)return i}return null},e.getFilledAreaIdByTitle=function(e,t){if(void 0===e.filledAreas)return null;t=t.toLowerCase();for(const i of e.filledAreas)if(i.title.toLowerCase()===t)return i.id;return null},e.getBandIndexByName=function(e,t){if(void 0===e.bands)return null;t=t.toLowerCase();for(let i=0;i{"use strict";var s=i(2015),r=i(2872),n=i(88537).assert,o=i(37667).symbolTitle,a=i(33981).StudyBarColorer,l=i(41855).StudyPriceAxisView,c=i(54376).createGraphicsPriceAxisViews,h=i(84801).ChartApiInterface,d=i(88564).DefaultProperty,u=i(97098).PriceFormatter,p=i(67802).VolumeFormatter,_=i(26811).PercentageFormatter,m=i(71053).PlotList,g=i(67072),f=i(76422),v=i(50993),S=v.LineStudyPlotStyle,y=i(55057).StudyPriceLineAxisView,b=i(8671).studyPlotFunctionMap,w=i(8671).studyEmptyPlotValuePredicate,C=i(72857).makeNextStudyId,P=i(67337),T=i(69774).StudyBase,x=i(13933);const{dataSourceChangeEvent:I}=i(33291);var M=i(20838).IntervalsVisibilitiesProperty,L=x.StudyStatusType,A=i(68906).colorToInteger,E=i(52418).intervalsVisibilitiesDefaults,k=i(98125).getLogger("Chart.Study"),D=P.enabled("datasource_copypaste"),V=P.enabled("study_symbol_ticker_description"),B=P.enabled("hide_unresolved_symbols_in_legend");function N(e,t,i){var s=new d(t,i,!0);s.removeProperty("intervalsVisibilities"),s.addChild("intervalsVisibilities",new M(i&&i.intervalsVisibilities)), -s.addExclusion("visible"),s.addExclusion("precision"),s.addExclusion("minTick"),s.addExclusion("intervalsVisibilities");for(var r=0;r=0?c:l}return l}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===i)return this._metaInfo.defaults.inputs.text;if("pineId"===i)return this._metaInfo.scriptIdPart;if("pineVersion"===i)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){var h=this._properties.inputs[i].value();return A(h)}if("price"===e.type){var d=this._properties.inputs[i].value();return t.priceInputsForDisplay?this.formatter().format(d):d}return this._properties.inputs[i].value()}return this._properties.inputs[i].value()}_rebindToSource(e,t){var i=this.parentSource();if(this._isChildStudy){var s;this._source.unsetChild(this);var r=null;if(e===this._model.mainSeries())this._source=null,this._isChildStudy=!1,this._ownerSource=null,s=this._series.seriesSource().instanceId(),r=h.REBIND_STUDY_CHILD_TO_STANDALONE;else{if(!(e instanceof F))return k.logError("Unable to rebind study to source of this type"),!1;this._ownerSource=e,this._source=e,s=this._source.sourceId(),this._source.setChild(this),this._source.isHibernated()&&this._source.start()}this._incrementTurnaround(),this.disablePriceRangeReady(),this._chartApi.rebindStudy(this._studyId,this._turnaround,s,this._studyName,t,this._handler,r)}else{if(!(e instanceof F))return k.logError("Unable to rebind study to source of this type"),!1;var n=e.isHibernated();n&&e.start();var o=!1;if(this._canCreateStudyWithRebindType(h.REBIND_STUDY_STANDALONE_TO_CHILD)&&(this._incrementTurnaround(),this.disablePriceRangeReady(), -o=this._chartApi.rebindStudy(this._studyId,this._turnaround,e.sourceId(),this._studyName,t,this._handler,h.REBIND_STUDY_STANDALONE_TO_CHILD)),!o)return n&&e.stop(),!1;this._isChildStudy=!0,this._ownerSource=e,this._source=e,this._source.setChild(this),this._childStudyByRebind.fire()}var a=this.m_priceScale,l=e.priceScale();if(a!==l){var c=this._model.paneForSource(this),d=this._model.paneForSource(e);c===d&&d.move(this,l,!0)}const u=this.parentSource();return i.formatterChanged().unsubscribe(this,this._onSourceFormatterChanged),u.formatterChanged().subscribe(this,this._onSourceFormatterChanged),i.priceStepChanged().unsubscribe(this,this._onSourcePriceStepChanged),u.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),i.currencyChanged().unsubscribeAll(this),u.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),i.unitChanged().unsubscribeAll(this),u.unitChanged().subscribe(this,this._onSourceUnitChanged),i.priceRangeReadyChanged().unsubscribeAll(this),u.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),this._recreatePriceFormattingDependencies(),!0}childStudyByRebind(){return this._childStudyByRebind}_changeInputsImpl(e,t){var i=this.source(),s=this._properties.inputs&&this._properties.inputs.state(),r=g.getSourceIdByInputs(this._metaInfo.inputs,s),n=!0;if(r)if("high"===r||"open"===r||"low"===r||"close"===r||"hl2"===r||"ohl3"===r||"ohlc4"===r)i=this._model.mainSeries();else for(var o=this._model.dataSources().filter((function(e){return e instanceof F&&e.canHaveChildren()})),a=0;a=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_sendTelemetryReport(e,t,i){void 0===i&&(i=this._getTelemetryAdditionalData());var s=Object.assign(t,{additional:i});(void 0).sendChartReport(e,s)}_sendTelemetryCounter(e,t){this._sendTelemetryReport(e,{count:1},t)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}destroy(){this._aboutToBeDestroyed.fire(),this._isDestroyed=!0,null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._properties.precision.listeners().unsubscribe(this,this._precisionChanged),this._showStudyArgumentsProperty.listeners().unsubscribe(this,this.invalidateTitleCache),this._properties.description.listeners().unsubscribe(this,this.invalidateTitleCache),this._properties.shortDescription&&this._properties.shortDescription.listeners().unsubscribe(this,this.invalidateTitleCache),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this),this.hasBarColorer()&&this._properties.visible.listeners().unsubscribe(this._model.mainSeries(),this._model.mainSeries().invalidateBarStylesCache),this._model.mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._recreatePriceFormattingDependencies),void 0!==this._properties.offsets&&this._properties.offsets.listeners().unsubscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offset&&this._properties.offset.listeners().unsubscribe(this,this._updateMaxOffsetValue),super.destroy()}desiredPriceScalePosition(){return this.metaInfo().isTVScriptStub?"overlay":this.metaInfo().linkedToSeries?"as-series":void 0===this.metaInfo().priceScale?null:["right","left","overlay"][this.metaInfo().priceScale]}guiPlotName(e){var t=this.properties().styles;return t&&t[e]&&t[e].title?t[e].title.value():this.title()}formatterChanged(){return this._formatterChanged}copiable(){return D&&!this.isChildStudy()}setPriceScale(e){super.setPriceScale(e),f.emit("study_event",this.id(),"price_scale_changed")}getStudyName(){return this._studyName}}TradingView.Study=F,t.Study=F,t.prepareStudyProperties=function(e,t,r,o,a){return function(e,t,r,o,a,l){var c=function(e,t,r,o){var a=i(31752);if(g.versionOf(e)<1)throw new Error("This function cannot work with metainfo of the old format version. Required format version >= 1");var l=TradingView.clone(defaults("study"));R(l,e);var c=g.getStudyPropertyRootName(e),h=TradingView.clone(defaults(c,o));h.intervalsVisibilities=TradingView.clone(E),("Overlay"===e.shortId||"Compare"===e.shortId)&&(h.currencyId=null,h.unitId=null) -;e.isTVScript&&e.TVScriptSourceCode!==h.TVScriptSourceCode&&(h=TradingView.clone(TradingView.factoryDefaults(c,o)));TradingView.merge(l,h),t&&(n(!(t instanceof s),"propsState should not be an instance of Property"),TradingView.merge(l,t));var d=TradingView.clone(e),u={};a.mergeInputsObjPart(u,d.defaults.inputs),a.mergeInputsObjPart(u,l.inputs),l.inputs=u,delete d.inputs,delete d.defaults.inputs;var p={};if(TradingView.merge(p,d.defaults),TradingView.merge(p,TradingView.factoryDefaults(c)),TradingView.merge(p,l),TradingView.merge(p,d),delete p.defaults,l=p,null!==r){var _=r.model().studiesColorRotatorFactory().getColorRotator(e);null!==_&&("Overlay@tv-basicstudies"===e.id?l.lineStyle.color=_.getColor(l.lineStyle.color,e):TradingView.merge(l,function(e,t){for(var i in e.styles){var s=e.styles[i].color;s&&(e.styles[i].color=t.getColor(s))}return e}(l,_)))}t&&TradingView.merge(l.styles,t.styles);return l}(e,t,r,o),h=g.getSourceInputIds(e);if(h.length>0){var d=h[0];l instanceof F?c.inputs[d]="{pid}$0":void 0!==c.inputs[d]&&-1!==c.inputs[d].indexOf("$")&&(c.inputs[d]="close")}return N(e,a,c)}(e,t,r,o,g.getStudyPropertyRootName(e),a)},t.prepareStudyPropertiesForLoadChart=function(e,t,s,r,n,o){return function(e,t,s,r,n,o,a){var l=function(e,t,s,r,n,o){var a=i(31752);e.version&&s.version&&e.version!==s.version&&k.logWarn("Serialized metaInfo version "+e.version+" is not equal to the saved state version "+s.version);var l=TradingView.clone(defaults("study"));l.intervalsVisibilities=TradingView.clone(E),TradingView.merge(l,TradingView.factoryDefaults(g.getStudyPropertyRootName(e))),R(l,e),TradingView.merge(l,s),l=n.updateStudyState(l,e,t),void 0!==o&&(l=o(s,l,e,t));var c=TradingView.clone(t||e);if(c&&g.versionOf(c)>=1){var h={};a.mergeInputsObjPart(h,(c.defaults||{}).inputs),a.mergeInputsObjPart(h,l.inputs),l.inputs=h,delete c.inputs,c.defaults&&delete c.defaults.inputs;var d={};TradingView.merge(d,c.defaults),TradingView.merge(d,TradingView.factoryDefaults(g.getStudyPropertyRootName(c))),TradingView.merge(d,l),delete c.defaults,TradingView.merge(d,c),l=d}return l}(e,t,s,0,n,a);return N(t||e,o,l)}(e,t,s,0,n,g.getStudyPropertyRootName(e),o)}},56138:(e,t,i)=>{"use strict";i.d(t,{plotShapesData:()=>r});var s=i(28353);const r={shape_arrow_down:{guiName:(0,s.t)("Arrow Down"),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:(0,s.t)("Arrow Up"),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:(0,s.t)("Circle"),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:(0,s.t)("Cross"),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:(0,s.t)("Diamond"),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:(0,s.t)("Flag"),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape", -pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:(0,s.t)("Label Down"),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:(0,s.t)("Label Up"),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:(0,s.t)("Square"),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:(0,s.t)("Triangle Down"),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:(0,s.t)("Triangle Up"),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:(0,s.t)("X Cross"),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},27306:(e,t,i)=>{"use strict";var s=i(15625).Version,r=i(98125).getLogger("Chart.StudyMigration");function n(e){this._studyId=e,this._maxToVers=s.ZERO,this._maxFromVers=s.ZERO,this._migrs=[]}n.prototype.addMigration=function(e,t,i){var r=s.parse(e),n=s.parse(t);r.isGreater(this._maxFromVers)&&(this._maxFromVers=r),n.isGreater(this._maxToVers)&&(this._maxToVers=n),this._migrs.push({fromVers:r,toVers:n,rules:i})},n.prototype.updateInputs=function(e,t,i){if(!i)return i;for(var s=TradingView.clone(i),n=e;n.isLess(t);){var o=this._findMigration(n);if(null==o)break;if(r.logNormal("Migrating study inputs from "+o.fromVers+" to "+o.toVers+" version, studyId: "+this._studyId+", migration: "+JSON.stringify(o)+", inputs: "+JSON.stringify(i)),s=this._applyMigration(s,o),!n.isLess(o.toVers))throw new Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");n=o.toVers}return n>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(s)),s},n.prototype._findMigration=function(e){for(var t=-1,i=this._maxFromVers,s=0;s=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throw new Error("Unknown action "+t.action+" for rule with type "+t.type);var i=e[t.inputId];return it.maxVal&&(e[t.inputId]=t.maxVal),r.logNormal("Input "+t.inputId+"="+i+" adjusted to value "+e[t.inputId]),e},n._applyInputChangedOptionsRule=function(e,t){if(!(["text"].indexOf(t.inputType)>=0&&"resetToDefValIfNeeded"===t.action))throw new Error("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);var i=e[t.inputId];return t.options.indexOf(i)<0&&(e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal)),e},e.exports=n},9771:(e,t,i)=>{"use strict";var s=i(66101).Study,r=i(52457).OverlayLegendValuesProvider,n=i(79284).OverlayStatusProvider,o=i(33981).SeriesBarColorer,a=i(82927).StudyOverlayBase;t.study_Overlay=class extends a{constructor(e,t,i,s){super(e,t,i,s),this._paneView=null;var r=this;this.properties().minTick.listeners().subscribe(null,(function(){r._recreatePriceFormattingDependencies(),r.updateAllViews(),r._model.fullUpdate()}))}_showLastValueOnPriceScale(){return this._model.properties().scalesProperties.showSeriesLastValue.value()}barColorer(){return new o(this)}_tryChangeInputs(){s.prototype._tryChangeInputs.call(this),this.m_formatter=null,this.priceScale().updateFormatter()}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update(),this._model.updateSource(this))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),super.destroy()}tags(){var e=[],t=this.symbolInfo();return t?e.push(t.name):this._properties.inputs.symbol.value()&&e.push(this._properties.inputs.symbol.value()),e}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(1369),i.e(7387),i.e(8623),i.e(607)]).then(i.bind(i,55976))).StudyOverlayDefinitionsViewModel}defaultPlotIdForAlert(){return""}changeStyles(){this.data().each((function(e,t){t[TradingView.STYLE_PLOT]=null})),s.prototype.changeStyles.call(this)}valuesProvider(){return new r(this,this.model())}statusProvider(e){return new n(this,this.model())}}},67509:(e,t,i)=>{"use strict" -;var s=i(88537).assert,r=i(80643).clone,n=i(66101).Study,o=i(71053).PlotList,a=i(8671).studyPlotFunctionMap,l=i(8671).studyEmptyPlotValuePredicate;class c{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var d=!1;s&&(d=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),d?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this.m_data=new o(a(this._metaInfo),l));var i=this.m_data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this.m_data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new c(e.strategyIndex,e.targetIndex,i).rebuildData(this.m_data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},31752:(e,t,i)=>{"use strict";var s=i(88537).assert,r=i(15625).Version,n=i(98125).getLogger("Chart.Study.Versioning"),o=i(76861),a=i(67072),l=i(14905).extractPineId,c=i(5402).migrateMetaInfoAndPropState;function h(e,t){if(!e)throw new Error("No studies metainfo");var s=i(27306);if(this._studiesMetainfo=e,!t)throw new Error("No studies migrations");this._studiesMigrations=t,this._migrations={};for(var r=0;r=22)return t;for(var i={},s=0,r=0;;){var n=t[r];if(void 0===n)break;var o=t[n.id];n.isFake&&(n.id="in_"+s++),i[r]=n,i[n.id]=o,r++}return i}]}h.prototype.updateMetaInfo=function(e){if(!e)return e;s(!e.isTVScript,"This method should update only built-in java indicators metaInfo. For Pine indicators use updateMetaInfoAsync");for(var t=null,i=this._studiesMetainfo,r=0;r=12&&l<=26){var c={};for(o=0;o=12&&c<=26){var d=r.columns;r.columns=[];for(var u=0;ut&&n.logWarn("Bad integer input max value in metaInfo id="+e.id+" title="+e.description))}},h._fixInputsMaxValue=function(e,t){if(!TradingView.isAbsent(t)){var i=h.INPUT_MAX_VALUE;if(t.inputs)for(var s=0;si&&(a.max=i))}if(e&&e.inputs){var r=h.splitInputs(e.inputs),n=r.arr;for(var o in n){var a;"integer"===(a=n[o]).type&&(a.max&&a.max>i&&(a.max=i))}e.inputs=TradingView.merge(r.obj,r.arr)}}},h.prototype.patchPropsStateAndMetaInfo=function(e,t,i){"Script$BOOKER"!==t.productId||t.alerts||delete e.alerts,h._fixInputsOrder(e,t),h._fixInputsMaxValue(e,t);var s=h.splitInputs(e.inputs);e.inputs=s.obj;var r=a.versionOf(t);ri&&(i=r))}e[i+1]=t},h.splitInputs=function(e){var t={},i={};for(var s in e)isNumber(parseInt(s,10))?t[s]=e[s]:i[s]=e[s];return{arr:t,obj:i}},h.findInputKeyById=function(e,t){var i=null;for(var s in e)if(isNumber(parseInt(s,10))&&e[s].id===t){i=s;break}return i},h.getInputKeyById=function(e,t){var i=h.findInputKeyById(e,t);if(!i)throw new Error("Cannot find input with id: "+t);return i},e.exports=h},14791:(e,t,i)=>{"use strict";i.d(t,{areEqualSymbols:()=>r,symbolSameAsCurrent:()=>o});const s=i(67337).enabled("uppercase_instrument_names");function r(e,t){return void 0===e?void 0===t:void 0!==t&&(s?e.toUpperCase()===t.toUpperCase():e===t)}function n(e,t){return e.some(e=>r(t,e))}function o(e,t,i){if(r(t,e))return!0;if(i){if(r(i.full_name,e)||r(i.pro_name,e))return!0;if(r(i.ticker,e))return!0;if(i.aliases&&n(i.aliases,e))return!0;if(i.alternatives&&n(i.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&r(i.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}},76818:(e,t,i)=>{"use strict";i.d(t,{TextWidthCache:()=>s});class s{constructor(e=150){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels.clear()}measureText(e,t){return this.getMetrics(e,t).width}yMidCorrection(e,t){const i=this.getMetrics(e,t);return"actualBoundingBoxAscent"in i&&"actualBoundingBoxDescent"in i?(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)/2:0}getMetrics(e,t){const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}e.save(),e.textBaseline="middle";const s=e.measureText(t);return e.restore(),0===s.width&&t.length||(this._cache.set(t,{metrics:s,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),s}}},5231:(e,t,i)=>{"use strict";var s=i(2872);function r(){this._marksByIndex=new Map,this._marksBySpan=[],this.changed=new s,this.minIndex=void 0,this.maxIndex=void 0}r.prototype.reset=function(){this._resetImpl(),this.changed.fire()},r.prototype._resetImpl=function(){this._marksByIndex=new Map,this._marksBySpan=[],this.minIndex=void 0,this.maxIndex=void 0,this._cache=void 0},r.prototype.merge=function(e){if(0!==e.length){var t=e[0].index,i=e[e.length-1].index;t<=this.minIndex&&i>=this.maxIndex&&this._resetImpl();for(var s=this._marksBySpan,r=new Set,n=0;n=this.maxIndex&&this.maxIndex--,this.maxIndex2;){if(1e3*this._marksByIndex.get(t).time===e)return t;if(1e3*this._marksByIndex.get(i).time===e)return i;var s=Math.round((t+i)/2);1e3*this._marksByIndex.get(s).time>e?i=s:t=s}return t},r.prototype.build=function(e,t){var i=Math.ceil(t/e);if(this._maxbar===i&&this._cache)return this._cache;this._maxbar=i;for(var s=[],r=this._marksBySpan.length;r--;)if(this._marksBySpan[r]){var n=s;s=[];for(var o=n.length,a=0,l=this._marksBySpan[r],c=l.length,h=1/0,d=-1/0,u=0;u=i&&_-d>=i&&(s.push(p),d=_)}for(;a{"use strict";i.d(t,{TimeAxisView:()=>o});var s=i(68906),r=i(93435);class n{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 n=Math.round(t.widthCache.measureText(e,s.text));if(n<=0)return -;e.save();const o=t.paddingHorizontal,a=n+2*o,l=a/2;let c=s.coordinate,h=Math.floor(c-l)+.5;if(s.alwaysInViewPort){const e=s.width;h<0?(c+=Math.abs(0-h),h=Math.floor(c-l)+.5):h+a>e&&(c-=Math.abs(e-(h+a)),h=Math.floor(c-l)+.5)}const d=h+a,u=Math.ceil(0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize+t.paddingBottom);e.fillStyle=s.background;const p=Math.round(h*i),_=Math.round(0*i),m=Math.round(d*i),g=Math.round(u*i),f=Math.round(2*i);e.beginPath(),e.moveTo(p,_),e.lineTo(p,g-f),e.arcTo(p,g,p+f,g,f),e.lineTo(m-f,g),e.arcTo(m,g,m,g-f,f),e.lineTo(m,_),e.fill();const v=0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const S=t.widthCache.yMidCorrection(e,"Apr0");e.translate((h+o)*i,(v+S)*i),(0,r.drawScaled)(e,i,()=>e.fillText(s.text,0,0)),e.restore()}}class o{constructor(e){this._renderer=new n,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()||!this._isVisible())return;const t=this._getIndex();if(null===t)return;e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,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}}},2271:(e,t,i)=>{"use strict";i.d(t,{INVALID_TIME_POINT_INDEX:()=>s});const s=-2e6},5816:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MINUTE_SPAN:()=>s,HOUR_SPAN:()=>r,DAY_SPAN:()=>n,WEEK_SPAN:()=>o,MONTH_SPAN:()=>a,YEAR_SPAN:()=>l,DEFAULT_BAR_SPACING:()=>c});const s=20,r=30,n=40,o=50,a=60,l=70,c=6},23075:(e,t,i)=>{"use strict";i.d(t,{trackDrawingCreated:()=>r,trackDrawingPasted:()=>n,trackDrawingCloned:()=>o,trackChartStyleChanged:()=>a});i(88537),i(16654);function s(e,t){0}function r(e){s()}function n(e){s()}function o(e){s()}function a(e){0}},35218:(e,t,i)=>{"use strict";i.d(t,{translatedIntervalString:()=>r});i(28353);var s=i(9315);function r(e){const t=(0,s.getTranslatedResolutionModel)(e,!0);return null===t?e:t.multiplier+(t.mayOmitShortKind?"":t.shortKind)}},17691:(e,t,i)=>{"use strict";i.d(t,{ApplyLineToolTemplateUndoCommand:()=>r});var s=i(35762);class r extends s.UndoCommand{constructor(e,t,i){super(i),this._source=e,this._newState=t,this._oldState=e.properties().state()}redo(){this._source.applyTemplate(this._newState)}undo(){this._source.applyTemplate(this._oldState)}}},79495:(e,t,i)=>{"use strict";i.d(t,{ExcludeLineToolsFromGroupUndoCommand:()=>l});var s=i(88537),r=(i(94419),i(28353)),n=i(24980),o=i(35762) -;const a=new n.TranslatedString("exclude line tools from group {group}",(0,r.t)("exclude line tools from group {group}"));class l extends o.UndoCommand{constructor(e,t,i){super(a.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=(0,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)}}},8597:(e,t,i)=>{"use strict";i.d(t,{MergeUpUndoCommand:()=>o,MergeDownUndoCommand:()=>a,MergeToTargetPane:()=>l});var s=i(88537),r=i(21749);class n extends r.MoveSourceUndoCommand{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=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),r=(0,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){(0,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=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,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))}),(0,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}}},21749:(e,t,i)=>{ -"use strict";i.d(t,{MoveSourceUndoCommand:()=>n});var s=i(88537),r=i(35762);class n extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const r=(0,s.ensureNotNull)(t.priceScale());this._initialPriceScaleId=r.id(),this._initialPriceScaleState=(0,s.ensureNotNull)(t.priceScale()).state();const n=(0,s.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=n.priceScalePosition(r),this._initialPriceScaleIndex=n.priceScaleIndex(r,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(n)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,t}_originalPriceScaleState(){return this._initialPriceScaleState}}},27579:(e,t,i)=>{"use strict";i.d(t,{MoveToNewPriceScaleUndoCommand:()=>o,MoveToExistingPriceScaleUndoCommand:()=>a});var s=i(88537),r=i(21749);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,s),this._sourcePaneRemoved=!1,this._targetPaneIndex=e.panes().indexOf(i)}redo(){const e=this._chartModel.panes()[this._initialPaneIndex],t=this._chartModel.panes()[this._targetPaneIndex],i=e!==t,r=this._targetPriceScale(t),n=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),o=this._chartModel.children(n,!0);for(const e of o)i?(this._chartModel.detachSource(e),t.addDataSource(e,r,!1)):t.move(e,r);i?(this._sourcePaneRemoved=this._chartModel.detachSource(n),t.addDataSource(n,r,!1)):t.move(n,r);const a=t.priceScalePosition(r);t.movePriceScale(r,a,this._targetPriceScaleIndex(n)),this._chartModel.fullUpdate()}undo(){this._sourcePaneRemoved&&this._chartModel.createPane(this._initialPaneIndex);const e=this._chartModel.panes()[this._initialPaneIndex],t=e!==this._chartModel.panes()[this._targetPaneIndex],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId));let r=e.getPriceScaleById(this._initialPriceScaleId);null===r&&(r=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex));const n=this._chartModel.children(i,!0);for(const i of n)t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r),(0,s.ensureNotNull)(i.priceScale()).restoreState(this._originalPriceScaleState()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScalePosition=s}_targetPriceScale(e){const t=e.createPriceScaleAtPosition(this._targetPriceScalePosition);return t.restoreState(this._newPriceScaleState("overlay"===this._targetPriceScalePosition)),t}_targetPriceScaleIndex(e){return e===this._chartModel.mainSeries()?0:void 0}}class a extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScaleId=s.id()}_targetPriceScale(e){return(0,s.ensureNotNull)(e.getPriceScaleById(this._targetPriceScaleId))}_targetPriceScaleIndex(e){}}},69746:(e,t,i)=>{"use strict";i.d(t,{PriceScaleChangeUndoCommand:()=>h});var s=i(88537),r=i(28353),n=i(24980),o=i(98125),a=i(35762);const l=(0, -o.getLogger)("Chart.ChartUndoModel"),c=new n.TranslatedString("scale price",(0,r.t)("scale price"));class h extends a.UndoCommand{constructor(e,t,i,s,r){super(c,!1),this._newPriceScaleState=null,this._model=e,this._paneIndex=e.panes().indexOf(t),this._priceScaleId=i.id(),this._state=s,this._timestamp=r?performance.now():null}undo(){if(null!==this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone");const[e,t]=this._paneAndScale();this._newPriceScaleState=t.state(),this._model.restorePriceScaleState(e,t,this._state)}redo(){if(null===this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone");const[e,t]=this._paneAndScale();this._model.restorePriceScaleState(e,t,this._newPriceScaleState),this._newPriceScaleState=null}canMerge(e){return e instanceof h&&null!==this._timestamp&&null!==e._timestamp&&null===this._newPriceScaleState&&e._model===this._model&&e._paneIndex===this._paneIndex&&e._priceScaleId===this._priceScaleId&&Math.abs(e._timestamp-this._timestamp)<1e3}merge(e){this._timestamp=e._timestamp}_paneAndScale(){const e=this._model.panes()[this._paneIndex],t=(0,s.ensureNotNull)(e.getPriceScaleById(this._priceScaleId));return[e,t]}}},65284:(e,t,i)=>{"use strict";i.d(t,{RemoveSourcesCommand:()=>m});var s=i(88537),r=i(28353),n=i(24980),o=i(35762),a=i(14291),l=i(98125),c=i(52546),h=i(81851),d=i(79495);class u extends o.UndoCommand{constructor({title:e,chartModel:t,lineDataSourceIds:i}){super(e),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._chartModel=t,this._lineDataSourceIds=i}redo(){const e=this._lineDataSourceIds.map(e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e)));this._groupLineToolsByGroups(e).forEach((e,t)=>{const i=new d.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)}),e.forEach(e=>{this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,s.ensureNotNull)(this._chartModel.paneForSource(e))),sharingMode:e.sharingMode().value()}),this._chartModel.removeSource(e)})}undo(){var e;for(let t=this._undoState.shift();t;t=this._undoState.shift())null===(e=this._chartModel.restoreSource(!1,t.paneIndex,null,t.state,null))||void 0===e||e.share(t.sharingMode);this._excludeLineToolsFromGroupUndoCommands.forEach(e=>e.undo())}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e},new Map)}}const p=(0,l.getLogger)("Chart.RemoveSourcesCommand"),_=new n.TranslatedString("remove line data sources",(0,r.t)("remove line data sources"));class m extends o.UndoCommand{constructor(e,t,i){super(i),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[r,n]=(0,c.closeSourcesSet)(e,t).reduce((e,t)=>((0,a.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e),[[],[]]);this._chartModel=e,this._sourceIds=r,this._lineDataSourceIds=n, -this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const o=t[0];1===t.length&&(0,h.isStudy)(o)&&(this._initialPriceScaleMode=(0,s.ensureNotNull)(o.priceScale()).mode())}removedIds(){return[...this._sourceIds,...this._lineDataSourceIds]}redo(){this._chartModel.panes().length;const e=this._sourceIds.map(e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e)));this._sourceStates=e.map(e=>(0,s.ensureNotNull)(e.state(!1)));const t=e.map(e=>(0,s.ensureNotNull)(this._chartModel.paneForSource(e)));this._paneIndexes=t.map(e=>this._chartModel.panes().indexOf(e)),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new u({title:_,chartModel:this._chartModel,lineDataSourceIds:this._lineDataSourceIds}),this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map((e,i)=>{const s=e.priceScale();if(null===s)return null;const r=t[i].priceScalePosition(s);return{id:s.id(),position:r,priceScaleIndex:t[i].priceScaleIndex(s,r)}});const i=new Set;e.forEach((e,t)=>{i.add(this._paneIndexes[t])}),this._paneStates=e.map((e,s)=>{const r=this._paneIndexes[s];return i.has(r)?t[s].state(!1,!0):null}),this._restorePanes=e.map(e=>this._chartModel.removeSource(e))}undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],this._sourceStates[t],this._priceScalePositionIds[t]);i&&e.push(i)}e.some((t,i)=>t.id()!==this._sourceIds[e.length-i-1])&&p.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,s.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}},91794:(e,t,i)=>{"use strict";i.d(t,{RestoreDefaultsPreferencesUndoCommand:()=>p});var s=i(88537),r=i(28353),n=i(24980),o=i(35762),a=i(67396),l=i(21761),c=i(13647),h=i(92033),d=i(76166);const u=new n.TranslatedString("apply all chart properties",(0,r.t)("apply all chart properties"));class p extends o.UndoCommand{constructor(e){super(u),this._trading=null,this._oldShowSellBuyButtons=null,this._oldNoConfirmEnabled=null,this._oldShowOnlyRejectionNotifications=null,this._oldShowPricesWithZeroVolume=null,this._oldShowPricesWithSpread=null,this._oldOrderExecutedSoundEnabled=null,this._prevWatermarkPreferences=null,this._model=e,this._trading=(0,h.tradingService)(),null!==this._trading&&(this._oldShowSellBuyButtons=this._trading.showSellBuyButtons.value(),this._oldNoConfirmEnabled=this._trading.noConfirmEnabled.value(),this._oldShowOnlyRejectionNotifications=this._trading.showOnlyRejectionNotifications.value(),this._oldShowPricesWithZeroVolume=this._trading.showPricesWith().zeroVolume.value(),this._oldShowPricesWithSpread=this._trading.showPricesWith().spread.value(),this._oldOrderExecutedSoundEnabled=this._trading.orderExecutedSoundParams.enabled.value()),this._defaultsPreferences=(0, -a.defaultsPreferencesByWhiteList)(this._model,this._model.mainSeries()),this._oldPreferences=e.preferences(),this._prevDateFormat=l.dateFormatProperty.value(),this._prevAddPlusButton=d.addPlusButtonProperty.value(),this._prevShowOpenMarkerStatus=c.showMarketOpenStatusProperty.value();const t=this._model.watermarkSource();null!==t&&(this._prevWatermarkPreferences=t.properties().state())}redo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue(!0),this._trading.noConfirmEnabled.setValue(!1),this._trading.showOnlyRejectionNotifications.setValue(!1),this._trading.showPricesWith().zeroVolume.setValue(!0),this._trading.showPricesWith().spread.setValue(!0),this._trading.orderExecutedSoundParams.enabled.setValue(!1)),this._model.applyPreferences(this._defaultsPreferences),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),(0,l.restoreDateFormatSettingsValue)(),(0,d.restoreAddPlusButtonSettingsValue)(),(0,c.restoreShowMarketOpenStatusProperty)();const e=this._model.watermarkSource();null!==e&&e.restorePropertiesDefaults()}undo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue((0,s.ensureNotNull)(this._oldShowSellBuyButtons)),this._trading.noConfirmEnabled.setValue((0,s.ensureNotNull)(this._oldNoConfirmEnabled)),this._trading.showOnlyRejectionNotifications.setValue((0,s.ensureNotNull)(this._oldShowOnlyRejectionNotifications)),this._trading.showPricesWith().zeroVolume.setValue((0,s.ensureNotNull)(this._oldShowPricesWithZeroVolume)),this._trading.showPricesWith().spread.setValue((0,s.ensureNotNull)(this._oldShowPricesWithSpread)),this._trading.orderExecutedSoundParams.enabled.setValue((0,s.ensureNotNull)(this._oldOrderExecutedSoundEnabled))),this._model.applyPreferences(this._oldPreferences),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),l.dateFormatProperty.setValue(this._prevDateFormat),c.showMarketOpenStatusProperty.setValue(this._prevShowOpenMarkerStatus),d.addPlusButtonProperty.setValue(this._prevAddPlusButton);const e=this._model.watermarkSource();null!==e&&null!==this._prevWatermarkPreferences&&e.properties().mergeAndFire(this._prevWatermarkPreferences)}}},97401:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleCurrencyUndoCommand:()=>o});var s=i(88537),r=i(35762),n=i(37667);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesCurrencies=new Map,this._oldSourcesCurrencies=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue;const e=t||(0,n.symbolOriginalCurrency)((0,s.ensureNotNull)(i.symbolInfo()));this._newSourcesCurrencies.set(i.id(),e),this._oldSourcesCurrencies.set(i.id(),i.currency()),this._showFade=this._showFade||i===o&&i.currency()!==e}}redo(){this._applyCurrencies(this._newSourcesCurrencies)}undo(){this._applyCurrencies(this._oldSourcesCurrencies)}_applyCurrencies(e){this._showFade&&this._chartWidget.screen.show();const t=this._chartWidget.model().model();e.forEach((e,i)=>{(0, -s.ensureNotNull)(t.dataSourceForId(i)).setCurrency(e)}),this._chartWidget.model().selectionMacro(e=>{e.clearSelection()})}}},59836:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleModeCommand:()=>o});var s=i(88564),r=i(35762),n=i(33291);class o extends r.UndoCommand{constructor(e,t,i,s){super(i),this._newMode=e,this._priceScaleId=t.id(),this._model=s,this._oldMode=t.mode()}redo(){this._applyMode(this._newMode)}undo(){this._applyMode(this._oldMode)}_applyMode(e){const t=this._findPriceScaleById();null!==t&&((0,s.saveDefaultProperties)(!0),t.setMode(e),(0,s.saveDefaultProperties)(!1),this._model&&(this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()))}_findPriceScaleById(){const e=this._model.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleSelectionStrategyCommand:()=>a});var s=i(88537),r=i(35762),n=i(74325);class o{constructor(e){this._leftScales=e.leftPriceScales().map(e=>e.id()),this._rightScales=e.rightPriceScales().map(e=>e.id())}restorePane(e){this._leftScales.reverse().map(t=>(0,s.ensureNotNull)(e.getPriceScaleById(t))).forEach(t=>e.movePriceScale(t,"left")),this._rightScales.reverse().map(t=>(0,s.ensureNotNull)(e.getPriceScaleById(t))).forEach(t=>e.movePriceScale(t,"right"))}}class a extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._targetStrategy=(0,n.createPriceScaleSelectionStrategy)(t),this._initialState=e.panes().map(e=>new o(e))}redo(){this._chartModel.panes().forEach(e=>e.setPriceScaleSelectionStrategy(this._targetStrategy)),this._chartModel.fullUpdate()}undo(){const e=this._chartModel.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleUnitUndoCommand:()=>o});var s=i(88537),r=i(35762),n=i(37667);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesUnits=new Map,this._oldSourcesUnits=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue;const e=t||(0,n.symbolOriginalUnit)((0,s.ensureNotNull)(i.symbolInfo()),this._chartWidget.model().model().unitConversionEnabled());this._newSourcesUnits.set(i.id(),e),this._oldSourcesUnits.set(i.id(),i.unit()),this._showFade=this._showFade||i===o&&i.unit()!==e}}redo(){this._applyUnits(this._newSourcesUnits)}undo(){this._applyUnits(this._oldSourcesUnits)}_applyUnits(e){this._showFade&&this._chartWidget.screen.show();const t=this._chartWidget.model().model();e.forEach((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setUnit(e)}),this._chartWidget.model().selectionMacro(e=>{e.clearSelection()})}}},870:(e,t,i)=>{"use strict";i.d(t,{SetScaleRatioPropertiesCommand:()=>o});var s=i(35762),r=i(88564),n=i(33291);class o extends s.UndoCommand{constructor(e,t,i,s){super(i),this._property=e,this._newValue=t,this._model=s, -this._priceScale=this._model.mainSeries().priceScale(),this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode()}redo(){this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode(),(0,r.saveDefaultProperties)(!0),this._priceScale.setMode({autoScale:!1,percentage:!1,log:!1}),this._property.setValue(this._newValue),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}undo(){(0,r.saveDefaultProperties)(!0),this._property.setValue(this._oldValue),this._priceScale.setMode(this._oldMode),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}}},52546:(e,t,i)=>{"use strict";function s(e,t){const i=new Set,s=t=>{e.children(t,!1).forEach(e=>{i.has(e)||(i.add(e),s(e))})};return t.forEach(s),t.filter(e=>!i.has(e)).map(t=>function e(t,i){let s=[];const r=t.children(i,!1);for(let i=0;ie.concat(t),[])}i.d(t,{closeSourcesSet:()=>s})},13339:(e,t,i)=>{"use strict";i.d(t,{TimeScaleChangeUndoCommand:()=>o});var s=i(98125),r=i(35762);const n=(0,s.getLogger)("Chart.ChartUndoModel");class o extends r.UndoCommand{constructor(e,t,i){super(i,!1),this._newRightOffsetAndBarSpacing=null,this.setCustomFlag("doesnt_affect_save",!0),this._model=e,this._rightOffsetAndBarSpacing=t}undo(){if(null!==this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone");const e=this._model.timeScale();this._newRightOffsetAndBarSpacing={barSpacing:e.barSpacing(),rightOffset:e.rightOffset()},e.setBarSpacing(this._rightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._rightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate()}redo(){if(null===this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone");const e=this._model.timeScale();e.setBarSpacing(this._newRightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._newRightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate(),this._newRightOffsetAndBarSpacing=null}}},35762:(e,t,i)=>{"use strict";i.d(t,{UndoCommand:()=>r});var s=i(24980);class r{constructor(e,t=!0){this._customFlags={},this._text=e||new s.TranslatedString("",""),this._executeOnPush=t}text(){return this._text}executeOnPush(){return this._executeOnPush}customFlag(e){return this._customFlags[e]}setCustomFlag(e,t){this._customFlags[e]=t}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},52940:(e,t,i)=>{"use strict";i.d(t,{createUndoHistory:()=>u});var s=i(88537),r=i(44556),n=i(16757),o=i(35762);class a extends o.UndoCommand{constructor(e,t,i){super(i),this._wv=e,this._newValue=t,this._oldValue=e.value()}redo(){this._wv.setValue(this._newValue)}undo(){this._wv.setValue(this._oldValue)}}var l=i(98125),c=i(2872),h=i.n(c);const d=(0,l.getLogger)("Common.UndoHistory");function u(){const e=[],t=new r.UndoStack,i=new r.UndoStack,o=new(h());function l(s){ -if(e.length>0)e[e.length-1].addCommand(s);else{i.clear();const e=t.head(),r=e&&e.text().originalText();e&&e.canMerge(s)?e.merge(s):t.push(s);const n=s.text().originalText();""!==n&&n!==r&&d.logNormal("DO: "+n)}s.executeOnPush()&&s.redo(),e.length||o.fire(c())}function c(){const e=t.head(),s=i.head();return{enableUndo:!t.isEmpty(),undoText:void 0===e?void 0:e.text().translatedText(),enableRedo:!i.isEmpty(),redoText:void 0===s?void 0:s.text().translatedText()}}return{beginUndoMacro:function(t){const i=new n.UndoMacroCommand(t);return e.push(i),i},clearStack:function(){t.clear(),i.clear(),o.fire(c())},createUndoCheckpoint:function(){return{lastActualCommand:t.isEmpty()?null:t.head()}},endUndoMacro:function(){const t=(0,s.ensureDefined)(e.pop());t.isEmpty()||l(t)},pushUndoCommand:l,redo:function(){if(i.isEmpty())return!1;const e=i.pop();return!!e&&(e.redo(),t.push(e),d.logNormal("REDO: "+e.text().originalText()),o.fire(c()),!0)},redoStack:function(){return i},setWatchedValue:function(e,t,i,s){if(e.value()!==t){const r=new a(e,t,i);r.setCustomFlag("doesnt_affect_save",!!s),l(r),r.redo()}},undo:function(){if(t.isEmpty())return!1;const e=t.pop();return!!e&&(e.undo(),i.push(e),d.logNormal("UNDO: "+e.text().originalText()),o.fire(c()),!0)},undoStack:function(){return t},undoToCheckpoint:function(e){for(;!t.isEmpty()&&e.lastActualCommand!==t.head();)t.pop().undo();i.clear(),o.fire(c())},state:c,onChange:function(){return o}}}},16757:(e,t,i)=>{"use strict";i.d(t,{UndoMacroCommand:()=>r});var s=i(35762);class r extends s.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(){for(let e=0;e=0;e--)this._subcommands[e].undo()}commands(){return this._subcommands}}},44556:(e,t,i)=>{"use strict";i.d(t,{UndoStack:()=>a});var s=i(35762),r=i(2872),n=i.n(r);const o=(0,i(98125).getLogger)("Common.UndoStack");class a{constructor(){this._commands=[],this._onChange=new(n())}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(e instanceof s.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void o.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}},36551:(e,t,i)=>{"use strict";i.d(t,{UnmergeDownUndoCommand:()=>o,UnmergeUpUndoCommand:()=>a,UnmergeToNewBottomPane:()=>l});var s=i(88537),r=i(21749);class n extends r.MoveSourceUndoCommand{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro(()=>{i.forEach(e=>this._chartModel.detachSource(e)), -this._chartModel.detachSource(e)});const r=this._chartModel.createPane(this.targetPaneIndex()),n=r.findSuitableScale(e);r.bulkActionMacro(()=>{r.addDataSource(e,n,!1),i.forEach(e=>r.addDataSource(e,n,!1))}),(0,s.ensureNotNull)(e.priceScale()).restoreState(this._newPriceScaleState(r.isOverlay(e))),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro(()=>{i.forEach(e=>this._chartModel.detachSource(e));const t=this._chartModel.detachSource(e);(0,s.assert)(t,"Undo of detaching must remove pane")});const r=this._chartModel.panes()[this._initialPaneIndex];let n=r.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=r.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),r.bulkActionMacro(()=>{r.addDataSource(e,n,!0),i.forEach(e=>r.addDataSource(e,n,!1))}),(0,s.ensureNotNull)(e.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}}class l extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}},79222:(e,t,i)=>{"use strict";i.d(t,{unitConvertibleGroups:()=>n,sourceNewUnitOnPinningToPriceScale:()=>o});var s=i(79680),r=i(37667);function n(e,t,i){const s=(0,r.symbolUnitConvertibleGroupsIfExist)(e,!0);if(null!==s)return s;const n=i.unitGroupById(t);return null===n?[]:[n]}function o(e,t,i,r){let o=null;if(i.unitConversionEnabled()&&(0,s.isSymbolSource)(e)){const s=i.availableUnits(),a=t.unit(s),l=e.unit(),c=null===l?[]:n(e.symbolInfo(),l,s);null!==a&&null!==a.selectedUnit&&!a.allUnitsAreOriginal&&a.selectedUnit!==l&&(r&&null===l||null!==l&&s.convertible(l,c))&&(o=a.selectedUnit)}return o}},10133:(e,t,i)=>{"use strict";i.d(t,{createVisibilityController:()=>l});var s=i(28353),r=i(32563),n=i(32255),o=i(56840);function a(e){return"alwaysOn"===e||"alwaysOff"===e?e:"visibleOnMouseOver"}function l(e,t){let i,l;function c(){if(!i){i=(0,n.createPrimitiveProperty)();let s=o.getValue(e);void 0===s&&void 0!==t&&(s=o.getValue(t)),i.setValue(a(s)),i.subscribe(i,t=>{o.setValue(e,a(t.value()))})}return i}return{property:c,availableValues:function(){return[{id:"visibleOnMouseOver",value:"visibleOnMouseOver",title:(0,s.t)("Visible on mouse over")},{id:"alwaysOn",value:"alwaysOn",title:(0,s.t)("Always visible")},{id:"alwaysOff",value:"alwaysOff",title:(0,s.t)("Always invisible")}]},actualBehavior:function(){if(!l){l=(0,n.createPrimitiveProperty)();const e=c(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=r.mobiletouch?"alwaysOn":"visibleOnMouseOver"),l&&l.setValue(t)};e.subscribe(l,t),t()}return l}}}},62587:(e,t,i)=>{"use strict";i.r(t),i.d(t,{watermarkProperty:()=>h, -restoreWatermarkPropertyDefaults:()=>d});var s=i(24377),r=i(56840),n=i(2015),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=(0,s.tryParseRgba)(e.color);t=Object.assign(t,e),null!==i&&(0!==i[3]?t.visibility=!0:(i[3]=.25,t.color=(0,s.rgbaToString)(i)))}}delete t.transparency}return t}let c=null;function h(){return null===c&&(c=new(o())(l()),r.onSync.subscribe(null,()=>{null!==c&&c.mergeAndFire(l())}),c.listeners().subscribe(null,()=>{null!==c&&r.setJSON("symbolWatermark",c.state())})),c}function d(){null!==c&&c.mergeAndFire(a)}},39094:(e,t,i)=>{"use strict";var s=i(35218).translatedIntervalString,r=i(1570).getTranslatedSymbolDescription,n=i(22799).CHART_FONT_FAMILY,o=i(62587),a=o.watermarkProperty,l=o.restoreWatermarkPropertyDefaults,c=i(93435).drawScaled,h=i(59803).applyDefaultsOverrides,d=i(59803).applyPropertiesOverrides;t.Watermark=function(e,t){var i={},o=a();function u(e,t){var s=e.font;return i.hasOwnProperty(s)||(i[s]={}),i[s].hasOwnProperty(t)||(i[s][t]=e.measureText(t).width),i[s][t]}h(o,void 0,!1,"symbolWatermarkProperties"),o.listeners().subscribe(this,(function(){e.updateSource(this)})),this.destroy=function(){o.listeners().unsubscribeAll(this)},this.properties=function(){return o},this.restorePropertiesDefaults=function(){l()},this.applyOverrides=function(e){d(o,void 0,!1,e,"symbolWatermarkProperties")};var p={renderer:function(e,i){return{draw:function(a,l){c(a,l.pixelRatio,(function(){var l=t.symbolInfo();a.fillStyle=o.color.value();var c,h=l.name;/QUANDL/.test(l.exchange)&&((c=h.split(/\//)).length&&(h=c[c.length-1]));for(var d={description:l.description,short_description:l.short_description,pro_name:l.pro_name,short_name:l.name,local_description:l.local_description,language:l.language},p=[{text:h?h+", "+s(t.interval()):"",font:"96px "+n,lineHeight:117,vertOffset:0},{text:r(d)||"",font:"48px "+n,lineHeight:58,vertOffset:5}],_=0,m=0;mi?i/g:1,_+=v.lineHeight*v.zoom}}var f=Math.max((e-_)/2,0);for(m=0;m{"use strict";i.d(t,{reorderDataSourcesStateZOrder:()=>S,newLineToolZOrder:()=>w,newStudyZOrder:()=>C,moveAfterSource:()=>E,moveBeforeSource:()=>k});var s=i(14291),r=i(81851),n=i(56972),o=i(50669),a=i(55257);function l(e){return(0,s.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()}function c(e){return(0,r.isStudy)(e)&&!e.isSpeciallyZOrderedSource()}function h(e,t){return e.zorder-t.zorder}function d(e,t){(0,o.isMainSeriesState)(e)?e.zorder=0:e.zorder=t}function u(e,t){ -e.setZorder(t)}function p(e){return e.zorder()}function _(e){return Math.round(1e3*e)/1e3}function m(e,t){const i=Math.max(e,t),s=Math.min(e,t);return Math.max(0,Math.ceil(i)-Math.floor(s)-1)}function g(e,t,i){let s=0;const r=(n=t,o=e,Math.abs(1e3*o-1e3*n)/1e3);var n,o,a;return r>i?(e=Math.trunc(e),s=Math.floor(r/(i+1))):(a=r/(i+1),s=Math.floor(1e3*a)/1e3),{startZOrder:e,zOrderStep:s}}function f(e,t,i,s){let r=e.length,n=t;for(let t=e.length-1;t>=-1;t--)if(-1===t||s(e[t])){const s=t;let o=T(n);if(r-1===s)s>=0&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o-=1e4,0===o&&(o-=1e4))}let l=r-1;for(;l>s;){const t=_(n-a);i(e[l],t),n=t,l--}s>=0&&i(e[s],o)}n=o,r=s}}function v(e,t,i,s){let r=-1,n=t;for(let t=0;t<=e.length;t++)if(t===e.length||s(e[t])){const s=t;let o=P(n);if(r+1===s)s<=e.length-1&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o+=1e4,0===o&&(o+=1e4))}let l=r+1;for(;l<=s-1;){const t=_(n+a);i(e[l],t),n=t,l++}s<=e.length-1&&i(e[s],o)}n=o,r=s}}function S(e){!function(e,t,i,s,r,n){let o=null;const a=[];for(const r of e)t(r)?(a.push(r),o=r):(i(r)||s(r))&&a.push(r);a.sort(n),null!==o&&r(o,0);const l=null===o?-1:a.indexOf(o);-1!==l?(f(a.slice(0,l),0,r,i),v(a.slice(l+1),0,r,i)):v(a,0,r,i)}(e,o.isMainSeriesState,o.isStudyState,o.isLineToolState,d,h)}function y(e,t){const i=Math.floor(e/1e4);let s=t.get(i);return void 0===s&&(s=[],t.set(i,s)),s}function b(e,t,i,s,r,n){let o=-1/0,a=1/0,l=-1/0,c=0;const h=new Map;for(let s=0;sr(e)-r(t));let p=T(r(u[0]));const m=P(p),f=g(p,m,u.length+1).zOrderStep;return 0!==f?(u.forEach(e=>{const t=_(p+f);s(e,t),p=t}),_(p+f)):_(m+5e3)}function w(e,t){return b(e,l,c,u,p,t)}function C(e){let t=-1e4;for(const i of e)c(i)&&(t=Math.min(t,i.zorder()-1e4));return 0===t?-1e4:t}function P(e){const t=1e4*Math.ceil(e/1e4);return t===e?t+1e4:t}function T(e){const t=1e4*Math.floor(e/1e4);return t===e?t-1e4:t}function x(e,t,i,s,r,n,o){const l=t.length,{newItems:c,movedItemsStartIndex:h}=i>0?(0,a.moveAfter)(e,t,i-1):(0,a.moveBefore)(e,t,0);let d=!1;for(let t=h;tr(e))?function(e,t,i,s,r,n){let o,a,l=-1,c=-1;0===i?(c=I(e,i+t,s),a=n(e[c])):i+t===e.length?(l=M(e,i-1,s),o=n(e[l])):(l=M(e,i-1,s),o=n(e[l]),c=I(e,i+t,s),a=n(e[c]));if((void 0===o||o<0)&&void 0!==a&&a<=0)f(e.slice(0,c),a,r,s);else if((void 0===a||a>0)&&void 0!==o&&o>=0)v(e.slice(l+1),o,r,s);else{const n=i+t,o=e.length-i;n0)&&void 0!==a&&a>=0){c=a;const e=void 0!==l?l:P(a),s=g(c,e,t);c=s.startZOrder,p=s.zOrderStep,d=i,u=d+t,h=1}if(0!==p)for(;d!==u;){const t=_(c+h*p);n(e[d],t),c=t,d+=h}else{const t=e.findIndex(e=>r(e));-1!==t?(f(e.slice(0,t),0,n,s),v(e.slice(t+1),0,n,s)):v(e,0,n,s)}}(c,l,h,r,s,n,o)}function I(e,t,i){for(;t=0&&i(e[t]);)t--;return Math.max(0,t)}function L(e,t,i,s,r,n,o){const a=e.indexOf(i)+1;x(e,t,a,s,r,n,o)}function A(e,t,i,s,r,n,o){const a=e.indexOf(i);x(e,t,a,s,r,n,o)}function E(e,t,i){L(e,t,i,n.isSeries,c,u,p)}function k(e,t,i){A(e,t,i,n.isSeries,c,u,p)}},89453:(e,t,i)=>{"use strict";i.d(t,{setSymbolSearchCompleteOverrideFunction:()=>r,getSymbolSearchCompleteOverrideFunction:()=>n});let s=e=>Promise.resolve(e);function r(e){s=e}function n(){return s}},67072:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(2015),r=i(98125).getLogger("Chart.Study.MetaInfo"),n=i(59572).applyOverridesToStudyDefaults,o={};function a(e){TradingView.merge(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}}),TradingView.merge(this,e);var t=e.fullId||e.id;TradingView.merge(this,a.parseIdString(t))}a.VERSION_STUDY_ARG_SOURCE=41,a.METAINFO_FORMAT_VERSION_SOS_V2=42,a.VERSION_PINE_PROTECT_TV_4164=43,a.CURRENT_METAINFO_FORMAT_VERSION=52,a.VERSION_NEW_STUDY_PRECISION_FORMAT=46,a.CHILD_STUDY_ALLOWED_PLOT_TYPES=["line"],a.canPlotBeSourceOfChildStudy=function(e){return a.CHILD_STUDY_ALLOWED_PLOT_TYPES.includes(e)},a.CHILD_STUDY_EXCLUDE_IDS=["CorrelationCoefficient@tv-basicstudies","Correlation - Log@tv-basicstudies-1"],a.CHILD_STUDY_PARENT_EXCLUDE_IDS=[],a.FilledArea={},a.FilledArea.TYPE_PLOTS="plot_plot",a.FilledArea.TYPE_HLINES="hline_hline",a.versionOf=function(e){var t="_metainfoVersion"in e&&isNumber(e._metainfoVersion)?e._metainfoVersion:0;return t<0&&r.logError("Metainfo format version cannot be negative: "+t),t},a.parseIdString=function(e){var t={};if(-1===e.indexOf("@"))t.shortId=e,t.packageId="tv-basicstudies",t.id=e+"@"+t.packageId,t.version=1;else{var i=e.split("@");t.shortId=i[0];var s=i[1].split("-");if(3===s.length)t.packageId=s.slice(0,2).join("-"),t.id=t.shortId+"@"+t.packageId,t.version=s[2];else if(1===s.length&&"decisionbar"===s[0])t.packageId="les-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1;else{if(1!==s.length)throw new Error("unexpected study id:"+e);t.packageId="tv-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1}}if(t.fullId=t.id+"-"+t.version,"tv-scripting"===t.packageId){var r=t.shortId;if(0===r.indexOf("Script$")||0===r.indexOf("StrategyScript$")){var n=r.indexOf("_");t.productId=n>=0?r.substring(0,n):t.packageId}else t.productId=t.packageId}else t.productId=t.packageId;return t},a.getPackageName=function(e){ -return(/^[^@]+@([^-]+-[^-]+)/.exec(e||"")||[0,"tv-basicstudies"])[1]},a.cutDollarHash=function(e){var t=e.indexOf("$"),i=e.indexOf("@");return-1===t?e:e.substring(0,t)+(i>=0?e.substring(i):"")},a.hasUserIdSuffix=function(e){return/^USER;[\d\w]+;\d+$/.test(e)},a.isStandardPine=function(e){return/^(Strategy)?Script\$STD;.*@tv-scripting$/.test(e)},a.getSourceIdByInputs=function(e,t){if(!Array.isArray(e)||!t)return null;for(var i=0;i0){var l=o.replace(/^[^\$]+/,t);i.inputs[n.id].setValue(l)}}}},a.patchChildStudyMetaInfoState=function(e){e.state&&function e(t){if("object"==typeof t)for(var i in t)"string"==typeof t[i]&&/^[^\$]+\$\d+$/.test(t[i])?t[i]=t[i].replace(/^[^\$]+/,"{pid}"):e(t[i])}(e.state.inputs),e.state.isChildStudy=!0},a.getStudyIdWithLatestVersion=function(e){const t=a.cutDollarHash(e.id);let i=t;return t.indexOf("@tv-scripting")>=0?i+="-101!":i+="-"+e.version,i},a.prototype.parseValue=function(e,t){return"bool"===e?TradingView.parseBool(t):t},a.prototype.defaultInputs=function(){for(var e=[],t=0;t0?e[0].id:null},a.prototype.createDefaults=function(){if(this.defaults){var e=TradingView.clone(this.defaults);e.precision="default";var t=a.getStudyPropertyRootName(this);defaults.create(t,e)}},a.prototype.removeDefaults=function(){defaults.remove(a.getStudyPropertyRootName(this))},a.findStudyMetaInfoByDescription=function(e,t){if(e){for(var i=0;i{"use strict";window.TradingView=window.TradingView||{},window.requireAll=function(e){return e.keys().map(e)},i(28353),i(32563).setClasses(),i(9196),i(56186).install(),i(49483),i(80643),i(29892),i(94419),i(11417),i(11372),i(37562),i(56840)},97881:(e,t,i)=>{"use strict";var s=i(28353).t;i(70606);var r=i(88537).assert;i(96488),i(59803),i(87980);const n=i(67337);JSON.parse(urlParams.disabledFeatures).forEach((function(e){n.setEnabled(e,!1)})),JSON.parse(urlParams.enabledFeatures).forEach((function(e){n.setEnabled(e,!0)})),function(){window.__settingsOverrides=window.parent[window.urlParams.uid].settingsOverrides||{};var e=window.parent[window.urlParams.uid].settingsAdapter;null!=e?(TVSettings.setSettingsAdapter(e),TVSettings.sync()):n.enabled("use_localstorage_for_settings")&&TVSettings.sync()}();var o=i(22799).setChartFontFamily;window.urlParams.customFontFamily&&o(window.urlParams.customFontFamily);var a=i(84120).RestrictedToolsetBootloader,l=i(9753).HeaderToolbarBootloader,c=i(84746).DrawingToolbarBootloader,h=i(85593).isDrawingToolbarVisible;(0,i(32563).setClasses)() -;var d=i(6087),u=i(45345).setTheme,p=i(33225),_=i(17437),m=i(25760),g=i(47193).migrateShortcut,f=i(76900).ChartSaver,v=i(41051).SaveChartService,S=i(86879).LoadChartService,y=i(46723).StudyTemplates,b=i(22668).FavoriteStudyTemplateService,w=i(82992).linking,C=i(76422),P=i(97098).formatterOptions,T=i(69147).customFormatters,x=i(34615).StudyMarket,I=i(21097).TVXWindowEvents,M=i(81836).createDeferredPromise,L=i(15840).deepExtend,A=i(9423).randomHash,E=i(65576).convertPropertyToWatchedValue,k=i(95707).property,D=i(62428).property,V=i(21761).dateFormatProperty,B=i(43370).default,N=i(29823).Interval,R=i(89356).Root,O=i(28325).ChartPage,F=i(39138).destroyQuoteSessions,W=i(73383).TIMEFRAMETYPE,H=new O(new R(window).allocate()),z=H.allocate({areaName:"center"}),U=(window.parent[urlParams.uid].brokerFactory,Boolean(!1)),j=i(54427).CHART_WIDGET_COLLECTION_SERVICE,G=i(16216);i(65235);var q=i(43425),Y=i(12409).createFavoriteDrawingToolbar,K=i(77317).setupChartEventHint,$=i(81602).setupChartScreenshotHint,X=i(87983),Z=i(67072),J=i(28399);i(27595),i(15495);var Q=i(78136).setSearchRequestDelay,ee=i(16654),te=i(216),ie=i(17937).addBrandingSource,se=i(13221).setAdditionalSymbolInfoFields,re=i(89453).setSymbolSearchCompleteOverrideFunction,ne=i(52741).DropdownApi,oe=i(97056).ContextMenuManager;const ae=new AbortController;var le=window.parent[urlParams.uid].getCustomIndicators,ce=M(),he=M(),de=n.enabled("left_toolbar");if(void 0!==window.parent[urlParams.uid].contextMenu){var ue=window.parent[urlParams.uid].contextMenu;void 0!==ue.items_processor&&oe.setCustomItemsProcessor(ue.items_processor),void 0!==ue.renderer_factory&&oe.setCustomRendererFactory(ue.renderer_factory)}if(Promise.all([ce.promise,he.promise]).then((function(){window.ChartApiInstance.start()})),"function"==typeof le){var pe=le(te);pe&&pe.then?pe.then((function(e){if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void ce.resolve();JSServer.studyLibrary.push.apply(JSServer.studyLibrary,e),ce.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((function(e){console.warn("Error loading custom indicators "+e),ce.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),ce.resolve())}else ce.resolve();window.widgetReady=function(e){C.subscribe("onChartReady",e)};var _e=urlParams.theme&&urlParams.theme.toLowerCase();function me(e){window.__defaultsOverrides=window.__defaultsOverrides||{},L(window.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&(window.applyDefaultsOverrides(TradingView.defaultProperties.chartproperties),window.applyDefaultOverridesToLinetools())}!function(e){d.themes[e]&&u(e)}(_e),window.applyStudiesOverrides=function(e){e&&(window.chartWidgetCollection?window.chartWidgetCollection.applyStudiesOverrides(e):Z.mergeDefaultsOverrides(e))},window.applyOverrides=function(e){me(e), -window.chartWidgetCollection&&window.chartWidgetCollection.applyOverrides(e)},window.doWhenApiIsReady=function(e){window.tradingViewApi?e():he.promise.then(e)},window.applyTradingCustomization=function(e){for(var t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];for(var t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t]},window.changeTheme=function(e,t){var i=d.themes[e.toLowerCase()];return i?window.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},window.getTheme=function(){return window.tradingViewApi.themes().getCurrentThemeName()},window.is_authenticated=!1;JSON.parse(window.urlParams.brokerConfig);s("charts by TradingView"),s("powered by TradingView"),s("by TradingView");var ge=null,fe=M(),ve=null,Se=function(){if(n.setEnabled("charting_library_debug_mode","true"===urlParams.debug),n.setEnabled("chart_property_page_trading",!1),n.enabled("remove_library_container_border")){var e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}n.enabled("no_min_chart_width")&&(window.document.body.style.minWidth="0px"),null!=urlParams.studiesOverrides&&Z.mergeDefaultsOverrides(JSON.parse(urlParams.studiesOverrides)),r(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),me(JSON.parse(urlParams.overrides)),urlParams.numeric_formatting=urlParams.numeric_formatting&&JSON.parse(urlParams.numeric_formatting),urlParams.numeric_formatting&&"string"==typeof urlParams.numeric_formatting.decimal_sign&&(P.decimalSign=urlParams.numeric_formatting.decimal_sign[0]),window.ChartApiInstance=new X(window.parent[urlParams.uid].datafeed),window.parent[urlParams.uid].customFormatters&&(window.parent[urlParams.uid].customFormatters.timeFormatter&&(T.timeFormatter=window.parent[urlParams.uid].customFormatters.timeFormatter),window.parent[urlParams.uid].customFormatters.dateFormatter&&(T.dateFormatter=window.parent[urlParams.uid].customFormatters.dateFormatter),window.parent[urlParams.uid].customFormatters.tickMarkFormatter&&(T.tickMarkFormatter=window.parent[urlParams.uid].customFormatters.tickMarkFormatter),window.parent[urlParams.uid].customFormatters.priceFormatterFactory&&(T.priceFormatterFactory=window.parent[urlParams.uid].customFormatters.priceFormatterFactory)),window.ChartApiInstance.setStudiesAccessController(window.ChartApiInstance.createStudiesAccessController(urlParams.studiesAccess));var t=urlParams.chartContent?JSON.parse(urlParams.chartContent).json:void 0,o=urlParams.chartContentExtendedData?JSON.parse(urlParams.chartContentExtendedData):t?t.extendedData:void 0,u=urlParams.interval||"D",_=function(e){var t=/(\d+)(\w+)/;return e.map((function(e){var i=t.exec(e.text),r=i[2].toLowerCase(),n=parseInt(i[1]),o="y"===r?12*n+"M":n+r,a=N.parse(e.resolution);return{text:s(e.title)||n+s(r,{context:"dates",count:n}),description:e.description||"",value:{value:o.toUpperCase(),type:W.PeriodBack},targetResolution:a.value(),requiresIntraday:a.isIntraday()}})) -}(JSON.parse(urlParams.timeFrames)),m={resizerBridge:z,padding:n.enabled("border_around_the_chart")?2:0,content:t,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:window.ChartApiInstance.studiesAccessController.isToolEnabled("Volume"),muteSessionErrors:!0,timezone:urlParams.timezone,defSymbol:urlParams.symbol,defInterval:u,compareSymbols:urlParams.compareSymbols&&JSON.parse(urlParams.compareSymbols),defTimeframe:window.parent[urlParams.uid].timeframe,paneContextMenuEnabled:n.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:U},priceScaleContextMenuEnabled:n.enabled("scales_context_menu"),currencyConversionEnabled:n.enabled("pricescale_currency"),unitConversionEnabled:n.enabled("pricescale_unit"),legendWidgetEnabled:n.enabled("legend_widget"),legendWidget:{contextMenu:{settings:n.enabled("show_chart_property_page"),showOpenMarketStatus:n.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:n.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:n.enabled("scales_context_menu"),timezoneMenuEnabled:n.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:n.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:n.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:n.enabled("right_bar_stays_on_scroll"),minBarSpacing:urlParams.time_scale&&JSON.parse(urlParams.time_scale).min_bar_spacing},goToDateEnabled:n.enabled("go_to_date"),crossHair:{menuEnabled:n.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:n.enabled("mouse_wheel_scale"),pinch:n.enabled("pinch_scale"),axisPressedMouseMove:{time:n.enabled("axis_pressed_mouse_move_scale"),price:n.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:n.enabled("mouse_wheel_scroll"),pressedMouseMove:n.enabled("pressed_mouse_move_scroll"),horzTouchDrag:n.enabled("horz_touch_drag_scroll"),vertTouchDrag:n.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:n.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:n.enabled("cropped_tick_marks"),countdownEnabled:n.enabled("countdown"),indicatorsDialogShortcutEnabled:n.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:n.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:n.enabled("go_to_date"),availableTimeFrames:function(e,t){return e?t!==ee.STATUS_DELAYED&&t!==ee.STATUS_DELAYED_STREAMING&&t!==ee.STATUS_READY?[]:_.filter((function(t){return!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))})):[]}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:n.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:!1,backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,fullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0, -snapshotUrl:urlParams.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:n.enabled("save_shortcut")};de&&(Y(),m.widgetOptions.isDrawingToolbarVisible=h),o&&(m.metaInfo={id:o.uid,name:o.name,description:o.description,uid:o.uid,username:"",tags:""}),window.parent[urlParams.uid].additionalSymbolInfoFields&&se(window.parent[urlParams.uid].additionalSymbolInfoFields),window.parent[urlParams.uid].symbolSearchComplete&&re(window.parent[urlParams.uid].symbolSearchComplete);var g=window.chartWidgetCollection=new q(m);let M=!1;g.onAboutToBeDestroyed.subscribe(null,()=>{M=!0},!0),ie(g),window.studyMarket=new x(g),void 0!==G&&G.registerService(j,g),g.activeChartWidget.subscribe((function(e){C.emit("activeChartChanged",g.getAll().indexOf(e))})),window.saver=new f(g);var L=new v(g,window.saver),A=new S(g);window.chartWidget=g.activeChartWidget.value(),window.pro=new TradingView.Pro;var E=function(e){if(!n.enabled("header_widget"))return null;var t=H.allocate({areaName:"top"}),s=new(0,i(68425).ChartChangesWatcher)(e.chartWidgetCollection.undoHistory,e.chartWidgetCollection.lineToolsSynchronizerHasChanges,window.saver,C),r=JSON.parse(urlParams.favorites);r.intervals=r.intervals.map((function(e){var t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t}));var o=null;n.enabled("study_templates")&&(o=new b(I,TVSettings),ve=new y({chartWidgetCollection:e.chartWidgetCollection,favoriteStudyTemplatesService:o}));var c=void 0,h=urlParams.header_widget_buttons_mode;"fullsize"===h&&(c=["full"]);"compact"===h&&(c=["small"]);return new l(new a,{chartSaver:window.saver,chartApiInstance:ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:r.chartTypes,defaultFavoriteIntervals:r.intervals,hideStudyTemplates:!0,resizerBridge:t,studyMarket:window.studyMarket,studyTemplates:ve,favoriteStudyTemplatesService:o,allowedModes:c,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:s,onClick:Me,snapshotUrl:e.snapshotUrl})}({chartWidgetCollection:g,saveChartService:L,loadChartService:A,snapshotUrl:urlParams.snapshotUrl});null!==E?E.load().then((function(e){ge=e.getComponent(),fe.resolve()})):(fe.promise.catch((function(){})),fe.reject("header widget is not loaded"));var k=function(e){if(de){var t=urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)?String(urlParams.toolbarbg):void 0;if(t){var i=document.createElement("style");i.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(i)}return new c({bgColor:t,chartWidgetCollection:e,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,resizerBridge:H.allocate({areaName:"left"}),onClick:Me})}return null}(g),D=null;window.tradingViewApi=new J({chartWidgetCollection:g,chartApiInstance:window.ChartApiInstance,saveChartService:L,loadChartService:A});if(w.bindToChartWidgetCollection(g),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)), -!TradingView.isNaN(urlParams.ssreqdelay)){var V=Math.max(0,+urlParams.ssreqdelay);Q(V)}window.ChartApiInstance.connect(),Promise.all([i.e(5514),i.e(9129),i.e(2e3),i.e(6363),i.e(3466),i.e(7836),i.e(8463),i.e(3921),i.e(7427),i.e(1112),i.e(6909),i.e(5998),i.e(6416),i.e(7419),i.e(3520),i.e(9042),i.e(323),i.e(2849),i.e(880),i.e(1075),i.e(9505),i.e(1890),i.e(1784),i.e(7210),i.e(2306)]).then(i.t.bind(i,87805,23)).then(({default:e})=>{M||(window.lineToolPropertiesToolbar=new e(g))});var R=document.querySelector(".tv-content");function O(){k&&k.load(ae.signal),D&&D.load(ae.signal).then((function(e){window.footerWidget=e.getComponent()}))}null!==R&&R.addEventListener("contextmenu",(function(e){null!==e.target&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),he.resolve(),g.undoHistory.undoStack().onChange().subscribe(null,B((function(e){e&&!e.customFlag("doesnt_affect_save")&&C.emit("onAutoSaveNeeded")}),1e3*(urlParams.autoSaveDelay||5),{leading:!1,trailing:!0})),window.chartWidget.withModel(null,(function(){if(ChartApiInstance.on("realtime_tick",(function(e){C.emit("onTick",e)})),!d.savedThemeName()&&_e){var e=d.getStdTheme(_e);e&&e.content&&void 0===t&&g.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:_e,standardTheme:!0,syncState:!0,noUndo:!0}).then(()=>window.applyOverrides(window.__defaultsOverrides))}n.enabled("charting_library_debug_mode")&&C.subscribeToAll((function(){var e=Array.prototype.slice.call(arguments);console.log('Event "{0}", arguments: {1}'.format(e[0],JSON.stringify(e.slice(1))))})),K&&(K(g),K=null),$&&($(g,{seriesControlBarEnabled:n.enabled("timeframes_toolbar")}),$=null)})),p.isAnyChartWidgetInitialized(g)?O():p.waitAnyChartWidgetInitialized(g,O),C.subscribe("chart_load_requested",(function(e){window.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}))};window.addEventListener("unload",(function(){ae.abort(),window.widgetbar&&(window.widgetbar.destroy(),window.widgetbar=null),window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),window.ChartApiInstance&&window.ChartApiInstance.disconnect(),F(),window.ChartApiInstance&&(window.ChartApiInstance.destroy(),window.ChartApiInstance=null)})),n.enabled("saveload_storage_customization")&&(window.parent[urlParams.uid].saveLoadAdapter?_.setCustomAdapter(window.parent[urlParams.uid].saveLoadAdapter):void 0!==urlParams.chartsStorageUrl&&urlParams.chartsStorageUrl&&void 0!==urlParams.clientId&&urlParams.clientId?_.initialize(urlParams.clientId,urlParams.userId,urlParams.chartsStorageUrl,urlParams.chartsStorageVer||"1.0"):(n.setEnabled("saveload_storage_customization",!1),n.setEnabled("header_saveload",!1)));var ye=M();function be(){ye.resolve()}window.parent[urlParams.uid].loadLastChart&&n.enabled("saveload_storage_customization")?_.getCharts().then((function(e){if(0!==e.length){var t=e.sort((function(e,t){return t.modified_iso-e.modified_iso}))[0];_.getChartContent(t).then((function(e){ -var t=JSON.parse(e.content);t.extendedData=e,urlParams.chartContent=JSON.stringify({json:t}),be()})).catch(be)}else be()})).catch(be):be();var we,Ce,Pe=M();Promise.all([Pe.promise,ye.promise,window.loadedCustomCss]).then((function(){var e,t,i,s,r,o,a=document.querySelector(".loading-indicator");if(a&&(a.style.display="none"),setTimeout(Se,0),n.enabled("14851")&&Math.random()<=.02){e=window,t=document,i="script",s="ga",e.GoogleAnalyticsObject=s,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,r=t.createElement(i),o=t.getElementsByTagName(i)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",o.parentNode.insertBefore(r,o);var l=document.URL.match(new RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-112911840-1","auto"),ga("set","anonymizeIp",!0),ga("set",{hostname:l,page:l,referrer:l}),ga("send","pageview")}})),we=!0,window.parent[urlParams.uid].datafeed.onReady((function(e){we&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=e,Pe.resolve()})),we=!1,window.getFunctionFromArguments=function(e){return window.parent[urlParams.uid][e]},window.createShortcutAction=(Ce=m.createGroup({desc:"API"}),function(e,t){Ce.add({hotkey:g(e),handler:t})}),window.initializationFinished=function(){window.chartWidgetCollection.undoHistory.clearStack()},window.headerReady=function(){return fe.promise},window.createButton=function(e){if(null===ge)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1,ge.addButton(A(),e)},window.createDropdown=function(e){if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=A();return ge?(ge.addDropdown(t,e),Promise.resolve(new ne(ge,t))):fe.promise.then(()=>(ge.addDropdown(t,e),new ne(ge,t)))},window.getAllFeatures=function(){const e=n.getAllFeatures();return Object.keys(e).forEach((function(t){isNaN(parseFloat(t))||delete e[t]})),e};var Te=null;window.getNavigationButtonsVisibility=function(){return null===Te&&(Te=E(k())),Te};var xe=null;window.getPaneButtonsVisibility=function(){return null===xe&&(xe=E(D())),xe};var Ie=null;function Me(e){var t=TradingView.bottomWidgetBar;t&&t.turnOffMaximize()}window.getDateFormat=function(){return null===Ie&&(Ie=E(V)),Ie}},11372:(e,t,i)=>{e=i.nmd(e),TradingView.cleanButAmpersand=function(e,t){var i=t?["&"]:["&"];return TradingView.clean(e,t,i)},TradingView.strip_tags=function(e){return e&&e.replace?e.replace(/(<([^>]+)>)/gi,""):e},TradingView.encodeSpread=function(e){return encodeURIComponent(e)},TradingView.clean=function(e,t,i){var s=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]],r=e;if(!e||!e.replace)return r;for(var n=0;n{"use strict";i.r(t);var s=i(21097),r=i(51768),n=i(38780);function o(e,t=!1){"loading"!==document.readyState?t?setTimeout(()=>e(),1):e():document.addEventListener("DOMContentLoaded",()=>e())}new Promise(e=>{o(e)});function a(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth{document.addEventListener("mouseenter",e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){let e="x";if(t.matches(".apply-overflow-tooltip--direction_both")?e="both":t.matches(".apply-overflow-tooltip--direction_y")&&(e="y"),t.matches(".apply-overflow-tooltip--check-children")){let i=!1;const s=t.children;for(let t=0;t(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e),[]).join("").trim(),(0,n.showOnElement)(t,{text:i});const s=()=>{(0,n.hide)(),["mouseleave","mousedown"].forEach(e=>t.removeEventListener(e,s))};["mouseleave","mousedown"].forEach(e=>t.addEventListener(e,s))}},!0)});var l=i(2872),c=i.n(l),h=i(11417),d=i(15840);let u;function p(e){window.iframeAuthWidget&&!1===window.user.profile_data_filled&&(window.iframeAuthWidget.preventClose=!0);const t=window.user.available_offers||{};window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.user.is_pro&&window.location.reload()),!1===window.user.profile_data_filled&&((0,r.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):(Object.keys(t).forEach(e=>{const i=e;t[i].available_for_anons||delete t[i]}),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:t},h.TVLocalStorage.removeItem("trial_availiable"))}u=window.loginStateChange?window.loginStateChange:window.loginStateChange=new(c()),u.subscribe(null,p),s.TVXWindowEvents.on("loginStateChange",e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,u.fire()}),s.TVXWindowEvents.on("signOut",()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//].forEach(t=>{t.test(window.location.pathname)&&(e=!1)}),e&&window.location.reload()}()}),(()=>{const e={};window.crossTabSyncUserAttr=e=>{const t={};e instanceof Array?e.forEach(e=>{t[e]=window.user[e]}):t[e]=window.user[e],s.TVXWindowEvents.emit("user-obj-changed",JSON.stringify(t))},s.TVXWindowEvents.on("user-obj-changed",t=>{const i=JSON.parse(t);let s -;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(e[s]||[]).forEach(e=>{e.fire(i[s])})}})})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),u.fire()},window.loginUser=function(e,t){window.TVDialogs&&window.TVDialogs.signModal&&window.TVDialogs.signModal.close(),window.user=(0,d.deepExtend)({},e),window.TradingView.changeLoginState(!0),"function"==typeof t&&window.TVDialogs&&window.TVDialogs.signModal?window.TVDialogs.signModal.on("signinSuccess",()=>{t()}):"function"==typeof t&&t()},window.loginRequiredDelegate=new(c()),window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=p,window.TradingView.setTrialAvailiable=e=>{h.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new(c())},68906:(e,t,i)=>{"use strict";i.r(t),i.d(t,{generateColor:()=>r,alphaToTransparency:()=>n,transparencyToAlpha:()=>o,applyTransparency:()=>a,resetTransparency:()=>l,getLuminance:()=>c,isHexColor:()=>h,colorFromBackground:()=>d,gradientColorAtPercent:()=>u,isColorDark:()=>p,rgbaFromInteger:()=>_,rgbaToInteger:()=>m,colorToInteger:()=>g});var s=i(24377);function r(e,t,i){if(t=t||0,!h(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(o(t)))):e;const[r,n,a]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(o(t));return(0,s.rgbaToString)([r,n,a,l])}function n(e){return 100*(1-e)}function o(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function a(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),r=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],o(t)*r))}function l(e){return"transparent"===e||h(e)?e:(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function c(e){const t=(0,s.parseRgb)(e).map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function h(e){return 0===e.indexOf("#")}function d(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function u(e,t,i){const[r,n,o,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(r+i*(l-r)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(d-a));return(0,s.rgbaToString)(u)}function p(e){return c(l(e))<.5}function _(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function m(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function g(e){const t=(0,s.tryParseRgba)(e);return null===t?0:m(t)}},59199:(e,t,i)=>{"use strict";i.d(t,{doAnimate:()=>n});const s={from:0,duration:250,easing:i(68587).easingFunc.easeOutCubic};class r{constructor(e){this._doing=!0,this._completed=!1,this._options={...s,...e};const t=performance.now();window.requestAnimationFrame(e=>{this._animation(t,this._options.from,e)})}stop(){this._doing=!1}completed(){return this._completed} -_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const s=(i=!i||i<1e12?performance.now():i)-e,r=s>=this._options.duration||t===this._options.to,n=(o=this._options.from,a=this._options.to,l=this._options.easing(s/this._options.duration),o*(1-l)+a*l);var o,a,l;const c=r?this._options.to:n,h=c-t;this._options.onStep(h,c),r?this._finishAnimation():window.requestAnimationFrame(t=>{this._animation(e,c,t)})}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function n(e){return new r(e)}},85198:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>s});(0,i(98125).getLogger)("Fetch");function s(e,t,i={}){return window.fetch(e,t)}},98125:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LOGLEVEL:()=>n,getLogLevel:()=>_,isHighRateEnabled:()=>m,setLogLevel:()=>g,getRawLogHistory:()=>f,serializeLogHistoryEntry:()=>v,getLogHistory:()=>S,getLogger:()=>b,loggingOn:()=>C,loggingOff:()=>P});const s="undefined"!=typeof window?window:{};let r=!1;try{localStorage.getItem(""),r=!0}catch(e){}var n;!function(e){e[e.ERROR=1]="ERROR",e[e.WARNING=2]="WARNING",e[e.INFO=3]="INFO",e[e.NORMAL=4]="NORMAL",e[e.DEBUG=5]="DEBUG"}(n||(n={}));let o=0;const a=[];let l=null,c=null,h=null,d=NaN,u=n.WARNING,p=!1;function _(){return u}function m(){return p}function g(e){e=Math.max(n.ERROR,Math.min(n.DEBUG,e)),u=e,T()}function f(e,t){let i=a.reduce((e,t)=>e.concat(t),[]);return i.sort((e,t)=>e.id-t.id),void 0!==t&&(i=i.filter(e=>e.subSystemId===t)),"number"==typeof e&&(i=i.slice(-e)),i}function v(e){return new Date(e.timestamp).toISOString()+":"+e.subSystemId+":"+e.message.replace(/"/g,"'")}function S(e,t){return function(e,t){let i,s=0,r=0;for(i=e.length-1;i>=1&&(s+=8*(1+encodeURIComponent(e[i]).length),!(i-1>0&&(r=8*(1+encodeURIComponent(e[i-1]).length),s+r>t)));i--);return e.slice(i)}(f(e,t).map(v),75497472)}function y(e,t,i,r){if(t===c&&r.id===h)return;const a=new Date;if(e<=n.NORMAL&&function(e,t,i,r,n){"function"===s.structuredClone&&(t=s.structuredClone(t));const a={id:o,message:t,subSystemId:r,timestamp:Number(e)};o+=1,i.push(a),void 0!==n&&i.length>n&&i.splice(0,1)}(a,t,i,r.id,r.maxCount),e<=u&&(!r.highRate||m())&&(!l||r.id.match(l))){const i=a.toISOString()+":"+r.id+":"+t;switch(e){case n.DEBUG:console.debug(i);break;case n.INFO:case n.NORMAL:r.color?console.log("%c"+i,"color: "+r.color):console.log(i);break;case n.WARNING:console.warn(i);break;case n.ERROR:console.error(i)}c=t,h=r.id,d&&clearTimeout(d),d=setTimeout(()=>{c=null,h=null,d=NaN},1e3)}}function b(e,t={}){const i=[];a.push(i);const s=Object.assign(t,{id:e});function r(e){return t=>y(e,String(t),i,s)}return{logDebug:r(n.DEBUG),logError:r(n.ERROR),logInfo:r(n.INFO),logNormal:r(n.NORMAL),logWarn:r(n.WARNING)}}const w=b("logger"),C=s.lon=(e,t)=>{g(n.DEBUG),w.logNormal("Debug logging enabled"),p=Boolean(e),l=t||null,T()},P=s.loff=()=>{g(n.INFO),w.logInfo("Debug logging disabled")};function T(){try{r&&(localStorage.setItem("tv.logger.logHighRate",String(p)),localStorage.setItem("tv.logger.loglevel",String(u)))}catch(e){ -w.logWarn(`Cannot save logger state (level: ${u}, high-rate: ${p}) to localStorage: ${e.message}`)}}!function(){p=!!r&&"true"===localStorage.getItem("tv.logger.logHighRate");let e=parseInt(r&&localStorage.getItem("tv.logger.loglevel")||"");Number.isNaN(e)&&(e=n.WARNING),g(e),w.logNormal(`Init with settings - level: ${u}, high-rate: ${p}`)}(),s.performance&&s.performance.now?w.logNormal("Sync logger and perf times, now is "+s.performance.now()):w.logWarn("Perf time is not available")},52640:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},45415:(e,t,i)=>{"use strict";i.d(t,{visitObject:()=>n});var s=i(80643);function r(e,t,i){return(0,s.isArray)(e)?function(e,t,i){return e.map(e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s})}(e,t,i):(0,s.isObject)(e)&&((0,s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach(n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o}),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},28789:(e,t,i)=>{"use strict";function s(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}i.d(t,{regExpEscape:()=>s})},62820:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isRtl:()=>r,stripLTRMarks:()=>o,startWithLTR:()=>a,forceLTRStr:()=>l,forceLTRStrSsr:()=>c,forceRTLStr:()=>h,getLTRScrollLeft:()=>d,getLTRScrollLeftOffset:()=>u,detectAutoDirection:()=>m});var s=i(64531);const r=()=>"rtl"===window.document.dir,n=new RegExp("‎|‪|‫|‬","g");function o(e){return""!==e&&r()&&null!=e?e.replace(n,""):e}function a(e){return""!==e&&r()&&null!=e?"‎"+e:e}function l(e){return""!==e&&r()&&null!=e?"‪"+e+"‬":e}function c(e){return"‪"+e+"‬"}function h(e){return""!==e&&r()&&null!=e?"‫"+e+"‬":e}function d(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function u(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}const p=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,_=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function m(e){const t=p.exec(e);return t?_.test(t[0])?"rtl":"ltr":""}},68587:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},51193:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(9289),i.e(4017),i.e(3016),i.e(2077)]).then(i.bind(i,30349))}i.d(t,{loadChangeIntervalDialog:()=>s})},8636:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(51193);let r=null;function n(e){const t=r=(0,s.loadChangeIntervalDialog)().then(i=>{t===r&&i.showChangeIntervalDialog(e)});return t}},94420:(e,t,i)=>{"use strict";function s(e){ -return Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(2e3),i.e(7962),i.e(8986),i.e(6363),i.e(8463),i.e(9289),i.e(7345),i.e(7176),i.e(8268),i.e(9055),i.e(2358),i.e(5802),i.e(9837),i.e(3016),i.e(1075),i.e(6085),i.e(1859)]).then(i.bind(i,54801)).then(t=>t.showGoToDateDialog(e))}i.d(t,{showGoToDateDialog:()=>s})},65645:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(28353),r=i(3615);function n(e){"number"!=typeof e&&(e=TradingView.STUDY_COUNT_LIMIT),(0,r.showWarning)({title:(0,s.t)("Warning"),text:(0,s.t)("Studies limit exceeded: {number} studies per layout.\nPlease, remove some studies.").format({number:e})})}},34615:(e,t,i)=>{"use strict";i.d(t,{StudyMarket:()=>n});var s=i(52714),r=i.n(s);class n{constructor(e,t){this._visibility=new(r())(!1),this._dialogPromise=null,this._dialog=null,this._chartWidgetCollection=e,this._options=t}visible(){return this._visibility.readonly()}show(e,t){var i;null===this._dialog&&this._requestDialog(e,t),null===(i=this._dialog)||void 0===i||i.open(e,void 0,t)}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}resetAllPages(){var e;null===(e=this._dialog)||void 0===e||e.resetAllStudies()}_requestDialog(e,t){if(null===this._dialogPromise){let s;s=Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(7962),i.e(8986),i.e(8463),i.e(5774),i.e(1112),i.e(9637),i.e(775),i.e(3016),i.e(6456)]).then(i.bind(i,54127)).then(e=>new e.IndicatorsLibraryContainer(this._chartWidgetCollection,this._options)),this._dialogPromise=s.then(i=>{this._dialog=i,this._dialog.visible().subscribe(e=>{this._visibility.setValue(e)}),this._dialog.open(e,void 0,t)})}return this._dialogPromise}}},13221:(e,t,i)=>{"use strict";i.d(t,{setAdditionalSymbolInfoFields:()=>r,getAdditionalSymbolInfoFields:()=>n});let s=[];function r(e){s=e}function n(){return s}},88679:(e,t,i)=>{"use strict";function s(e,t){Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(6324),i.e(3016),i.e(9374)]).then(i.t.bind(i,65398,19)).then(i=>{i.showSymbolInfoDialog(e,t)})}i.d(t,{showSymbolInfoDialog:()=>s})},89330:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>s});class s{constructor(e){this._chartWidgetCollection=e}saveChartLineTools(e,t,i){return Promise.reject("Line tools storage is not supported")}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols(),s=i[t.activeChartWidget.value().id()],r={...(n=s,{...n,legs:JSON.stringify(null!==(o=n.legs)&&void 0!==o?o:[])})};var n,o;const a=t.metaInfo;return a.id.value()&&(r.id=a.id.value()),r.name=a.name.value()||"",r.description=a.description.value()||"",r.charts_symbols=function(e){const t={};for(const i of Object.keys(e))t[i]={symbol:e[i].symbol};return JSON.stringify(t)}(i),r.is_realtime=r.is_realtime=e?"0":"1",r}async _saveLineToolsToStorage(){return Promise.resolve()}}},76900:(e,t,i)=>{"use strict";var s=i(2872),r=i(28353).t,n=i(88537).assert,o=i(80643).deepEquals,a=i(43007).backend,l=i(89330).ChartSaverBase;r("The publication preview could not be loaded. Please disable your browser extensions and try again."), -r("Failed to save library"),r("Failed to save script");function c(e,t){e.content=JSON.stringify(t)}t.ChartSaver=class extends l{constructor(e){super(e),this._chartAboutToBeSavedDelegate=new s,this._chartSavedDelegate=new s,this._prevChartState=null,this._chartSizeLimitExceededDelegate=new s}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}whenReadyToSave(e){var t=this._chartWidgetCollection.activeChartWidget.value().model().mainSeries();if(t.hasDelayedSymbolIntervalChange()){var i,s=null;i=function(){t.dataEvents().symbolError().unsubscribe(null,s,!0),e()},s=function(){t.dataEvents().symbolResolved().unsubscribe(null,i,!0)},t.dataEvents().symbolResolved().subscribe(null,i,!0),t.dataEvents().symbolError().subscribe(null,s,!0)}else e()}saveToJSON(){var e=this._getCommonSavingInfo(!1);return c(e,this._getChartWidgetCollectionState(!1,!0)),e}_getChartWidgetCollectionState(e,t,i,s,r){return e||(t=!0,s=!1),t?this._chartWidgetCollection.state(!!e,i,s,r):this._chartWidgetCollection.activeChartWidget.value().state(!!e,i,s,r)}publishChart(e){}publishScript(e,t,i){}onPublish(e,t){}_saveChartImpl(e,t,i,s,r,n){var o=i,l=s;if(o=function(s){t.id.value()||(t.id.setValue(s),t.uid.setValue(s)),"function"==typeof i&&i(t,e)},!e.name)return console.warn("Saving chart with empty name is not allowed"),void s();a.saveChart(e.name,e.short_name,e.resolution,e,t).then(o.bind(this)).catch(l.bind(this))}_saveChart(e,t,i,s){var r=this._chartWidgetCollection.metaInfo,n=function(n){return o(this._prevChartState,n)[0]&&null!=r.id.value()?(this._chartSavedDelegate.fire(!0),void(t&&t(r,n))):this._saveChartImpl(n,r,t,i,s,e)}.bind(this);this._saveLineToolsToStorage().then((function(){var t=e(!0);return n(t)})).catch((function(t){var i=e(!1);return n(i)}))}saveChartSilently(e,t,i){i=i||{};var s=function(e){var t=e&&!1,s=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),r=this._getCommonSavingInfo(!1,t);return c(r,s),i.chartName&&(r.name=i.chartName),r.name&&0!==r.name.length||!i.defaultChartName||(r.name=i.defaultChartName),i.autoSave&&(r.autoSave=!0),r}.bind(this);this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart(s,function(t,i){n(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),this._chartWidgetCollection.metaInfo.name.setValue(i.name),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid.value(),data:i}),delete this._prevChartState.savingToken}.bind(this),function(){this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t.apply(null,arguments)}.bind(this),i)}isSaveInProcess(){return this._isSaveInProcess}}},1570:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(28353);function s(e){return e.description||""}},82724:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},8128:(e,t,i)=>{"use strict";function s(e){if(!o(e))throw e}function r(e){ -return(null==e?void 0:e.aborted)?Promise.reject(n()):new Promise((t,i)=>{null==e||e.addEventListener("abort",()=>i(n()),{once:!0})})}function n(){return new DOMException("Aborted","AbortError")}function o(e){return e instanceof Error&&"AbortError"===e.name}function a(e,t){return Promise.race([r(e),t])}async function l(e,t){let i;try{await a(e,new Promise(e=>{i=setTimeout(e,t)}))}finally{clearTimeout(i)}}i.d(t,{skipAbortError:()=>s,isAbortError:()=>o,respectAbort:()=>a,delay:()=>l})},98619:(e,t,i)=>{"use strict";function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const r=e.length;for(;is})},15840:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach(t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach(i=>{const n=e[i],o=t[i];if(o===e)return;const a=Array.isArray(o);if(o&&(r(o)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&r(n)?n:{},e[i]=s(t,o)}else void 0!==o&&(e[i]=o)})}),e):e}function r(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},88461:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},72077:(e,t,i)=>{"use strict";i.d(t,{getTwemojiUrl:()=>r});var s=i(18438);function r(e,t){let i="";return s.default.parse(e,e=>(i=s.default.base+("svg"===t?`svg/${e}.svg`:`72x72/${e}.png`),!1)),i}},9423:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>r,randomHash:()=>n,randomHashN:()=>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;i{"use strict";i.d(t,{parseHtml:()=>r,parseHtmlElement:()=>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),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}},54475:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n}) -;const r=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(r.join(", "))&&e.preventDefault()}},80054:(e,t,i)=>{"use strict";i.d(t,{htmlEscape:()=>n,removeSpaces:()=>o,capitalizeFirstLetterInWord:()=>a});const s=/[<"'&>]/g,r=e=>`&#${e.charCodeAt(0)};`;function n(e){return e.replace(s,r)}function o(e=""){return e.replace(/\s+/g,"")}function a(e=""){return e.replace(/\b\w/g,e=>e.toUpperCase())}},96397:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},38881:(e,t,i)=>{"use strict";i.d(t,{ChunkLoader:()=>r});var s=i(8128);class r{constructor(){this._retries=5,this._cache=null,this._tryLoad=(e,t)=>{this._retries=this._retries-1;this._startLoading(e).then(t,0!==this._retries?i=>{(0,s.isAbortError)(i)||setTimeout(()=>this._tryLoad(e,t),3e3)}:void 0)}}load(e){return this._cache||(this._cache=new Promise(this._tryLoad.bind(this,null!=e?e:null))),this._cache}}},65446:(e,t,i)=>{"use strict";function s(e,t){const i=e.files&&e.files.length>0;if(!i&&t&&t.eventPhase>0)return r(t,e),Promise.resolve();if(!i){let t=!1;const i=i=>{i.stopImmediatePropagation(),r(i,e),t=!0};try{document.addEventListener("copy",i,!0),document.execCommand("copy")}finally{document.removeEventListener("copy",i,!0)}if(t)return Promise.resolve()}return async function(e){if(!navigator.clipboard||!navigator.clipboard.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");const t={};for(const i of e.files||[])t[i.type]=i;e.text&&(t["text/plain"]=e.text);e.html&&(t["text/html"]=e.html);return navigator.clipboard.write([new window.ClipboardItem(t)])}(e)}function r(e,t){e.preventDefault();const i=e.clipboardData;t.text&&i.setData("text/plain",t.text),t.html&&i.setData("text/html",t.html)}async function n(e,t){if("text/plain"===t&&!navigator.clipboard.write){const t=await e;return navigator.clipboard.writeText(await t.text())}if(!navigator.clipboard||!navigator.clipboard.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");let i=null;try{i=new window.ClipboardItem({[t]:e})}catch(s){i=new window.ClipboardItem({[t]:await e})}if(i)return navigator.clipboard.write([i]);throw new Error("ClipboardApi is not supported")}i.d(t,{writeImpl:()=>s,writePromiseUsingApi:()=>n})},5370:(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.d(t,{parseUpdateMode:()=>s})},84917:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{WeekDays:()=>s,Months:()=>r}),function(e){e[e.SUNDAY=1]="SUNDAY",e[e.MONDAY=2]="MONDAY",e[e.TUESDAY=3]="TUESDAY",e[e.WEDNESDAY=4]="WEDNESDAY",e[e.THURSDAY=5]="THURSDAY",e[e.FRIDAY=6]="FRIDAY",e[e.SATURDAY=7]="SATURDAY"}(s||(s={})),function(e){ -e[e.JANUARY=0]="JANUARY",e[e.FEBRUARY=1]="FEBRUARY",e[e.MARCH=2]="MARCH",e[e.APRIL=3]="APRIL",e[e.MAY=4]="MAY",e[e.JUNE=5]="JUNE",e[e.JULY=6]="JULY",e[e.AUGUST=7]="AUGUST",e[e.SEPTEMBER=8]="SEPTEMBER",e[e.OCTOBER=9]="OCTOBER",e[e.NOVEMBER=10]="NOVEMBER",e[e.DECEMBER=11]="DECEMBER"}(r||(r={}))},81836:(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.d(t,{createDeferredPromise:()=>s})},76861:(e,t,i)=>{"use strict";function s(e=location.host){return-1!==["i18n.tradingview.com","partial.tradingview.com","www.tradingview.com","wwwcn.tradingview.com"].indexOf(e)||-1!==["d33t3vvu2t2yu5.cloudfront.net","dwq4do82y8xi7.cloudfront.net","s.tradingview.com","s3.tradingview.com"].indexOf(e)||e.match(/^[a-z]{2}\.tradingview\.com/)||e.match(/prod-[^.]+.tradingview.com/)?"battle":e.includes("tradingview.com")||e.includes("staging")?"staging":e.match(/webcharts/)?"staging_local":(e.match(/^localhost(:\d+)?$/),"local")}function r(){return"local"===s()}function n(){return"battle"===s()}function o(){return!n()}i.r(t),i.d(t,{environment:()=>s,isLocal:()=>r,isProd:()=>n,isDebug:()=>o})},80007:(e,t,i)=>{"use strict";i.d(t,{preventDefault:()=>r,wrapHandlerWithPreventEvent:()=>n,preventScrollByWheelClick:()=>o});var s=i(49483);function r(e){e.cancelable&&e.preventDefault()}function n(e){return t=>{r(t),e()}}function o(e){s.isChrome&&e.addEventListener("mousedown",e=>{if(1===e.button)return e.preventDefault(),!1})}},46627:(e,t,i)=>{"use strict";i.d(t,{FeatureToggleWatchedValue:()=>n});var s=i(52714),r=i.n(s);class n extends(r()){constructor(e,t){super(function(e,t){return t}(0,t))}destroy(){0}}},56186:(e,t,i)=>{"use strict";function s(e){if(e instanceof Error)return e.stack||e.message;try{return e.outerHTML.slice(0,1024)}catch(e){}try{if(void 0!==e)return JSON.stringify(e).slice(0,1024)}catch(e){}return String(e)}function r(){window.__tv_js_errors||(window.__tv_js_errors=[]),window.addEventListener("error",e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(`${t} ${e.message||"JS error"}. ${e.filename||""}, line ${e.lineno}, col ${e.colno}.\nError: `+s(e.error))},!1),window.addEventListener("unhandledrejection",e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(t+" Unhandled rejection.\nReason: "+s(e.reason))},!1),document.addEventListener("securitypolicyviolation",e=>{var t,i;const r=(new Date).toISOString(),n="report"===e.disposition?"CSP report-only":"CSP violation";window.__tv_js_errors.push(`${r} ${n}: ${e.violatedDirective||e.effectiveDirective}. ${e.sourceFile||""}, line ${null!==(t=e.lineno)&&void 0!==t?t:e.lineNumber}, col ${null!==(i=e.colno)&&void 0!==i?i:e.columnNumber}.\nBlocked URI: ${e.blockedURL||e.blockedURI}\nSample: ${e.sample}\nTarget: `+s(e.target))},!1)}i.d(t,{install:()=>r})},76422:(e,t,i)=>{"use strict";i.r(t),i.d(t,{unsubscribe:()=>l,on:()=>c,subscribe:()=>h,subscribeToAll:()=>d,emit:()=>u,emitOnce:()=>p});var s=i(2872),r=i.n(s);const n={},o=[],a={};function l(e,t,i){n[e].unsubscribe(i,t)}function c(e,t,i){ -h(e,t,i)}function h(e,t,i,s){n.hasOwnProperty(e)||(n[e]=new(r())),a[e]?t.call(i):n[e].subscribe(i,t,s)}function d(e){o.push(e)}function u(e,...t){const i=[e].concat(t);o.forEach(e=>{e.apply(null,i)}),n.hasOwnProperty(e)&&n[e].fire.apply(n[e],t)}function p(e){a[e]&&console.warn(`Something went wrong: emitOnce called multiple times with same event (${e})`),a[e]=!0,u.apply(null,arguments)}},25760:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Modifiers:()=>s.Modifiers,createGroup:()=>u,pressedKeys:()=>d,registerWindow:()=>p,unregisterWindow:()=>_});var s=i(68335),r=i(35749),n=i(52714),o=i.n(n);var a=i(51768);class l{constructor(e,t){this._group=e,this.hotkey=t.hotkey,this.handler=t.handler,this.desc=t.desc,this.element=t.element||null,t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1}destroy(){this._group&&(this._group.remove(this),this._group=null)}}class c{constructor(e,t){this._actions=[],this._manager=e,this.modal=!(!t||!t.modal),t&&(this.desc=t.desc),t&&t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1,this._manager.registerGroup(this)}add(e){const t=new l(this,e);return this._actions.push(t),t}remove(e){for(let t=this._actions.length;t-- >0;)this._actions[t]===e&&this._actions.splice(t,1)}handleHotkey(e,t){for(let i=this._actions.length;i-- >0;){const r=this._actions[i];if(r.hotkey===e&&((!r.element||t.target&&r.element.contains(t.target))&&!r.isDisabled()))return r.handler(t),t.preventDefault(),(0,a.trackEvent)("Keyboard Shortcuts",(0,s.humanReadableHash)(e)),!0}return!1}promote(){this._manager.promoteGroup(this)}destroy(){this._actions.length=0,this._manager.unregisterGroup(this)}}const h=new class{constructor(){this._groups=[],this._pressedKeys=new(o())(0),this._keyDownListener=e=>{if(e.defaultPrevented)return;const t=(0,s.hashFromEvent)(e);if(this._pressedKeys.setValue(t),!(0,r.isNativeUIInteraction)(t,e.target))for(let i=this._groups.length;i-- >0;){const s=this._groups[i];if(!s.isDisabled()){if(s.handleHotkey(t,e))return;if(s.modal)return}}},this._keyUpListener=e=>{const t=(0,s.hashFromEvent)(e);this._pressedKeys.setValue(t)},this._blurEvent=()=>{this._pressedKeys.setValue(0)},this._mouseEvent=e=>{const t=(0,s.modifiersFromEvent)(e),i=255&this._pressedKeys.value();this._pressedKeys.setValue(t|i)}}listen(e){e.addEventListener("keydown",this._keyDownListener),e.addEventListener("keyup",this._keyUpListener),e.addEventListener("blur",this._blurEvent),e.addEventListener("mousemove",this._mouseEvent)}unlisten(e){e.removeEventListener("keydown",this._keyDownListener),e.removeEventListener("keyup",this._keyUpListener),e.removeEventListener("blur",this._blurEvent),e.removeEventListener("mousemove",this._mouseEvent)}registerGroup(e){this._groups.push(e)}unregisterGroup(e){for(let t=this._groups.length;t--;)this._groups[t]===e&&this._groups.splice(t,1)}promoteGroup(e){let t=this._groups.length-1;for(let i=this._groups.length;i--;){ -if(this._groups[i]===e)return void(i!==t&&(this._groups.splice(i,1),this._groups.splice(t,0,e)));this._groups[i].modal&&(t=i-1)}}pressedKeys(){return this._pressedKeys}},d=h.pressedKeys();function u(e){return new c(h,e)}function p(e){h.listen(e)}function _(e){h.unlisten(e)}p(window)},68335:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMacKeyboard:()=>r,Modifiers:()=>n,modifiersFromEvent:()=>o,hashFromEvent:()=>a,hashShiftPlusEnter:()=>l,humanReadableModifiers:()=>c,humanReadableHash:()=>d});var s=i(49483);const r=(0,s.isMac)()||s.CheckMobile.iOS();var n;function o(e){let t=0;return e.shiftKey&&(t+=1024),e.altKey&&(t+=512),e.ctrlKey&&(t+=256),e.metaKey&&(t+=2048),t}function a(e){return o(e)|e.keyCode}!function(e){e[e.None=0]="None",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Mod=r?2048:256]="Mod",e[e.Control=256]="Control",e[e.Meta=2048]="Meta"}(n||(n={}));const l=1037;function c(e,t=!r){let i="";return 256&e&&(i+=r?"^":"Ctrl",t&&(i+=" + ")),512&e&&(i+=r?"⌥":"Alt",t&&(i+=" + ")),1024&e&&(i+=r?"⇧":"Shift",t&&(i+=" + ")),2048&e&&(i+=r?"⌘":"Win",t&&(i+=" + ")),i}const h={9:"⇥",13:"↵",27:"Esc",8:r?"⌫":"Backspace",32:"Space",35:"End",36:"Home",37:"←",38:"↑",39:"→",40:"↓",45:"Ins",46:"Del",188:",",191:"/"};for(let e=1;e<=16;e++)h[e+111]="F"+e;function d(e){let t=c(e);const i=255&e;return t+=i in h?h[i]:String.fromCharCode(i),t}},47193:(e,t,i)=>{"use strict";i.d(t,{migrateShortcut:()=>o});var s=i(68335);function r(e){if("number"==typeof e)return e;switch(e.toLowerCase()){case"ctrl":return s.Modifiers.Control;case"shift":return s.Modifiers.Shift;case"alt":return s.Modifiers.Alt;default:return e.toUpperCase().charCodeAt(0)}}function n(e){let t=0;for(let i=0;i{"use strict";i.d(t,{isTextEditingField:()=>r,isNativeUIInteraction:()=>n});var s=i(68335);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}},82992:(e,t,i)=>{"use strict";i.d(t,{linking:()=>u});var s=i(4889),r=i(52714),n=i.n(r),o=i(67337),a=i(37667),l=i(98125),c=i(15943);const h=(0, -l.getLogger)("Linking");var d;!function(e){e[e.NotBound=0]="NotBound",e[e.BoundToWidget=1]="BoundToWidget",e[e.BoundToModel=2]="BoundToModel"}(d||(d={}));const u=new class{constructor(){this._watchedSymbol=new(n()),this._seriesShortSymbol=new(n()),this._proSymbol=new(n()),this._watchedInterval=new(n()),this._watchedIntraday=new(n()),this._watchedSeconds=new(n()),this._watchedTicks=new(n()),this._watchedRange=new(n()),this._watchedSupportedResolutions=new(n()),this._watchedSupportedChartStyles=new(n())([]),this._symbolNamesList=new(n()),this._chartWidgetBindingState=d.NotBound,this._activeChartWidget=null,this._watchedSymbolListenerBound=this._watchedSymbolListener.bind(this),this._watchedIntervalListenerBound=this._watchedIntervalListener.bind(this),this._onSymbolLinkBound=this._onSymbolLink.bind(this),this._searchCharts=null,this._searchChartsLoadDebounced=null,this._selfEmit=!1,this._preventFeedBySymbol=!1,this._feedBySymbolDebounceCounter=0}get symbol(){return this._watchedSymbol}get proSymbol(){return this._proSymbol}get symbolNamesList(){return this._symbolNamesList}get seriesShortSymbol(){return this._seriesShortSymbol.readonly()}get interval(){return this._watchedInterval}get intraday(){return this._watchedIntraday.readonly()}get seconds(){return this._watchedSeconds.readonly()}get ticks(){return this._watchedTicks.readonly()}get range(){return this._watchedRange.readonly()}get supportedResolutions(){return this._watchedSupportedResolutions.readonly()}get supportedChartStyles(){return this._watchedSupportedChartStyles.readonly()}get preventFeedBySymbol(){return this._preventFeedBySymbol}bindToChartWidget(e){if(this.unbindFromChartWidget(),this._activeChartWidget=e,e.hasModel())return void this._onChartModelCreated(e.model());e.modelCreated().subscribe(this,this._onChartModelCreated),this._chartWidgetBindingState=d.BoundToWidget;const t=e.properties().childs().mainSeriesProperties.childs();this._watchedSymbol.setValue(t.symbol.value()),this._watchedInterval.setValue(t.interval.value())}unbindFromChartWidget(){switch(this._chartWidgetBindingState){case d.BoundToWidget:if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);break;case d.BoundToModel:this._symbolProperty().unsubscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.unsubscribe(this._watchedSymbolListenerBound),this._mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._updateSeriesSymbolInfo),this._mainSeries().dataEvents().symbolError().unsubscribe(this,this._updateSeriesSymbolInfo),this._intervalProperty().unsubscribe(this,this._onIntervalPropertyChange),this._watchedInterval.unsubscribe(this._watchedIntervalListenerBound),delete this._watchedSymbol.hook,delete this._watchedSymbol.writeLock}this._activeChartWidget=null,this._chartWidgetBindingState=d.NotBound}getChartWidget(){return this._activeChartWidget}bindToChartWidgetCollection(e){this._chartWidgetCollection=e,this.unbindFromChartWidget(),e.activeChartWidget.subscribe(e=>{ -this.unbindFromChartWidget(),this.bindToChartWidget(e)},{callWithLast:!0})}bindToSearchCharts(e){this.unbindFromSearchCharts(),this._searchCharts=e,e.onSearchBySymbol.subscribe(this,this._onSearchBySymbol),e.loadingSymbol.subscribe(e=>{!1===e&&(this._feedBySymbolDebounceCounter=0)}),this._watchedSymbol.subscribe(this._onSymbolLinkBound)}unbindFromSearchCharts(){this._searchCharts&&(this._searchCharts.onSearchBySymbol.unsubscribe(this,this._onSearchBySymbol),this._watchedSymbol.unsubscribe(this._onSymbolLinkBound),this._searchCharts=null)}setPreventFeedBySymbol(e){this._preventFeedBySymbol=e}_onSearchBySymbol(e){if(!e.resolved_symbol)throw new Error("no resolved_symbol");this._selfEmit=!0,this._watchedSymbol.setValue(e.resolved_symbol),this._selfEmit=!1}_onSymbolLink(e){if(!this._selfEmit){if(!this._searchCharts){const e="No search charts defined";throw h.logError(e),new Error(e)}this._preventFeedBySymbol||this._loadSearchCharts(e)}}_loadSearchCharts(e){if(!this._searchCharts){const e="No search charts defined";throw h.logError(e),new Error(e)}if(this._searchChartsLoadDebounced)return void(this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced(e)));const t=e=>this._searchCharts?(!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchChartsLoadDebounced=null,this._searchCharts.feedBySymbol.call(this._searchCharts,e)):()=>{};!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchCharts.feedBySymbol(e)}_mainSeries(){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");return this._activeChartWidget.model().mainSeries()}_properties(){return this._mainSeries().properties()}_symbolProperty(){return this._properties().symbol}_intervalProperty(){return this._properties().interval}_watchedSymbolListener(e){this._symbolProperty().value()!==e&&this._chartWidgetCollection.setSymbol(e)}_sendSnowplowAnalytics(){if(!window.user.do_not_track)throw new Error("unsupported")}_onSymbolPropertyChange(){const e=this._symbolProperty().value()!==this._watchedSymbol.value();this._watchedSymbol.setValue(this._symbolProperty().value()),e&&this._chartWidgetCollection.setSymbol(this._symbolProperty().value())}_onSymbolResolved(e){const t=this._mainSeries().symbolInfo();t&&this._applyValuesFromSymbolInfo(t)}_applyValuesFromSymbolInfo(e){const t=e.pro_name||o.enabled("trading_terminal")&&(e.full_name||e.name)||"";this._proSymbol.setValue(t),e.aliases&&this._symbolNamesList.setValue(e.aliases)}_updateSeriesSymbolInfo(){this._seriesShortSymbol.setValue(this._properties().shortName.value());const e=this._mainSeries().symbolInfo();if(e){this._applyValuesFromSymbolInfo(e);{const t=e.supported_resolutions -;t?this._watchedSupportedResolutions.setValue(t):this._watchedSupportedResolutions.setValue(void 0)}let t=(0,c.allChartStyles)();(0,a.isCloseBasedSymbol)(e)&&(t=t.filter(e=>(0,a.isSingleValueBasedStyle)(e))),this._watchedSupportedChartStyles.setValue(t),this._watchedIntraday.setValue(!!e.has_intraday),this._watchedSeconds.setValue(!!e.has_seconds),this._watchedTicks.setValue(!(0,a.isCloseBasedSymbol)(e)&&!!e.has_ticks),this._watchedRange.setValue(!(0,a.isCloseBasedSymbol)(e))}else this._watchedIntraday.deleteValue(),this._watchedSeconds.deleteValue(),this._watchedTicks.deleteValue(),this._watchedRange.deleteValue(),this._proSymbol.deleteValue()}_watchedIntervalListener(e){this._intervalProperty().value()!==e&&this._chartWidgetCollection.setResolution(e)}_onIntervalPropertyChange(){const e=this._intervalProperty().value()!==this._watchedInterval.value();this._watchedInterval.setValue(this._intervalProperty().value()),e&&this._chartWidgetCollection.setResolution(this._intervalProperty().value())}_onChartModelCreated(e){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");this._chartWidgetBindingState=d.BoundToModel,this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);const t=this._symbolProperty();t.subscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.setValue(t.value()),this._watchedSymbol.subscribe(this._watchedSymbolListenerBound);const i=this._mainSeries();i.dataEvents().symbolResolved().subscribe(this,this._onSymbolResolved),this._watchedSymbol.hook=e=>(i.symbolSameAsCurrent(e)&&(e=i.symbol()),e),i.dataEvents().symbolResolved().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolError().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolGroupNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),this._updateSeriesSymbolInfo();const s=this._intervalProperty();s.subscribe(this,this._onIntervalPropertyChange),this._watchedInterval.setValue(s.value()),this._watchedInterval.subscribe(this._watchedIntervalListenerBound),this._activeChartWidget.readOnly()&&(this._watchedSymbol.writeLock=!0)}};window.TradingViewApi||(window.TradingViewApi={linking:u})},11417:(e,t,i)=>{"use strict";const{getLogger:s}=i(98125),r=s("TVLocalStorage");var n=function(){try{this.isAvailable=!0,this.localStorage=window.localStorage,this.localStorage.setItem("tvlocalstorage.available","true")}catch(e){delete this.isAvailable,delete this.localStorage}this._updateLength();try{this._report()}catch(e){}};n.prototype._report=function(){if(this.isAvailable){const e=10,t=[];for(let e=0;et.length-e.length);const i=t.slice(0,e);t.sort((e,t)=>t.key.length-e.key.length);const s=t.slice(0,e);r.logNormal("Total amount of keys in Local Storage: "+this.length),r.logNormal(`Top ${e} keys with longest values: ${JSON.stringify(i)}`), -r.logNormal(`Top ${e} longest key names: ${JSON.stringify(s)}`);try{navigator.storage.estimate().then(e=>{r.logNormal("Storage estimate: "+JSON.stringify(e))})}catch(e){}}},n.prototype.length=0,n.prototype.isAvailable=!1,n.prototype.localStorage={"tvlocalstorage.available":"false"},n.prototype._updateLength=function(){if(this.isAvailable)this.length=this.localStorage.length;else{var e,t=0;for(e in this.localStorage)this.localStorage.hasOwnProperty(e)&&t++;this.length=t}},n.prototype.key=function(e){return this.isAvailable?this.localStorage.key(e):Object.keys(this.localStorage)[e]},n.prototype.getItem=function(e){return this.isAvailable?this.localStorage.getItem(e):void 0===this.localStorage[e]?null:this.localStorage[e]},n.prototype.setItem=function(e,t){this.isAvailable?this.localStorage.setItem(e,t):this.localStorage[e]=t,this._updateLength()},n.prototype.removeItem=function(e){this.isAvailable?this.localStorage.removeItem(e):delete this.localStorage[e],this._updateLength()},n.prototype.clear=function(){this.isAvailable?this.localStorage.clear():this.localStorage={},this._updateLength()};var o=function(e){this.storage=e};o.prototype.getItem=function(e){return Promise.resolve(this.storage.getItem(e))},o.prototype.setItem=function(e,t){return Promise.resolve(this.storage.setItem(e,t))},window.TVLocalStorage=new n,window.TVLocalStorageAsync=new o(window.TVLocalStorage),e.exports={TVLocalStorage:window.TVLocalStorage,TVLocalStorageAsync:window.TVLocalStorageAsync}},84015:(e,t,i)=>{"use strict";function s(e,t=!1){return!1}function r(e){return e}i.d(t,{isOnMobileAppPage:()=>s,urlWithMobileAppParams:()=>r})},19334:(e,t,i)=>{"use strict";function s(){}i.d(t,{addPerfMark:()=>o});const r=console.timeStamp?console.timeStamp.bind(console):s,n=window.performance&&performance.mark?performance.mark.bind(performance):s;window.performance&&performance.measure&&performance.measure.bind(performance),window.performance&&performance.clearMarks&&performance.clearMarks.bind(performance);function o(e){r(e),n(e)}},14905:(e,t,i)=>{"use strict";function s(e){return e===r(e)}function r(e){const t=e.indexOf("$"),i=e.indexOf("@");return t<0&&i>=0?null:e.substring(Math.max(t+1,0),i>=0?i:e.length)}i.d(t,{isPineIdString:()=>s,extractPineId:()=>r})},16216:(e,t,i)=>{"use strict";i.r(t),i.d(t,{registerService:()=>o,unregisterService:()=>a,hasService:()=>l,service:()=>c,waitServiceRegistered:()=>h});var s=i(81836);const r={},n=new Map;function o(e,t){if(l(e))throw new Error("Service already registered");r[e.id]=t;const i=n.get(e.id);void 0!==i&&(n.delete(e.id),i.resolve(t))}function a(e){if(!l(e))throw new Error("Service not found");r[e.id]=void 0}function l(e){return void 0!==r[e.id]}function c(e){const t=r[e.id];if(void 0===t)throw new Error("ServiceLocator: Service "+e.id+" not found");return t}function h(e){if(l(e))return Promise.resolve(c(e));let t=n.get(e.id);return void 0===t&&(t=(0,s.createDeferredPromise)(),n.set(e.id,t)),t.promise}},56840:(e,t,i)=>{"use strict";e=i.nmd(e),i(49483);i(85198).fetch -;var s=i(28789).regExpEscape,r=i(21097).TVXWindowEvents,n=i(11417).TVLocalStorage,o=i(2872),a=i(67337),l=["s.tradingview.com","betacdn.tradingview.com"],c=a.enabled("use_localstorage_for_settings"),h=window.TVSettings=function(){var e=!1,t=null;function i(){return!t&&c}try{e=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(e){}if(e){var d={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},u=function(e,t,i){var s=d[e];return null==s?t:s},p=function(){};return{loaded:!1,loadedModel:!1,getValue:u,getJSON:u,getBool:u,getFloat:u,getInt:u,setValue:p,setJSON:p,remove:p,keys:function(){return Object.keys(d)},keysMask:function(){return[]},sync:p,onSync:{subscribe:function(){}}}}window.environment;var _,m=TradingView.onWidget()?"tradingview-widget":"tradingview",g=m+".",f={},v=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^domepanel.visible$/,/^orderpanel.visible$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/,/^trading\.orderWidgetMode\./,/^symbolWatermark$/,/^pinereference\.size$/,/^pinereference\.position$/,/^hint\.+/,/^ChartDrawingToolbarWidget\.visible/];function S(e){return g+e}function y(e,t){var i=f[e];return null==i?t:i}function b(e,t,i){i=i||{};var s=""+t;return f[e]!==s&&(f[e]=s,C(e)),i.forceFlush&&!_&&(_=setTimeout((function(){_=void 0,P()}),10)),h}function w(e,t){return t=t||{},null!=f[e]&&(delete f[e],C(e)),t.forceFlush&&P(),h}function C(e){if(t)null==f[e]?t.removeValue(e):t.setValue(e,f[e]);else if(i())try{null==f[e]?n.removeItem(S(e)):n.setItem(S(e),f[e])}catch(e){}else 0;r.emit("settings",JSON.stringify({key:e,value:f[e]}))}function P(e){}function T(){return Object.keys(f)}function x(e){for(var t=0;t=0;n--)e.test(i[n])&&r.push(i[n]),e.lastIndex=0;return r},sync:function(e){null!==e?(t?M(t.initialSettings||{}):i()?(function(){if(TradingView.onWidget()&&l.includes(window.location.host))for(var e=n.length;e--;){var t=n.key(e);if(0===t.indexOf("tradingview.")){var i=t.replace("tradingview.",m+".");n.setItem(i,n.getItem(t)),n.removeItem(t)}}}(),function(){f={};for(var e=!a.enabled("save_chart_properties_to_local_storage"),t=n.length;t--;){var i=n.key(t);if(i&&I(i)){var s=i.substring(g.length);e&&!x(s)||(f[s]=n.getItem(i))}}}()):M(e||{}),L.fire()):!0},onSync:L,setSettingsAdapter:function(e){t=e}}}();e&&e.exports&&(e.exports=h)},26843:(e,t,i)=>{"use strict";i.d(t,{StdTheme:()=>a.StdTheme,getStdChartTheme:()=>h,getStdThemeNames:()=>c,isStdTheme:()=>u,translateThemeName:()=>d});var s=i(28353),r=i(24377) +r.assert)("hline_hline"===t.type,"Wrong filledArea type: "+t.type),this._initBandIndexes(t.objAId,t.objBId),this._fillStyleProps=i,this._bandBgRenderer=new Ye}update(){if(this._points=[],!this._fillStyleProps.childs().visible.value())return;if(null===this._bandAKey||null===this._bandBKey)return;const e=this._source.properties().bands[this._bandAKey],t=this._source.properties().bands[this._bandBKey],i=this._source.priceScale(),s=this._source.firstValue();i&&!i.isEmpty()&&null!==s&&(this._points.push(i.priceToCoordinate(e.value.value(),s)),this._points.push(i.priceToCoordinate(t.value.value(),s)))}renderer(){let e=this._fillStyleProps.childs().transparency.value();e=(0,z.clamp)(e,0,100);const t={points:this._points,backcolor:(0,k.generateColor)(this._fillStyleProps.childs().color.value(),e),transparency:this._fillStyleProps.childs().transparency.value()};return this._bandBgRenderer.setData(t),this._bandBgRenderer}_initBandIndexes(e,t){this._bandAKey=null,this._bandBKey=null;(0,r.ensureDefined)(this._source.metaInfo().bands).forEach((i,s)=>{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)})}}var Xe=i(13933),Ze=i(36759),Je=i(23653),Qe=i(33291),et=i(52714),tt=i.n(et),it=i(37667),st=i(8175),rt=i(97098),nt=i(67802),ot=i(26811),at=i(69147);const lt=(0,o.getLogger)("Chart.Study"),ct=(0,n.t)("Invalid Symbol");const ht={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:A.enabled("dont_show_boolean_study_arguments"),asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!0,priceInputsForDisplay:!1},dt=A.enabled("study_symbol_ticker_description"),ut=A.enabled("hide_main_series_symbol_from_indicator_legend");function pt(e,t){const i=e.plots[t];if(!i||!(0,L.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,L.isOhlcPlotStyleBars)(r)||n&&(0,L.isOhlcPlotStyleBars)(n)||!!o&&(0,L.isOhlcPlotStyleBars)(o)}function _t(e,t){const i=e.plots[t];if(!i||!(0,L.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,L.isOhlcPlotStyleCandles)(r)||n&&(0,L.isOhlcPlotStyleCandles)(n)||!!o&&(0,L.isOhlcPlotStyleCandles)(o)}function mt(e,t){(0,r.assert)(void 0!==e,"zOrder must be defined"),(0,r.assert)(!t.has(e),"zOrder must be unique")}class gt extends d.PriceDataSource{constructor(e,t,i,s){super(e),this.onStart=new(c()),this._onHibernationStateChange=new(c()),this._symbolsResolved=new(c()),this._statusChanged=new(c()),this._paneViews=[],this._legendView=null,this._priceAxisViews=[],this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={}, +this._source=null,this._isChildStudy=!1,this._status={type:Xe.StudyStatusType.Undefined},this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._numericFormatter=new M.NumericFormatter,this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._labelPaneViews=[],this._ownFirstValue=null,this._plotOffsets={},this._formatter=null,this._ongoingDataUpdate=Promise.resolve(),this._studyModified=!1,this._isDestroyed=!1,this._graphics=new g.LiveStudyGraphics,this._tagsChanged=new(c()),this._currencySourceSymbolInputProperty=null,this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new(c()),this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new(tt())(0),this._currencySourceSymbolInfo=null,this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),i instanceof gt&&(this._source=i,this._isChildStudy=!0,this._source.setChild(this));const r=this.parentSource();r.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),r.unitChanged().subscribe(this,this._onSourceUnitChanged),r.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),r.formatterChanged().subscribe(this,this._onSourceFormatterChanged),r.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),dt&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,()=>{this.invalidateTitleCache(!0)}),this._properties.subscribe(this,this._onPropertiesChanged),this._properties.visible.subscribe(this,this._visibleChanged),this._properties.visible.subscribe(this,this.processHibernate),this._properties.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),this._properties.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offsets&&this._properties.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offset&&this._properties.offset.listeners().subscribe(this,this._updateMaxOffsetValue),this._initializeCurrencySource(),b.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;e=0?e:0}} +return this._isChildStudy&&m().patchChildStudyMetaInfoState(l),l}restoreData(e){var t,i;this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=null!==(t=e.symbols)&&void 0!==t?t:{},this._graphics=e.graphics?(0,g.loadStudyGraphics)(e.graphics):(0,g.emptyStudyGraphics)(),this._postProcessGraphics(),this._plotOffsets=null!==(i=e.plotOffsets)&&void 0!==i?i:{},this._setStatus({type:Xe.StudyStatusType.Completed},!0)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}hasBarColorer(){return(0,r.ensureNotNull)(this._metaInfo).plots.some(L.isBarColorerPlot)}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}isChildStudy(){return this._isChildStudy}hasChildren(){return this._children.length>0}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){if(this._model.collapsed().value()||!this.properties().visible.value()||!this.isActualInterval())return!1;const e=this.metaInfo();if(e.plots.length>0)return!0;for(const t of Object.keys(e.graphics))for(const i of Object.keys(e.graphics[t])){const e=this.properties().graphics[t][i];if(!e.visible||e.visible.value())return!0}return!(!e.isTVScriptStrategy&&!e.hasAlertFunction)}inputs(e){const t=(0,I.merge)((0,I.clone)(ht),e||{});return t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0),this._buildInputs(t)}metaInfo(){return this._metaInfo}status(){return this._status}name(e){return e?this.metaInfo().shortDescription||this._properties.shortDescription&&this._properties.shortDescription.value()||"Study":this.metaInfo().description||this._properties.description&&this._properties.description.value()||"Study"}title(e,t,i,s){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const r=JSON.stringify([e,t,i,s]);if(this._titleStrCache[r])return this._titleStrCache[r];if(this._titleInPartsCache[r])return this._joinTitlesParts(this._titleInPartsCache[r]);const n=this._title(e,t,i,s);return this._titleStrCache[r]=n,n}titleInParts(e,t,i,s){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const r=JSON.stringify([e,t,i,s]);if(this._titleInPartsCache[r])return this._titleInPartsCache[r];const n=this._titleInParts(e,t,i,s);return this._titleInPartsCache[r]=n,n}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e)),this._labelPaneViews.forEach(t=>t.update(e)),null===(t=this._dataWindowView)||void 0===t||t.update(),null===(i=this._legendView)||void 0===i||i.update(),null===(s=this._statusView)||void 0===s||s.update(),this._priceAxisViews.forEach(t=>t.update(e)),this._priceLinesAxisViews.forEach(t=>t.update(e)),null===(r=this._inputsLinesPaneView)||void 0===r||r.update(e),null===(n=this._inputsAnchorsPaneView)||void 0===n||n.update(e),this._inputsTimeAxisPaneViews.forEach(t=>t.update(e)),this._inputsPriceAxisPaneViews.forEach(t=>t.update(e))}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&m().isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}currency(){if(null!==this._currencySourceSymbolInfo)return(0,it.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this.parentSource().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this.parentSource().unit():null}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}inputsForAlertState(){ +return this.inputs()}sessionId(){return this.parentSource().sessionId()}sessionIdChanged(){return this.parentSource().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,C.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return new S.StudyLegendValuesProvider(this,this.model())}statusProvider(e){return new x.StudyStatusProvider(this,this._model.properties().childs().scalesProperties.childs().textColor)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&b.hideAllIndicators().value()}paneViews(e){if(this.isSourceHidden()||!e.hasPriceDataSource(this))return null;const t=[];return!this._startMovingPoint&&this._wasCompletedBefore&&t.push(...this._paneViews),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&t.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&t.push(this._inputsAnchorsPaneView),t}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){if(this.properties().oldShowLastValue&&!this.properties().oldShowLastValue.value())return null;let i=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(i=i.concat(this._inputsPriceAxisPaneViews)),e.findTargetPriceAxisViews(this,t,i,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e,this.stop()}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,Qe.dataSourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,this.start(),{indexesChanged:!1,pricesChanged:!1}}clearData(){var e;this._invalidateLastNonEmptyPlotRowCache(),this.data().clear(),this._graphics instanceof g.LiveStudyGraphics&&(null===(e=this._graphics)||void 0===e||e.clear()),this._plotOffsets={},this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,Qe.dataSourceChangeEvent)(this.id(),void 0,!0))}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._isChildStudy&&(0,r.ensureNotNull)(this._source).processHibernate(),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate() +;this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every(e=>e.isHibernationAllowed()))}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,Qe.dataSourceChangeEvent)(this.id())),this._model.updateSource(this)}maxOffset(){return this._maxOffset}_transformData(e){}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,r.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,r.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){throw new Error("Not implemented")}isHibernated(){return!this.isVisible()&&!this.isStarted()}_createViews(){var e,t;this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._paneViews=[],this._labelPaneViews=[];const i=new Set,s=this.metaInfo(),n=Boolean(s.usePlotsZOrder),o=new Map;if(s.plots)for(let t=0;t{const i=this._properties.bands[t];if(i&&i.visible.value()){const t=new qe(i,this),s=n?(0,r.ensureDefined)(e.zorder):o.size;mt(s,o),o.set(s,{paneViews:[t]})}}),this._properties.bandsBackground&&((0,r.assert)(!n,"'usePlotsZOrder' flag does not supported"),o.set(o.size,{paneViews:[new Ke(this)]}));const a=this._paneViews;(0,g.createGraphicsPaneViews)(this,this.model()).then(e=>{for(let t=0;ts.plots.some(t=>(0,L.isColorerPlot)(t)&&t.target===e);if(this._properties.filledAreas&&s.filledAreas)for(let e=0;ee-t);for(let e=0;e0){const t=this.barColorer().firstColoredBar(e[0].index);this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);this._model.recalculatePane(r,(0,Qe.dataSourceChangeEvent)(this.id(),null!=s?s:void 0)),this._updateSources()}_updateSources(){ +this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}_titleInputs(e,t){return this.inputs(this._titleInputsOptions(e,t))}_titleInputsOptions(e,t){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!1,skippedGroups:[],noExchanges:e,noResolution:t,skipColorInputs:!0,skipTimeInputs:!0,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:ut}}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_unsubscribeToSessionId(){this._isSubscribedToSessionId&&(this.sessionIdChanged().unsubscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!1)}_onSessionIdChanged(){this.restart(!0)}_title(e,t,i,s){const r=this._titleInParts(e,t,i,s);return this._joinTitlesParts(r)}_formatterByMetaInfo(){var e,t;const i=this.metaInfo().format;if("inherit"===i.type)return null;const s=this.series().symbolInfo(),r=(0,I.isNumber)(i.precision)?Math.pow(10,i.precision):void 0;{const s=null!==(t=null===(e=null===at.customFormatters||void 0===at.customFormatters?void 0:at.customFormatters.studyFormatterFactory)||void 0===e?void 0:e.call(at.customFormatters,i,this.symbolSource().symbolInfo()))&&void 0!==t?t:null;if(null!==s)return s}switch(i.type){case"price":return new rt.PriceFormatter(r);case"volume":{let e=i.precision;return void 0===e&&(e=s&&(0,I.isNumber)(s.volume_precision)?s.volume_precision:0),new nt.VolumeFormatter(e)}case"percent":return new ot.PercentageFormatter(r);default:return lt.logWarn("Unsupported format type: "+i.type),null}}_postProcessPriceRange(e){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new u.PriceRange(e.minValue()-t,e.maxValue()+t)}const t=this.priceScale();return t&&t.isLog()&&e?new u.PriceRange(t.priceToLogical(e.minValue()),t.priceToLogical(e.maxValue())):e}_joinTitlesParts(e){const t=e[1]?e[1].join(", "):"";return e[0]+(t.length>0?" ("+t+")":"")}_titleInParts(e,t,i,s){var r;const o=this.name(e);t=t||{};const a=[(0,n.t)(o,{context:"study"})];let l=[];if(!i){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&a.push(i);const n=this.metaInfo(),o=this._titleInputs(s,!0)||[];if(o.length>0){const i={};if(this._isChildStudy)for(let t=0;t=0&&this._source){const t=this._source.metaInfo(),n=this._source.title(e,{},!0,s);if(1===t.plots.length)i[l]=n;else{const e=l.split("$")[1],s=null===(r=t.plots[parseInt(e)])||void 0===r?void 0:r.id,o=t.styles&&t.styles[s],a=o&&o.title||s;i[l]=n+": "+a}}break}l=o.map(e=>{let s=(0,I.isNumber)(e)?this._numericFormatter.format(e):i&&i[e.toString()]||e.toString();return t&&t[s.toString()]&&(s=t[s.toString()]),s})}}return[a.join(" · "),l]}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;t"line"===e.type)}_hasAlertConditions(){if(this.metaInfo().plots.some(L.isAlertConditionPlot))return!0;const e=this.stateForAlert();return Boolean(e.alerts&&e.alerts.conditions)}_hasAlertFunction(){const e=this.metaInfo();return Boolean(e.hasAlertFunction)}_onDataUpdate(e,t){this._studyModified&&(this.clearData(),this._studyModified=!1);const i=(0,h.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then(()=>i,()=>i).then(this._onDataUnpacked.bind(this,e,t.indexes)),this._ongoingDataUpdate}_mergeData(e){var t,i;return this._invalidateLastNonEmptyPlotRowCache(),null!==(i=null===(t=this.data().merge(e))||void 0===t?void 0:t.index)&&void 0!==i?i:null}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_allSymbolsAreResolved(){const e=this.metaInfo(),t=[];let i=!1;for(let s=0;sthis._symbolsResolved.fire()):e}return Promise.all(t).catch(e=>(this._setStatus({type:Xe.StudyStatusType.Error,errorDescription:{error:ct}}),this.stop(!0),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e))).then(()=>{null!==this._studyId&&this.stop(!0),this.start(!0),this._symbolsResolved.fire(),this._recheckLineToolsActuality()})}_getSymbolForApi(e){return e}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise((i,s)=>{this._onSymbolResolvingStart(),this._chartApi.resolveSymbol((0,P.makeNextSymbolId)(),e,r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":this._setStatus({type:Xe.StudyStatusType.Undefined}),this._resolvedSymbols[e]=r.params[1],this._resolvedSymbolsByInput[t]=r.params[1],this._onSymbolResolved(e,t,r.params[1]),this.invalidateTitleCache(!0),i();break;case"symbol_error":if(this._setStatus({type:Xe.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===T.permissionDenied&&r.params[2])switch(r.params[2]){case T.SymbolErrorPermissionDeniedReason.Symbol:if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i);break;default:return void this._resolveSymbol(r.params[2],t).then(i)}0,s()}})}),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach(e=>{e.ownerSource()===this&&e.calcIsActualSymbol()})}_getSymbolObject(e){const t={symbol:e},i=this.currency() +;return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){this._onCurrencyMayChange()}_onSymbolResolvingStart(){}_onSymbolError(){}_setStatus(e,t){var i;this._status=e,e.type===Xe.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==Xe.StudyStatusType.Error&&e.type!==Xe.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(e))}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;ivoid 0!==i[e],1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)}_onCurrencyChanged(){"alwaysOff"!==(0,st.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_tryChangeInputs(){const e=(0,r.ensureDefined)((0,I.clone)(this._inputs));this.isStarted()&&this._chartApi.isConnected().value()?this._allInputsAreValid()?this._allSymbolsAreResolved().then(()=>{const t=this.inputs({keepOptionalSymbolsEmpty:!0}),i=JSON.stringify(t)!==JSON.stringify(this._inputs);this._isStopped()?i&&this.disablePriceRangeReady():i&&(this._changeInputsImpl(t,e),this._inputs=t)}).catch(e=>{lt.logError("ERROR: "+this._debugId()+" _tryChangeInputs: cannot modify study, "+e)}):this.stop():(this.stop(!0),this.start(!0)),this._tagsChanged.fire()}_debugId(){const e=[] +;return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,i){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(i),this._transformData(e);const s=this._mergeData(e);null!==i&&(i.indexes_replace?((0,r.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds,this._metaInfo.graphics))),this._onDataUpdated(e,i,t,s),this.priceRangeReady()||this._enablePriceRangeReady()}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._plotOffsets;this._plotOffsets=e&&e.offsets||{},(0,s.default)(t,this._plotOffsets)||this.updateAllViews((0,Qe.dataSourceChangeEvent)(this.id(),void 0,!0)),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){const r=s.id,n=this.properties().styles[r],o=(0,L.isShapesPlot)(s)||(0,L.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,L.isArrowsPlot)(s);let a=(0,L.isLinePlot)(s)||(0,L.isOhlcPlot)(s);if(o){const e=n.location.value(),t=[f.MarkLocation.Absolute,f.MarkLocation.Top,f.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||o&&t,a=a||e===f.MarkLocation.Absolute}if(!a)return i;const l={name:r,offset:this.offset(r)},c=n.plottype.value();if(!this.properties().skipHistogramBaseOnAutoScale&&[L.LineStudyPlotStyle.Histogram,L.LineStudyPlotStyle.Columns,L.LineStudyPlotStyle.Area].indexOf(c)>=0){const s=n.histogramBase.value(),r=this.data().minMaxOnRangeCached(e,t,[l]);return(0,I.isNumber)(s)&&null!==r&&(i.baseValueMinMax=(0,p.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,p.mergeMinMax)(i.baseValueMinMax,r)),i}return i.fields.push(l),i}_fillPrecalculatedAutoscaleInfo(e,t){return this._metaInfo.plots.filter(e=>!(0,L.isPlotWithTechnicalValues)(e)).filter(e=>{const t=e.id;let i;if((0,L.isOhlcPlot)(e)){const t=e.target;i=this.properties().ohlcPlots[t]}else i=this.properties().styles[t];return i.visible.value()}).reduce((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_buildInputs(e){(0,r.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){lt.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach(i=>{null!=t[i]&&(e[i]=t[i])}),e}{const e=[];return Object.keys(t).forEach(i=>{null!=t[i]&&e.push(t[i])}),e}}_prepareInput(e,t){const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return[]}_dependenciesForAlerts(){throw new Error("Not implemented")}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0, +Ze.isActualInterval)(this._series.intervalObj(),this.properties().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this.source();if(e instanceof gt){const t=e.metaInfo();return t.is_price_study&&"Compare@tv-basicstudies"!==t.id?e._getNonPriceParent():e}return null}_updateInputValue(e,t){const i=this._properties.inputs;if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){var e;null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=null!==(e=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()])&&void 0!==e?e:null)}_initializeCurrencySource(){var e,t;const i=this.metaInfo(),s="symbolInputSymbolSource"===(null===(e=i.symbolSource)||void 0===e?void 0:e.type)&&(null===(t=i.symbolSource)||void 0===t?void 0:t.inputId),r=i.inputs.find(e=>e.id===s),n="symbol"===(null==r?void 0:r.type);if("string"==typeof s&&n&&i.is_price_study){const e=this._properties.inputs[s];null!=e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}}},55153:(e,t,i)=>{"use strict";i.d(t,{StudyCompare:()=>N});var s=i(88537),r=i(8175),n=i(66101),o=i(37667),a=i(2015),l=i.n(a),c=i(67337),h=i(3825),d=i(97938),u=i(74477);const p=c.enabled("force_exchange_as_title");class _ extends d.PriceAxisView{constructor(e,t){super(),this._studyCompare=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._studyCompare.priceScale(),r=this._studyCompare.lastValueData(this._data.plotIndex,!1);if(r.noData||null===s||s.isEmpty())return;i.background=r.color,i.textColor=this.generateTextColor(r.color),i.coordinate=r.coordinate,i.floatCoordinate=r.floatCoordinate;const n=this._studyCompare.model().properties().childs().scalesProperties.childs();n.showSeriesLastValue.value()&&(e.text=(0,u.getCurrentModePriceText)(s,r),n.seriesLastValueMode.value()!==h.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,u.getOppositeModePriceText)(s,r),e.visible=!0),t.text="",n.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._studyCompare.symbolInfo();return p?e=(0,o.displayedSymbolExchange)(t):this._studyCompare.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,o.displayedSymbolName)(t)),e}}i(28353);var m=i(26179),g=i(44601),f=i(85733),v=i(49483),S=i(80643),y=i(89027);class b extends y.StudyValuesProvider{constructor(e,t){super(e,t),this._emptyValues[0].title=e.guiPlotName("")}_hideValues(){return!1}}const w=v.CheckMobile.any();class C extends m.StudyDataWindowView{constructor(e,t){super(e,t),this._studyCompare=e}_hideValues(){return!1}_createValuesProvider(e,t){return new b(e,t)} +_currentIndex(){const e=this._model.crossHairSource().lockedIndex;let t;return w&&(null===this._model.crossHairSource().pane&&void 0===e||(0,g.isLineToolName)(f.tool.value())||null!==this._model.lineBeingEdited())?t=this._study.data().lastIndex():(t=this._model.crossHairSource().appliedIndex(),(0,S.isNumber)(t)||(t=this._study.data().lastIndex())),t}}class P extends C{constructor(e,t){super(e,t),this._additional=null,this._showSeriesOHLC=t.properties().childs().paneProperties.childs().legendProperties.childs().showSeriesOHLC,this._showSeriesOHLC.subscribe(this,this.update)}areValuesVisible(){return this._showSeriesOHLC.value()}destroy(){this._showSeriesOHLC.unsubscribeAll(this)}additional(){return this._additional}_updateImpl(){super._updateImpl()}}var T=i(190),x=i(40529);class I extends x.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(!0,void 0,!1,!1)}}var M=i(14791),L=i(52714),A=i.n(L);const E=c.enabled("study_overlay_compare_legend_option"),k=c.enabled("force_exchange_as_title"),D=c.enabled("uppercase_instrument_names"),V=!c.enabled("hide_study_compare_legend_item"),B=c.enabled("hide_unresolved_symbols_in_legend");class N extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new(l())(null)),e.hasChild("unitId")||e.addChild("unitId",new(l())(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._isActingAsSymbolSource=new(A())(!0),this._realignToolsLastParams=null,this.properties().childs().minTick.subscribe(null,()=>this._recreatePriceFormattingDependencies()),this.properties().childs().minTick.subscribe(null,()=>this._model.fullUpdate()),this.properties().childs().currencyId.subscribe(this,this._onCurrencyChanged),this.properties().childs().unitId.subscribe(this,this._onUnitChanged),this.properties().merge({skipHistogramBaseOnAutoScale:!0}),this._symbolResolvingActive=new(A())(!1),this._symbolHibernated=new(A())(!1),e.mainSeries().onIntervalChanged().subscribe(this,()=>e.realignLineTools(this))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}properties(){return super.properties()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}createPriceAxisView(e){return new _(this,{plotIndex:"compare"})}setSymbolParams(e){this._setSymbolCurrencyUnitInternal(e)}symbol(){return this._properties.inputs.symbol.value()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.inputs.symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){ +const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,M.symbolSameAsCurrent)(e,this.symbol(),this.symbolInfo())}currency(){return this._properties.currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,o.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this._properties.unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,o.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return 2}setStyle(e){}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}state(e,t){const i=super.state(e,t);return this._model.unitConversionEnabled()||delete i.state.unitId,e&&((0,s.ensureDefined)(i.data).symbols={___snapshot:this.symbolInfo()||void 0}),i}symbolTitle(e,t){return this.title(!0,{},!1,e)}titleInParts(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return[D?r.toUpperCase():r]}tags(){const e=this.symbol();return e?[e]:[]}statusView(){return V?super.statusView():null}guiPlotName(e){return this.properties().childs().inputs.childs().symbol.value()}canOverrideMinTick(){return!0}canBeHiddenByGlobalFlag(){return!1}valuesProvider(){return new b(this,this.model())}statusProvider(e){return new I(this,this._model.properties().childs().scalesProperties.childs().textColor)}_createViews(){this._legendView||(this._legendView=new P(this,this._model)),this._dataWindowView||(this._dataWindowView=new C(this,this._model)),this._statusView||(this._statusView=new T.StudyStatusView(this)),super._createViews()}_showLastValueOnPriceScale(){return this._model.properties().childs().scalesProperties.childs().showSeriesLastValue.value()}_onUnitChanged(){"alwaysOff"!==(0,r.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_getSymbolForApi(e){return(0,o.symbolForApi)(this._resolvedSymbolsByInput[e]||null,e)}_onSymbolResolvingStart(){super._onSymbolResolvingStart(),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,o.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,o.symbolCurrency)(i),n=(0,o.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolCurrencyUnitInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}_changeInputsImpl(e,t){super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_createStudyOnServer(){super._createStudyOnServer(),this._realignLineToolsIfParamsChanged()}_tryCreateFormatter(){const e=this.symbolInfo() +;return(0,o.createSeriesFormatter)(e,this.properties().childs().minTick.value())}_titleInParts(e,t,i,s){const r=this.symbolInfo();let n;if(r){const e=(0,o.getStudySymbolExchange)(r);if(k&&e)n=e;else if(n=r.name,E)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":n=r.description;break;case"ticker-and-description":n=`${r.name}, ${r.description}`}else if(e&&!s)return[n,[e]]}else n=B?"":this.properties().childs().inputs.childs().symbol.value();return[n]}_setSymbolCurrencyUnitInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),a=n.inputs.childs().symbol.value(),l=n.currencyId.value(),c=n.unitId.value();if(void 0!==i&&i!==a&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&s!==l&&n.currencyId.setValueSilently(s),void 0!==r&&r!==c&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,o.symbolCurrency)(e)),n.unitId.setValueSilently((0,o.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==a&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol),n.currencyId.value()!==l&&n.currencyId.listeners().fire(n.currencyId),n.unitId.value()!==c&&n.unitId.listeners().fire(n.unitId),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){const e=this.symbol(),t=this.interval(),i=this.currency(),s=this.unit();null!==this._realignToolsLastParams&&this._realignToolsLastParams.symbol===e&&this._realignToolsLastParams.interval===t&&this._realignToolsLastParams.currency===i&&this._realignToolsLastParams.unit===s||(this._model.realignLineTools(this),this._realignToolsLastParams={symbol:e,interval:t,currency:i,unit:s})}}},82927:(e,t,i)=>{"use strict";i.d(t,{StudyOverlayBase:()=>le});var s=i(88537),r=i(49483),n=i(98125),o=i(66101),a=i(8175),l=i(63948),c=i(37667),h=i(2015),d=i.n(h),u=i(19234),p=i(67337),_=i(90810),m=i(14791),g=i(59100),f=i(9315),v=i(71053),S=i(80643),y=i(69927),b=i(52714),w=i.n(b),C=i(33291),P=i(190),T=i(42169),x=i(97938),I=i(3825),M=i(74477);const L=p.enabled("force_exchange_as_title");class A extends x.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._source.lastValueData("close",!1);if(s.noData)return;const r=this._source.model(),n=this._source.priceScale();if(null===n)return;if(!r.isPriceScaleVisible(n))return;i.background=s.color,i.textColor=this.generateTextColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate;const o=this._source.model().properties().childs().scalesProperties.childs();o.showSeriesLastValue.value()&&(e.text=(0,M.getCurrentModePriceText)(n,s),o.seriesLastValueMode.value()!==I.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,M.getOppositeModePriceText)(n,s),e.visible=!0),t.text="",o.showSymbolLabels.value()&&(t.text=this._paneText(), +t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.symbolInfo();return L?e=(0,c.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,c.displayedSymbolName)(t)),e}}var E=i(55057);class k extends E.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}var D=i(43891),V=i(40254);class B{constructor(e){this._lineRenderer=new V.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1,!this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0);e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:D.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var N=i(93751),R=i(14445),O=i(44601),F=i(85733),W=i(22458);const H=r.CheckMobile.any();class z extends R.DataWindowView{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 R.DataWindowItem(e.title,"")),this.update()}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}update(){this._invalidated=!0}study(){return this._study}_updateImpl(){this._header=this._study.title();let e;this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,N.isNumber)(e)||(e=this._study.data().lastIndex()));const t=this._valueProvider.getValues(e);for(let e=0;ee||t,i.showBarChange,i.showSeriesOHLC),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new U.OverlayLegendValuesProvider(e,t)}}var q=i(28978),Y=i(66919),K=i(85224),$=i(33837),X=i(34041),Z=i(35251),J=i(30076),Q=i(59153) +;const ee=r.CheckMobile.any()&&!1,te=p.enabled("uppercase_instrument_names"),ie=p.enabled("study_overlay_compare_legend_option"),se=p.enabled("secondary_series_extend_time_scale"),re=p.enabled("hide_unresolved_symbols_in_legend"),ne=!p.enabled("hide_study_overlay_legend_item"),oe=(0,n.getLogger)("Chart.StudyOverlay");function ae(e,t){return null==e[t]}class le extends o.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new(d())(null)),e.hasChild("unitId")||e.addChild("unitId",new(d())(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._quotesProvider=new _.QuotesProvider,this._seriesSource=null,this._symbolResolvingActive=new(w())(!1),this._symbolHibernated=new(w())(!1),this._styleToRecover=null,this._isActingAsSymbolSource=new(w())(!0),this._realignToolsLastParams=null,this.m_data=new v.PlotList((0,l.seriesPlotFunctionMap)(),ae),ee&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const r=this.properties().childs();r.currencyId.subscribe(this,this._onCurrencyChanged),r.unitId.subscribe(this,this._onUnitChanged),r.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),r.style.subscribe(this,this._onChartStyleChanged),r.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),this._formatter=null,e.mainSeries().onIntervalChanged().subscribe(this,()=>e.realignLineTools(this))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}properties(){return this._properties}setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.inputs.symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}supportsPressedChunks(){return!1}pressedChunks(e,t){throw new Error("Pressed chunks are not supported")}data(){return null===this._seriesSource?super.data():this._seriesSource.data().bars()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,m.symbolSameAsCurrent)(e,this.symbol(),this.symbolInfo())}priceSource(){switch(this._properties.style.value()){case 2:return this._properties.lineStyle.priceSource.value();case 3:return this._properties.areaStyle.priceSource.value();case 10:return this._properties.baselineStyle.priceSource.value();case 13: +return this._properties.columnStyle.priceSource.value()}return null}barFunction(){return this._barFunction}quotes(){return this._quotesProvider.quotes()}currency(){return this._properties.currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,c.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this._properties.unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,c.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}state(e,t){const i=super.state(e,t);return this._model.unitConversionEnabled()||delete i.state.unitId,e&&((0,s.ensureDefined)(i.data).symbols={___snapshot:this.symbolInfo()||void 0}),i}symbolTitle(e,t){return this.title(!0,{},!1,e)}title(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return te?r.toUpperCase():r}titleInParts(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return[te?r.toUpperCase():r]}isStarted(){return null===this._seriesSource?super.isStarted():this._seriesSource.isStarted()}sourceId(){return null===this._seriesSource?super.sourceId():(0,s.ensureNotNull)(this._seriesSource.instanceId())}moveData(e){null===this._seriesSource?super.moveData(e):this._seriesSource.moveData(e)}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const i=this.data().search(t,v.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==i?this._barFunction(i.value):null,this._ownFirstValue}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s;const o=this.properties().childs();if(!o.visible.value())return s;const a=this.nearestIndex(n.lastBar(),v.PlotRowSearchMode.NearestLeft,1);if(void 0===a)return s;const l=this.firstValue();if(null===l)return s;const c=this._lastNonEmptyPlotRow(4),h=null!==c&&n.contains(c.index),d=null!==c?c.value:null,u=t||h?d:this.data().valueAt(a);if(null===u)return s;const p=this._barFunction(u);if(!(0,S.isNumber)(p))return s;const _=r.priceToCoordinate(p,l);let m;switch(o.style.value()){case 0:m=u[1]<=u[4]?o.barStyle.childs().upColor.value():o.barStyle.childs().downColor.value();break;case 1:case 9:m=u[1]<=u[4]?o.candleStyle.childs().upColor.value():o.candleStyle.childs().downColor.value();break;case 13:m=u[1]<=u[4]?o.columnStyle.childs().upColor.value():o.columnStyle.childs().downColor.value();break;case 2:m=o.lineStyle.childs().color.value();break;case 3:m=o.areaStyle.childs().color1.value();break;case 10:{const e=o.baselineStyle.childs() +;m=_(0,s.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}}r&&this._paneViews.push(r),null!==i&&this._paneViews.push(i),this._paneViews.push(new B(this)),this._dataWindowView||(this._dataWindowView=new z(this,this._model)),this._legendView||(this._legendView=new G(this,this._model)),this._statusView||(this._statusView=new P.StudyStatusView(this)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new q.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){null===this._seriesSource?super._createStudyOnServer():this._modifyStudyOnServer((0,s.ensureDefined)(this._inputs)),this._realignLineToolsIfParamsChanged()}_modifyStudyOnServer(e){null===this._seriesSource?super._modifyStudyOnServer(e):(this._seriesSource.modifySeries((0,u.decodeExtendedSymbol)(e.symbol),(0,f.getServerInterval)(this._series.properties().childs().interval.value())),this._seriesSource.isStarted()||this._seriesSource.start())}_stopStudyOnServer(){null===this._seriesSource?super._stopStudyOnServer():this._seriesSource.stop()}_titleInParts(e,t,i,s){const r=this.symbolInfo();let n;if(r){if(n=r.name,ie)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":n=r.description;break;case"ticker-and-description":n=`${r.name}, ${r.description}`}const e=!s&&(0,c.getStudySymbolExchange)(r);if(e)return[n,[e]]}else n=re?"":this.properties().childs().inputs.childs().symbol.value();return[n]}_onAllowExtendTimeScaleChanged(){const e=this.isStarted();if(e&&this.stop(!0),se&&this.properties().childs().allowExtendTimeScale.value()){this._seriesSource=new g.SeriesDataSource(this._model.chartApi(),"st_o_");const e=this._seriesSource.dataEvents();e.seriesError().subscribe(this,e=>{this._onStudyError(this._convertSeriesErrorToStudy(e))}),e.loading().subscribe(this,this._onStudyLoading), +e.completed().subscribe(this,(e,t)=>{this._onStudyCompleted(t)}),e.dataUpdated().subscribe(this,()=>{this._studyModified=!1;const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,C.dataSourceChangeEvent)(this.id())),this._updateSources(),this.priceRangeReady()||this._enablePriceRangeReady()})}else{if(null!==this._seriesSource){const e=this._seriesSource.dataEvents();e.seriesError().unsubscribeAll(this),e.loading().unsubscribeAll(this),e.completed().unsubscribeAll(this),e.dataUpdated().unsubscribeAll(this),this._seriesSource.destroy()}this._seriesSource=null}e&&this.start(!0)}_convertSeriesErrorToStudy(e){return{error:e.error,ctx:e.ctx,solution_id:e.solution_id}}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),l=o.currencyId.value(),h=o.unitId.value(),d=o.style.value();if(void 0!==i&&i!==a&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&s!==l&&o.currencyId.setValueSilently(s),void 0!==r&&r!==h&&o.unitId.setValueSilently(r),void 0!==n&&o.style.setValueSilently(n),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,c.symbolCurrency)(e)),o.unitId.setValueSilently((0,c.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol),o.currencyId.value()!==l&&o.currencyId.listeners().fire(o.currencyId),o.unitId.value()!==h&&o.unitId.listeners().fire(o.unitId),o.style.value()!==d&&o.style.listeners().fire(o.style),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){var e;const t=null!==(e=this.priceSource())&&void 0!==e?e:"close";this._barFunction=(0,l.barFunction)(t)}_onChartStyleChanged(){var e;this._updateBarFunction(),(null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,c.isCloseBasedSymbol)(this.symbolInfo())?(0,c.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){const e=this.symbol(),t=this.interval(),i=this.currency(),s=this.unit();null!==this._realignToolsLastParams&&this._realignToolsLastParams.symbol===e&&this._realignToolsLastParams.interval===t&&this._realignToolsLastParams.currency===i&&this._realignToolsLastParams.unit===s||(this._model.realignLineTools(this),this._realignToolsLastParams={symbol:e,interval:t,currency:i,unit:s})}}},41855:(e,t,i)=>{"use strict";i.d(t,{StudyPriceAxisView:()=>r});var s=i(97938);class r extends s.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1 +;const s=this._source.model(),r=this._source.priceScale();if(null===r)return;if(!s.isPriceScaleVisible(r))return;const n=this._source.lastValueData(this._data.plotIndex,!1);if(n.noData)return;i.background=n.color;let o=n.color;"transparent"===o&&(o=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(o),i.coordinate=n.coordinate,i.floatCoordinate=n.floatCoordinate,this._showAxisLabel()&&(e.text=n.text,e.visible=!0),this._updatePaneRendererData(t)}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().showLabelsOnPriceScale.value()}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().showLabelsOnPriceScale.value()}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},59572:(e,t,i)=>{"use strict";i.d(t,{applyOverridesToStudy:()=>c,applyOverridesToStudyDefaults:()=>h});var s=i(88537),r=i(50993);const n=(0,i(98125).getLogger)("Chart.Model.StudyPropertiesOverrider");var o,a;function l(e,t,i,s){const r=i.split(".");if(0===r.length||0===r[0].length)return;const l=function(e){const t=e.split(":");return{name:t[0],type:2===t.length?t[1]:null}}(r[0]),c=l.name,h=l.type,d=null!==h,u=!d||"band"===h,p=!d||"area"===h,_=!d||"input"===h,m=!d||"plot"===h?a.getPlotIdByTitle(e,c):null,g=u?a.getBandIndexByName(e,c):null,f=p?a.getFilledAreaIdByTitle(e,c):null,v=_?a.getInputByName(e,c):null,S=t.hasOwnProperty(c);if((null!==m?1:0)+(null!==g?1:0)+(null!==f?1:0)+(null!==v?1:0)+(S?1:0)>1)return void n.logWarn(`Study '${e.description}' has ambiguous identifier '${c}'`);const y=r[1];if(null!==m){if(1===r.length)return void n.logWarn(`Path of sub-property of '${c}' plot for study '${e.description}' must be not empty`);const i=r.slice(1);o.applyPlotProperty(e,t,m,i,s)}else if(null!==v)o.applyInputValue(t,v,s);else if(null!==g){if(void 0===y)return void n.logWarn(`Property name of '${c}' band for study '${e.description}' must be set`);o.applyBandProperty(t,g,y,s)}else if(null!==f){if(void 0===y)return void n.logWarn(`Property name of '${c}' area for study '${e.description}' must be set`);o.applyFilledAreaProperty(t,f,y,s)}else S?o.setRootProperty(t,r,s):n.logWarn(`Study '${e.description}' has no plot or input '${c}'`)}function c(e,t){const i=e.properties(),s=i.state();for(const i in t)t.hasOwnProperty(i)&&l(e.metaInfo(),s,i,t[i]);i.mergeAndFire(s)}function h(e,t,i){for(const s in e){if(!e.hasOwnProperty(s))continue;const r=s.indexOf(".");if(-1===r)continue;const o=s.substring(0,r),c=a.getMetaInfoByDescription(t,o);if(null===c){n.logWarn("There is no such study "+o);continue}const h=i(c);null!==h?l(c,h,s.substring(r+1),e[s]):n.logWarn("Cannot apply overrides for study "+o)}}!function(e){const t={line:r.LineStudyPlotStyle.Line,histogram:r.LineStudyPlotStyle.Histogram,cross:r.LineStudyPlotStyle.Cross,area:r.LineStudyPlotStyle.Area, +columns:r.LineStudyPlotStyle.Columns,circles:r.LineStudyPlotStyle.Circles,line_with_breaks:r.LineStudyPlotStyle.LineWithBreaks,area_with_breaks:r.LineStudyPlotStyle.AreaWithBreaks};e.applyPlotProperty=function(e,i,o,a,l){if(void 0===i.styles)return void n.logWarn("Study does not have styles");const c=a[0];if("color"===c){return void function(e,t,i,r,o){if(void 0!==e.styles)if(null===t&&!isNaN(r)&&r>0)n.logWarn("Study plot does not have color #"+r);else{if(0===r||isNaN(r)){(0,s.ensureDefined)(e.styles[i]).color=String(o),r=0}null!==t&&((0,s.ensureDefined)(t.colors[r]).color=String(o))}else n.logWarn("Study does not have styles")}(i,function(e,t,i){if(void 0===e.plots)return null;for(const s of e.plots){if(!(0,r.isColorerPlot)(s)||void 0===t.palettes)continue;const e=t.palettes[s.palette];if(s.target===i&&void 0!==e)return e}return null}(e,i,o),o,a.length>1?parseInt(a[1]):NaN,l)}const h=i.styles[o];if(void 0!==h&&h.hasOwnProperty(c)){if("plottype"===c){const e=t[String(l)];if(void 0===e)return void n.logWarn("Unsupported plot type for plot: "+l);l=e}h[c]=l}else n.logWarn(`Study plot does not have property '${c}'`)},e.applyBandProperty=function(e,i,s,r){if(void 0===e.bands)return void n.logWarn("Study does not have bands");const o=e.bands[i];if(void 0!==o&&o.hasOwnProperty(s)){if("plottype"===s){const e=t[String(r)];if(void 0===e)return void n.logWarn("Unsupported plot type for band: "+r);r=e}o[s]=r}else n.logWarn(`Study band does not have property '${s}'`)},e.applyFilledAreaProperty=function(e,t,i,s){if(void 0===e.filledAreasStyle)return void n.logWarn("Study does not have areas");const r=e.filledAreasStyle[t];void 0!==r&&r.hasOwnProperty(i)?r[i]=s:n.logWarn(`Study area does not have property '${i}'`)},e.applyInputValue=function(e,t,i){void 0!==e.inputs&&e.inputs.hasOwnProperty(t)?e.inputs[t]=i:n.logWarn(`Study does not have input '${t}'`)},e.setRootProperty=function(e,t,i){if(0===t.length)return;let s=e;for(const e of t.slice(0,-1)){if(null==s||!s.hasOwnProperty(e))break;s=s[e]}const r=t[t.length-1];null!=s&&s.hasOwnProperty(r)?s[r]=i:n.logWarn("Study does not have property "+t.join("."))}}(o||(o={})),function(e){e.getInputByName=function(e,t){if(void 0===e.inputs)return null;t=t.toLowerCase();for(const i of e.inputs)if(i.name.toLowerCase()===t)return i.id;return null},e.getPlotIdByTitle=function(e,t){if(void 0===e.styles)return null;t=t.toLowerCase();for(const i in e.styles){const s=e.styles[i];if((void 0!==s&&void 0!==s.title?s.title:i).toLowerCase()===t)return i}return null},e.getFilledAreaIdByTitle=function(e,t){if(void 0===e.filledAreas)return null;t=t.toLowerCase();for(const i of e.filledAreas)if(i.title.toLowerCase()===t)return i.id;return null},e.getBandIndexByName=function(e,t){if(void 0===e.bands)return null;t=t.toLowerCase();for(let i=0;i{"use strict";var s=i(2015),r=i(2872),n=i(88537).assert,o=i(37667).symbolTitle,a=i(33981).StudyBarColorer,l=i(41855).StudyPriceAxisView,c=i(54376).createGraphicsPriceAxisViews,h=i(84801).ChartApiInterface,d=i(88564).DefaultProperty,u=i(97098).PriceFormatter,p=i(71053).PlotList,_=i(67072),m=i(76422),g=i(50993),f=g.LineStudyPlotStyle,v=i(55057).StudyPriceLineAxisView,S=i(8671).studyPlotFunctionMap,y=i(8671).studyEmptyPlotValuePredicate,b=i(72857).makeNextStudyId,w=i(67337),C=i(69774).StudyBase,P=i(13933);const{dataSourceChangeEvent:T}=i(33291);var x=i(20838).IntervalsVisibilitiesProperty,I=P.StudyStatusType,M=i(68906).colorToInteger,L=i(52418).intervalsVisibilitiesDefaults,A=i(98125).getLogger("Chart.Study"),E=w.enabled("datasource_copypaste"),k=w.enabled("study_symbol_ticker_description"),D=w.enabled("hide_unresolved_symbols_in_legend");function V(e,t,i){var s=new d(t,i,!0);s.removeProperty("intervalsVisibilities"),s.addChild("intervalsVisibilities",new x(i&&i.intervalsVisibilities)),s.addExclusion("visible"),s.addExclusion("precision"),s.addExclusion("minTick"),s.addExclusion("intervalsVisibilities");for(var r=0;r=0?c:l}return l}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===i)return this._metaInfo.defaults.inputs.text;if("pineId"===i)return this._metaInfo.scriptIdPart;if("pineVersion"===i)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){var h=this._properties.inputs[i].value();return M(h)}if("price"===e.type){var d=this._properties.inputs[i].value();return t.priceInputsForDisplay?this.formatter().format(d):d}return this._properties.inputs[i].value()}return this._properties.inputs[i].value()}_rebindToSource(e,t){var i=this.parentSource();if(this._isChildStudy){var s +;this._source.unsetChild(this);var r=null;if(e===this._model.mainSeries())this._source=null,this._isChildStudy=!1,this._ownerSource=null,s=this._series.seriesSource().instanceId(),r=h.REBIND_STUDY_CHILD_TO_STANDALONE;else{if(!(e instanceof R))return A.logError("Unable to rebind study to source of this type"),!1;this._ownerSource=e,this._source=e,s=this._source.sourceId(),this._source.setChild(this),this._source.isHibernated()&&this._source.start()}this._incrementTurnaround(),this.disablePriceRangeReady(),this._chartApi.rebindStudy(this._studyId,this._turnaround,s,this._studyName,t,this._handler,r)}else{if(!(e instanceof R))return A.logError("Unable to rebind study to source of this type"),!1;var n=e.isHibernated();n&&e.start();var o=!1;if(this._canCreateStudyWithRebindType(h.REBIND_STUDY_STANDALONE_TO_CHILD)&&(this._incrementTurnaround(),this.disablePriceRangeReady(),o=this._chartApi.rebindStudy(this._studyId,this._turnaround,e.sourceId(),this._studyName,t,this._handler,h.REBIND_STUDY_STANDALONE_TO_CHILD)),!o)return n&&e.stop(),!1;this._isChildStudy=!0,this._ownerSource=e,this._source=e,this._source.setChild(this),this._childStudyByRebind.fire()}var a=this.m_priceScale,l=e.priceScale();if(a!==l){var c=this._model.paneForSource(this),d=this._model.paneForSource(e);c===d&&d.move(this,l,!0)}const u=this.parentSource();return i.formatterChanged().unsubscribe(this,this._onSourceFormatterChanged),u.formatterChanged().subscribe(this,this._onSourceFormatterChanged),i.priceStepChanged().unsubscribe(this,this._onSourcePriceStepChanged),u.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),i.currencyChanged().unsubscribeAll(this),u.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),i.unitChanged().unsubscribeAll(this),u.unitChanged().subscribe(this,this._onSourceUnitChanged),i.priceRangeReadyChanged().unsubscribeAll(this),u.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),this._recreatePriceFormattingDependencies(),!0}childStudyByRebind(){return this._childStudyByRebind}_changeInputsImpl(e,t){var i=this.source(),s=this._properties.inputs&&this._properties.inputs.state(),r=_.getSourceIdByInputs(this._metaInfo.inputs,s),n=!0;if(r)if("high"===r||"open"===r||"low"===r||"close"===r||"hl2"===r||"ohl3"===r||"ohlc4"===r)i=this._model.mainSeries();else for(var o=this._model.dataSources().filter((function(e){return e instanceof R&&e.canHaveChildren()})),a=0;a=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_sendTelemetryReport(e,t,i){void 0===i&&(i=this._getTelemetryAdditionalData());var s=Object.assign(t,{additional:i});(void 0).sendChartReport(e,s)}_sendTelemetryCounter(e,t){this._sendTelemetryReport(e,{count:1},t)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}destroy(){this._aboutToBeDestroyed.fire(),this._isDestroyed=!0,null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._properties.precision.listeners().unsubscribe(this,this._precisionChanged),this._showStudyArgumentsProperty.listeners().unsubscribe(this,this.invalidateTitleCache),this._properties.description.listeners().unsubscribe(this,this.invalidateTitleCache),this._properties.shortDescription&&this._properties.shortDescription.listeners().unsubscribe(this,this.invalidateTitleCache),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this),this.hasBarColorer()&&this._properties.visible.listeners().unsubscribe(this._model.mainSeries(),this._model.mainSeries().invalidateBarStylesCache),this._model.mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._recreatePriceFormattingDependencies),void 0!==this._properties.offsets&&this._properties.offsets.listeners().unsubscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offset&&this._properties.offset.listeners().unsubscribe(this,this._updateMaxOffsetValue),super.destroy()}desiredPriceScalePosition(){return this.metaInfo().isTVScriptStub?"overlay":this.metaInfo().linkedToSeries?"as-series":void 0===this.metaInfo().priceScale?null:["right","left","overlay"][this.metaInfo().priceScale]}guiPlotName(e){var t=this.properties().styles;return t&&t[e]&&t[e].title?t[e].title.value():this.title()}formatterChanged(){return this._formatterChanged}copiable(){return E&&!this.isChildStudy()}setPriceScale(e){super.setPriceScale(e),m.emit("study_event",this.id(),"price_scale_changed")}getStudyName(){return this._studyName}} +TradingView.Study=R,t.Study=R,t.prepareStudyProperties=function(e,t,r,o,a){return function(e,t,r,o,a,l){var c=function(e,t,r,o){var a=i(31752);if(_.versionOf(e)<1)throw new Error("This function cannot work with metainfo of the old format version. Required format version >= 1");var l=TradingView.clone(defaults("study"));B(l,e);var c=_.getStudyPropertyRootName(e),h=TradingView.clone(defaults(c,o));h.intervalsVisibilities=TradingView.clone(L),("Overlay"===e.shortId||"Compare"===e.shortId)&&(h.currencyId=null,h.unitId=null);e.isTVScript&&e.TVScriptSourceCode!==h.TVScriptSourceCode&&(h=TradingView.clone(TradingView.factoryDefaults(c,o)));TradingView.merge(l,h),t&&(n(!(t instanceof s),"propsState should not be an instance of Property"),TradingView.merge(l,t));var d=TradingView.clone(e),u={};a.mergeInputsObjPart(u,d.defaults.inputs),a.mergeInputsObjPart(u,l.inputs),l.inputs=u,delete d.inputs,delete d.defaults.inputs;var p={};if(TradingView.merge(p,d.defaults),TradingView.merge(p,TradingView.factoryDefaults(c)),TradingView.merge(p,l),TradingView.merge(p,d),delete p.defaults,l=p,null!==r){var m=r.model().studiesColorRotatorFactory().getColorRotator(e);null!==m&&("Overlay@tv-basicstudies"===e.id?l.lineStyle.color=m.getColor(l.lineStyle.color,e):TradingView.merge(l,function(e,t){for(var i in e.styles){var s=e.styles[i].color;s&&(e.styles[i].color=t.getColor(s))}return e}(l,m)))}t&&TradingView.merge(l.styles,t.styles);return l}(e,t,r,o),h=_.getSourceInputIds(e);if(h.length>0){var d=h[0];l instanceof R?c.inputs[d]="{pid}$0":void 0!==c.inputs[d]&&-1!==c.inputs[d].indexOf("$")&&(c.inputs[d]="close")}return V(e,a,c)}(e,t,r,o,_.getStudyPropertyRootName(e),a)},t.prepareStudyPropertiesForLoadChart=function(e,t,s,r,n,o){return function(e,t,s,r,n,o,a){var l=function(e,t,s,r,n,o){var a=i(31752);e.version&&s.version&&e.version!==s.version&&A.logWarn("Serialized metaInfo version "+e.version+" is not equal to the saved state version "+s.version);var l=TradingView.clone(defaults("study"));l.intervalsVisibilities=TradingView.clone(L),TradingView.merge(l,TradingView.factoryDefaults(_.getStudyPropertyRootName(e))),B(l,e),TradingView.merge(l,s),l=n.updateStudyState(l,e,t),void 0!==o&&(l=o(s,l,e,t));var c=TradingView.clone(t||e);if(c&&_.versionOf(c)>=1){var h={};a.mergeInputsObjPart(h,(c.defaults||{}).inputs),a.mergeInputsObjPart(h,l.inputs),l.inputs=h,delete c.inputs,c.defaults&&delete c.defaults.inputs;var d={};TradingView.merge(d,c.defaults),TradingView.merge(d,TradingView.factoryDefaults(_.getStudyPropertyRootName(c))),TradingView.merge(d,l),delete c.defaults,TradingView.merge(d,c),l=d}return l}(e,t,s,0,n,a);return V(t||e,o,l)}(e,t,s,0,n,_.getStudyPropertyRootName(e),o)}},56138:(e,t,i)=>{"use strict";i.d(t,{plotShapesData:()=>r});var s=i(28353);const r={shape_arrow_down:{guiName:(0,s.t)("Arrow Down"),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:(0,s.t)("Arrow Up"),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup", +icon:"arrow_up"},shape_circle:{guiName:(0,s.t)("Circle"),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:(0,s.t)("Cross"),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:(0,s.t)("Diamond"),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:(0,s.t)("Flag"),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:(0,s.t)("Label Down"),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:(0,s.t)("Label Up"),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:(0,s.t)("Square"),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:(0,s.t)("Triangle Down"),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:(0,s.t)("Triangle Up"),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:(0,s.t)("X Cross"),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},27306:(e,t,i)=>{"use strict";var s=i(15625).Version,r=i(98125).getLogger("Chart.StudyMigration");function n(e){this._studyId=e,this._maxToVers=s.ZERO,this._maxFromVers=s.ZERO,this._migrs=[]}n.prototype.addMigration=function(e,t,i){var r=s.parse(e),n=s.parse(t);r.isGreater(this._maxFromVers)&&(this._maxFromVers=r),n.isGreater(this._maxToVers)&&(this._maxToVers=n),this._migrs.push({fromVers:r,toVers:n,rules:i})},n.prototype.updateInputs=function(e,t,i){if(!i)return i;for(var s=TradingView.clone(i),n=e;n.isLess(t);){var o=this._findMigration(n);if(null==o)break;if(r.logNormal("Migrating study inputs from "+o.fromVers+" to "+o.toVers+" version, studyId: "+this._studyId+", migration: "+JSON.stringify(o)+", inputs: "+JSON.stringify(i)),s=this._applyMigration(s,o),!n.isLess(o.toVers))throw new Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");n=o.toVers}return n>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(s)),s},n.prototype._findMigration=function(e){for(var t=-1,i=this._maxFromVers,s=0;s=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throw new Error("Unknown action "+t.action+" for rule with type "+t.type);var i=e[t.inputId];return it.maxVal&&(e[t.inputId]=t.maxVal),r.logNormal("Input "+t.inputId+"="+i+" adjusted to value "+e[t.inputId]),e},n._applyInputChangedOptionsRule=function(e,t){if(!(["text"].indexOf(t.inputType)>=0&&"resetToDefValIfNeeded"===t.action))throw new Error("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);var i=e[t.inputId];return t.options.indexOf(i)<0&&(e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal)),e},e.exports=n},9771:(e,t,i)=>{"use strict";var s=i(66101).Study,r=i(52457).OverlayLegendValuesProvider,n=i(79284).OverlayStatusProvider,o=i(33981).SeriesBarColorer,a=i(82927).StudyOverlayBase;t.study_Overlay=class extends a{constructor(e,t,i,s){super(e,t,i,s),this._paneView=null;var r=this;this.properties().minTick.listeners().subscribe(null,(function(){r._recreatePriceFormattingDependencies(),r.updateAllViews(),r._model.fullUpdate()}))}_showLastValueOnPriceScale(){return this._model.properties().scalesProperties.showSeriesLastValue.value()}barColorer(){return new o(this)}_tryChangeInputs(){s.prototype._tryChangeInputs.call(this),this.m_formatter=null,this.priceScale().updateFormatter()}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update(),this._model.updateSource(this))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),super.destroy()}tags(){var e=[],t=this.symbolInfo() +;return t?e.push(t.name):this._properties.inputs.symbol.value()&&e.push(this._properties.inputs.symbol.value()),e}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(1369),i.e(7387),i.e(8623),i.e(607)]).then(i.bind(i,55976))).StudyOverlayDefinitionsViewModel}defaultPlotIdForAlert(){return""}changeStyles(){this.data().each((function(e,t){t[TradingView.STYLE_PLOT]=null})),s.prototype.changeStyles.call(this)}valuesProvider(){return new r(this,this.model())}statusProvider(e){return new n(this,this.model())}}},67509:(e,t,i)=>{"use strict";var s=i(88537).assert,r=i(80643).clone,n=i(66101).Study,o=i(71053).PlotList,a=i(8671).studyPlotFunctionMap,l=i(8671).studyEmptyPlotValuePredicate;class c{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var d=!1;s&&(d=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),d?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this.m_data=new o(a(this._metaInfo),l));var i=this.m_data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this.m_data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new c(e.strategyIndex,e.targetIndex,i).rebuildData(this.m_data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},31752:(e,t,i)=>{"use strict";var s=i(88537).assert,r=i(15625).Version,n=i(98125).getLogger("Chart.Study.Versioning"),o=i(76861),a=i(67072),l=i(14905).extractPineId,c=i(5402).migrateMetaInfoAndPropState;function h(e,t){if(!e)throw new Error("No studies metainfo");var s=i(27306);if(this._studiesMetainfo=e,!t)throw new Error("No studies migrations");this._studiesMigrations=t,this._migrations={};for(var r=0;r=22)return t;for(var i={},s=0,r=0;;){var n=t[r];if(void 0===n)break;var o=t[n.id];n.isFake&&(n.id="in_"+s++),i[r]=n,i[n.id]=o,r++}return i}]}h.prototype.updateMetaInfo=function(e){if(!e)return e;s(!e.isTVScript,"This method should update only built-in java indicators metaInfo. For Pine indicators use updateMetaInfoAsync");for(var t=null,i=this._studiesMetainfo,r=0;r=12&&l<=26){var c={};for(o=0;o=12&&c<=26){var d=r.columns;r.columns=[];for(var u=0;ut&&n.logWarn("Bad integer input max value in metaInfo id="+e.id+" title="+e.description))}},h._fixInputsMaxValue=function(e,t){if(!TradingView.isAbsent(t)){var i=h.INPUT_MAX_VALUE;if(t.inputs)for(var s=0;si&&(a.max=i))}if(e&&e.inputs){var r=h.splitInputs(e.inputs),n=r.arr;for(var o in n){var a;"integer"===(a=n[o]).type&&(a.max&&a.max>i&&(a.max=i))}e.inputs=TradingView.merge(r.obj,r.arr)}}},h.prototype.patchPropsStateAndMetaInfo=function(e,t,i){"Script$BOOKER"!==t.productId||t.alerts||delete e.alerts,h._fixInputsOrder(e,t),h._fixInputsMaxValue(e,t);var s=h.splitInputs(e.inputs);e.inputs=s.obj;var r=a.versionOf(t);ri&&(i=r))}e[i+1]=t},h.splitInputs=function(e){var t={},i={};for(var s in e)isNumber(parseInt(s,10))?t[s]=e[s]:i[s]=e[s];return{arr:t,obj:i}},h.findInputKeyById=function(e,t){var i=null;for(var s in e)if(isNumber(parseInt(s,10))&&e[s].id===t){i=s;break}return i},h.getInputKeyById=function(e,t){var i=h.findInputKeyById(e,t);if(!i)throw new Error("Cannot find input with id: "+t);return i},e.exports=h},14791:(e,t,i)=>{"use strict";i.d(t,{areEqualSymbols:()=>r,symbolSameAsCurrent:()=>o});const s=i(67337).enabled("uppercase_instrument_names");function r(e,t){return void 0===e?void 0===t:void 0!==t&&(s?e.toUpperCase()===t.toUpperCase():e===t)}function n(e,t){return e.some(e=>r(t,e))}function o(e,t,i){if(r(t,e))return!0;if(i){if(r(i.full_name,e)||r(i.pro_name,e))return!0;if(r(i.ticker,e))return!0;if(i.aliases&&n(i.aliases,e))return!0;if(i.alternatives&&n(i.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&r(i.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}},76818:(e,t,i)=>{"use strict";i.d(t,{TextWidthCache:()=>s});class s{constructor(e=150){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels.clear()}measureText(e,t){return this.getMetrics(e,t).width}yMidCorrection(e,t){const i=this.getMetrics(e,t);return"actualBoundingBoxAscent"in i&&"actualBoundingBoxDescent"in i?(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)/2:0}getMetrics(e,t){const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}e.save(),e.textBaseline="middle";const s=e.measureText(t);return e.restore(),0===s.width&&t.length||(this._cache.set(t,{metrics:s,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),s}}},5231:(e,t,i)=>{"use strict";var s=i(2872);function r(){this._marksByIndex=new Map,this._marksBySpan=[],this.changed=new s, +this.minIndex=void 0,this.maxIndex=void 0}r.prototype.reset=function(){this._resetImpl(),this.changed.fire()},r.prototype._resetImpl=function(){this._marksByIndex=new Map,this._marksBySpan=[],this.minIndex=void 0,this.maxIndex=void 0,this._cache=void 0},r.prototype.merge=function(e){if(0!==e.length){var t=e[0].index,i=e[e.length-1].index;t<=this.minIndex&&i>=this.maxIndex&&this._resetImpl();for(var s=this._marksBySpan,r=new Set,n=0;n=this.maxIndex&&this.maxIndex--,this.maxIndex2;){if(1e3*this._marksByIndex.get(t).time===e)return t;if(1e3*this._marksByIndex.get(i).time===e)return i;var s=Math.round((t+i)/2);1e3*this._marksByIndex.get(s).time>e?i=s:t=s}return t},r.prototype.build=function(e,t){var i=Math.ceil(t/e);if(this._maxbar===i&&this._cache)return this._cache;this._maxbar=i;for(var s=[],r=this._marksBySpan.length;r--;)if(this._marksBySpan[r]){var n=s;s=[];for(var o=n.length,a=0,l=this._marksBySpan[r],c=l.length,h=1/0,d=-1/0,u=0;u=i&&_-d>=i&&(s.push(p),d=_)}for(;a{"use strict";i.d(t,{TimeAxisView:()=>o});var s=i(68906),r=i(93435);class n{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 n=Math.round(t.widthCache.measureText(e,s.text));if(n<=0)return;e.save();const o=t.paddingHorizontal,a=n+2*o,l=a/2;let c=s.coordinate,h=Math.floor(c-l)+.5;if(s.alwaysInViewPort){const e=s.width;h<0?(c+=Math.abs(0-h),h=Math.floor(c-l)+.5):h+a>e&&(c-=Math.abs(e-(h+a)),h=Math.floor(c-l)+.5)}const d=h+a,u=Math.ceil(0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize+t.paddingBottom);e.fillStyle=s.background;const p=Math.round(h*i),_=Math.round(0*i),m=Math.round(d*i),g=Math.round(u*i),f=Math.round(2*i);e.beginPath(),e.moveTo(p,_),e.lineTo(p,g-f),e.arcTo(p,g,p+f,g,f),e.lineTo(m-f,g),e.arcTo(m,g,m,g-f,f),e.lineTo(m,_),e.fill();const v=0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const S=t.widthCache.yMidCorrection(e,"Apr0");e.translate((h+o)*i,(v+S)*i),(0,r.drawScaled)(e,i,()=>e.fillText(s.text,0,0)),e.restore()}}class o{constructor(e){this._renderer=new n,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()||!this._isVisible())return;const t=this._getIndex();if(null===t)return;e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,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}}},2271:(e,t,i)=>{"use strict";i.d(t,{INVALID_TIME_POINT_INDEX:()=>s});const s=-2e6},5816:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MINUTE_SPAN:()=>s,HOUR_SPAN:()=>r,DAY_SPAN:()=>n,WEEK_SPAN:()=>o,MONTH_SPAN:()=>a,YEAR_SPAN:()=>l,DEFAULT_BAR_SPACING:()=>c});const s=20,r=30,n=40,o=50,a=60,l=70,c=6},23075:(e,t,i)=>{"use strict";i.d(t,{trackDrawingCreated:()=>r,trackDrawingPasted:()=>n,trackDrawingCloned:()=>o,trackChartStyleChanged:()=>a});i(88537), +i(16654);function s(e,t){0}function r(e){s()}function n(e){s()}function o(e){s()}function a(e){0}},35218:(e,t,i)=>{"use strict";i.d(t,{translatedIntervalString:()=>r});i(28353);var s=i(9315);function r(e){const t=(0,s.getTranslatedResolutionModel)(e,!0);return null===t?e:t.multiplier+(t.mayOmitShortKind?"":t.shortKind)}},17691:(e,t,i)=>{"use strict";i.d(t,{ApplyLineToolTemplateUndoCommand:()=>r});var s=i(35762);class r extends s.UndoCommand{constructor(e,t,i){super(i),this._source=e,this._newState=t,this._oldState=e.properties().state()}redo(){this._source.applyTemplate(this._newState)}undo(){this._source.applyTemplate(this._oldState)}}},79495:(e,t,i)=>{"use strict";i.d(t,{ExcludeLineToolsFromGroupUndoCommand:()=>l});var s=i(88537),r=(i(94419),i(28353)),n=i(24980),o=i(35762);const a=new n.TranslatedString("exclude line tools from group {group}",(0,r.t)("exclude line tools from group {group}"));class l extends o.UndoCommand{constructor(e,t,i){super(a.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=(0,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)}}},8597:(e,t,i)=>{"use strict";i.d(t,{MergeUpUndoCommand:()=>o,MergeDownUndoCommand:()=>a,MergeToTargetPane:()=>l});var s=i(88537),r=i(21749);class n extends r.MoveSourceUndoCommand{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=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),r=(0,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){(0,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=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,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))}),(0,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}}},21749:(e,t,i)=>{"use strict";i.d(t,{MoveSourceUndoCommand:()=>n});var s=i(88537),r=i(35762);class n extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const r=(0,s.ensureNotNull)(t.priceScale());this._initialPriceScaleId=r.id(),this._initialPriceScaleState=(0,s.ensureNotNull)(t.priceScale()).state();const n=(0,s.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=n.priceScalePosition(r),this._initialPriceScaleIndex=n.priceScaleIndex(r,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(n)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,t}_originalPriceScaleState(){return this._initialPriceScaleState}}},27579:(e,t,i)=>{"use strict";i.d(t,{MoveToNewPriceScaleUndoCommand:()=>o,MoveToExistingPriceScaleUndoCommand:()=>a});var s=i(88537),r=i(21749);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,s),this._sourcePaneRemoved=!1,this._targetPaneIndex=e.panes().indexOf(i)}redo(){const e=this._chartModel.panes()[this._initialPaneIndex],t=this._chartModel.panes()[this._targetPaneIndex],i=e!==t,r=this._targetPriceScale(t),n=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),o=this._chartModel.children(n,!0);for(const e of o)i?(this._chartModel.detachSource(e),t.addDataSource(e,r,!1)):t.move(e,r);i?(this._sourcePaneRemoved=this._chartModel.detachSource(n),t.addDataSource(n,r,!1)):t.move(n,r);const a=t.priceScalePosition(r);t.movePriceScale(r,a,this._targetPriceScaleIndex(n)),this._chartModel.fullUpdate()}undo(){this._sourcePaneRemoved&&this._chartModel.createPane(this._initialPaneIndex);const e=this._chartModel.panes()[this._initialPaneIndex],t=e!==this._chartModel.panes()[this._targetPaneIndex],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId));let r=e.getPriceScaleById(this._initialPriceScaleId);null===r&&(r=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex));const n=this._chartModel.children(i,!0);for(const i of n)t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r),(0, +s.ensureNotNull)(i.priceScale()).restoreState(this._originalPriceScaleState()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScalePosition=s}_targetPriceScale(e){const t=e.createPriceScaleAtPosition(this._targetPriceScalePosition);return t.restoreState(this._newPriceScaleState("overlay"===this._targetPriceScalePosition)),t}_targetPriceScaleIndex(e){return e===this._chartModel.mainSeries()?0:void 0}}class a extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScaleId=s.id()}_targetPriceScale(e){return(0,s.ensureNotNull)(e.getPriceScaleById(this._targetPriceScaleId))}_targetPriceScaleIndex(e){}}},69746:(e,t,i)=>{"use strict";i.d(t,{PriceScaleChangeUndoCommand:()=>h});var s=i(88537),r=i(28353),n=i(24980),o=i(98125),a=i(35762);const l=(0,o.getLogger)("Chart.ChartUndoModel"),c=new n.TranslatedString("scale price",(0,r.t)("scale price"));class h extends a.UndoCommand{constructor(e,t,i,s,r){super(c,!1),this._newPriceScaleState=null,this._model=e,this._paneIndex=e.panes().indexOf(t),this._priceScaleId=i.id(),this._state=s,this._timestamp=r?performance.now():null}undo(){if(null!==this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone");const[e,t]=this._paneAndScale();this._newPriceScaleState=t.state(),this._model.restorePriceScaleState(e,t,this._state)}redo(){if(null===this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone");const[e,t]=this._paneAndScale();this._model.restorePriceScaleState(e,t,this._newPriceScaleState),this._newPriceScaleState=null}canMerge(e){return e instanceof h&&null!==this._timestamp&&null!==e._timestamp&&null===this._newPriceScaleState&&e._model===this._model&&e._paneIndex===this._paneIndex&&e._priceScaleId===this._priceScaleId&&Math.abs(e._timestamp-this._timestamp)<1e3}merge(e){this._timestamp=e._timestamp}_paneAndScale(){const e=this._model.panes()[this._paneIndex],t=(0,s.ensureNotNull)(e.getPriceScaleById(this._priceScaleId));return[e,t]}}},65284:(e,t,i)=>{"use strict";i.d(t,{RemoveSourcesCommand:()=>m});var s=i(88537),r=i(28353),n=i(24980),o=i(35762),a=i(14291),l=i(98125),c=i(52546),h=i(81851),d=i(79495);class u extends o.UndoCommand{constructor({title:e,chartModel:t,lineDataSourceIds:i}){super(e),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._chartModel=t,this._lineDataSourceIds=i}redo(){const e=this._lineDataSourceIds.map(e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e)));this._groupLineToolsByGroups(e).forEach((e,t)=>{const i=new d.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)}),e.forEach(e=>{this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,s.ensureNotNull)(this._chartModel.paneForSource(e))),sharingMode:e.sharingMode().value()}),this._chartModel.removeSource(e)})}undo(){var e +;for(let t=this._undoState.shift();t;t=this._undoState.shift())null===(e=this._chartModel.restoreSource(!1,t.paneIndex,null,t.state,null))||void 0===e||e.share(t.sharingMode);this._excludeLineToolsFromGroupUndoCommands.forEach(e=>e.undo())}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e},new Map)}}const p=(0,l.getLogger)("Chart.RemoveSourcesCommand"),_=new n.TranslatedString("remove line data sources",(0,r.t)("remove line data sources"));class m extends o.UndoCommand{constructor(e,t,i){super(i),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[r,n]=(0,c.closeSourcesSet)(e,t).reduce((e,t)=>((0,a.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e),[[],[]]);this._chartModel=e,this._sourceIds=r,this._lineDataSourceIds=n,this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const o=t[0];1===t.length&&(0,h.isStudy)(o)&&(this._initialPriceScaleMode=(0,s.ensureNotNull)(o.priceScale()).mode())}removedIds(){return[...this._sourceIds,...this._lineDataSourceIds]}redo(){this._chartModel.panes().length;const e=this._sourceIds.map(e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e)));this._sourceStates=e.map(e=>(0,s.ensureNotNull)(e.state(!1)));const t=e.map(e=>(0,s.ensureNotNull)(this._chartModel.paneForSource(e)));this._paneIndexes=t.map(e=>this._chartModel.panes().indexOf(e)),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new u({title:_,chartModel:this._chartModel,lineDataSourceIds:this._lineDataSourceIds}),this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map((e,i)=>{const s=e.priceScale();if(null===s)return null;const r=t[i].priceScalePosition(s);return{id:s.id(),position:r,priceScaleIndex:t[i].priceScaleIndex(s,r)}});const i=new Set;e.forEach((e,t)=>{i.add(this._paneIndexes[t])}),this._paneStates=e.map((e,s)=>{const r=this._paneIndexes[s];return i.has(r)?t[s].state(!1,!0):null}),this._restorePanes=e.map(e=>this._chartModel.removeSource(e))}undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],this._sourceStates[t],this._priceScalePositionIds[t]);i&&e.push(i)}e.some((t,i)=>t.id()!==this._sourceIds[e.length-i-1])&&p.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,s.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}},91794:(e,t,i)=>{"use strict";i.d(t,{RestoreDefaultsPreferencesUndoCommand:()=>p});var s=i(88537),r=i(28353),n=i(24980),o=i(35762),a=i(67396),l=i(21761),c=i(13647),h=i(92033),d=i(76166);const u=new n.TranslatedString("apply all chart properties",(0,r.t)("apply all chart properties"));class p extends o.UndoCommand{constructor(e){super(u), +this._trading=null,this._oldShowSellBuyButtons=null,this._oldNoConfirmEnabled=null,this._oldShowOnlyRejectionNotifications=null,this._oldShowPricesWithZeroVolume=null,this._oldShowPricesWithSpread=null,this._oldOrderExecutedSoundEnabled=null,this._prevWatermarkPreferences=null,this._model=e,this._trading=(0,h.tradingService)(),null!==this._trading&&(this._oldShowSellBuyButtons=this._trading.showSellBuyButtons.value(),this._oldNoConfirmEnabled=this._trading.noConfirmEnabled.value(),this._oldShowOnlyRejectionNotifications=this._trading.showOnlyRejectionNotifications.value(),this._oldShowPricesWithZeroVolume=this._trading.showPricesWith().zeroVolume.value(),this._oldShowPricesWithSpread=this._trading.showPricesWith().spread.value(),this._oldOrderExecutedSoundEnabled=this._trading.orderExecutedSoundParams.enabled.value()),this._defaultsPreferences=(0,a.defaultsPreferencesByWhiteList)(this._model,this._model.mainSeries()),this._oldPreferences=e.preferences(),this._prevDateFormat=l.dateFormatProperty.value(),this._prevAddPlusButton=d.addPlusButtonProperty.value(),this._prevShowOpenMarkerStatus=c.showMarketOpenStatusProperty.value();const t=this._model.watermarkSource();null!==t&&(this._prevWatermarkPreferences=t.properties().state())}redo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue(!0),this._trading.noConfirmEnabled.setValue(!1),this._trading.showOnlyRejectionNotifications.setValue(!1),this._trading.showPricesWith().zeroVolume.setValue(!0),this._trading.showPricesWith().spread.setValue(!0),this._trading.orderExecutedSoundParams.enabled.setValue(!1)),this._model.applyPreferences(this._defaultsPreferences),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),(0,l.restoreDateFormatSettingsValue)(),(0,d.restoreAddPlusButtonSettingsValue)(),(0,c.restoreShowMarketOpenStatusProperty)();const e=this._model.watermarkSource();null!==e&&e.restorePropertiesDefaults()}undo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue((0,s.ensureNotNull)(this._oldShowSellBuyButtons)),this._trading.noConfirmEnabled.setValue((0,s.ensureNotNull)(this._oldNoConfirmEnabled)),this._trading.showOnlyRejectionNotifications.setValue((0,s.ensureNotNull)(this._oldShowOnlyRejectionNotifications)),this._trading.showPricesWith().zeroVolume.setValue((0,s.ensureNotNull)(this._oldShowPricesWithZeroVolume)),this._trading.showPricesWith().spread.setValue((0,s.ensureNotNull)(this._oldShowPricesWithSpread)),this._trading.orderExecutedSoundParams.enabled.setValue((0,s.ensureNotNull)(this._oldOrderExecutedSoundEnabled))),this._model.applyPreferences(this._oldPreferences),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),l.dateFormatProperty.setValue(this._prevDateFormat),c.showMarketOpenStatusProperty.setValue(this._prevShowOpenMarkerStatus),d.addPlusButtonProperty.setValue(this._prevAddPlusButton);const e=this._model.watermarkSource();null!==e&&null!==this._prevWatermarkPreferences&&e.properties().mergeAndFire(this._prevWatermarkPreferences)}}},97401:(e,t,i)=>{"use strict";i.d(t,{ +SetPriceScaleCurrencyUndoCommand:()=>o});var s=i(88537),r=i(35762),n=i(37667);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesCurrencies=new Map,this._oldSourcesCurrencies=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue;const e=t||(0,n.symbolOriginalCurrency)((0,s.ensureNotNull)(i.symbolInfo()));this._newSourcesCurrencies.set(i.id(),e),this._oldSourcesCurrencies.set(i.id(),i.currency()),this._showFade=this._showFade||i===o&&i.currency()!==e}}redo(){this._applyCurrencies(this._newSourcesCurrencies)}undo(){this._applyCurrencies(this._oldSourcesCurrencies)}_applyCurrencies(e){this._showFade&&this._chartWidget.screen.show();const t=this._chartWidget.model().model();e.forEach((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setCurrency(e)}),this._chartWidget.model().selectionMacro(e=>{e.clearSelection()})}}},59836:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleModeCommand:()=>o});var s=i(88564),r=i(35762),n=i(33291);class o extends r.UndoCommand{constructor(e,t,i,s){super(i),this._newMode=e,this._priceScaleId=t.id(),this._model=s,this._oldMode=t.mode()}redo(){this._applyMode(this._newMode)}undo(){this._applyMode(this._oldMode)}_applyMode(e){const t=this._findPriceScaleById();null!==t&&((0,s.saveDefaultProperties)(!0),t.setMode(e),(0,s.saveDefaultProperties)(!1),this._model&&(this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()))}_findPriceScaleById(){const e=this._model.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleSelectionStrategyCommand:()=>a});var s=i(88537),r=i(35762),n=i(74325);class o{constructor(e){this._leftScales=e.leftPriceScales().map(e=>e.id()),this._rightScales=e.rightPriceScales().map(e=>e.id())}restorePane(e){this._leftScales.reverse().map(t=>(0,s.ensureNotNull)(e.getPriceScaleById(t))).forEach(t=>e.movePriceScale(t,"left")),this._rightScales.reverse().map(t=>(0,s.ensureNotNull)(e.getPriceScaleById(t))).forEach(t=>e.movePriceScale(t,"right"))}}class a extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._targetStrategy=(0,n.createPriceScaleSelectionStrategy)(t),this._initialState=e.panes().map(e=>new o(e))}redo(){this._chartModel.panes().forEach(e=>e.setPriceScaleSelectionStrategy(this._targetStrategy)),this._chartModel.fullUpdate()}undo(){const e=this._chartModel.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleUnitUndoCommand:()=>o});var s=i(88537),r=i(35762),n=i(37667);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesUnits=new Map,this._oldSourcesUnits=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue +;const e=t||(0,n.symbolOriginalUnit)((0,s.ensureNotNull)(i.symbolInfo()),this._chartWidget.model().model().unitConversionEnabled());this._newSourcesUnits.set(i.id(),e),this._oldSourcesUnits.set(i.id(),i.unit()),this._showFade=this._showFade||i===o&&i.unit()!==e}}redo(){this._applyUnits(this._newSourcesUnits)}undo(){this._applyUnits(this._oldSourcesUnits)}_applyUnits(e){this._showFade&&this._chartWidget.screen.show();const t=this._chartWidget.model().model();e.forEach((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setUnit(e)}),this._chartWidget.model().selectionMacro(e=>{e.clearSelection()})}}},870:(e,t,i)=>{"use strict";i.d(t,{SetScaleRatioPropertiesCommand:()=>o});var s=i(35762),r=i(88564),n=i(33291);class o extends s.UndoCommand{constructor(e,t,i,s){super(i),this._property=e,this._newValue=t,this._model=s,this._priceScale=this._model.mainSeries().priceScale(),this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode()}redo(){this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode(),(0,r.saveDefaultProperties)(!0),this._priceScale.setMode({autoScale:!1,percentage:!1,log:!1}),this._property.setValue(this._newValue),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}undo(){(0,r.saveDefaultProperties)(!0),this._property.setValue(this._oldValue),this._priceScale.setMode(this._oldMode),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}}},52546:(e,t,i)=>{"use strict";function s(e,t){const i=new Set,s=t=>{e.children(t,!1).forEach(e=>{i.has(e)||(i.add(e),s(e))})};return t.forEach(s),t.filter(e=>!i.has(e)).map(t=>function e(t,i){let s=[];const r=t.children(i,!1);for(let i=0;ie.concat(t),[])}i.d(t,{closeSourcesSet:()=>s})},13339:(e,t,i)=>{"use strict";i.d(t,{TimeScaleChangeUndoCommand:()=>o});var s=i(98125),r=i(35762);const n=(0,s.getLogger)("Chart.ChartUndoModel");class o extends r.UndoCommand{constructor(e,t,i){super(i,!1),this._newRightOffsetAndBarSpacing=null,this.setCustomFlag("doesnt_affect_save",!0),this._model=e,this._rightOffsetAndBarSpacing=t}undo(){if(null!==this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone");const e=this._model.timeScale();this._newRightOffsetAndBarSpacing={barSpacing:e.barSpacing(),rightOffset:e.rightOffset()},e.setBarSpacing(this._rightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._rightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate()}redo(){if(null===this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone");const e=this._model.timeScale();e.setBarSpacing(this._newRightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._newRightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate(),this._newRightOffsetAndBarSpacing=null}}},35762:(e,t,i)=>{"use strict";i.d(t,{UndoCommand:()=>r});var s=i(24980);class r{ +constructor(e,t=!0){this._customFlags={},this._text=e||new s.TranslatedString("",""),this._executeOnPush=t}text(){return this._text}executeOnPush(){return this._executeOnPush}customFlag(e){return this._customFlags[e]}setCustomFlag(e,t){this._customFlags[e]=t}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},52940:(e,t,i)=>{"use strict";i.d(t,{createUndoHistory:()=>u});var s=i(88537),r=i(44556),n=i(16757),o=i(35762);class a extends o.UndoCommand{constructor(e,t,i){super(i),this._wv=e,this._newValue=t,this._oldValue=e.value()}redo(){this._wv.setValue(this._newValue)}undo(){this._wv.setValue(this._oldValue)}}var l=i(98125),c=i(2872),h=i.n(c);const d=(0,l.getLogger)("Common.UndoHistory");function u(){const e=[],t=new r.UndoStack,i=new r.UndoStack,o=new(h());function l(s){if(e.length>0)e[e.length-1].addCommand(s);else{i.clear();const e=t.head(),r=e&&e.text().originalText();e&&e.canMerge(s)?e.merge(s):t.push(s);const n=s.text().originalText();""!==n&&n!==r&&d.logNormal("DO: "+n)}s.executeOnPush()&&s.redo(),e.length||o.fire(c())}function c(){const e=t.head(),s=i.head();return{enableUndo:!t.isEmpty(),undoText:void 0===e?void 0:e.text().translatedText(),enableRedo:!i.isEmpty(),redoText:void 0===s?void 0:s.text().translatedText()}}return{beginUndoMacro:function(t){const i=new n.UndoMacroCommand(t);return e.push(i),i},clearStack:function(){t.clear(),i.clear(),o.fire(c())},createUndoCheckpoint:function(){return{lastActualCommand:t.isEmpty()?null:t.head()}},endUndoMacro:function(){const t=(0,s.ensureDefined)(e.pop());t.isEmpty()||l(t)},pushUndoCommand:l,redo:function(){if(i.isEmpty())return!1;const e=i.pop();return!!e&&(e.redo(),t.push(e),d.logNormal("REDO: "+e.text().originalText()),o.fire(c()),!0)},redoStack:function(){return i},setWatchedValue:function(e,t,i,s){if(e.value()!==t){const r=new a(e,t,i);r.setCustomFlag("doesnt_affect_save",!!s),l(r),r.redo()}},undo:function(){if(t.isEmpty())return!1;const e=t.pop();return!!e&&(e.undo(),i.push(e),d.logNormal("UNDO: "+e.text().originalText()),o.fire(c()),!0)},undoStack:function(){return t},undoToCheckpoint:function(e){for(;!t.isEmpty()&&e.lastActualCommand!==t.head();)t.pop().undo();i.clear(),o.fire(c())},state:c,onChange:function(){return o}}}},16757:(e,t,i)=>{"use strict";i.d(t,{UndoMacroCommand:()=>r});var s=i(35762);class r extends s.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(){for(let e=0;e=0;e--)this._subcommands[e].undo()}commands(){return this._subcommands}}},44556:(e,t,i)=>{"use strict";i.d(t,{UndoStack:()=>a});var s=i(35762),r=i(2872),n=i.n(r);const o=(0,i(98125).getLogger)("Common.UndoStack");class a{constructor(){this._commands=[],this._onChange=new(n())}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){ +if(!(e instanceof s.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void o.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}},36551:(e,t,i)=>{"use strict";i.d(t,{UnmergeDownUndoCommand:()=>o,UnmergeUpUndoCommand:()=>a,UnmergeToNewBottomPane:()=>l});var s=i(88537),r=i(21749);class n extends r.MoveSourceUndoCommand{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro(()=>{i.forEach(e=>this._chartModel.detachSource(e)),this._chartModel.detachSource(e)});const r=this._chartModel.createPane(this.targetPaneIndex()),n=r.findSuitableScale(e);r.bulkActionMacro(()=>{r.addDataSource(e,n,!1),i.forEach(e=>r.addDataSource(e,n,!1))}),(0,s.ensureNotNull)(e.priceScale()).restoreState(this._newPriceScaleState(r.isOverlay(e))),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro(()=>{i.forEach(e=>this._chartModel.detachSource(e));const t=this._chartModel.detachSource(e);(0,s.assert)(t,"Undo of detaching must remove pane")});const r=this._chartModel.panes()[this._initialPaneIndex];let n=r.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=r.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),r.bulkActionMacro(()=>{r.addDataSource(e,n,!0),i.forEach(e=>r.addDataSource(e,n,!1))}),(0,s.ensureNotNull)(e.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}}class l extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}},79222:(e,t,i)=>{"use strict";i.d(t,{unitConvertibleGroups:()=>n,sourceNewUnitOnPinningToPriceScale:()=>o});var s=i(79680),r=i(37667);function n(e,t,i){const s=(0,r.symbolUnitConvertibleGroupsIfExist)(e,!0);if(null!==s)return s;const n=i.unitGroupById(t);return null===n?[]:[n]}function o(e,t,i,r){let o=null;if(i.unitConversionEnabled()&&(0,s.isSymbolSource)(e)){const s=i.availableUnits(),a=t.unit(s),l=e.unit(),c=null===l?[]:n(e.symbolInfo(),l,s);null!==a&&null!==a.selectedUnit&&!a.allUnitsAreOriginal&&a.selectedUnit!==l&&(r&&null===l||null!==l&&s.convertible(l,c))&&(o=a.selectedUnit)}return o}},10133:(e,t,i)=>{"use strict";i.d(t,{createVisibilityController:()=>l});var s=i(28353),r=i(32563),n=i(32255),o=i(56840);function a(e){return"alwaysOn"===e||"alwaysOff"===e?e:"visibleOnMouseOver"} +function l(e,t){let i,l;function c(){if(!i){i=(0,n.createPrimitiveProperty)();let s=o.getValue(e);void 0===s&&void 0!==t&&(s=o.getValue(t)),i.setValue(a(s)),i.subscribe(i,t=>{o.setValue(e,a(t.value()))})}return i}return{property:c,availableValues:function(){return[{id:"visibleOnMouseOver",value:"visibleOnMouseOver",title:(0,s.t)("Visible on mouse over")},{id:"alwaysOn",value:"alwaysOn",title:(0,s.t)("Always visible")},{id:"alwaysOff",value:"alwaysOff",title:(0,s.t)("Always invisible")}]},actualBehavior:function(){if(!l){l=(0,n.createPrimitiveProperty)();const e=c(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=r.mobiletouch?"alwaysOn":"visibleOnMouseOver"),l&&l.setValue(t)};e.subscribe(l,t),t()}return l}}}},62587:(e,t,i)=>{"use strict";i.r(t),i.d(t,{watermarkProperty:()=>h,restoreWatermarkPropertyDefaults:()=>d});var s=i(24377),r=i(56840),n=i(2015),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=(0,s.tryParseRgba)(e.color);t=Object.assign(t,e),null!==i&&(0!==i[3]?t.visibility=!0:(i[3]=.25,t.color=(0,s.rgbaToString)(i)))}}delete t.transparency}return t}let c=null;function h(){return null===c&&(c=new(o())(l()),r.onSync.subscribe(null,()=>{null!==c&&c.mergeAndFire(l())}),c.listeners().subscribe(null,()=>{null!==c&&r.setJSON("symbolWatermark",c.state())})),c}function d(){null!==c&&c.mergeAndFire(a)}},39094:(e,t,i)=>{"use strict";var s=i(35218).translatedIntervalString,r=i(1570).getTranslatedSymbolDescription,n=i(22799).CHART_FONT_FAMILY,o=i(62587),a=o.watermarkProperty,l=o.restoreWatermarkPropertyDefaults,c=i(93435).drawScaled,h=i(59803).applyDefaultsOverrides,d=i(59803).applyPropertiesOverrides;t.Watermark=function(e,t){var i={},o=a();function u(e,t){var s=e.font;return i.hasOwnProperty(s)||(i[s]={}),i[s].hasOwnProperty(t)||(i[s][t]=e.measureText(t).width),i[s][t]}h(o,void 0,!1,"symbolWatermarkProperties"),o.listeners().subscribe(this,(function(){e.updateSource(this)})),this.destroy=function(){o.listeners().unsubscribeAll(this)},this.properties=function(){return o},this.restorePropertiesDefaults=function(){l()},this.applyOverrides=function(e){d(o,void 0,!1,e,"symbolWatermarkProperties")};var p={renderer:function(e,i){return{draw:function(a,l){c(a,l.pixelRatio,(function(){var l=t.symbolInfo();a.fillStyle=o.color.value();var c,h=l.name;/QUANDL/.test(l.exchange)&&((c=h.split(/\//)).length&&(h=c[c.length-1]));for(var d={description:l.description,short_description:l.short_description,pro_name:l.pro_name,short_name:l.name,local_description:l.local_description,language:l.language},p=[{text:h?h+", "+s(t.interval()):"",font:"96px "+n,lineHeight:117,vertOffset:0},{text:r(d)||"",font:"48px "+n,lineHeight:58,vertOffset:5}],_=0,m=0;mi?i/g:1,_+=v.lineHeight*v.zoom}}var f=Math.max((e-_)/2,0);for(m=0;m{"use strict";i.d(t,{reorderDataSourcesStateZOrder:()=>S,newLineToolZOrder:()=>w,newStudyZOrder:()=>C,moveAfterSource:()=>E,moveBeforeSource:()=>k});var s=i(14291),r=i(81851),n=i(56972),o=i(50669),a=i(55257);function l(e){return(0,s.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()}function c(e){return(0,r.isStudy)(e)&&!e.isSpeciallyZOrderedSource()}function h(e,t){return e.zorder-t.zorder}function d(e,t){(0,o.isMainSeriesState)(e)?e.zorder=0:e.zorder=t}function u(e,t){e.setZorder(t)}function p(e){return e.zorder()}function _(e){return Math.round(1e3*e)/1e3}function m(e,t){const i=Math.max(e,t),s=Math.min(e,t);return Math.max(0,Math.ceil(i)-Math.floor(s)-1)}function g(e,t,i){let s=0;const r=(n=t,o=e,Math.abs(1e3*o-1e3*n)/1e3);var n,o,a;return r>i?(e=Math.trunc(e),s=Math.floor(r/(i+1))):(a=r/(i+1),s=Math.floor(1e3*a)/1e3),{startZOrder:e,zOrderStep:s}}function f(e,t,i,s){let r=e.length,n=t;for(let t=e.length-1;t>=-1;t--)if(-1===t||s(e[t])){const s=t;let o=T(n);if(r-1===s)s>=0&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o-=1e4,0===o&&(o-=1e4))}let l=r-1;for(;l>s;){const t=_(n-a);i(e[l],t),n=t,l--}s>=0&&i(e[s],o)}n=o,r=s}}function v(e,t,i,s){let r=-1,n=t;for(let t=0;t<=e.length;t++)if(t===e.length||s(e[t])){const s=t;let o=P(n);if(r+1===s)s<=e.length-1&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o+=1e4,0===o&&(o+=1e4))}let l=r+1;for(;l<=s-1;){const t=_(n+a);i(e[l],t),n=t,l++}s<=e.length-1&&i(e[s],o)}n=o,r=s}}function S(e){!function(e,t,i,s,r,n){let o=null;const a=[];for(const r of e)t(r)?(a.push(r),o=r):(i(r)||s(r))&&a.push(r);a.sort(n),null!==o&&r(o,0);const l=null===o?-1:a.indexOf(o);-1!==l?(f(a.slice(0,l),0,r,i),v(a.slice(l+1),0,r,i)):v(a,0,r,i)}(e,o.isMainSeriesState,o.isStudyState,o.isLineToolState,d,h)}function y(e,t){const i=Math.floor(e/1e4);let s=t.get(i);return void 0===s&&(s=[],t.set(i,s)),s}function b(e,t,i,s,r,n){let o=-1/0,a=1/0,l=-1/0,c=0;const h=new Map;for(let s=0;sr(e)-r(t));let p=T(r(u[0]));const m=P(p),f=g(p,m,u.length+1).zOrderStep;return 0!==f?(u.forEach(e=>{const t=_(p+f);s(e,t),p=t}),_(p+f)):_(m+5e3)}function w(e,t){return b(e,l,c,u,p,t)}function C(e){let t=-1e4;for(const i of e)c(i)&&(t=Math.min(t,i.zorder()-1e4));return 0===t?-1e4:t}function P(e){ +const t=1e4*Math.ceil(e/1e4);return t===e?t+1e4:t}function T(e){const t=1e4*Math.floor(e/1e4);return t===e?t-1e4:t}function x(e,t,i,s,r,n,o){const l=t.length,{newItems:c,movedItemsStartIndex:h}=i>0?(0,a.moveAfter)(e,t,i-1):(0,a.moveBefore)(e,t,0);let d=!1;for(let t=h;tr(e))?function(e,t,i,s,r,n){let o,a,l=-1,c=-1;0===i?(c=I(e,i+t,s),a=n(e[c])):i+t===e.length?(l=M(e,i-1,s),o=n(e[l])):(l=M(e,i-1,s),o=n(e[l]),c=I(e,i+t,s),a=n(e[c]));if((void 0===o||o<0)&&void 0!==a&&a<=0)f(e.slice(0,c),a,r,s);else if((void 0===a||a>0)&&void 0!==o&&o>=0)v(e.slice(l+1),o,r,s);else{const n=i+t,o=e.length-i;n0)&&void 0!==a&&a>=0){c=a;const e=void 0!==l?l:P(a),s=g(c,e,t);c=s.startZOrder,p=s.zOrderStep,d=i,u=d+t,h=1}if(0!==p)for(;d!==u;){const t=_(c+h*p);n(e[d],t),c=t,d+=h}else{const t=e.findIndex(e=>r(e));-1!==t?(f(e.slice(0,t),0,n,s),v(e.slice(t+1),0,n,s)):v(e,0,n,s)}}(c,l,h,r,s,n,o)}function I(e,t,i){for(;t=0&&i(e[t]);)t--;return Math.max(0,t)}function L(e,t,i,s,r,n,o){const a=e.indexOf(i)+1;x(e,t,a,s,r,n,o)}function A(e,t,i,s,r,n,o){const a=e.indexOf(i);x(e,t,a,s,r,n,o)}function E(e,t,i){L(e,t,i,n.isSeries,c,u,p)}function k(e,t,i){A(e,t,i,n.isSeries,c,u,p)}},89453:(e,t,i)=>{"use strict";i.d(t,{setSymbolSearchCompleteOverrideFunction:()=>r,getSymbolSearchCompleteOverrideFunction:()=>n});let s=e=>Promise.resolve(e);function r(e){s=e}function n(){return s}},67072:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(2015),r=i(98125).getLogger("Chart.Study.MetaInfo"),n=i(59572).applyOverridesToStudyDefaults,o={};function a(e){TradingView.merge(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}}),TradingView.merge(this,e);var t=e.fullId||e.id;TradingView.merge(this,a.parseIdString(t))}a.VERSION_STUDY_ARG_SOURCE=41,a.METAINFO_FORMAT_VERSION_SOS_V2=42,a.VERSION_PINE_PROTECT_TV_4164=43,a.CURRENT_METAINFO_FORMAT_VERSION=52,a.VERSION_NEW_STUDY_PRECISION_FORMAT=46,a.CHILD_STUDY_ALLOWED_PLOT_TYPES=["line"],a.canPlotBeSourceOfChildStudy=function(e){return a.CHILD_STUDY_ALLOWED_PLOT_TYPES.includes(e)},a.CHILD_STUDY_EXCLUDE_IDS=["CorrelationCoefficient@tv-basicstudies","Correlation - Log@tv-basicstudies-1"],a.CHILD_STUDY_PARENT_EXCLUDE_IDS=[],a.FilledArea={},a.FilledArea.TYPE_PLOTS="plot_plot",a.FilledArea.TYPE_HLINES="hline_hline",a.versionOf=function(e){var t="_metainfoVersion"in e&&isNumber(e._metainfoVersion)?e._metainfoVersion:0;return t<0&&r.logError("Metainfo format version cannot be negative: "+t),t},a.parseIdString=function(e){var t={};if(-1===e.indexOf("@"))t.shortId=e, +t.packageId="tv-basicstudies",t.id=e+"@"+t.packageId,t.version=1;else{var i=e.split("@");t.shortId=i[0];var s=i[1].split("-");if(3===s.length)t.packageId=s.slice(0,2).join("-"),t.id=t.shortId+"@"+t.packageId,t.version=s[2];else if(1===s.length&&"decisionbar"===s[0])t.packageId="les-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1;else{if(1!==s.length)throw new Error("unexpected study id:"+e);t.packageId="tv-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1}}if(t.fullId=t.id+"-"+t.version,"tv-scripting"===t.packageId){var r=t.shortId;if(0===r.indexOf("Script$")||0===r.indexOf("StrategyScript$")){var n=r.indexOf("_");t.productId=n>=0?r.substring(0,n):t.packageId}else t.productId=t.packageId}else t.productId=t.packageId;return t},a.getPackageName=function(e){return(/^[^@]+@([^-]+-[^-]+)/.exec(e||"")||[0,"tv-basicstudies"])[1]},a.cutDollarHash=function(e){var t=e.indexOf("$"),i=e.indexOf("@");return-1===t?e:e.substring(0,t)+(i>=0?e.substring(i):"")},a.hasUserIdSuffix=function(e){return/^USER;[\d\w]+;\d+$/.test(e)},a.isStandardPine=function(e){return/^(Strategy)?Script\$STD;.*@tv-scripting$/.test(e)},a.getSourceIdByInputs=function(e,t){if(!Array.isArray(e)||!t)return null;for(var i=0;i0){var l=o.replace(/^[^\$]+/,t);i.inputs[n.id].setValue(l)}}}},a.patchChildStudyMetaInfoState=function(e){e.state&&function e(t){if("object"==typeof t)for(var i in t)"string"==typeof t[i]&&/^[^\$]+\$\d+$/.test(t[i])?t[i]=t[i].replace(/^[^\$]+/,"{pid}"):e(t[i])}(e.state.inputs),e.state.isChildStudy=!0},a.getStudyIdWithLatestVersion=function(e){const t=a.cutDollarHash(e.id);let i=t;return t.indexOf("@tv-scripting")>=0?i+="-101!":i+="-"+e.version,i},a.prototype.parseValue=function(e,t){return"bool"===e?TradingView.parseBool(t):t},a.prototype.defaultInputs=function(){for(var e=[],t=0;t0?e[0].id:null},a.prototype.createDefaults=function(){if(this.defaults){var e=TradingView.clone(this.defaults);e.precision="default";var t=a.getStudyPropertyRootName(this);defaults.create(t,e)}},a.prototype.removeDefaults=function(){defaults.remove(a.getStudyPropertyRootName(this))},a.findStudyMetaInfoByDescription=function(e,t){if(e){for(var i=0;i{"use strict";window.TradingView=window.TradingView||{},window.requireAll=function(e){return e.keys().map(e)},i(28353),i(32563).setClasses(),i(9196),i(56186).install(),i(49483),i(80643),i(29892),i(94419),i(11417),i(11372),i(37562),i(56840)},97881:(e,t,i)=>{"use strict";var s=i(28353).t;i(70606);var r=i(88537).assert;i(96488),i(59803),i(87980);const n=i(67337);JSON.parse(urlParams.disabledFeatures).forEach((function(e){n.setEnabled(e,!1)})),JSON.parse(urlParams.enabledFeatures).forEach((function(e){n.setEnabled(e,!0)})),function(){window.__settingsOverrides=window.parent[window.urlParams.uid].settingsOverrides||{};var e=window.parent[window.urlParams.uid].settingsAdapter;null!=e?(TVSettings.setSettingsAdapter(e),TVSettings.sync()):n.enabled("use_localstorage_for_settings")&&TVSettings.sync()}();var o=i(22799).setChartFontFamily +;window.urlParams.customFontFamily&&o(window.urlParams.customFontFamily);var a=i(84120).RestrictedToolsetBootloader,l=i(9753).HeaderToolbarBootloader,c=i(84746).DrawingToolbarBootloader,h=i(85593).isDrawingToolbarVisible;(0,i(32563).setClasses)();var d=i(6087),u=i(45345).setTheme,p=i(33225),_=i(17437),m=i(25760),g=i(47193).migrateShortcut,f=i(76900).ChartSaver,v=i(41051).SaveChartService,S=i(86879).LoadChartService,y=i(46723).StudyTemplates,b=i(22668).FavoriteStudyTemplateService,w=i(82992).linking,C=i(76422),P=i(97098).formatterOptions,T=i(69147).customFormatters,x=i(34615).StudyMarket,I=i(21097).TVXWindowEvents,M=i(81836).createDeferredPromise,L=i(15840).deepExtend,A=i(9423).randomHash,E=i(65576).convertPropertyToWatchedValue,k=i(95707).property,D=i(62428).property,V=i(21761).dateFormatProperty,B=i(43370).default,N=i(29823).Interval,R=i(89356).Root,O=i(28325).ChartPage,F=i(39138).destroyQuoteSessions,W=i(73383).TIMEFRAMETYPE,H=new O(new R(window).allocate()),z=H.allocate({areaName:"center"}),U=(window.parent[urlParams.uid].brokerFactory,Boolean(!1)),j=i(54427).CHART_WIDGET_COLLECTION_SERVICE,G=i(16216);i(65235);var q=i(43425),Y=i(12409).createFavoriteDrawingToolbar,K=i(77317).setupChartEventHint,$=i(81602).setupChartScreenshotHint,X=i(87983),Z=i(67072),J=i(28399);i(27595),i(15495);var Q=i(78136).setSearchRequestDelay,ee=i(16654),te=i(216),ie=i(17937).addBrandingSource,se=i(13221).setAdditionalSymbolInfoFields,re=i(89453).setSymbolSearchCompleteOverrideFunction,ne=i(52741).DropdownApi,oe=i(97056).ContextMenuManager;const ae=new AbortController;var le=window.parent[urlParams.uid].getCustomIndicators,ce=M(),he=M(),de=n.enabled("left_toolbar");if(void 0!==window.parent[urlParams.uid].contextMenu){var ue=window.parent[urlParams.uid].contextMenu;void 0!==ue.items_processor&&oe.setCustomItemsProcessor(ue.items_processor),void 0!==ue.renderer_factory&&oe.setCustomRendererFactory(ue.renderer_factory)}if(Promise.all([ce.promise,he.promise]).then((function(){window.ChartApiInstance.start()})),"function"==typeof le){var pe=le(te);pe&&pe.then?pe.then((function(e){if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void ce.resolve();JSServer.studyLibrary.push.apply(JSServer.studyLibrary,e),ce.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((function(e){console.warn("Error loading custom indicators "+e),ce.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),ce.resolve())}else ce.resolve();window.widgetReady=function(e){C.subscribe("onChartReady",e)};var _e=urlParams.theme&&urlParams.theme.toLowerCase();function me(e){window.__defaultsOverrides=window.__defaultsOverrides||{},L(window.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&(window.applyDefaultsOverrides(TradingView.defaultProperties.chartproperties),window.applyDefaultOverridesToLinetools())}!function(e){ +d.themes[e]&&u(e)}(_e),window.applyStudiesOverrides=function(e){e&&(window.chartWidgetCollection?window.chartWidgetCollection.applyStudiesOverrides(e):Z.mergeDefaultsOverrides(e))},window.applyOverrides=function(e){me(e),window.chartWidgetCollection&&window.chartWidgetCollection.applyOverrides(e)},window.doWhenApiIsReady=function(e){window.tradingViewApi?e():he.promise.then(e)},window.applyTradingCustomization=function(e){for(var t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];for(var t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t]},window.changeTheme=function(e,t){var i=d.themes[e.toLowerCase()];return i?window.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},window.getTheme=function(){return window.tradingViewApi.themes().getCurrentThemeName()},window.is_authenticated=!1;JSON.parse(window.urlParams.brokerConfig);s("charts by TradingView"),s("powered by TradingView"),s("by TradingView");var ge=null,fe=M(),ve=null,Se=function(){if(n.setEnabled("charting_library_debug_mode","true"===urlParams.debug),n.setEnabled("chart_property_page_trading",!1),n.enabled("remove_library_container_border")){var e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}n.enabled("no_min_chart_width")&&(window.document.body.style.minWidth="0px"),null!=urlParams.studiesOverrides&&Z.mergeDefaultsOverrides(JSON.parse(urlParams.studiesOverrides)),r(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),me(JSON.parse(urlParams.overrides)),urlParams.numeric_formatting=urlParams.numeric_formatting&&JSON.parse(urlParams.numeric_formatting),urlParams.numeric_formatting&&"string"==typeof urlParams.numeric_formatting.decimal_sign&&(P.decimalSign=urlParams.numeric_formatting.decimal_sign[0]),window.ChartApiInstance=new X(window.parent[urlParams.uid].datafeed),window.parent[urlParams.uid].customFormatters&&(window.parent[urlParams.uid].customFormatters.timeFormatter&&(T.timeFormatter=window.parent[urlParams.uid].customFormatters.timeFormatter),window.parent[urlParams.uid].customFormatters.dateFormatter&&(T.dateFormatter=window.parent[urlParams.uid].customFormatters.dateFormatter),window.parent[urlParams.uid].customFormatters.tickMarkFormatter&&(T.tickMarkFormatter=window.parent[urlParams.uid].customFormatters.tickMarkFormatter),window.parent[urlParams.uid].customFormatters.priceFormatterFactory&&(T.priceFormatterFactory=window.parent[urlParams.uid].customFormatters.priceFormatterFactory),window.parent[urlParams.uid].customFormatters.studyFormatterFactory&&(T.studyFormatterFactory=window.parent[urlParams.uid].customFormatters.studyFormatterFactory)),window.ChartApiInstance.setStudiesAccessController(window.ChartApiInstance.createStudiesAccessController(urlParams.studiesAccess)) +;var t=urlParams.chartContent?JSON.parse(urlParams.chartContent).json:void 0,o=urlParams.chartContentExtendedData?JSON.parse(urlParams.chartContentExtendedData):t?t.extendedData:void 0,u=urlParams.interval||"D",_=function(e){var t=/(\d+)(\w+)/;return e.map((function(e){var i=t.exec(e.text),r=i[2].toLowerCase(),n=parseInt(i[1]),o="y"===r?12*n+"M":n+r,a=N.parse(e.resolution);return{text:s(e.title)||n+s(r,{context:"dates",count:n}),description:e.description||"",value:{value:o.toUpperCase(),type:W.PeriodBack},targetResolution:a.value(),requiresIntraday:a.isIntraday()}}))}(JSON.parse(urlParams.timeFrames)),m={resizerBridge:z,padding:n.enabled("border_around_the_chart")?2:0,content:t,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:window.ChartApiInstance.studiesAccessController.isToolEnabled("Volume"),muteSessionErrors:!0,timezone:urlParams.timezone,defSymbol:urlParams.symbol,defInterval:u,compareSymbols:urlParams.compareSymbols&&JSON.parse(urlParams.compareSymbols),defTimeframe:window.parent[urlParams.uid].timeframe,paneContextMenuEnabled:n.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:U},priceScaleContextMenuEnabled:n.enabled("scales_context_menu"),currencyConversionEnabled:n.enabled("pricescale_currency"),unitConversionEnabled:n.enabled("pricescale_unit"),legendWidgetEnabled:n.enabled("legend_widget"),legendWidget:{contextMenu:{settings:n.enabled("show_chart_property_page"),showOpenMarketStatus:n.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:n.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:n.enabled("scales_context_menu"),timezoneMenuEnabled:n.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:n.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:n.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:n.enabled("right_bar_stays_on_scroll"),minBarSpacing:urlParams.time_scale&&JSON.parse(urlParams.time_scale).min_bar_spacing},goToDateEnabled:n.enabled("go_to_date"),crossHair:{menuEnabled:n.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:n.enabled("mouse_wheel_scale"),pinch:n.enabled("pinch_scale"),axisPressedMouseMove:{time:n.enabled("axis_pressed_mouse_move_scale"),price:n.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:n.enabled("mouse_wheel_scroll"),pressedMouseMove:n.enabled("pressed_mouse_move_scroll"),horzTouchDrag:n.enabled("horz_touch_drag_scroll"),vertTouchDrag:n.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:n.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:n.enabled("cropped_tick_marks"),countdownEnabled:n.enabled("countdown"),indicatorsDialogShortcutEnabled:n.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:n.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:n.enabled("go_to_date"),availableTimeFrames:function(e,t){ +return e?t!==ee.STATUS_DELAYED&&t!==ee.STATUS_DELAYED_STREAMING&&t!==ee.STATUS_READY?[]:_.filter((function(t){return!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))})):[]}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:n.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:!1,backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,fullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:urlParams.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:n.enabled("save_shortcut")};de&&(Y(),m.widgetOptions.isDrawingToolbarVisible=h),o&&(m.metaInfo={id:o.uid,name:o.name,description:o.description,uid:o.uid,username:"",tags:""}),window.parent[urlParams.uid].additionalSymbolInfoFields&&se(window.parent[urlParams.uid].additionalSymbolInfoFields),window.parent[urlParams.uid].symbolSearchComplete&&re(window.parent[urlParams.uid].symbolSearchComplete);var g=window.chartWidgetCollection=new q(m);let M=!1;g.onAboutToBeDestroyed.subscribe(null,()=>{M=!0},!0),ie(g),window.studyMarket=new x(g),void 0!==G&&G.registerService(j,g),g.activeChartWidget.subscribe((function(e){C.emit("activeChartChanged",g.getAll().indexOf(e))})),window.saver=new f(g);var L=new v(g,window.saver),A=new S(g);window.chartWidget=g.activeChartWidget.value(),window.pro=new TradingView.Pro;var E=function(e){if(!n.enabled("header_widget"))return null;var t=H.allocate({areaName:"top"}),s=new(0,i(68425).ChartChangesWatcher)(e.chartWidgetCollection.undoHistory,e.chartWidgetCollection.lineToolsSynchronizerHasChanges,window.saver,C),r=JSON.parse(urlParams.favorites);r.intervals=r.intervals.map((function(e){var t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t}));var o=null;n.enabled("study_templates")&&(o=new b(I,TVSettings),ve=new y({chartWidgetCollection:e.chartWidgetCollection,favoriteStudyTemplatesService:o}));var c=void 0,h=urlParams.header_widget_buttons_mode;"fullsize"===h&&(c=["full"]);"compact"===h&&(c=["small"]);return new l(new a,{chartSaver:window.saver,chartApiInstance:ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:r.chartTypes,defaultFavoriteIntervals:r.intervals,hideStudyTemplates:!0,resizerBridge:t,studyMarket:window.studyMarket,studyTemplates:ve,favoriteStudyTemplatesService:o,allowedModes:c,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:s,onClick:Me,snapshotUrl:e.snapshotUrl})}({chartWidgetCollection:g,saveChartService:L,loadChartService:A,snapshotUrl:urlParams.snapshotUrl});null!==E?E.load().then((function(e){ge=e.getComponent(),fe.resolve()})):(fe.promise.catch((function(){})),fe.reject("header widget is not loaded"));var k=function(e){if(de){var t=urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)?String(urlParams.toolbarbg):void 0;if(t){var i=document.createElement("style") +;i.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(i)}return new c({bgColor:t,chartWidgetCollection:e,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,resizerBridge:H.allocate({areaName:"left"}),onClick:Me})}return null}(g),D=null;window.tradingViewApi=new J({chartWidgetCollection:g,chartApiInstance:window.ChartApiInstance,saveChartService:L,loadChartService:A});if(w.bindToChartWidgetCollection(g),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),!TradingView.isNaN(urlParams.ssreqdelay)){var V=Math.max(0,+urlParams.ssreqdelay);Q(V)}window.ChartApiInstance.connect(),Promise.all([i.e(5514),i.e(9129),i.e(2e3),i.e(6363),i.e(3466),i.e(7836),i.e(8463),i.e(3921),i.e(7427),i.e(1112),i.e(6909),i.e(5998),i.e(6416),i.e(7419),i.e(3520),i.e(9042),i.e(323),i.e(2849),i.e(880),i.e(1075),i.e(9505),i.e(1890),i.e(1784),i.e(7210),i.e(2306)]).then(i.t.bind(i,87805,23)).then(({default:e})=>{M||(window.lineToolPropertiesToolbar=new e(g))});var R=document.querySelector(".tv-content");function O(){k&&k.load(ae.signal),D&&D.load(ae.signal).then((function(e){window.footerWidget=e.getComponent()}))}null!==R&&R.addEventListener("contextmenu",(function(e){null!==e.target&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),he.resolve(),g.undoHistory.undoStack().onChange().subscribe(null,B((function(e){e&&!e.customFlag("doesnt_affect_save")&&C.emit("onAutoSaveNeeded")}),1e3*(urlParams.autoSaveDelay||5),{leading:!1,trailing:!0})),window.chartWidget.withModel(null,(function(){if(ChartApiInstance.on("realtime_tick",(function(e){C.emit("onTick",e)})),!d.savedThemeName()&&_e){var e=d.getStdTheme(_e);e&&e.content&&void 0===t&&g.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:_e,standardTheme:!0,syncState:!0,noUndo:!0}).then(()=>window.applyOverrides(window.__defaultsOverrides))}n.enabled("charting_library_debug_mode")&&C.subscribeToAll((function(){var e=Array.prototype.slice.call(arguments);console.log('Event "{0}", arguments: {1}'.format(e[0],JSON.stringify(e.slice(1))))})),K&&(K(g),K=null),$&&($(g,{seriesControlBarEnabled:n.enabled("timeframes_toolbar")}),$=null)})),p.isAnyChartWidgetInitialized(g)?O():p.waitAnyChartWidgetInitialized(g,O),C.subscribe("chart_load_requested",(function(e){window.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}))};window.addEventListener("unload",(function(){ae.abort(),window.widgetbar&&(window.widgetbar.destroy(),window.widgetbar=null),window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),window.ChartApiInstance&&window.ChartApiInstance.disconnect(),F(),window.ChartApiInstance&&(window.ChartApiInstance.destroy(),window.ChartApiInstance=null)})), +n.enabled("saveload_storage_customization")&&(window.parent[urlParams.uid].saveLoadAdapter?_.setCustomAdapter(window.parent[urlParams.uid].saveLoadAdapter):void 0!==urlParams.chartsStorageUrl&&urlParams.chartsStorageUrl&&void 0!==urlParams.clientId&&urlParams.clientId?_.initialize(urlParams.clientId,urlParams.userId,urlParams.chartsStorageUrl,urlParams.chartsStorageVer||"1.0"):(n.setEnabled("saveload_storage_customization",!1),n.setEnabled("header_saveload",!1)));var ye=M();function be(){ye.resolve()}window.parent[urlParams.uid].loadLastChart&&n.enabled("saveload_storage_customization")?_.getCharts().then((function(e){if(0!==e.length){var t=e.sort((function(e,t){return t.modified_iso-e.modified_iso}))[0];_.getChartContent(t).then((function(e){var t=JSON.parse(e.content);t.extendedData=e,urlParams.chartContent=JSON.stringify({json:t}),be()})).catch(be)}else be()})).catch(be):be();var we,Ce,Pe=M();Promise.all([Pe.promise,ye.promise,window.loadedCustomCss]).then((function(){var e,t,i,s,r,o,a=document.querySelector(".loading-indicator");if(a&&(a.style.display="none"),setTimeout(Se,0),n.enabled("14851")&&Math.random()<=.02){e=window,t=document,i="script",s="ga",e.GoogleAnalyticsObject=s,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,r=t.createElement(i),o=t.getElementsByTagName(i)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",o.parentNode.insertBefore(r,o);var l=document.URL.match(new RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-112911840-1","auto"),ga("set","anonymizeIp",!0),ga("set",{hostname:l,page:l,referrer:l}),ga("send","pageview")}})),we=!0,window.parent[urlParams.uid].datafeed.onReady((function(e){we&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=e,Pe.resolve()})),we=!1,window.getFunctionFromArguments=function(e){return window.parent[urlParams.uid][e]},window.createShortcutAction=(Ce=m.createGroup({desc:"API"}),function(e,t){Ce.add({hotkey:g(e),handler:t})}),window.initializationFinished=function(){window.chartWidgetCollection.undoHistory.clearStack()},window.headerReady=function(){return fe.promise},window.createButton=function(e){if(null===ge)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1,ge.addButton(A(),e)},window.createDropdown=function(e){if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=A();return ge?(ge.addDropdown(t,e),Promise.resolve(new ne(ge,t))):fe.promise.then(()=>(ge.addDropdown(t,e),new ne(ge,t)))},window.getAllFeatures=function(){const e=n.getAllFeatures();return Object.keys(e).forEach((function(t){isNaN(parseFloat(t))||delete e[t]})),e};var Te=null;window.getNavigationButtonsVisibility=function(){return null===Te&&(Te=E(k())),Te};var xe=null +;window.getPaneButtonsVisibility=function(){return null===xe&&(xe=E(D())),xe};var Ie=null;function Me(e){var t=TradingView.bottomWidgetBar;t&&t.turnOffMaximize()}window.getDateFormat=function(){return null===Ie&&(Ie=E(V)),Ie}},11372:(e,t,i)=>{e=i.nmd(e),TradingView.cleanButAmpersand=function(e,t){var i=t?["&"]:["&"];return TradingView.clean(e,t,i)},TradingView.strip_tags=function(e){return e&&e.replace?e.replace(/(<([^>]+)>)/gi,""):e},TradingView.encodeSpread=function(e){return encodeURIComponent(e)},TradingView.clean=function(e,t,i){var s=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]],r=e;if(!e||!e.replace)return r;for(var n=0;n{"use strict";i.r(t);var s=i(21097),r=i(51768),n=i(38780);function o(e,t=!1){"loading"!==document.readyState?t?setTimeout(()=>e(),1):e():document.addEventListener("DOMContentLoaded",()=>e())}new Promise(e=>{o(e)});function a(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth{document.addEventListener("mouseenter",e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){let e="x";if(t.matches(".apply-overflow-tooltip--direction_both")?e="both":t.matches(".apply-overflow-tooltip--direction_y")&&(e="y"),t.matches(".apply-overflow-tooltip--check-children")){let i=!1;const s=t.children;for(let t=0;t(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e),[]).join("").trim(),(0,n.showOnElement)(t,{text:i});const s=()=>{(0,n.hide)(),["mouseleave","mousedown"].forEach(e=>t.removeEventListener(e,s))};["mouseleave","mousedown"].forEach(e=>t.addEventListener(e,s))}},!0)});var l=i(2872),c=i.n(l),h=i(11417),d=i(15840);let u;function p(e){window.iframeAuthWidget&&!1===window.user.profile_data_filled&&(window.iframeAuthWidget.preventClose=!0);const t=window.user.available_offers||{};window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.user.is_pro&&window.location.reload()),!1===window.user.profile_data_filled&&((0,r.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):(Object.keys(t).forEach(e=>{const i=e;t[i].available_for_anons||delete t[i]}),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:t},h.TVLocalStorage.removeItem("trial_availiable"))}u=window.loginStateChange?window.loginStateChange:window.loginStateChange=new(c()),u.subscribe(null,p), +s.TVXWindowEvents.on("loginStateChange",e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,u.fire()}),s.TVXWindowEvents.on("signOut",()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//].forEach(t=>{t.test(window.location.pathname)&&(e=!1)}),e&&window.location.reload()}()}),(()=>{const e={};window.crossTabSyncUserAttr=e=>{const t={};e instanceof Array?e.forEach(e=>{t[e]=window.user[e]}):t[e]=window.user[e],s.TVXWindowEvents.emit("user-obj-changed",JSON.stringify(t))},s.TVXWindowEvents.on("user-obj-changed",t=>{const i=JSON.parse(t);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(e[s]||[]).forEach(e=>{e.fire(i[s])})}})})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),u.fire()},window.loginUser=function(e,t){window.TVDialogs&&window.TVDialogs.signModal&&window.TVDialogs.signModal.close(),window.user=(0,d.deepExtend)({},e),window.TradingView.changeLoginState(!0),"function"==typeof t&&window.TVDialogs&&window.TVDialogs.signModal?window.TVDialogs.signModal.on("signinSuccess",()=>{t()}):"function"==typeof t&&t()},window.loginRequiredDelegate=new(c()),window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=p,window.TradingView.setTrialAvailiable=e=>{h.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new(c())},68906:(e,t,i)=>{"use strict";i.r(t),i.d(t,{generateColor:()=>r,alphaToTransparency:()=>n,transparencyToAlpha:()=>o,applyTransparency:()=>a,resetTransparency:()=>l,getLuminance:()=>c,isHexColor:()=>h,colorFromBackground:()=>d,gradientColorAtPercent:()=>u,isColorDark:()=>p,rgbaFromInteger:()=>_,rgbaToInteger:()=>m,colorToInteger:()=>g});var s=i(24377);function r(e,t,i){if(t=t||0,!h(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(o(t)))):e;const[r,n,a]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(o(t));return(0,s.rgbaToString)([r,n,a,l])}function n(e){return 100*(1-e)}function o(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function a(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),r=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],o(t)*r))}function l(e){return"transparent"===e||h(e)?e:(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function c(e){const t=(0,s.parseRgb)(e).map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function h(e){return 0===e.indexOf("#")}function d(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function u(e,t,i){const[r,n,o,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(r+i*(l-r)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(d-a));return(0, +s.rgbaToString)(u)}function p(e){return c(l(e))<.5}function _(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function m(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function g(e){const t=(0,s.tryParseRgba)(e);return null===t?0:m(t)}},59199:(e,t,i)=>{"use strict";i.d(t,{doAnimate:()=>n});const s={from:0,duration:250,easing:i(68587).easingFunc.easeOutCubic};class r{constructor(e){this._doing=!0,this._completed=!1,this._options={...s,...e};const t=performance.now();window.requestAnimationFrame(e=>{this._animation(t,this._options.from,e)})}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const s=(i=!i||i<1e12?performance.now():i)-e,r=s>=this._options.duration||t===this._options.to,n=(o=this._options.from,a=this._options.to,l=this._options.easing(s/this._options.duration),o*(1-l)+a*l);var o,a,l;const c=r?this._options.to:n,h=c-t;this._options.onStep(h,c),r?this._finishAnimation():window.requestAnimationFrame(t=>{this._animation(e,c,t)})}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function n(e){return new r(e)}},85198:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>s});(0,i(98125).getLogger)("Fetch");function s(e,t,i={}){return window.fetch(e,t)}},98125:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LOGLEVEL:()=>n,getLogLevel:()=>_,isHighRateEnabled:()=>m,setLogLevel:()=>g,getRawLogHistory:()=>f,serializeLogHistoryEntry:()=>v,getLogHistory:()=>S,getLogger:()=>b,loggingOn:()=>C,loggingOff:()=>P});const s="undefined"!=typeof window?window:{};let r=!1;try{localStorage.getItem(""),r=!0}catch(e){}var n;!function(e){e[e.ERROR=1]="ERROR",e[e.WARNING=2]="WARNING",e[e.INFO=3]="INFO",e[e.NORMAL=4]="NORMAL",e[e.DEBUG=5]="DEBUG"}(n||(n={}));let o=0;const a=[];let l=null,c=null,h=null,d=NaN,u=n.WARNING,p=!1;function _(){return u}function m(){return p}function g(e){e=Math.max(n.ERROR,Math.min(n.DEBUG,e)),u=e,T()}function f(e,t){let i=a.reduce((e,t)=>e.concat(t),[]);return i.sort((e,t)=>e.id-t.id),void 0!==t&&(i=i.filter(e=>e.subSystemId===t)),"number"==typeof e&&(i=i.slice(-e)),i}function v(e){return new Date(e.timestamp).toISOString()+":"+e.subSystemId+":"+e.message.replace(/"/g,"'")}function S(e,t){return function(e,t){let i,s=0,r=0;for(i=e.length-1;i>=1&&(s+=8*(1+encodeURIComponent(e[i]).length),!(i-1>0&&(r=8*(1+encodeURIComponent(e[i-1]).length),s+r>t)));i--);return e.slice(i)}(f(e,t).map(v),75497472)}function y(e,t,i,r){if(t===c&&r.id===h)return;const a=new Date;if(e<=n.NORMAL&&function(e,t,i,r,n){"function"===s.structuredClone&&(t=s.structuredClone(t));const a={id:o,message:t,subSystemId:r,timestamp:Number(e)};o+=1,i.push(a),void 0!==n&&i.length>n&&i.splice(0,1)}(a,t,i,r.id,r.maxCount),e<=u&&(!r.highRate||m())&&(!l||r.id.match(l))){const i=a.toISOString()+":"+r.id+":"+t;switch(e){case n.DEBUG:console.debug(i);break;case n.INFO:case n.NORMAL:r.color?console.log("%c"+i,"color: "+r.color):console.log(i);break +;case n.WARNING:console.warn(i);break;case n.ERROR:console.error(i)}c=t,h=r.id,d&&clearTimeout(d),d=setTimeout(()=>{c=null,h=null,d=NaN},1e3)}}function b(e,t={}){const i=[];a.push(i);const s=Object.assign(t,{id:e});function r(e){return t=>y(e,String(t),i,s)}return{logDebug:r(n.DEBUG),logError:r(n.ERROR),logInfo:r(n.INFO),logNormal:r(n.NORMAL),logWarn:r(n.WARNING)}}const w=b("logger"),C=s.lon=(e,t)=>{g(n.DEBUG),w.logNormal("Debug logging enabled"),p=Boolean(e),l=t||null,T()},P=s.loff=()=>{g(n.INFO),w.logInfo("Debug logging disabled")};function T(){try{r&&(localStorage.setItem("tv.logger.logHighRate",String(p)),localStorage.setItem("tv.logger.loglevel",String(u)))}catch(e){w.logWarn(`Cannot save logger state (level: ${u}, high-rate: ${p}) to localStorage: ${e.message}`)}}!function(){p=!!r&&"true"===localStorage.getItem("tv.logger.logHighRate");let e=parseInt(r&&localStorage.getItem("tv.logger.loglevel")||"");Number.isNaN(e)&&(e=n.WARNING),g(e),w.logNormal(`Init with settings - level: ${u}, high-rate: ${p}`)}(),s.performance&&s.performance.now?w.logNormal("Sync logger and perf times, now is "+s.performance.now()):w.logWarn("Perf time is not available")},52640:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},45415:(e,t,i)=>{"use strict";i.d(t,{visitObject:()=>n});var s=i(80643);function r(e,t,i){return(0,s.isArray)(e)?function(e,t,i){return e.map(e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s})}(e,t,i):(0,s.isObject)(e)&&((0,s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach(n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o}),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},28789:(e,t,i)=>{"use strict";function s(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}i.d(t,{regExpEscape:()=>s})},62820:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isRtl:()=>r,stripLTRMarks:()=>o,startWithLTR:()=>a,forceLTRStr:()=>l,forceLTRStrSsr:()=>c,forceRTLStr:()=>h,getLTRScrollLeft:()=>d,getLTRScrollLeftOffset:()=>u,detectAutoDirection:()=>m});var s=i(64531);const r=()=>"rtl"===window.document.dir,n=new RegExp("‎|‪|‫|‬","g");function o(e){return""!==e&&r()&&null!=e?e.replace(n,""):e}function a(e){return""!==e&&r()&&null!=e?"‎"+e:e}function l(e){return""!==e&&r()&&null!=e?"‪"+e+"‬":e}function c(e){return"‪"+e+"‬"}function h(e){return""!==e&&r()&&null!=e?"‫"+e+"‬":e}function d(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function u(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t} +const p=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,_=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function m(e){const t=p.exec(e);return t?_.test(t[0])?"rtl":"ltr":""}},68587:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},51193:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(9289),i.e(4017),i.e(3016),i.e(2077)]).then(i.bind(i,30349))}i.d(t,{loadChangeIntervalDialog:()=>s})},8636:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(51193);let r=null;function n(e){const t=r=(0,s.loadChangeIntervalDialog)().then(i=>{t===r&&i.showChangeIntervalDialog(e)});return t}},94420:(e,t,i)=>{"use strict";function s(e){return Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(2e3),i.e(7962),i.e(8986),i.e(6363),i.e(8463),i.e(9289),i.e(7345),i.e(7176),i.e(8268),i.e(9055),i.e(2358),i.e(5802),i.e(9837),i.e(3016),i.e(1075),i.e(6085),i.e(1859)]).then(i.bind(i,54801)).then(t=>t.showGoToDateDialog(e))}i.d(t,{showGoToDateDialog:()=>s})},65645:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(28353),r=i(3615);function n(e){"number"!=typeof e&&(e=TradingView.STUDY_COUNT_LIMIT),(0,r.showWarning)({title:(0,s.t)("Warning"),text:(0,s.t)("Studies limit exceeded: {number} studies per layout.\nPlease, remove some studies.").format({number:e})})}},34615:(e,t,i)=>{"use strict";i.d(t,{StudyMarket:()=>n});var s=i(52714),r=i.n(s);class n{constructor(e,t){this._visibility=new(r())(!1),this._dialogPromise=null,this._dialog=null,this._chartWidgetCollection=e,this._options=t}visible(){return this._visibility.readonly()}show(e,t){var i;null===this._dialog&&this._requestDialog(e,t),null===(i=this._dialog)||void 0===i||i.open(e,void 0,t)}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}resetAllPages(){var e;null===(e=this._dialog)||void 0===e||e.resetAllStudies()}_requestDialog(e,t){if(null===this._dialogPromise){let s;s=Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(7962),i.e(8986),i.e(8463),i.e(5774),i.e(1112),i.e(9637),i.e(775),i.e(3016),i.e(6456)]).then(i.bind(i,54127)).then(e=>new e.IndicatorsLibraryContainer(this._chartWidgetCollection,this._options)),this._dialogPromise=s.then(i=>{this._dialog=i,this._dialog.visible().subscribe(e=>{this._visibility.setValue(e)}),this._dialog.open(e,void 0,t)})}return this._dialogPromise}}},13221:(e,t,i)=>{"use strict";i.d(t,{setAdditionalSymbolInfoFields:()=>r,getAdditionalSymbolInfoFields:()=>n});let s=[];function r(e){s=e}function n(){return s}},88679:(e,t,i)=>{"use strict";function s(e,t){Promise.all([i.e(5514),i.e(9129),i.e(4194),i.e(6324),i.e(3016),i.e(9374)]).then(i.t.bind(i,65398,19)).then(i=>{i.showSymbolInfoDialog(e,t)})}i.d(t,{showSymbolInfoDialog:()=>s})},89330:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>s});class s{constructor(e){this._chartWidgetCollection=e}saveChartLineTools(e,t,i){return Promise.reject("Line tools storage is not supported")} +_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols(),s=i[t.activeChartWidget.value().id()],r={...(n=s,{...n,legs:JSON.stringify(null!==(o=n.legs)&&void 0!==o?o:[])})};var n,o;const a=t.metaInfo;return a.id.value()&&(r.id=a.id.value()),r.name=a.name.value()||"",r.description=a.description.value()||"",r.charts_symbols=function(e){const t={};for(const i of Object.keys(e))t[i]={symbol:e[i].symbol};return JSON.stringify(t)}(i),r.is_realtime=r.is_realtime=e?"0":"1",r}async _saveLineToolsToStorage(){return Promise.resolve()}}},76900:(e,t,i)=>{"use strict";var s=i(2872),r=i(28353).t,n=i(88537).assert,o=i(80643).deepEquals,a=i(43007).backend,l=i(89330).ChartSaverBase;r("The publication preview could not be loaded. Please disable your browser extensions and try again."),r("Failed to save library"),r("Failed to save script");function c(e,t){e.content=JSON.stringify(t)}t.ChartSaver=class extends l{constructor(e){super(e),this._chartAboutToBeSavedDelegate=new s,this._chartSavedDelegate=new s,this._prevChartState=null,this._chartSizeLimitExceededDelegate=new s}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}whenReadyToSave(e){var t=this._chartWidgetCollection.activeChartWidget.value().model().mainSeries();if(t.hasDelayedSymbolIntervalChange()){var i,s=null;i=function(){t.dataEvents().symbolError().unsubscribe(null,s,!0),e()},s=function(){t.dataEvents().symbolResolved().unsubscribe(null,i,!0)},t.dataEvents().symbolResolved().subscribe(null,i,!0),t.dataEvents().symbolError().subscribe(null,s,!0)}else e()}saveToJSON(){var e=this._getCommonSavingInfo(!1);return c(e,this._getChartWidgetCollectionState(!1,!0)),e}_getChartWidgetCollectionState(e,t,i,s,r){return e||(t=!0,s=!1),t?this._chartWidgetCollection.state(!!e,i,s,r):this._chartWidgetCollection.activeChartWidget.value().state(!!e,i,s,r)}publishChart(e){}publishScript(e,t,i){}onPublish(e,t){}_saveChartImpl(e,t,i,s,r,n){var o=i,l=s;if(o=function(s){t.id.value()||(t.id.setValue(s),t.uid.setValue(s)),"function"==typeof i&&i(t,e)},!e.name)return console.warn("Saving chart with empty name is not allowed"),void s();a.saveChart(e.name,e.short_name,e.resolution,e,t).then(o.bind(this)).catch(l.bind(this))}_saveChart(e,t,i,s){var r=this._chartWidgetCollection.metaInfo,n=function(n){return o(this._prevChartState,n)[0]&&null!=r.id.value()?(this._chartSavedDelegate.fire(!0),void(t&&t(r,n))):this._saveChartImpl(n,r,t,i,s,e)}.bind(this);this._saveLineToolsToStorage().then((function(){var t=e(!0);return n(t)})).catch((function(t){var i=e(!1);return n(i)}))}saveChartSilently(e,t,i){i=i||{};var s=function(e){var t=e&&!1,s=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),r=this._getCommonSavingInfo(!1,t);return c(r,s),i.chartName&&(r.name=i.chartName),r.name&&0!==r.name.length||!i.defaultChartName||(r.name=i.defaultChartName),i.autoSave&&(r.autoSave=!0),r}.bind(this);this._isSaveInProcess=!0, +this._chartAboutToBeSavedDelegate.fire(),this._saveChart(s,function(t,i){n(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),this._chartWidgetCollection.metaInfo.name.setValue(i.name),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid.value(),data:i}),delete this._prevChartState.savingToken}.bind(this),function(){this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t.apply(null,arguments)}.bind(this),i)}isSaveInProcess(){return this._isSaveInProcess}}},1570:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(28353);function s(e){return e.description||""}},82724:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},8128:(e,t,i)=>{"use strict";function s(e){if(!o(e))throw e}function r(e){return(null==e?void 0:e.aborted)?Promise.reject(n()):new Promise((t,i)=>{null==e||e.addEventListener("abort",()=>i(n()),{once:!0})})}function n(){return new DOMException("Aborted","AbortError")}function o(e){return e instanceof Error&&"AbortError"===e.name}function a(e,t){return Promise.race([r(e),t])}async function l(e,t){let i;try{await a(e,new Promise(e=>{i=setTimeout(e,t)}))}finally{clearTimeout(i)}}i.d(t,{skipAbortError:()=>s,isAbortError:()=>o,respectAbort:()=>a,delay:()=>l})},98619:(e,t,i)=>{"use strict";function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const r=e.length;for(;is})},15840:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach(t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach(i=>{const n=e[i],o=t[i];if(o===e)return;const a=Array.isArray(o);if(o&&(r(o)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&r(n)?n:{},e[i]=s(t,o)}else void 0!==o&&(e[i]=o)})}),e):e}function r(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},88461:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},72077:(e,t,i)=>{"use strict";i.d(t,{getTwemojiUrl:()=>r});var s=i(18438);function r(e,t){let i="";return s.default.parse(e,e=>(i=s.default.base+("svg"===t?`svg/${e}.svg`:`72x72/${e}.png`),!1)),i}s.default.base="https://cdnjs.cloudflare.com/ajax/libs/twemoji/13.0.1/"},9423:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>r,randomHash:()=>n,randomHashN:()=>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;i{"use strict";i.d(t,{parseHtml:()=>r,parseHtmlElement:()=>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),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}},54475:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const r=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(r.join(", "))&&e.preventDefault()}},80054:(e,t,i)=>{"use strict";i.d(t,{htmlEscape:()=>n,removeSpaces:()=>o,capitalizeFirstLetterInWord:()=>a});const s=/[<"'&>]/g,r=e=>`&#${e.charCodeAt(0)};`;function n(e){return e.replace(s,r)}function o(e=""){return e.replace(/\s+/g,"")}function a(e=""){return e.replace(/\b\w/g,e=>e.toUpperCase())}},96397:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},38881:(e,t,i)=>{"use strict";i.d(t,{ChunkLoader:()=>r});var s=i(8128);class r{constructor(){this._retries=5,this._cache=null,this._tryLoad=(e,t)=>{this._retries=this._retries-1;this._startLoading(e).then(t,0!==this._retries?i=>{(0,s.isAbortError)(i)||setTimeout(()=>this._tryLoad(e,t),3e3)}:void 0)}}load(e){return this._cache||(this._cache=new Promise(this._tryLoad.bind(this,null!=e?e:null))),this._cache}}},65446:(e,t,i)=>{"use strict";function s(e,t){const i=e.files&&e.files.length>0;if(!i&&t&&t.eventPhase>0)return r(t,e),Promise.resolve();if(!i){let t=!1;const i=i=>{i.stopImmediatePropagation(),r(i,e),t=!0};try{document.addEventListener("copy",i,!0),document.execCommand("copy")}finally{document.removeEventListener("copy",i,!0)}if(t)return Promise.resolve()}return async function(e){if(!navigator.clipboard||!navigator.clipboard.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");const t={};for(const i of e.files||[])t[i.type]=i;e.text&&(t["text/plain"]=e.text);e.html&&(t["text/html"]=e.html);return navigator.clipboard.write([new window.ClipboardItem(t)])}(e)}function r(e,t){e.preventDefault();const i=e.clipboardData;t.text&&i.setData("text/plain",t.text),t.html&&i.setData("text/html",t.html)}async function n(e,t){if("text/plain"===t&&!navigator.clipboard.write){const t=await e;return navigator.clipboard.writeText(await t.text())} +if(!navigator.clipboard||!navigator.clipboard.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");let i=null;try{i=new window.ClipboardItem({[t]:e})}catch(s){i=new window.ClipboardItem({[t]:await e})}if(i)return navigator.clipboard.write([i]);throw new Error("ClipboardApi is not supported")}i.d(t,{writeImpl:()=>s,writePromiseUsingApi:()=>n})},5370:(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.d(t,{parseUpdateMode:()=>s})},84917:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{WeekDays:()=>s,Months:()=>r}),function(e){e[e.SUNDAY=1]="SUNDAY",e[e.MONDAY=2]="MONDAY",e[e.TUESDAY=3]="TUESDAY",e[e.WEDNESDAY=4]="WEDNESDAY",e[e.THURSDAY=5]="THURSDAY",e[e.FRIDAY=6]="FRIDAY",e[e.SATURDAY=7]="SATURDAY"}(s||(s={})),function(e){e[e.JANUARY=0]="JANUARY",e[e.FEBRUARY=1]="FEBRUARY",e[e.MARCH=2]="MARCH",e[e.APRIL=3]="APRIL",e[e.MAY=4]="MAY",e[e.JUNE=5]="JUNE",e[e.JULY=6]="JULY",e[e.AUGUST=7]="AUGUST",e[e.SEPTEMBER=8]="SEPTEMBER",e[e.OCTOBER=9]="OCTOBER",e[e.NOVEMBER=10]="NOVEMBER",e[e.DECEMBER=11]="DECEMBER"}(r||(r={}))},81836:(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.d(t,{createDeferredPromise:()=>s})},76861:(e,t,i)=>{"use strict";function s(e=location.host){return-1!==["i18n.tradingview.com","partial.tradingview.com","www.tradingview.com","wwwcn.tradingview.com"].indexOf(e)||-1!==["d33t3vvu2t2yu5.cloudfront.net","dwq4do82y8xi7.cloudfront.net","s.tradingview.com","s3.tradingview.com"].indexOf(e)||e.match(/^[a-z]{2}\.tradingview\.com/)||e.match(/prod-[^.]+.tradingview.com/)?"battle":e.includes("tradingview.com")||e.includes("staging")?"staging":e.match(/webcharts/)?"staging_local":(e.match(/^localhost(:\d+)?$/),"local")}function r(){return"local"===s()}function n(){return"battle"===s()}function o(){return!n()}i.r(t),i.d(t,{environment:()=>s,isLocal:()=>r,isProd:()=>n,isDebug:()=>o})},80007:(e,t,i)=>{"use strict";i.d(t,{preventDefault:()=>r,wrapHandlerWithPreventEvent:()=>n,preventScrollByWheelClick:()=>o});var s=i(49483);function r(e){e.cancelable&&e.preventDefault()}function n(e){return t=>{r(t),e()}}function o(e){s.isChrome&&e.addEventListener("mousedown",e=>{if(1===e.button)return e.preventDefault(),!1})}},46627:(e,t,i)=>{"use strict";i.d(t,{FeatureToggleWatchedValue:()=>n});var s=i(52714),r=i.n(s);class n extends(r()){constructor(e,t){super(function(e,t){return t}(0,t))}destroy(){0}}},56186:(e,t,i)=>{"use strict";function s(e){if(e instanceof Error)return e.stack||e.message;try{return e.outerHTML.slice(0,1024)}catch(e){}try{if(void 0!==e)return JSON.stringify(e).slice(0,1024)}catch(e){}return String(e)}function r(){window.__tv_js_errors||(window.__tv_js_errors=[]),window.addEventListener("error",e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(`${t} ${e.message||"JS error"}. ${e.filename||""}, line ${e.lineno}, col ${e.colno}.\nError: `+s(e.error))},!1), +window.addEventListener("unhandledrejection",e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(t+" Unhandled rejection.\nReason: "+s(e.reason))},!1),document.addEventListener("securitypolicyviolation",e=>{var t,i;const r=(new Date).toISOString(),n="report"===e.disposition?"CSP report-only":"CSP violation";window.__tv_js_errors.push(`${r} ${n}: ${e.violatedDirective||e.effectiveDirective}. ${e.sourceFile||""}, line ${null!==(t=e.lineno)&&void 0!==t?t:e.lineNumber}, col ${null!==(i=e.colno)&&void 0!==i?i:e.columnNumber}.\nBlocked URI: ${e.blockedURL||e.blockedURI}\nSample: ${e.sample}\nTarget: `+s(e.target))},!1)}i.d(t,{install:()=>r})},76422:(e,t,i)=>{"use strict";i.r(t),i.d(t,{unsubscribe:()=>l,on:()=>c,subscribe:()=>h,subscribeToAll:()=>d,emit:()=>u,emitOnce:()=>p});var s=i(2872),r=i.n(s);const n={},o=[],a={};function l(e,t,i){n[e].unsubscribe(i,t)}function c(e,t,i){h(e,t,i)}function h(e,t,i,s){n.hasOwnProperty(e)||(n[e]=new(r())),a[e]?t.call(i):n[e].subscribe(i,t,s)}function d(e){o.push(e)}function u(e,...t){const i=[e].concat(t);o.forEach(e=>{e.apply(null,i)}),n.hasOwnProperty(e)&&n[e].fire.apply(n[e],t)}function p(e){a[e]&&console.warn(`Something went wrong: emitOnce called multiple times with same event (${e})`),a[e]=!0,u.apply(null,arguments)}},25760:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Modifiers:()=>s.Modifiers,createGroup:()=>u,pressedKeys:()=>d,registerWindow:()=>p,unregisterWindow:()=>_});var s=i(68335),r=i(35749),n=i(52714),o=i.n(n);var a=i(51768);class l{constructor(e,t){this._group=e,this.hotkey=t.hotkey,this.handler=t.handler,this.desc=t.desc,this.element=t.element||null,t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1}destroy(){this._group&&(this._group.remove(this),this._group=null)}}class c{constructor(e,t){this._actions=[],this._manager=e,this.modal=!(!t||!t.modal),t&&(this.desc=t.desc),t&&t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1,this._manager.registerGroup(this)}add(e){const t=new l(this,e);return this._actions.push(t),t}remove(e){for(let t=this._actions.length;t-- >0;)this._actions[t]===e&&this._actions.splice(t,1)}handleHotkey(e,t){for(let i=this._actions.length;i-- >0;){const r=this._actions[i];if(r.hotkey===e&&((!r.element||t.target&&r.element.contains(t.target))&&!r.isDisabled()))return r.handler(t),t.preventDefault(),(0,a.trackEvent)("Keyboard Shortcuts",(0,s.humanReadableHash)(e)),!0}return!1}promote(){this._manager.promoteGroup(this)}destroy(){this._actions.length=0,this._manager.unregisterGroup(this)}}const h=new class{constructor(){this._groups=[],this._pressedKeys=new(o())(0),this._keyDownListener=e=>{if(e.defaultPrevented)return;const t=(0,s.hashFromEvent)(e);if(this._pressedKeys.setValue(t),!(0,r.isNativeUIInteraction)(t,e.target))for(let i=this._groups.length;i-- >0;){const s=this._groups[i];if(!s.isDisabled()){if(s.handleHotkey(t,e))return;if(s.modal)return}}},this._keyUpListener=e=>{const t=(0, +s.hashFromEvent)(e);this._pressedKeys.setValue(t)},this._blurEvent=()=>{this._pressedKeys.setValue(0)},this._mouseEvent=e=>{const t=(0,s.modifiersFromEvent)(e),i=255&this._pressedKeys.value();this._pressedKeys.setValue(t|i)}}listen(e){e.addEventListener("keydown",this._keyDownListener),e.addEventListener("keyup",this._keyUpListener),e.addEventListener("blur",this._blurEvent),e.addEventListener("mousemove",this._mouseEvent)}unlisten(e){e.removeEventListener("keydown",this._keyDownListener),e.removeEventListener("keyup",this._keyUpListener),e.removeEventListener("blur",this._blurEvent),e.removeEventListener("mousemove",this._mouseEvent)}registerGroup(e){this._groups.push(e)}unregisterGroup(e){for(let t=this._groups.length;t--;)this._groups[t]===e&&this._groups.splice(t,1)}promoteGroup(e){let t=this._groups.length-1;for(let i=this._groups.length;i--;){if(this._groups[i]===e)return void(i!==t&&(this._groups.splice(i,1),this._groups.splice(t,0,e)));this._groups[i].modal&&(t=i-1)}}pressedKeys(){return this._pressedKeys}},d=h.pressedKeys();function u(e){return new c(h,e)}function p(e){h.listen(e)}function _(e){h.unlisten(e)}p(window)},68335:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMacKeyboard:()=>r,Modifiers:()=>n,modifiersFromEvent:()=>o,hashFromEvent:()=>a,hashShiftPlusEnter:()=>l,humanReadableModifiers:()=>c,humanReadableHash:()=>d});var s=i(49483);const r=(0,s.isMac)()||s.CheckMobile.iOS();var n;function o(e){let t=0;return e.shiftKey&&(t+=1024),e.altKey&&(t+=512),e.ctrlKey&&(t+=256),e.metaKey&&(t+=2048),t}function a(e){return o(e)|e.keyCode}!function(e){e[e.None=0]="None",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Mod=r?2048:256]="Mod",e[e.Control=256]="Control",e[e.Meta=2048]="Meta"}(n||(n={}));const l=1037;function c(e,t=!r){let i="";return 256&e&&(i+=r?"^":"Ctrl",t&&(i+=" + ")),512&e&&(i+=r?"⌥":"Alt",t&&(i+=" + ")),1024&e&&(i+=r?"⇧":"Shift",t&&(i+=" + ")),2048&e&&(i+=r?"⌘":"Win",t&&(i+=" + ")),i}const h={9:"⇥",13:"↵",27:"Esc",8:r?"⌫":"Backspace",32:"Space",35:"End",36:"Home",37:"←",38:"↑",39:"→",40:"↓",45:"Ins",46:"Del",188:",",191:"/"};for(let e=1;e<=16;e++)h[e+111]="F"+e;function d(e){let t=c(e);const i=255&e;return t+=i in h?h[i]:String.fromCharCode(i),t}},47193:(e,t,i)=>{"use strict";i.d(t,{migrateShortcut:()=>o});var s=i(68335);function r(e){if("number"==typeof e)return e;switch(e.toLowerCase()){case"ctrl":return s.Modifiers.Control;case"shift":return s.Modifiers.Shift;case"alt":return s.Modifiers.Alt;default:return e.toUpperCase().charCodeAt(0)}}function n(e){let t=0;for(let i=0;i{"use strict";i.d(t,{isTextEditingField:()=>r,isNativeUIInteraction:()=>n});var s=i(68335);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}},82992:(e,t,i)=>{"use strict";i.d(t,{linking:()=>u});var s=i(4889),r=i(52714),n=i.n(r),o=i(67337),a=i(37667),l=i(98125),c=i(15943);const h=(0,l.getLogger)("Linking");var d;!function(e){e[e.NotBound=0]="NotBound",e[e.BoundToWidget=1]="BoundToWidget",e[e.BoundToModel=2]="BoundToModel"}(d||(d={}));const u=new class{constructor(){this._watchedSymbol=new(n()),this._seriesShortSymbol=new(n()),this._proSymbol=new(n()),this._watchedInterval=new(n()),this._watchedIntraday=new(n()),this._watchedSeconds=new(n()),this._watchedTicks=new(n()),this._watchedRange=new(n()),this._watchedSupportedResolutions=new(n()),this._watchedSupportedChartStyles=new(n())([]),this._symbolNamesList=new(n()),this._chartWidgetBindingState=d.NotBound,this._activeChartWidget=null,this._watchedSymbolListenerBound=this._watchedSymbolListener.bind(this),this._watchedIntervalListenerBound=this._watchedIntervalListener.bind(this),this._onSymbolLinkBound=this._onSymbolLink.bind(this),this._searchCharts=null,this._searchChartsLoadDebounced=null,this._selfEmit=!1,this._preventFeedBySymbol=!1,this._feedBySymbolDebounceCounter=0}get symbol(){return this._watchedSymbol}get proSymbol(){return this._proSymbol}get symbolNamesList(){return this._symbolNamesList}get seriesShortSymbol(){return this._seriesShortSymbol.readonly()}get interval(){return this._watchedInterval}get intraday(){return this._watchedIntraday.readonly()}get seconds(){return this._watchedSeconds.readonly()}get ticks(){return this._watchedTicks.readonly()}get range(){return this._watchedRange.readonly()}get supportedResolutions(){return this._watchedSupportedResolutions.readonly()}get supportedChartStyles(){return this._watchedSupportedChartStyles.readonly()}get preventFeedBySymbol(){return this._preventFeedBySymbol}bindToChartWidget(e){if(this.unbindFromChartWidget(),this._activeChartWidget=e,e.hasModel())return void this._onChartModelCreated(e.model());e.modelCreated().subscribe(this,this._onChartModelCreated),this._chartWidgetBindingState=d.BoundToWidget;const t=e.properties().childs().mainSeriesProperties.childs();this._watchedSymbol.setValue(t.symbol.value()),this._watchedInterval.setValue(t.interval.value())}unbindFromChartWidget(){switch(this._chartWidgetBindingState){case d.BoundToWidget:if(!this._activeChartWidget)throw new Error("ChartWidget is undefined") +;this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);break;case d.BoundToModel:this._symbolProperty().unsubscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.unsubscribe(this._watchedSymbolListenerBound),this._mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._updateSeriesSymbolInfo),this._mainSeries().dataEvents().symbolError().unsubscribe(this,this._updateSeriesSymbolInfo),this._intervalProperty().unsubscribe(this,this._onIntervalPropertyChange),this._watchedInterval.unsubscribe(this._watchedIntervalListenerBound),delete this._watchedSymbol.hook,delete this._watchedSymbol.writeLock}this._activeChartWidget=null,this._chartWidgetBindingState=d.NotBound}getChartWidget(){return this._activeChartWidget}bindToChartWidgetCollection(e){this._chartWidgetCollection=e,this.unbindFromChartWidget(),e.activeChartWidget.subscribe(e=>{this.unbindFromChartWidget(),this.bindToChartWidget(e)},{callWithLast:!0})}bindToSearchCharts(e){this.unbindFromSearchCharts(),this._searchCharts=e,e.onSearchBySymbol.subscribe(this,this._onSearchBySymbol),e.loadingSymbol.subscribe(e=>{!1===e&&(this._feedBySymbolDebounceCounter=0)}),this._watchedSymbol.subscribe(this._onSymbolLinkBound)}unbindFromSearchCharts(){this._searchCharts&&(this._searchCharts.onSearchBySymbol.unsubscribe(this,this._onSearchBySymbol),this._watchedSymbol.unsubscribe(this._onSymbolLinkBound),this._searchCharts=null)}setPreventFeedBySymbol(e){this._preventFeedBySymbol=e}_onSearchBySymbol(e){if(!e.resolved_symbol)throw new Error("no resolved_symbol");this._selfEmit=!0,this._watchedSymbol.setValue(e.resolved_symbol),this._selfEmit=!1}_onSymbolLink(e){if(!this._selfEmit){if(!this._searchCharts){const e="No search charts defined";throw h.logError(e),new Error(e)}this._preventFeedBySymbol||this._loadSearchCharts(e)}}_loadSearchCharts(e){if(!this._searchCharts){const e="No search charts defined";throw h.logError(e),new Error(e)}if(this._searchChartsLoadDebounced)return void(this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced(e)));const t=e=>this._searchCharts?(!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchChartsLoadDebounced=null,this._searchCharts.feedBySymbol.call(this._searchCharts,e)):()=>{};!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchCharts.feedBySymbol(e)}_mainSeries(){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");return this._activeChartWidget.model().mainSeries()}_properties(){return this._mainSeries().properties()}_symbolProperty(){return this._properties().symbol}_intervalProperty(){return this._properties().interval}_watchedSymbolListener(e){ +this._symbolProperty().value()!==e&&this._chartWidgetCollection.setSymbol(e)}_sendSnowplowAnalytics(){if(!window.user.do_not_track)throw new Error("unsupported")}_onSymbolPropertyChange(){const e=this._symbolProperty().value()!==this._watchedSymbol.value();this._watchedSymbol.setValue(this._symbolProperty().value()),e&&this._chartWidgetCollection.setSymbol(this._symbolProperty().value())}_onSymbolResolved(e){const t=this._mainSeries().symbolInfo();t&&this._applyValuesFromSymbolInfo(t)}_applyValuesFromSymbolInfo(e){const t=e.pro_name||o.enabled("trading_terminal")&&(e.full_name||e.name)||"";this._proSymbol.setValue(t),e.aliases&&this._symbolNamesList.setValue(e.aliases)}_updateSeriesSymbolInfo(){this._seriesShortSymbol.setValue(this._properties().shortName.value());const e=this._mainSeries().symbolInfo();if(e){this._applyValuesFromSymbolInfo(e);{const t=e.supported_resolutions;t?this._watchedSupportedResolutions.setValue(t):this._watchedSupportedResolutions.setValue(void 0)}let t=(0,c.allChartStyles)();(0,a.isCloseBasedSymbol)(e)&&(t=t.filter(e=>(0,a.isSingleValueBasedStyle)(e))),this._watchedSupportedChartStyles.setValue(t),this._watchedIntraday.setValue(!!e.has_intraday),this._watchedSeconds.setValue(!!e.has_seconds),this._watchedTicks.setValue(!(0,a.isCloseBasedSymbol)(e)&&!!e.has_ticks),this._watchedRange.setValue(!(0,a.isCloseBasedSymbol)(e))}else this._watchedIntraday.deleteValue(),this._watchedSeconds.deleteValue(),this._watchedTicks.deleteValue(),this._watchedRange.deleteValue(),this._proSymbol.deleteValue()}_watchedIntervalListener(e){this._intervalProperty().value()!==e&&this._chartWidgetCollection.setResolution(e)}_onIntervalPropertyChange(){const e=this._intervalProperty().value()!==this._watchedInterval.value();this._watchedInterval.setValue(this._intervalProperty().value()),e&&this._chartWidgetCollection.setResolution(this._intervalProperty().value())}_onChartModelCreated(e){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");this._chartWidgetBindingState=d.BoundToModel,this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);const t=this._symbolProperty();t.subscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.setValue(t.value()),this._watchedSymbol.subscribe(this._watchedSymbolListenerBound);const i=this._mainSeries();i.dataEvents().symbolResolved().subscribe(this,this._onSymbolResolved),this._watchedSymbol.hook=e=>(i.symbolSameAsCurrent(e)&&(e=i.symbol()),e),i.dataEvents().symbolResolved().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolError().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolGroupNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),this._updateSeriesSymbolInfo();const s=this._intervalProperty();s.subscribe(this,this._onIntervalPropertyChange),this._watchedInterval.setValue(s.value()),this._watchedInterval.subscribe(this._watchedIntervalListenerBound), +this._activeChartWidget.readOnly()&&(this._watchedSymbol.writeLock=!0)}};window.TradingViewApi||(window.TradingViewApi={linking:u})},11417:(e,t,i)=>{"use strict";const{getLogger:s}=i(98125),r=s("TVLocalStorage");var n=function(){try{this.isAvailable=!0,this.localStorage=window.localStorage,this.localStorage.setItem("tvlocalstorage.available","true")}catch(e){delete this.isAvailable,delete this.localStorage}this._updateLength();try{this._report()}catch(e){}};n.prototype._report=function(){if(this.isAvailable){const e=10,t=[];for(let e=0;et.length-e.length);const i=t.slice(0,e);t.sort((e,t)=>t.key.length-e.key.length);const s=t.slice(0,e);r.logNormal("Total amount of keys in Local Storage: "+this.length),r.logNormal(`Top ${e} keys with longest values: ${JSON.stringify(i)}`),r.logNormal(`Top ${e} longest key names: ${JSON.stringify(s)}`);try{navigator.storage.estimate().then(e=>{r.logNormal("Storage estimate: "+JSON.stringify(e))})}catch(e){}}},n.prototype.length=0,n.prototype.isAvailable=!1,n.prototype.localStorage={"tvlocalstorage.available":"false"},n.prototype._updateLength=function(){if(this.isAvailable)this.length=this.localStorage.length;else{var e,t=0;for(e in this.localStorage)this.localStorage.hasOwnProperty(e)&&t++;this.length=t}},n.prototype.key=function(e){return this.isAvailable?this.localStorage.key(e):Object.keys(this.localStorage)[e]},n.prototype.getItem=function(e){return this.isAvailable?this.localStorage.getItem(e):void 0===this.localStorage[e]?null:this.localStorage[e]},n.prototype.setItem=function(e,t){this.isAvailable?this.localStorage.setItem(e,t):this.localStorage[e]=t,this._updateLength()},n.prototype.removeItem=function(e){this.isAvailable?this.localStorage.removeItem(e):delete this.localStorage[e],this._updateLength()},n.prototype.clear=function(){this.isAvailable?this.localStorage.clear():this.localStorage={},this._updateLength()};var o=function(e){this.storage=e};o.prototype.getItem=function(e){return Promise.resolve(this.storage.getItem(e))},o.prototype.setItem=function(e,t){return Promise.resolve(this.storage.setItem(e,t))},window.TVLocalStorage=new n,window.TVLocalStorageAsync=new o(window.TVLocalStorage),e.exports={TVLocalStorage:window.TVLocalStorage,TVLocalStorageAsync:window.TVLocalStorageAsync}},84015:(e,t,i)=>{"use strict";function s(e,t=!1){return!1}function r(e){return e}i.d(t,{isOnMobileAppPage:()=>s,urlWithMobileAppParams:()=>r})},19334:(e,t,i)=>{"use strict";function s(){}i.d(t,{addPerfMark:()=>o});const r=console.timeStamp?console.timeStamp.bind(console):s,n=window.performance&&performance.mark?performance.mark.bind(performance):s;window.performance&&performance.measure&&performance.measure.bind(performance),window.performance&&performance.clearMarks&&performance.clearMarks.bind(performance);function o(e){r(e),n(e)}},14905:(e,t,i)=>{"use strict";function s(e){return e===r(e)}function r(e){const t=e.indexOf("$"),i=e.indexOf("@") +;return t<0&&i>=0?null:e.substring(Math.max(t+1,0),i>=0?i:e.length)}i.d(t,{isPineIdString:()=>s,extractPineId:()=>r})},16216:(e,t,i)=>{"use strict";i.r(t),i.d(t,{registerService:()=>o,unregisterService:()=>a,hasService:()=>l,service:()=>c,waitServiceRegistered:()=>h});var s=i(81836);const r={},n=new Map;function o(e,t){if(l(e))throw new Error("Service already registered");r[e.id]=t;const i=n.get(e.id);void 0!==i&&(n.delete(e.id),i.resolve(t))}function a(e){if(!l(e))throw new Error("Service not found");r[e.id]=void 0}function l(e){return void 0!==r[e.id]}function c(e){const t=r[e.id];if(void 0===t)throw new Error("ServiceLocator: Service "+e.id+" not found");return t}function h(e){if(l(e))return Promise.resolve(c(e));let t=n.get(e.id);return void 0===t&&(t=(0,s.createDeferredPromise)(),n.set(e.id,t)),t.promise}},56840:(e,t,i)=>{"use strict";e=i.nmd(e),i(49483);i(85198).fetch;var s=i(28789).regExpEscape,r=i(21097).TVXWindowEvents,n=i(11417).TVLocalStorage,o=i(2872),a=i(67337),l=["s.tradingview.com","betacdn.tradingview.com"],c=a.enabled("use_localstorage_for_settings"),h=window.TVSettings=function(){var e=!1,t=null;function i(){return!t&&c}try{e=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(e){}if(e){var d={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},u=function(e,t,i){var s=d[e];return null==s?t:s},p=function(){};return{loaded:!1,loadedModel:!1,getValue:u,getJSON:u,getBool:u,getFloat:u,getInt:u,setValue:p,setJSON:p,remove:p,keys:function(){return Object.keys(d)},keysMask:function(){return[]},sync:p,onSync:{subscribe:function(){}}}}window.environment;var _,m=TradingView.onWidget()?"tradingview-widget":"tradingview",g=m+".",f={},v=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^domepanel.visible$/,/^orderpanel.visible$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/,/^trading\.orderWidgetMode\./,/^symbolWatermark$/,/^pinereference\.size$/,/^pinereference\.position$/,/^hint\.+/,/^ChartDrawingToolbarWidget\.visible/];function S(e){return g+e}function y(e,t){var i=f[e];return null==i?t:i}function b(e,t,i){i=i||{};var s=""+t;return f[e]!==s&&(f[e]=s,C(e)),i.forceFlush&&!_&&(_=setTimeout((function(){_=void 0,P()}),10)),h}function w(e,t){return t=t||{},null!=f[e]&&(delete f[e],C(e)),t.forceFlush&&P(),h}function C(e){if(t)null==f[e]?t.removeValue(e):t.setValue(e,f[e]);else if(i())try{null==f[e]?n.removeItem(S(e)):n.setItem(S(e),f[e])}catch(e){}else 0;r.emit("settings",JSON.stringify({key:e,value:f[e]}))}function P(e){}function T(){return Object.keys(f)}function x(e){for(var t=0;t=0;n--)e.test(i[n])&&r.push(i[n]),e.lastIndex=0;return r},sync:function(e){null!==e?(t?M(t.initialSettings||{}):i()?(function(){if(TradingView.onWidget()&&l.includes(window.location.host))for(var e=n.length;e--;){var t=n.key(e);if(0===t.indexOf("tradingview.")){var i=t.replace("tradingview.",m+".");n.setItem(i,n.getItem(t)),n.removeItem(t)}}}(),function(){f={};for(var e=!a.enabled("save_chart_properties_to_local_storage"),t=n.length;t--;){var i=n.key(t);if(i&&I(i)){var s=i.substring(g.length);e&&!x(s)||(f[s]=n.getItem(i))}}}()):M(e||{}),L.fire()):!0},onSync:L,setSettingsAdapter:function(e){t=e}}}();e&&e.exports&&(e.exports=h)},26843:(e,t,i)=>{"use strict";i.d(t,{StdTheme:()=>a.StdTheme,getStdChartTheme:()=>h,getStdThemeNames:()=>c,isStdTheme:()=>u,translateThemeName:()=>d});var s=i(28353),r=i(24377) ;const n=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#131722","lineColor":"rgba(42, 46, 57, 0)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"horzGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#ffffff","backgroundGradientStartColor":"#ffffff","backgroundGradientEndColor":"#ffffff","separatorColor":"#E0E3EB"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7","style":2,"width":1}}}},"mainSourceProperties":{"baseLineColor":"#B2B5BE","candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"haStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"barStyle":{"downColor":"#F23645","upColor":"#089981"},"pnfStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"baselineStyle":{"baselineColor":"#758696","topFillColor1":"rgba(8, 153, 129, 0.28)","topFillColor2":"rgba(8, 153, 129, 0.05)","bottomFillColor1":"rgba(242, 54, 69, 0.05)","bottomFillColor2":"rgba(242, 54, 69, 0.28)","topLineColor":"#089981","bottomLineColor":"#F23645"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF","linewidth":2,"linestyle":0},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"kagiStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"pbStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae"},"rangeStyle":{"upColor":"#089981","downColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"}}}}'),o=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#B2B5BE","lineColor":"rgba(240, 243, 250, 0)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"horzGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#131722","backgroundGradientStartColor":"#181C27","backgroundGradientEndColor":"#131722","backgroundType":"gradient","separatorColor":"#2A2E39"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7","style":2,"width":1}}}},"mainSourceProperties":{"baseLineColor":"#5d606b","candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#B5B5B8","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"haStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#B5B5B8","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"barStyle":{"downColor":"#F23645","upColor":"#089981"},"pnfStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#336854","downColorProjection":"#7f323f"},"baselineStyle":{"baselineColor":"#758696","topFillColor1":"rgba(8, 153, 129, 0.28)","topFillColor2":"rgba(8, 153, 129, 0.05)","bottomFillColor1":"rgba(242, 54, 69, 0.05)","bottomFillColor2":"rgba(242, 54, 69, 0.28)","topLineColor":"#089981","bottomLineColor":"#F23645"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF","linewidth":2,"linestyle":0},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"kagiStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#336854","downColorProjection":"#7f323f"},"pbStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f"},"rangeStyle":{"upColor":"#089981","downColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f"}}}}') ;var a=i(24633);function l(){return{[a.StdTheme.Light]:JSON.parse(JSON.stringify(n)),[a.StdTheme.Dark]:JSON.parse(JSON.stringify(o))}}function c(){return[a.StdTheme.Light,a.StdTheme.Dark]}function h(e){return l()[e]}function d(e){return{[a.StdTheme.Light]:s.t("Light",{context:"colorThemeName"}),[a.StdTheme.Dark]:s.t("Dark",{context:"colorThemeName"})}[e]||e}function u(e){const t=l();return c().some(i=>p(t[i],e))}function p(e,t){let i=e.content===t.content;return function(e={},t){try{!function e(t,i,s){for(const r in t)if(t.hasOwnProperty(r)){const n=i.concat(r);if("object"==typeof t[r])e(t[r],n,s);else if(s(n,t[r]))throw new Error("exit")}}(e,[],t)}catch(e){return}}(e.content,(e,s)=>{const n=function(e,t={}){let i=t;for(let t=0;t{"use strict";var s;i.d(t,{StdTheme:()=>s}),function(e){e.Light="light",e.Dark="dark"}(s||(s={}))},6087:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEFAULT_THEME:()=>p,extractThemeFromModel:()=>R,getCurrentTheme:()=>S,getStdTheme:()=>L,getStdThemeNames:()=>I,getStdThemedValue:()=>A,getTheme:()=>T,getThemeNames:()=>x,getThemedColor:()=>y,isPublicTheme:()=>v,isStdTheme:()=>N,isStdThemeName:()=>M,isStdThemedDefaultValue:()=>E,isThemeExist:()=>V,loadTheme:()=>b,removeTheme:()=>D,restoreTheme:()=>w,saveTheme:()=>k,savedThemeName:()=>C,syncTheme:()=>P,themes:()=>f,translateStdThemeName:()=>B});var s=i(24377),r=i(59803),n=i(56840);function o(){return(0,n.getValue)("current_theme.name")||null}var a=i(85198);const l=(0,i(98125).getLogger)("Themes.Provider");let c=null;function h(e){return(0,a.fetch)("/theme/?themeName="+encodeURIComponent(e),{credentials:"include",method:"GET"}).then(e=>e.json()).then(e=>{const t={};return e.content&&(t.content=JSON.parse(e.content)),t})}var d=i(26843),u=i(45345);const p="light";var _=i(28353) ;const m=JSON.parse('{"color-bg-primary":"color-cold-gray-850","color-bg-primary-hover":"color-cold-gray-800","color-bg-secondary":"color-cold-gray-900","color-bg-highlight":"color-cold-gray-900","color-bg-scroll-buttons":"color-cold-gray-800","color-legacy-bg-scroll-buttons":"color-cold-gray-550","color-legacy-bg-widget":"color-cold-gray-900","color-text-primary":"color-cold-gray-200","color-text-secondary":"color-cold-gray-500","color-text-tertiary":"color-cold-gray-400","color-text-disabled":"color-cold-gray-650","color-accent-content":"color-white","color-divider":"color-cold-gray-700","color-divider-hover":"color-cold-gray-800","color-divider-secondary":"color-cold-gray-800","color-box-shadow":"color-cold-gray-900","color-active-hover-text":"color-cold-gray-300","color-alert-text":"color-cold-gray-200","color-border":"color-cold-gray-750","color-border-chat-fields":"color-cold-gray-750","color-border-hover":"color-cold-gray-650","color-border-table":"color-cold-gray-800","color-brand":"color-tv-blue-500","color-brand-hover":"color-tv-blue-600","color-brand-active":"color-tv-blue-700","color-button-hover-bg":"color-cold-gray-850","color-chart-page-bg":"color-cold-gray-800","color-common-tooltip-bg":"color-cold-gray-750","color-danger":"color-ripe-red-600","color-danger-hover":"color-ripe-red-500","color-danger-active":"color-ripe-red-400","color-depthrenderer-fill-style":"color-cold-gray-150","color-depthrenderer-stroke-style":"color-cold-gray-650","color-disabled-border-and-color":"color-cold-gray-800","color-disabled-input":"color-cold-gray-750","color-empty-container-message":"color-cold-gray-500","color-highlight-new":"color-tv-blue-a800","color-icons":"color-cold-gray-500","color-input-bg":"color-cold-gray-800","color-input-textarea-readonly":"color-cold-gray-650","color-input-placeholder-text":"color-cold-gray-700","color-input-publish-bg":"color-cold-gray-900","color-item-active-blue":"color-tv-blue-a800","color-item-hover-active-bg":"color-cold-gray-800","color-item-hover-bg":"color-cold-gray-800","color-item-hover-blue":"color-tv-blue-a800","color-item-selected-blue":"color-tv-blue-a800","color-item-active-text":"color-cold-gray-200","color-item-active-bg":"color-tv-blue-500","color-link":"color-tv-blue-500","color-link-hover":"color-tv-blue-600","color-link-active":"color-tv-blue-700","color-list-item":"color-cold-gray-500","color-list-nth-child-bg":"color-cold-gray-850","color-news-highlight":"color-cold-gray-800","color-pane-bg":"color-cold-gray-900","color-pane-secondary-bg":"color-cold-gray-850","color-placeholder":"color-cold-gray-650","color-popup-menu-item-hover-bg":"color-cold-gray-800","color-popup-menu-separator":"color-cold-gray-700","color-row-hover-active-bg":"color-cold-gray-800","color-sb-scrollbar-body-bg":"color-cold-gray-650","color-screener-description":"color-cold-gray-200","color-section-separator-border":"color-cold-gray-750","color-search-button-hover":"color-cold-gray-700","color-separator-table-chat":"color-cold-gray-750","color-success":"color-minty-green-700","color-success-hover":"color-minty-green-600","color-success-active":"color-minty-green-500","color-tag-active-bg":"color-cold-gray-750","color-tag-hover-bg":"color-cold-gray-800","color-text-regular":"color-cold-gray-200","color-toolbar-button-text":"color-cold-gray-300","color-toolbar-button-text-hover":"color-cold-gray-300","color-toolbar-button-text-active":"color-tv-blue-500","color-toolbar-button-text-active-hover":"color-tv-blue-600","color-toolbar-button-background-hover":"color-cold-gray-800","color-toolbar-button-background-secondary-hover":"color-cold-gray-750","color-toolbar-toggle-button-background-active":"color-tv-blue-500","color-toolbar-toggle-button-background-active-hover":"color-tv-blue-600","color-toolbar-interactive-element-text-normal":"color-cold-gray-300","color-toolbar-interactive-element-text-hover":"color-cold-gray-250","color-toolbar-opened-element-bg":"color-cold-gray-800","color-tooltip-bg":"color-cold-gray-750","color-tv-button-checked":"color-cold-gray-500","color-tv-dialog-caption":"color-cold-gray-50","color-tv-dropdown-item-hover-bg":"color-cold-gray-800","color-underlined-text":"color-cold-gray-300","color-widget-pages-bg":"color-cold-gray-900","color-warning":"color-tan-orange-700","color-forex-icon":"color-white","color-list-item-active-bg":"color-tv-blue-500","color-list-item-hover-bg":"color-cold-gray-800","color-list-item-text":"color-cold-gray-200","color-price-axis-label-back":"color-cold-gray-800","color-price-axis-label-text":"color-cold-gray-500","color-price-axis-gear":"color-cold-gray-500","color-price-axis-gear-hover":"color-cold-gray-400","color-price-axis-highlight":"color-cold-gray-800","color-bid":"color-tv-blue-500","color-scroll-bg":"color-cold-gray-750","color-scroll-border":"color-cold-gray-850","color-widget-border":"color-cold-gray-800","color-scroll-buttons-arrow":"color-white","color-control-intent-default":"color-cold-gray-650","color-control-intent-success":"color-minty-green-600","color-control-intent-primary":"color-tv-blue-500","color-control-intent-warning":"color-tan-orange-500","color-control-intent-danger":"color-ripe-red-700","color-growing":"color-minty-green-600","color-falling":"color-ripe-red-600","color-pre-market":"color-tan-orange-600","color-pre-market-bg":"color-tan-orange-400","color-post-market":"color-tv-blue-500","color-post-market-bg":"color-tv-blue-400","color-market-open":"color-minty-green-500","color-market-open-bg":"color-minty-green-400","color-market-closed":"color-cold-gray-400","color-market-holiday":"color-cold-gray-400","color-invalid-symbol":"color-ripe-red-400","color-invalid-symbol-hover":"color-ripe-red-500","color-replay-mode":"color-tv-blue-500","color-replay-mode-icon":"color-tv-blue-50","color-replay-mode-hover":"color-tv-blue-600","color-notaccurate-mode":"color-berry-pink-700","color-notaccurate-mode-bg":"color-berry-pink-400","color-delay-mode":"color-tan-orange-700","color-delay-mode-bg":"color-tan-orange-400","color-eod-mode":"color-grapes-purple-700","color-eod-mode-bg":"color-grapes-purple-400","color-data-problem":"color-ripe-red-600","color-data-problem-bg":"color-ripe-red-400","color-data-problem-hover":"color-ripe-red-500","color-list-item-bg-highlighted":"color-tv-blue-a900","color-list-item-bg-selected":"color-tv-blue-a800","color-list-item-bg-highlighted-hover":"color-tv-blue-a800","color-list-item-bg-selected-hover":"color-tv-blue-a700","color-screener-header-bg":"color-cold-gray-850","color-screener-header-bg-hover":"color-cold-gray-800","color-overlay":"color-cold-gray-950","color-card-border":"color-cold-gray-700","color-card-border-hover":"color-cold-gray-600","color-background-special-primary":"color-black","color-stroke-special-primary":"color-cold-gray-800","color-selection-bg":"color-tv-blue-a700"}') diff --git a/charting_library/charting_library.cjs.js b/charting_library/charting_library.cjs.js index 5a0a2568..2d4f268d 100644 --- a/charting_library/charting_library.cjs.js +++ b/charting_library/charting_library.cjs.js @@ -1 +1 @@ -"use strict";function t(e,n){const i={...e};for(const o in n)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==n[o]&&(i[o]=n[o]):i[o]=t(e[o],n[o]);return i}Object.defineProperty(exports,"__esModule",{value:!0});const e={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},n={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};let i=!1;function o(t){var e;const n=/\.woff(\d*)/.exec(t);return``}function s(t,e){const n=new URL(`${t||""}`,location.href).href,i=JSON.parse('["bundles/runtime.6b7a1146863d7196d6d3.js","bundles/5386.eb112967859403067d3d.css","bundles/5386.eb112967859403067d3d.rtl.css","bundles/1857.10c97feeb46d934b8a25.js","bundles/library.a70ecf079f22e76a3ae6.js","bundles/b1a63a011fd92dfb93db6db243bb036c.woff2","bundles/40f9a03d174178efb12303caa9bc7cd8.woff2","bundles/3293616ec0c605c7c2db25829a0a509e.woff"]'),s=JSON.parse('[{"iso":"ar","dir":"rtl","language":"ar"},{"iso":"pt","dir":"ltr","language":"pt"},{"iso":"cs","dir":"ltr","language":"cs"},{"iso":"de","dir":"ltr","language":"de"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"es","dir":"ltr","language":"es"},{"iso":"fa","dir":"rtl","language":"fa"},{"iso":"fr","dir":"ltr","language":"fr"},{"iso":"he","dir":"rtl","language":"he_IL"},{"iso":"hu","dir":"ltr","language":"hu_HU"},{"iso":"id","dir":"ltr","language":"id_ID"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"it","dir":"ltr","language":"it"},{"iso":"ja","dir":"ltr","language":"ja"},{"iso":"ko","dir":"ltr","language":"ko"},{"iso":"ms","dir":"ltr","language":"ms_MY"},{"iso":"pl","dir":"ltr","language":"pl"},{"iso":"ru","dir":"ltr","language":"ru"},{"iso":"sv","dir":"ltr","language":"sv"},{"iso":"th","dir":"ltr","language":"th"},{"iso":"tr","dir":"ltr","language":"tr"},{"iso":"vi","dir":"ltr","language":"vi"},{"iso":"zh-Hans","dir":"ltr","language":"zh"},{"iso":"zh-Hant","dir":"ltr","language":"zh_TW"},{"iso":"el","dir":"ltr","language":"el"},{"iso":"nl","dir":"ltr","language":"nl_NL"},{"iso":"ro","dir":"ltr","language":"ro"}]'),r=encodeURIComponent(e),a=s.find((t=>t.language===r)),d=`lang="${a.iso}" dir="${a.dir}"`,l=`\n${function(t,e){if(void 0===t)return"";const n=[],i=[],s=[],r=/\.css$/i,a=/\.rtl\.css$/i;for(const d of t)d.endsWith(".js")?i.push(`