"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[52046],{749028:(e,t,s)=>{s.d(t,{isSignedExchangeAgreement:()=>n,saveExchangeAgreement:()=>a});var i=s(120780),r=s(526698);function a(e){return(0,i.fetch)("/exchange-agreement/",{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(e)}).then((e=>e.ok?e.json():e.json().then((t=>{throw new r.AggregateError((0,r.accumulateErrors)(t.errors,e.status))}))))}const o={};async function n(e){let t="/is-signed-exchange-agreement/";if(e.exchange&&(t+=`?exchange=${e.exchange}`,o[e.exchange]))return o[e.exchange];const s=await(0,i.fetch)(t);if(!s.ok){const e=await s.json();throw Error(e.detail)}const r=await s.json();return e.exchange&&(o[e.exchange]=r),r}},875049:(e,t,s)=>{s.d(t,{default:()=>a});var i=s(345848);const r={filterNamesMap:{script_type:"Indicators and Strategies","script_type-indicators":"Indicators","script_type-strategies":"Strategies",stream:"All Markets","stream-stocks":"Stocks","stream-indices":"Indices","stream-commodities":"Commodities","stream-currencies":"Currencies","stream-bitcoin":"Bitcoin","interval-all":"All Intervals","interval-m":"Short Term","interval-h":"Medium Term","interval-dwm":"Long Term","sort-unmoderated":"Unmoderated","sort-trending":"Trending","sort-discussed":"Most Discussed","sort-viewed":"Most Viewed","sort-agreed":"Most Agreed","sort-suggested":"Suggested","sort-recent":"All Ideas","time-day":"Today","time-week":"This Week","time-month":"This Month","time-all":"All Time","by-everyone":"Everyone","by-following":"Following","by-me":"My Ideas"},goProFeaturesMap:{customIntervals:"Add Custom Interval",intradaySpread:"Inraday Spread",kagiRenko:"Japanese Intraday Chart",alerts:{prefix:"New Alerts Limit",widget:"Widget",chart:"Chart Header"},multipleCharts:"Multiple Charts Layout",savedChartsLimit:"Save Chart Limit",studyLimit:"Studies Limit",multipleWatchLists:{prefix:"Watchlists",new:"Create New List",rename:"Rename List",saveAs:"Save List As"},importWatchlist:"Watchlists Import Watchlist",exportWatchlist:"Watchlists Export Watchlist",BATSExchangePopup:"BATS Exchange Popup",DataQualityPopup:"Data Quality Popup",FreeDelayPopup:"Free Delay Popup",proRTProduct:"Volume Profile",studyOnStudy:"Unlimited Study on Study"},trackFeature:{savedChartsLimit:!0,BATSExchangePopup:!0,FreeDelayPopup:!0,DataQualityPopup:!0,intradaySpread:!0,studyOnStudy:!0},trackGoPro:function(e,t,s){s&&!t&&(t=s,s=null);var a=r.goProFeaturesMap[t];if(a){if(s){if("string"==typeof a)return;a="{0} {1}".format(a.prefix,a[s])}(0,i.trackEvent)(e,a)}}},a=r},405117:(e,t,s)=>{s.r(t),s.d(t,{trackGoProFeature:()=>r});var i=s(875049);function r(e,t){i.default.trackGoPro("Gopro Features",e,t)}},766269:(e,t,s)=>{s.d(t,{FuturesCotractExpirationTime:()=>n});var i=s(988124),r=s(401580),a=s(44031),o=s(444331);class n{constructor(e,t){this._utcTime=new r.WatchedValue(null),this._expired=new r.WatchedValue(!1),this._sessionSpec=new r.WatchedValue(null),this._sessionSpecCache=null,this._utcDayStart=new Date(0),this._timeoutId=null, this._expiredBySymbolInfoTypespecs=!1,this._expiredByQuotesTypespecs=null,this._marketStatusSpawn=e.spawn(),this._quotesUpdate=t,this._quotesUpdate.subscribe(this,this._onQuotesUpdate)}destroy(){this._marketStatusSpawn.destroy(),this._clearTimeoutIfNeeded(),this._quotesUpdate.unsubscribeAll(this)}reset(){this._expiredBySymbolInfoTypespecs=!1,this._expiredByQuotesTypespecs=null,this._utcTime.setValue(null),this._expired.setValue(!1)}utcTime(){return this._utcTime.readonly()}expired(){return this._expired.readonly()}utcDayStart(){return this._utcDayStart}sessionSpec(){return this._sessionSpec.readonly()}setSymbolInfo(e){var t;if(this._clearTimeoutIfNeeded(),null===e||!(0,o.isFuturesContractSymbol)(e)||void 0===e.expiration)return this._utcTime.setValue(null),void this._expired.setValue(!1);null!==this._sessionSpecCache&&this._sessionSpecCache.timezone===e.timezone&&this._sessionSpecCache.session===e.session&&this._sessionSpecCache.corrections===e.corrections&&this._sessionSpecCache.holidays===e.session_holidays||(this._sessionSpecCache={timezone:e.timezone,session:e.session,corrections:e.corrections,holidays:e.session_holidays,spec:new a.SessionSpec(e.timezone,e.session,e.session_holidays,e.corrections)},this._sessionSpec.setValue(null));const s=this._sessionSpecCache.spec;this._utcDayStart=function(e){const t=Math.floor(e/1e4)%1e4,s=Math.floor(e/100)%100-1,i=e%100;return new Date(Date.UTC(t,s,i))}(e.expiration);const r=s.bordersOfDailyBar(this._utcDayStart);if(null===r)return this._utcTime.setValue(null),this._expired.setValue(!1),void this._sessionSpec.setValue(s);const n=(0,i.get_timezone)(e.timezone);this._utcTime.setValue((0,i.cal_to_utc)(n,r.to)+1e3),this._sessionSpec.setValue(s),this._expiredBySymbolInfoTypespecs=Boolean(null===(t=e.typespecs)||void 0===t?void 0:t.includes("expired")),this._updateExpired()}_updateExpired(){this._clearTimeoutIfNeeded();const e=this._utcTime.value();if(null===e)return;if(this._expiredByQuotesTypespecs||this._expiredBySymbolInfoTypespecs)return void this._expired.setValue(!0);const t=window.ChartApiInstance.serverTime();let s;switch(this._marketStatusSpawn.value()){case"out_of_session":case"holiday":s=e-3e5-t;break;case"market":case"pre_market":case"post_market":s=e+3e5-t;break;default:s=e-t}s>0&&(this._timeoutId=setTimeout((()=>this._updateExpired()),Math.min(2e9,s))),this._expired.setValue(s<=0)}_clearTimeoutIfNeeded(){null!==this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null)}_onQuotesUpdate(e,t){var s,i;let r=!1;if(null===this._expiredByQuotesTypespecs)this._expiredByQuotesTypespecs=Boolean(null===(s=e.values.typespecs)||void 0===s?void 0:s.includes("expired")),r=this._expiredByQuotesTypespecs;else if(void 0!==t.values.typespecs){const e=Boolean(null===(i=t.values.typespecs)||void 0===i?void 0:i.includes("expired"));r=this._expiredByQuotesTypespecs!==e,this._expiredByQuotesTypespecs=e}r&&null!==this._utcTime.value()&&this._updateExpired()}}},188177:(e,t,s)=>{s.d(t,{MarketStatusModel:()=>u}) ;var i=s(650151),r=s(401580),a=s(66732),o=s(44031),n=s(766269),l=s(988124);function h(){return window.ChartApiInstance.serverTime()/1e3}function d(e,t,s){return e<=s?t<=s?1/0:t/1e3:Math.min(e,t)/1e3}class u{constructor(e){var t,s;this._currentSession=new r.WatchedValue(null),this._delistedByTypespecs=new r.WatchedValue(!1),this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new r.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._futuresContractExpirationTime=null,this._quotesProvider=e,this._futuresContractExpirationTime=new n.FuturesCotractExpirationTime(this._currentSession.readonly(),e.quotesUpdate()),e.quoteSymbolChanged().subscribe(this,(()=>{(0,i.ensureNotNull)(this._futuresContractExpirationTime).reset(),this._nextSessionEdgeInternal=null,this._recalculateNextSessionEdge()})),this._marketStatus=(0,a.combine)(((e,t,s)=>null===e?e:t?"delisted":s?"expired":function(e){switch(e){case"market":return"market";case"pre_market":return"pre_market";case"post_market":return"post_market";case"out_of_session":return"out_of_session";case"holiday":return"holiday"}(0,i.ensureNever)(e)}(e)),this._currentSession.weakReference(),this._delistedByTypespecs.weakReference(),(null!==(s=null===(t=this._futuresContractExpirationTime)||void 0===t?void 0:t.expired())&&void 0!==s?s:new r.WatchedValue(!1)).weakReference()),e.quotesUpdate().subscribe(this,(e=>{var t;this._currentSession.setValue(null!==(t=null==e?void 0:e.values.current_session)&&void 0!==t?t:null)})),e.quoteSymbolChanged().subscribe(this,(()=>{this._currentSession.setValue(null)}))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId),(0,i.ensureNotNull)(this._futuresContractExpirationTime).destroy(),this._marketStatus.destroy()}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){var t,s,r,a,n,l;if((0,i.ensureNotNull)(this._futuresContractExpirationTime).setSymbolInfo(e),this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);const h=new o.SessionSpec(e.timezone,null!==(t=e.session_display)&&void 0!==t?t:e.session,e.session_holidays,e.corrections);let d,u;const c=null===(s=e.subsessions)||void 0===s?void 0:s.find((e=>"premarket"===e.id)),_=null===(r=e.subsessions)||void 0===r?void 0:r.find((e=>"postmarket"===e.id));void 0!==c&&(d=new o.SessionSpec(e.timezone,null!==(a=c["session-display"])&&void 0!==a?a:c.session,e.session_holidays,c["session-correction"])),void 0!==_&&(u=new o.SessionSpec(e.timezone,null!==(n=_["session-display"])&&void 0!==n?n:_.session,e.session_holidays,_["session-correction"])),this._delistedByTypespecs.setValue(Boolean(null===(l=e.typespecs)||void 0===l?void 0:l.includes("discontinued"))),this._sessionsSpec={general:h,preMarket:d,postMarket:u},this._recalculateNextSessionEdge()}status(){return this._marketStatus}currentSession(){return this._currentSession}nextSessionEdge(){ return this._nextSessionEdge}_getNextSessionEdgeInternal(){var e;if(null===this._sessionsSpec||"24x7"===this._sessionsSpec.general.spec())return null;const t=1e3*h();if(null===this._nextSessionEdgeInternal||(null!==(e=this._nextSessionEdgeInternal.timestamp)&&void 0!==e?e:1/0)<=t/1e3){const{general:e,preMarket:s,postMarket:i}=this._sessionsSpec,r=(0,l.get_timezone)(e.timezone()),a=(0,l.utc_to_cal)(r,t),o=d((0,l.cal_to_utc)(r,e.alignToNearestSessionStart(a,1)),(0,l.cal_to_utc)(r,e.alignToNearestSessionEnd(a,1)),t),n=d(void 0!==s?(0,l.cal_to_utc)(r,s.alignToNearestSessionStart(a,1)):1/0,void 0!==s?(0,l.cal_to_utc)(r,s.alignToNearestSessionEnd(a,1)):1/0,t),u=d(void 0!==i?(0,l.cal_to_utc)(r,i.alignToNearestSessionStart(a,1)):1/0,void 0!==i?(0,l.cal_to_utc)(r,i.alignToNearestSessionEnd(a,1)):1/0,t);let c=Math.min(o,n,u);if(c===1/0){const t=h(),s=6e4,i=new Date(Math.round(new Date(1e3*t).getTime()/s)*s).getTime()+s,a=(0,l.utc_to_cal)(r,i),o=d((0,l.cal_to_utc)(r,e.alignToNearestSessionStart(a,1)),(0,l.cal_to_utc)(r,e.alignToNearestSessionEnd(a,1)),i),_=Math.min(o,n,u);_!==1/0?(this._nextSessionEdgeInternal={timestamp:c},c=_):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=c===u?{timestamp:c,status:"post_market"}:c===n?{timestamp:c,status:"pre_market"}:{timestamp:c}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-h())};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},147675:(e,t,s)=>{s.d(t,{CRUCIAL_REALTIME_BATS:()=>c,DELAY_WITHOUT_AGREEMENT:()=>_,firstReplacedByBatsExchange:()=>p,getExchange:()=>f,isDelay:()=>y,isDelayForGuest:()=>g,isDelayWithoutMarketAgreement:()=>v,isEod:()=>m,isTickByTick:()=>S,witoutRealtime:()=>b});var i=s(650151),r=s(59171),a=s.n(r),o=s(833813),n=s(778016),l=s(519073);const h=["DJ","JSE","BELEX"],d=["NZX"],u=["BIVA"],c=["AMEX","NASDAQ","NYSE"],_=["ICESG","TURQUOISE","TAIFEX"];function p(e){const t=a().getExchanges(e.pro_name),s=a().getExchanges(e.full_name);for(let e=0;e0}function b(e){return"index"===e.type&&h.includes(e.listed_exchange)||"futures"===e.type&&d.includes(e.listed_exchange)||u.includes(e.listed_exchange)}function S(e,t){return!((0,n.enabled)(o.ProductFeatures.TICK_BY_TICK_PUSH_DATA)||y(e.delay)||m(e,t)||(0,l.hasCryptoTypespec)(e.typespecs||[]))}function g(e,t){return t.listed_exchange===e&&!window.is_authenticated}function v(e){return _.includes(e.listed_exchange)} async function f(e){{const t=(0,i.ensureDefined)(window.pro);await new Promise((e=>{t.runOrUpdate(e)}));const s=t.getProduct(function(e){return`exchange-${e.pro_perm}`}(e)),r=function(e){let t;if(!window.pro)throw new Error("Pro module not defined");t=window.pro.getProductsByType(window.pro.PRODUCT_TYPES.exchange).find((t=>{var s;return Boolean(null===(s=t.included_exchanges)||void 0===s?void 0:s.includes(e))}));return t||null}(s.exchange||"");return r&&["cme-full","us-stocks"].includes(r.exchange)?s:r||s}}},736029:(e,t,s)=>{s.d(t,{extrapolateBarsFrontByCount:()=>a,extrapolateBarsFrontToTime:()=>r});var i=s(987571);function r(e,t,s,i,a=!1){if(t>s){const o=r(e,s,t,i,a);return o.count=-o.count,o}return o(e,t,1,((e,t)=>t>s||0!==i&&e>i),a)}function a(e,t,s,i=!1){const r=s<0?-1:1;return o(e,t,r,((e,t)=>e>=s*r),i)}function o(e,t,s,r,a){let o=0,n=t;e.moveTo(n);let l=0,h=Number.MAX_VALUE,d=!1,u=t;const c=[];for(;!r(o,n);){if(l>15)throw new Error("Internal error 0x10 while extrapolating.");const r=e.indexOfBar(n);if(r===i.SessionStage.PRE_SESSION&&1===s)n=e.startOfBar(0),e.moveTo(n);else if(r===i.SessionStage.PRE_SESSION&&-1===s)n=e.startOfBar(i.SessionStage.PRE_SESSION),e.moveTo(n);else if(r===i.SessionStage.POST_SESSION&&1===s)n=e.startOfBar(i.SessionStage.POST_SESSION),e.moveTo(n);else{if(r===i.SessionStage.POST_SESSION&&-1===s)throw new Error("Internal error 0x12 while extrapolating.");{const _=e.startOfBar(r);if(_>t&&s>0||t>_&&s<0){if(d&&h===_)throw new Error("Internal error 0x11 while extrapolating.");d=!0,h=_,l=0,o++,u=_,a&&c.push(u)}if(0===r&&-1===s)n=_-1;else{n=e.startOfBar(r+s);const t=e.startOfBar(i.SessionStage.POST_SESSION);n>t&&(e.moveTo(t),n=e.startOfBar(0))}}}l++}return{time:u,times:c,count:o}}},432078:(e,t,s)=>{s.d(t,{ComputedTimePointWeights:()=>o});var i=s(674981);function r(e,t){for(let s=0;s=.5?Math.ceil(e):Math.floor(e),s=e-t;if(t>=this._invalidatedFromIndex){const e=this._invalidatedFromIndex;let s=this._items[e-1];const i=Math.min(this._maxIndexWithWeight,t);this._createItems(i);for(let t=e;t<=i;++t)s=this._fillItem(t,s);this._invalidatedFromIndex=i+1}if(t>this._maxIndexWithWeight){return this._items[this._maxIndexWithWeight].barEndTotal+(t-this._maxIndexWithWeight-.5)+s}const i=this._items[t];return i.barCenterTotal+i.weight*s}rangeWeight(e,t){const s=[];if(null===this._maxIndexWithWeight)return[{index:e,barStartTotal:e-.5,barCenterTotal:e,barEndTotal:e+.5,weight:1}];if(e=this._invalidatedFromIndex){const i=this._invalidatedFromIndex;let r=this._items[i-1];const a=Math.min(this._maxIndexWithWeight,t);this._createItems(a);for(let t=i;t<=a;++t)r=this._fillItem(t,r),t>=e&&s.push(r);this._invalidatedFromIndex=a+1}return 0===s.length&&s.push(this._items[this._maxIndexWithWeight]),s}index(e){if(null===this._maxIndexWithWeight)return e;if(0!==this._invalidatedFromIndex&&this._items[this._invalidatedFromIndex-1].barEndTotal-.001>=e){const t=(0,i.lowerbound)(this._items,e,((e,t)=>e.barEndTotal-.001e)return this._invalidatedFromIndex=i+1,i+(e-s.barCenterTotal)/s.weight;this._invalidatedFromIndex=this._maxIndexWithWeight+1}const t=this._items[this._maxIndexWithWeight];return this._maxIndexWithWeight+.5+e-t.barEndTotal}state(e){return{maxIndexWithWeight:this._maxIndexWithWeight,items:this._items.slice(),weightsMap:Array.from(this._weightsMap.entries())}}restoreState(e){this._maxIndexWithWeight=e.maxIndexWithWeight,this._items=e.items.slice(),this._weightsMap=new Map(e.weightsMap)}_createItems(e){const t=e-(this._items.length-1);if(t>0){const e=this._items.length;this._items=this._items.concat(Array.from({length:t},((t,s)=>({barStartTotal:1,barCenterTotal:1,barEndTotal:1,weight:1,index:s+e}))))}}_fillItem(e,t){var s;const i=this._items[e],r=null!==(s=this._weightsMap.get(e))&&void 0!==s?s:1;return i.weight=r,i.barCenterTotal=void 0===t?0:t.barEndTotal+r/2,i.barStartTotal=i.barCenterTotal-r/2,i.barEndTotal=i.barCenterTotal+r/2,i}}class o{constructor(){this._baseIndex=0,this._preBaseIndexWeights=new a,this._postBaseIndexWeights=new a,this._weightsMap=new Map}setBaseIndex(e){this._baseIndex=e,this._preBaseIndexWeights=new a,this._postBaseIndexWeights=new a;for(const[e,t]of this._weightsMap)this.setWeight(e,t)}indexToTotalWeight(e){const t=e-this._baseIndex;return t<0?-this._preBaseIndexWeights.totalWeight(-t):this._postBaseIndexWeights.totalWeight(t)}totalWeightToIndex(e){return e<0?this._baseIndex-this._preBaseIndexWeights.index(-e):this._baseIndex+this._postBaseIndexWeights.index(e)}clear(){this._preBaseIndexWeights=new a,this._postBaseIndexWeights=new a,this._weightsMap.clear()}setWeight(e,t){const s=e-this._baseIndex;s<=0&&this._preBaseIndexWeights.setWeight(-s,t),s>=0&&this._postBaseIndexWeights.setWeight(s,t),this._weightsMap.set(e,t)}indexRangeToWeights(e,t,s){const i=e-this._baseIndex,a=t-this._baseIndex;let o=0;if(s=null!=s?s:[],i<0){const e=this._preBaseIndexWeights.rangeWeight(Math.max(1,-a),-i),t=e.length-s.length;t>0&&r(s,t);for(let t=e.length-1;t>=0;t-=1){const i=e[t],r=s[o];r.center=-i.barCenterTotal,r.left=-i.barEndTotal,r.right=-i.barStartTotal, r.timePointIndex=this._baseIndex-i.index,o+=1}}if(a>=0){const e=this._postBaseIndexWeights.rangeWeight(Math.max(0,i),a),t=e.length+o-s.length;t>0&&r(s,t);for(const t of e){const e=s[o];e.center=t.barCenterTotal,e.left=t.barStartTotal,e.right=t.barEndTotal,e.timePointIndex=this._baseIndex+t.index,o+=1}}return s.slice(0,o)}moveData(e){const t=new Map;for(const s of e){const e=this._weightsMap.get(s.old);if(void 0!==e){t.set(s.new,e),this._weightsMap.delete(s.old);const i=s.old-this._baseIndex;i<=0&&this._preBaseIndexWeights.deleteItemByIndex(-i),i>=0&&this._postBaseIndexWeights.deleteItemByIndex(i)}}for(const[e,s]of t)this.setWeight(e,s)}state(e){return{type:"computed",state:{baseIndex:this._baseIndex,preBaseIndexWeights:this._preBaseIndexWeights.state(e),postBaseIndexWeights:this._postBaseIndexWeights.state(e),weightsMap:Array.from(this._weightsMap.entries())}}}restoreState(e){this._baseIndex=e.state.baseIndex,this._weightsMap=new Map(e.state.weightsMap),this._preBaseIndexWeights.restoreState(e.state.preBaseIndexWeights),this._postBaseIndexWeights.restoreState(e.state.postBaseIndexWeights)}needAdjustingOnDataRestoring(){return!0}}},487906:(e,t,s)=>{s.d(t,{SeriesBase:()=>ei});var i,r=s(316230),a=s(650151),o=s(638456),n=s(345848),l=s(251954),h=s(201089),d=s(268222),u=s(974655),c=s(507795),_=s(544421),p=s(195447),m=s(534741),y=s(291784),b=s(354950),S=s(444331);!function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(i||(i={}));var g=s(624444),v=s(339315),f=s(833642),w=s(444372),P=s(244842),C=s(665570),x=s(985715),I=s(29469);const T=w.t(null,void 0,s(389659)),V=P.enabled("hide_unresolved_symbols_in_legend");class D extends x.StatusProviderBase{constructor(e,t,s){super(),this._series=e,this._statusViewProperties=t,this._options=s||{}}text(){return(0,I.generateTitleForGui)(this._getTitleGenerationOptions())}getSplitTitle(){return(0,I.generateSplitTitleForGui)(this._getTitleGenerationOptions())}bold(){return!1}size(){return this._statusViewProperties.childs().fontSize.value()+"px"}errorStatus(){const e=this._series.seriesErrorMessage();return null!==e?{error:e,title:T}:null}_getTitleGenerationOptions(){const e=this._series.symbolInfo(),t=this._statusViewProperties.childs(),s=this._series.symbolTextSourceProxyProperty().value();let i;t.showExchange.value()&&e&&(i=(0,S.getSymbolExchange)(e));const r=null!==null?null:void 0;return{description:A(s,e),exchange:i,symbol:V&&null===e?"":this._series.symbol(),interval:t.showInterval.value()&&!this._options.hideResolution?this._series.interval():void 0,style:this._series.properties().childs().style.value(),inputs:this._series.getInputsProperties().state(),boxSize:this._series.data().boxSize,reversalAmount:this._series.data().reversalAmount,ticker:B(s,e),priceSource:r}}}function B(e,t){return"ticker-and-description"!==e?"":null!==t?t.name:void 0}function A(e,t){if(null!==t)return"ticker"===e?t.name:"long-description"===e&&void 0!==t.long_description?t.long_description:(0,C.getTranslatedSymbolDescription)({pro_name:t.pro_name||void 0, short_name:t.name||void 0,description:t.description||void 0,short_description:t.short_description||void 0,local_description:t.local_description||void 0,language:t.language||void 0})}class R extends f.StatusView{constructor(e,t,s){super(new D(e,t,s)),this._invalidated=!0,this._series=e,this._series.onRestarted().subscribe(this,this.update),this._series.dataEvents().symbolResolved().subscribe(this,this.update),this._series.dataEvents().completed().subscribe(this,this.update),this._series.boxSizeValue().subscribe(this.update.bind(this)),t.childs().symbolTextSource.listeners().subscribe(this,this.update)}getSeriesPrecision(){let e=4;const t=this._series.symbolInfo();return t&&t.pricescale&&(e=Math.round(Math.log(t.pricescale)/Math.log(10))),e}round(e){const t=this.getSeriesPrecision(),s=Math.round(e*Math.pow(10,t))/Math.pow(10,t);return s?s.toString():""}update(){this._invalidated=!0}text(){return this._updateImpl(),super.text()}bold(){return this._updateImpl(),super.bold()}size(){return this._updateImpl(),super.size()}getSplitTitle(){return this._updateImpl(),this._statusProvider.getSplitTitle()}_updateImpl(){this._invalidated&&(this._bold=this._statusProvider.bold(),this._size=this._statusProvider.size(),this._text=this._statusProvider.text(),this._invalidated=!1)}}var M=s(150335),E=s(782086),k=s(168883),N=s(885482),F=s(748844),L=s(616117);const W=o.CheckMobile.any(),O=P.enabled("hide_resolution_in_legend");class U extends E.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._series=e,this._model=t,this._valuesProvider=this._createValuesProvider(e,t),this._items=this._valuesProvider.getItems().map((e=>new E.DataWindowItem(e.id,e.title,"",e.unimportant))),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}series(){return this._series}_updateImpl(){var e,t;const s=this._series.symbolInfo();if(s){const e=[s.name];if(O||e.push((0,k.translatedIntervalString)(this._series.interval())),(0,S.isEconomicSymbol)(s)){const t=(0,S.getSourceForEconomySymbol)(s);null!==t&&e.push(t)}else e.push((0,o.onWidget)()||"forex"===s.type?s.exchange:s.listed_exchange);this._header=e.join(` ${S.symbolTitleSeparator} `),this._title=s.description}else this._header=this._series.symbol();let i=this._model.crossHairSource().appliedIndex();P.enabled("use_last_visible_bar_value_in_legend")&&!(0,M.isNumber)(i)&&(i=null!==(t=null===(e=this._model.timeScale().visibleBarsStrictRange())||void 0===e?void 0:e.lastBar())&&void 0!==t?t:NaN);const r=this._valuesProvider.getValues(i);for(let e=0;ee||t||s||i),s.showBarChange.weakReference(),s.showSeriesOHLC.weakReference(),s.showVolume.weakReference(),s.showLastDayChange.weakReference()),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){const e=this._series.dataPoweredBy();return null!==e&&e.length>0?w.t(null,void 0,s(493345))+" "+e:null}marketTitle(){const e=this._series.marketStatusModel().status().value();return this._showLastPriceAndChangeOnly()&&("pre_market"===e||"post_market"===e)?`${z}:`:""}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_createValuesProvider(e,t){return new j(e,t)}}var $=s(188177),X=s(261066),Q=s(223699),Y=s(547944),K=s(736029),Z=s(541558);let J=0;class ee{constructor(e,t){this._extrapolatedData=[],this._cacheForFuture=!1,this._modelId=J++,this._builderCache=null,this._uniqueId=(0,Z.randomHashN)(6),this._resolution=t,this._symbolInfo=e,this._valid=Boolean(e.timezone)&&Boolean(e.session), this._session=new Y.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections)}syncSourceTarget(){return{uniqueId:this._uniqueId,resolution:this._resolution,symbolInfo:this._symbolInfo,session:this._session.state()}}getSymbolInfo(){return this._symbolInfo}getSession(){return this._session}getResolution(){return this._resolution}uniqueId(){return this._modelId}distance(e,t){if(!this.isValid())return{success:!1};if(e>t)return{success:!1};if(e===t)return{success:!0,result:0};let s=this._extrapolatedData.length,i=0!==s?this._extrapolatedData[0]:null,r=null!==i?this._extrapolatedData[s-1]:null;const a=er){const i=(0,K.extrapolateBarsFrontToTime)(this.barBuilder(),r||1e3*e,1e3*t,2e3,!0);this._extrapolatedData=this._extrapolatedData.concat(i.times),s=this._extrapolatedData.length,this._cacheForFuture=a}if(r=this._extrapolatedData[s-1],r<1e3*t)return{success:!1};const o=this._extrapolatedData.indexOf(1e3*t);return-1===o?{success:!1}:{success:!0,result:o}}projectTime(e,t){if(!this.isValid())return e;let s=this._extrapolatedData.length,i=s>0?this._extrapolatedData[0]:null,r=null!==i?this._extrapolatedData[s-1]:null;const a=t>=0;1e3*e===i&&this._cacheForFuture===a||(this._extrapolatedData=[1e3*e],s=1,i=null,r=null);const o=Math.abs(t);if(null===i||o>=s){const i=(0,K.extrapolateBarsFrontByCount)(this.barBuilder(),r||1e3*e,Math.sign(t)*(o-s+1),!0);this._extrapolatedData=this._extrapolatedData.concat(i.times),s=this._extrapolatedData.length,this._cacheForFuture=a}return se.exchange.toUpperCase()));if(!(null==t?void 0:t.includes(e.listed_exchange)))return!1}return async function(e){try{return(await(0,ae.isSignedExchangeAgreement)({exchange:e.pro_perm})).response}catch(e){return!1}}(e)}var ne=s(59171),le=s.n(ne);var he=s(928691);const de=(0,h.getLogger)("Chart.Definitions.Series");function ue(e,t){return"TickByTick"===e?{mode:e,updatePeriod:t}:{mode:e}}async function ce(e,t,s){const i=[];return(0,ie.isDelay)(e.delay)?async function(e){const t=[];return(0,ie.witoutRealtime)(e)?t.push(ue("DelayNoRealtime")):(0,ie.isDelayForGuest)("MOEX",e)?t.push(ue("MOEXDelayForGuest")):(0,ie.isDelayForGuest)("TFEX",e)?t.push(ue("TFEXDelayForGuest")):(0,ie.isDelayForGuest)("CHIXAU",e)?t.push(ue("CHIXAuDelayForGuest")):(0,ie.isDelayForGuest)("NGM",e)?t.push(ue("NGMDelayForGuest")):(0, ie.isDelayForGuest)("ICESG",e)?t.push(ue("ICESGDelayForGuest")):(0,ie.isDelayForGuest)("TAIFEX",e)?t.push(ue("TAIFEXDelayForGuest")):(0,ie.isDelayForGuest)("TURQUOISE",e)?t.push(ue("TURQUOISEDelayForGuest")):(0,ie.isDelayForGuest)("ADX",e)?t.push(ue("ADXDelayForGuest")):(0,ie.isDelayForGuest)("LUXSE",e)?t.push(ue("LUXSEDelayForGuest")):(0,ie.isDelayForGuest)("NSENG",e)?t.push(ue("NSENGDelayForGuest")):(0,ie.isDelayForGuest)("TRADEGATE",e)?t.push(ue("TRADEGATEDelayForGuest")):["BER","DUS","HAM","HAN","MUN"].some((t=>(0,ie.isDelayForGuest)(t,e)))?t.push(ue("DEForGuest")):["MIL"].some((t=>(0,ie.isDelayForGuest)(t,e)))?t.push(ue("MILDelayForGuest")):await oe(e)?t.push(ue("DelayToRealtime")):(0,ie.isDelayWithoutMarketAgreement)(e)?t.push(ue("DelayWithoutMarketAgreement")):t.push(ue("DelayToRealtime")),t}(e):(0,ie.isEod)(e,t)?(i.push(ue("EOD")),i):((0,ie.isTickByTick)(e,t)&&0!==s&&i.push(ue("TickByTick",s)),function(e){return le().hasBatsSymbols(e.full_name)}(e)&&i.push(ue("BATSToRealtime")),i)}class _e{constructor(e,t,s,i){this._dataUpdatedInfoStatus=new te.WatchedObject(null),this._symbolInfo=(0,se.createWVFromGetterAndSubscription)(e.getter,e.onChange),this._status=(0,se.createWVFromGetterAndSubscription)(t.getter,t.onChange),this._updatePeriod=(0,se.createWVFromGetterAndSubscription)(s.getter,s.onChange),this._symbolInfo.subscribe(this._update.bind(this)),this._status.subscribe(this._update.bind(this)),this._updatePeriod.subscribe(this._update.bind(this)),this._resetSubscription=i,this._resetSubscription.subscribe(this,this._resetStatus)}destroy(){this._symbolInfo.destroy(),this._status.destroy(),this._updatePeriod.destroy(),this._resetSubscription.unsubscribeAll(this)}status(){return this._dataUpdatedInfoStatus.readonly()}symbolName(){const e=this._symbolInfo.value();return null!==e?e.name:""}time(){const e=this._symbolInfo.value(),t=null!==e&&e.delay&&e.delay>0?e.delay:900;return Math.round(t/60)}listedExchange(){const e=this._symbolInfo.value();return null!==e?e.listed_exchange:""}async description(){const e=this._symbolInfo.value();if(null===e)return"";let t={};try{t=(0,a.ensureNotNull)(await(0,ie.getExchange)(e))}catch(e){de.logWarn(`Cannot get exchange ${(0,he.errorToString)(e)}`)}return t.description||e.listed_exchange}exchange(){const e=this._symbolInfo.value();return null!==e?e.exchange:""}proName(){const e=this._symbolInfo.value();return null!==e?e.pro_name:""}country(){var e;return(null===(e=this._symbolInfo.value())||void 0===e?void 0:e.country)||""}proPerm(){const e=this._symbolInfo.value();return null!==e?e.pro_perm:""}firstReplacedByBatsExchange(){const e=this._symbolInfo.value();return e&&(0,ie.firstReplacedByBatsExchange)(e)}isSpread(){const e=this._symbolInfo.value();return null!==e&&"spread"===e.type}_resetStatus(){this._dataUpdatedInfoStatus.setValue(null)}async _update(){const e=this._symbolInfo.value();if(null===e)return void this._dataUpdatedInfoStatus.setValue(null);const t=this._status.value();if("string"==typeof t)return void this._dataUpdatedInfoStatus.setValue(null);if(2===t||1===t)return ;const s=await ce(e,t,this._updatePeriod.value());0!==s.length?this._dataUpdatedInfoStatus.setValue(s):this._dataUpdatedInfoStatus.setValue(null)}}var pe=s(120780),me=s(466931),ye=s(389137),be=s(405069);const Se=(0,h.getLogger)("Chart.DataProblemModel");class ge{constructor(e,t){this._mainDataProblem=new te.WatchedObject(null),this._supportPortalProblems=new te.WatchedObject([]),this._allDataProblems=new te.WatchedObject([]),this._pushStreamHandler=null,this._destroyed=!1,this._quotesProvider=e,this._quotesProvider.quotesUpdate().subscribe(this,this._update.bind(this)),this._resetSubscription=t,this._resetSubscription.subscribe(this,this._resetStatus),this._mainDataProblem.subscribe((()=>this._updateAllDataProblems())),this._supportPortalProblems.subscribe((()=>this._updateAllDataProblems())),this._requestSupportPortalProblems()}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._resetSubscription.unsubscribeAll(this),null!==this._pushStreamHandler&&be.pushStreamMultiplexer.off("support-portal-problem",this._pushStreamHandler),this._destroyed=!0}dataProblems(){return this._allDataProblems}_resetStatus(){this._mainDataProblem.setValue(null)}_update(e){void 0===e.values||void 0===e.values.data_problem?this._resetStatus():this._mainDataProblem.setValue((0,ye.clone)(e.values.data_problem))}_updateAllDataProblems(){const e=this._mainDataProblem.value(),t=this._supportPortalProblems.value();this._allDataProblems.setValue(null===e?t:[e,...t])}async _requestSupportPortalProblems(){{const e=await(0,pe.fetch)(`${me.supportPortalProblemsHost}/support/support-portal-problems/?language=${window.locale}`);if(this._destroyed)return;if(!e.ok)return void Se.logWarn("Couldn't load support portal problems");const t=(await e.json()).issues,s=()=>{const e=t.filter((e=>e.show_on_chart&&!1!==e.is_active&&(void 0===e.language||e.language.some((e=>e===window.locale||"all"===e))))).map((e=>({severity:"low",title:e.title,text:e.description})));this._supportPortalProblems.setValue(e)};s(),this._pushStreamHandler=e=>{switch(e.action){case"created":t.push(e.data);break;case"modified":{const s=t.findIndex((t=>t.id===e.data.id));-1!==s?t[s]={...t[s],...e.data}:t.push(e.data);break}case"deleted":{const s=t.findIndex((t=>t.id===e.data.id));-1!==s&&t.splice(s,1);break}}s()},be.pushStreamMultiplexer.on("support-portal-problem",this._pushStreamHandler)}}}var ve=s(356747),fe=s(246733),we=s(229765),Pe=s(909598),Ce=s(988124);function xe(e){return e<10?`0${e}`:e.toString()}function Ie(e,t=Date.now()/1e3){let s=Math.ceil(e-t);if(s<=0)return"";if(s<3600){const e=Math.floor(s/60),t=Math.ceil(s%60);return`${xe(e)}:${xe(t)}`}if(s<86400){const e=Math.floor(s/3600);s%=3600;const t=Math.floor(s/60);s%=60;const i=Math.ceil(s);return`${xe(e)}:${xe(t)}:${xe(i)}`}{const i=new Date(1e3*e),r=new Date(1e3*t),a=Ce.get_year(i),o=Ce.get_year(r),n=Ce.get_month(i),l=Ce.get_month(r),h=Ce.get_day_of_month(r),d=Te(i)-Te(r)>=0?0:-1;let u=12*(a-o)+(n-l)+d;if(u>0){const t=Ce.get_days_in_month(l,o);!function(e,t){const s=Ce.get_day_of_month(e) ;e.setUTCMonth(Ce.get_month(e)+t),Ce.get_day_of_month(e)!==s&&e.setUTCDate(0)}(r,u);const s=Ce.get_days_in_month(Ce.get_month(r),Ce.get_year(r)),i=h!==t&&s===Ce.get_day_of_month(r)?t-h:0;let a=Math.ceil((e-r.getTime()/1e3)/86400)+i;return a>=s&&(u++,a=0),`${u}M ${a}d`}if(-1===d){if(Ce.get_days_in_month(l,o)-s/86400<1/24)return"1M 0d"}let c=Math.floor(s/86400);s%=86400;let _=Math.ceil(s/3600);return 24===_&&(_=0,c+=1),c===Ce.get_days_in_month(n,a)?"1M 0d":`${c}d ${_}h`}}function Te(e){return 86400*e.getUTCDate()+3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()}var Ve=s(740086),De=s(964824);const Be=P.enabled("force_exchange_as_title"),Ae=P.enabled("chart_style_hilo_last_price");const Re={alwaysShowGlobalLast:!1,visibleOnHistoryOnly:!1,showCountdown:!0,showSymbolLabel:!0,useSolidBodyColor:!0};class Me extends we.PriceAxisView{constructor(e,t,s){super(),this._previousCountdown="",this._source=e,this._model=t,this._options={...Re,...s}}updateCountdown(){this._countdownText()!==this._previousCountdown&&(this.update((0,De.sourceChangeEvent)(this._source.id())),this._model.updateSourcePriceScale(this._source))}_getSource(){return this._source}_getModel(){return this._model}_isCountdownEnabled(){return this._options.showCountdown}_countdownText(){{const e=this._source.barCloseTime();return null===e?"":Ie(e,this._currentTime()/1e3)}}_updateRendererData(e,t,s){var i;if(e.visible=!1,t.visible=!1,!this._source.isVisible())return;const r=this._source.properties().childs();if(!Ae&&12===r.style.value())return;const o=this._model.timeScale().visibleBarsStrictRange(),n=this._source.data().last();if(null===o||null===n)return;if(this._options.visibleOnHistoryOnly&&o.contains(n.index))return;const l=this._model.properties().childs().scalesProperties.childs();let h=l.showSeriesLastValue.value(),d=this._isCountdownEnabled()&&r.showCountdown.value()&&(12===(u=r.style.value())?Ae:(0,S.isTimeBasedStyle)(u))&&(this._options.alwaysShowGlobalLast||o.contains(n.index));var u;let c=this._options.showSymbolLabel&&l.showSymbolLabels.value();const _=l.seriesLastValueMode.value()===Pe.PriceAxisLastValueMode.LastPriceAndPercentageValue,p=this._source.lastValueData(void 0,this._options.alwaysShowGlobalLast);if(p.noData)return;const m=8===r.style.value();if((h||d||c)&&m&&r.haStyle.childs().showRealLastPrice.value()){const e=this._source.lastValueData(void 0,!1),t=this._source.lastValueData(void 0,!0);e.noData||t.noData||e.index!==t.index||(h=!1,d=!1,c=!1)}const y=(0,fe.resetTransparency)(this._source.priceLineColor(p.color));if(this._options.useSolidBodyColor?(s.background=y,s.borderColor=void 0):(s.background=this._model.backgroundColorAtYPercentFromTop((null!==(i=s.fixedCoordinate)&&void 0!==i?i:s.coordinate)/(0,a.ensureNotNull)(this._model.paneForSource(this._source)).height()),s.borderColor=y),s.coordinate=p.coordinate,s.floatCoordinate=p.floatCoordinate,h||d){const t=this._axisFirstLineText(p,h);e.text=t,this._options.useSolidBodyColor?(s.textColor=this.generateTextColor(s.background),e.borderVisible=!1):(e.borderVisible=!0, s.textColor=y),e.textColor=s.textColor;const i=h&&_?(0,Ve.getOppositeModePriceText)(this._source.priceScale(),p):"";e.secondLine=i,s.secondLineTextColor=s.textColor;const r=d?this._countdownText():"";this._previousCountdown=r,e.thirdLine=r,s.thirdLineTextColor=(0,fe.generateColor)(s.textColor,25),0===t.length&&0===i.length&&0===r.length||(e.visible=!0)}c&&(t.text=this._paneText(c),t.visible=t.text.length>0)}_paneText(e){let t="";const s=this._source.symbolInfo();return Be?t=(0,S.displayedSymbolExchange)(s):e&&(t=(0,S.displayedSymbolName)(s)),t}_axisFirstLineText(e,t){return t?(0,Ve.getCurrentModePriceText)(this._source.priceScale(),e):""}_currentTime(){return window.ChartApiInstance.serverTime()}}var Ee=s(177126),ke=s(175203),Ne=s(95452),Fe=s(855611),Le=s(30574),We=s(782856);function Oe(e){const[t]=function(e){const t=new Set;e.isSpread()&&t.add(We.DataSourceDangerReason.Spread);const s=e.symbolInfo();return"CRYPTOCAP"===(null==s?void 0:s.exchange)&&t.add(We.DataSourceDangerReason.CryptoCap),t}(e);return null!=t?t:null}var Ue=s(710455);const qe={0:{background:"rgba(242, 54, 69, 0.15)",line:"#F23645"},1:{background:"rgba(255, 152, 0, 0.15)",line:"#FF9800"},2:{background:"rgba(8, 153, 129, 0.15)",line:"#089981"}};class je extends Ue.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(){return null}_drawImpl(e){if(null===this._data)return;const t=qe[this._data.predictionCode],s=e.context;s.fillStyle=t.background,s.fillRect(Math.max(0,this._data.startX),0,e.mediaSize.width,e.mediaSize.height),s.strokeStyle=t.line,s.beginPath(),s.lineWidth=1;const i=Math.round(this._data.startX);s.moveTo(i,0),s.lineTo(i,e.mediaSize.height),s.stroke()}}class He{constructor(e,t,s,i){this._renderer=new je,this._startX=0,this._series=t,this._timeScale=e,this._lastKnownBarIndex=s,this._direction=i}update(){this._startX=this._timeScale.indexToCoordinate(this._lastKnownBarIndex)+.5*this._timeScale.barSpacing()+1}renderer(){const e=(0,_.barFunction)("close"),t=this._series.data().bars(),s=e((0,a.ensureNotNull)(t.valueAt(this._lastKnownBarIndex))),i=e((0,a.ensureNotNull)(t.last()).value);let r=0;i>s?r=1:i{null==e||e.abort()};try{s=await this._createStudy(e.signal)}catch(e){return}this._study=s,this._applySeriesPropertiesToStudy(),s.properties().subscribe(this,this._applyStudyPropertiesToSeries),this._applyStudyPropertiesToSeries();const i=e=>{this._status=e,this._onStatusChanged.fire()};s.onStatusChanged().subscribe(this,i),i(s.status()),this._destroyStudy=()=>{var e;s.properties().unsubscribeAll(this),s.onStatusChanged().unsubscribeAll(this),s.stop(),null===(e=s.destroy)||void 0===e||e.call(s),this._status=void 0,this._onStatusChanged.fire(),this._study=null,this._destroyStudy=null},this._series.style()===this.requiredStyle()&&this._study.start()}else null===(s=this._destroyStudy)||void 0===s||s.call(this)}wasCompletedBefore(){var e;return Boolean(null===(e=this._study)||void 0===e?void 0:e.wasCompletedBefore())}status(){return this._status}onStatusChanged(){return this._onStatusChanged}state(e){return{}}restoreState(e,t){}priceRange(e,t){var s,i;return null!==(i=null===(s=this._study)||void 0===s?void 0:s.priceRange(e,t,{scaleSeriesOnly:!1,targetPriceScale:this._series.priceScale()}))&&void 0!==i?i:null}autoScaleInfo(e,t,s){var i;return null===(i=this._study)||void 0===i?void 0:i.autoScaleInfo(e,t,s)}requestMoreDataIndex(){return null}}var Ke=s(70843),Ze=s(832696),Je=s(266325),et=s(142257);class tt extends et.UndoCommand{constructor(e,t,i,r){super(new Qe.TranslatedString("TPO Reset all splits and merges",w.t(null,void 0,s(543775)))),this._binding=e,this._splitsAndMerges=r}redo(){const e=this._binding.state(!1);e.splitsAndMerges={},this._binding.restoreState(e)}undo(){const e=this._binding.state(!1);e.splitsAndMerges=this._splitsAndMerges,this._binding.restoreState(e)}}function st(e,t,s){"state"in e?(e.customFields&&(null==t||t.restoreStateCustomFields(e.customFields)),e.data&&s&&(null==t||t.restoreData(e.data))):null==t||t.restoreStateCustomFields(e)}class it extends Ye{constructor(){super(...arguments),this._state={},this._inputBarBuilder=null}bindToSeriesProperties(e){const t=e.childs().tpoStyle;t.subscribe(this,(()=>{null!==this._study&&this._study.properties().mergeAndFire((0,Ke.prepareStudyPropertiesState)(t.state()))}));const s="tpoStyle.levels";e.setThemedColors([{path:`${s}.pocColor`,colors:Ze.tpoThemedColors.poc},{path:`${s}.poorHighColor`,colors:Ze.tpoThemedColors.poorHigh},{path:`${s}.poorLowColor`,colors:Ze.tpoThemedColors.poorLow},{path:`${s}.singleprintsColor`,colors:Ze.tpoThemedColors.singleprints},{path:`${s}.vahColor`,colors:Ze.tpoThemedColors.vah},{path:`${s}.valColor`,colors:Ze.tpoThemedColors.val}])}requiredStyle(){return 18}state(e){var t,s,i,r,a;return e?null!==(s=null===(t=this._study)||void 0===t?void 0:t.state(!0))&&void 0!==s?s:null:null!==(r=null===(i=this._study)||void 0===i?void 0:i.stateCustomFields())&&void 0!==r?r:"state"in this._state?null!==(a=this._state.customFields)&&void 0!==a?a:{}:this._state}restoreState(e,t){this._state=e, this._withData=t,st(e,this._study,t)}requestMoreDataIndex(){const e=this._series.symbolInfo(),t=this._series.bars().firstIndex(),s=this._series.model().timeScale().logicalRange(),i=this._series.syncModel();if(!e||null===t||!s||!i)return null;const r=Math.floor(s.left()),o=this._series.bars().search(r,m.PlotRowSearchMode.NearestRight);if(!o)return null;const n=this._series.properties().childs().tpoStyle.childs().inputs.childs(),l=function(e,t){switch(e){case"Day":return`${t}D`;case"Week":return`${t}W`;case"Month":return`${t}M`}(0,a.ensureNever)(e)}(n.period.value(),n.periodsNum.value());if(null===this._inputBarBuilder||this._inputBarBuilder.symbolInfo!==e||this._inputBarBuilder.inputResolution!==l){const t=new Y.SessionInfo(e.timezone,e.session,e.session_holidays);this._inputBarBuilder={symbolInfo:e,inputResolution:l,barBuilder:(0,Y.newBarBuilder)(l,t,t)}}const h=this._inputBarBuilder.barBuilder,d=1e3*o.value[0];h.moveTo(d);const u=h.startOfBar(0);return r-(0,K.extrapolateBarsFrontToTime)(i.barBuilder(),u,d,1e3).count}async _createStudy(e){var t;const i=await(0,Je.respectAbort)(e,Promise.resolve().then(s.bind(s,556983))),r=await i.createTpoPeriodicStudy(this._series.model(),tt.bind(this,this));if(e.aborted)throw r.stop(),null===(t=r.destroy)||void 0===t||t.call(r),(0,Je.createAbortError)();return st(this._state,r,this._withData),r.properties().childs().inputs.childs().ticksPerRow.subscribe(this,(e=>{this._series.properties().childs().tpoStyle.childs().inputs.childs().ticksPerRow.setValue(e.value())})),r}_applySeriesPropertiesToStudy(){var e;null===(e=this._study)||void 0===e||e.properties().mergeAndFire((0,Ke.prepareStudyPropertiesState)(this._series.properties().childs().tpoStyle.state()))}_applyStudyPropertiesToSeries(){const e=(0,a.ensureNotNull)(this._study).properties().childs().inputs.childs().ticksPerRow.value();this._series.properties().childs().tpoStyle.childs().inputs.childs().ticksPerRow.setValue(e)}}var rt=s(490515);function at(e,t,s){(null==e?void 0:e.customFields)&&(null==t||t.restoreStateCustomFields(e.customFields)),(null==e?void 0:e.data)&&s&&(null==t||t.restoreData(e.data))}class ot extends Ye{bindToSeriesProperties(e){const t=e.childs().volFootprintStyle,s=t.state();t.hasChild("bgColors")&&t.removeProperty("bgColors"),t.addChild("bgColors",new rt.VolumeFootprintBgColorsProperty(s.bgColors)),t.childs().inputs.subscribe(this,(()=>{null!==this._study&&this._study.properties().childs().inputs.mergeAndFire(t.childs().inputs.state())}))}requiredStyle(){return 17}state(e){var t,s;return null!==(s=null===(t=this._study)||void 0===t?void 0:t.state(e))&&void 0!==s?s:null}restoreState(e,t){this._state=e,this._withData=t,at(e,this._study,t)}async _createStudy(e){var t;const i=await(0,Je.respectAbort)(e,Promise.resolve().then(s.bind(s,205838))),r=await i.createVolumeFootprintStudy(this._series.model());if(e.aborted)throw r.stop(),null===(t=r.destroy)||void 0===t||t.call(r),(0,Je.createAbortError)();return at(this._state,r,this._withData),r}_applySeriesPropertiesToStudy(){var e ;null===(e=this._study)||void 0===e||e.properties().childs().inputs.mergeAndFire(this._series.properties().childs().volFootprintStyle.childs().inputs.state())}_applyStudyPropertiesToSeries(){}}class nt{constructor(e){this._onStatusChanged=new Xe.Delegate,this._bindings=[new it(e),new ot(e)],this._bindings.forEach((e=>e.onStatusChanged().subscribe(this,(()=>this._onStatusChanged.fire()))))}destroy(){this._bindings.forEach((e=>e.destroy()))}bindToSeriesProperties(e){this._bindings.forEach((t=>t.bindToSeriesProperties(e)))}paneViews(e){return this._bindings.reduce(((t,s)=>t.concat(s.paneViews(e))),[])}stop(){this._bindings.forEach((e=>e.stop()))}clearData(){this._bindings.forEach((e=>e.clearData()))}updateAllViews(e){this._bindings.forEach((t=>t.updateAllViews(e)))}syncStudy(e){this._bindings.forEach((t=>t.syncStudy(e)))}onStatusChanged(){return this._onStatusChanged}wasCompletedBeforeForStyle(e){var t,s;return null===(s=null===(t=this._bindings.find((t=>t.requiredStyle()===e)))||void 0===t?void 0:t.wasCompletedBefore())||void 0===s||s}statusForChartStyle(e){var t;return null===(t=this._bindings.find((t=>t.requiredStyle()===e)))||void 0===t?void 0:t.status()}priceRange(e,t){return(0,y.mergePriceRanges)(this._bindings.map((s=>s.priceRange(e,t))))}requestMoreDataIndex(e){var t,s;return null!==(s=null===(t=this._bindings.find((t=>t.requiredStyle()===e)))||void 0===t?void 0:t.requestMoreDataIndex())&&void 0!==s?s:null}getInputsInfoProperties(e){var t,s;return null===(s=null===(t=this._bindings.find((t=>t.requiredStyle()===e)))||void 0===t?void 0:t.properties())||void 0===s?void 0:s.inputs}state(e){return this._bindings.reduce(((t,s)=>(t[s.requiredStyle()]=s.state(e),t)),{})}restoreState(e,t){for(const s of this._bindings){const i=e[s.requiredStyle()];i&&s.restoreState(i,t)}}autoScaleInfos(e,t,s){return this._bindings.map((i=>i.autoScaleInfo(e,t,s))).filter(ye.isExistent)}}var lt=s(234271),ht=s(432078);class dt extends ht.ComputedTimePointWeights{constructor(e){super(),this._middleVolume=e,this._minValidVolume=.9*e}setVolume(e,t){this.setWeight(e,1+Math.log2(Math.max(t,this._minValidVolume)/this._middleVolume))}}class ut extends we.PriceAxisView{constructor(e,t){super(),this._source=e,this._model=t}_updateRendererData(e,t,s){e.visible=!1;const i=this._source;if(!this._model.properties().childs().scalesProperties.childs().showSeriesPrevCloseValue.value())return;if(i.isDWM())return;const r=i.prevClose();if(null===r)return;const a=(0,fe.resetTransparency)(this._source.properties().childs().prevClosePriceLineColor.value());s.background=a,s.textColor=this.generateTextColor(a),s.coordinate=r.coordinate,e.text=(0,Ve.getCurrentModePriceText)(i.priceScale(),r),e.visible=!0}}var ct=s(955831);class _t extends ct.HorizontalLinePaneView{constructor(e){super(),this._series=e,this._model=e.model()}}var pt=s(458963);class mt extends _t{constructor(e){super(e),this._lineRendererData.linestyle=pt.LINESTYLE_DOTTED}_updateImpl(){this._lineRendererData.visible=!1;const e=this._series.properties().childs() ;if(!e.showPrevClosePriceLine.value())return;if(this._series.isDWM())return;const t=this._series.prevClose();null!==t&&(this._lineRendererData.visible=!0,this._lineRendererData.y=t.coordinate,this._lineRendererData.color=e.prevClosePriceLineColor.value(),this._lineRendererData.linewidth=e.prevClosePriceLineWidth.value())}}var yt=s(969419),bt=s(956725),St=s(9640),gt=s(86441),vt=s(63316),ft=s(315801);class wt{constructor(e,t){this._bars=[],this._invalidated=!0,this._isMarkersEnabled=(0,P.enabled)("source_selection_markers"),this._selectionData=null,this._blockSize=0,this._series=e,this._model=t,this._selectionIndexer=new vt.SelectionIndexes(t.timeScale())}update(){this._invalidated=!0}nearestIndex(e,t){var s,i;return null!==(i=null===(s=this.bars().search(e,t))||void 0===s?void 0:s.index)&&void 0!==i?i:null}items(){return this._bars}_updateImpl(){if(this._bars=[],6===this._series.properties().childs().style.value()&&!this._series.data().boxSize)return;const e=this._series.priceScale(),t=this._model.timeScale();if(t.isEmpty()||e.isEmpty())return;const s=t.visibleStrictDataRange(this.bars());if(null===s)return;if(0===this.bars().size())return;if(this._series.data().bars().isEmpty())return;let i=s.firstBar();const r=s.lastBar(),o=this._series.firstValue();if(null===o)return;for(;i<=r;i++){if(null!==this.bars().valueAt(i))break}if(i>r)return;const n=this.bars().range(i,r),l={},h=this._series.properties().childs().style.value(),d=6===h?(0,a.ensureDefined)(this._series.data().boxSize):0;if(n.each(((e,t)=>{l.value=t;const s=this._barItem(l,t,e);return null===s||(l.previousValue=t,this._bars.push(s)),!1})),6===h&&(this._blockSize=(e.priceToCoordinate(0,o)-e.priceToCoordinate(500,o))/500*d),e.barPricesToCoordinates(this._bars,o),t.fillBarBorders(this._bars),this._model.selection().isSelected(this._series)){const s=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,barSpacing:t.barSpacing(),hittestResult:ft.HitTarget.Regular};const i=(0,a.ensureNotNull)(this._model.paneForSource(this._series)).height();this._selectionData.hittestResult=ft.HitTarget.Regular;for(let r=0;r=e.start&&s<=e.end){i=e;break}if(void 0===i)throw new Error("Last price animation internal logic error");const r=i.easing((s-i.start)/(i.end-i.start));return{fillColor:Ht(t,r,i.startFillAlpha,i.endFillAlpha),strokeColor:Ht(t,r,i.startStrokeAlpha,i.endStrokeAlpha),radius:(a=r,o=i.startRadius,n=i.endRadius,o+(n-o)*a)};var a,o,n}class Gt{constructor(e){this._renderer=new Ut,this._invalidated=!0,this._stageInvalidated=!0,this._startTime=performance.now(),this._endTime=this._startTime-1,this._series=e}update(e){if(this._invalidated=!0,"data-source-change"===e.type&&e.sourceId===this._series.id()&&e.realtime&&this._series.seriesLoaded()){const e=performance.now(),t=this._endTime-e;if(t>0)return void(t<650&&(this._endTime+=2600));this._startTime=e,this._endTime=e+2600}}invalidateStage(){this._stageInvalidated=!0}animationActive(){return performance.now()<=this._endTime}stopAnimation(){this._endTime=this._startTime-1}renderer(e){return this._invalidated?(this._updateImpl(e),this._invalidated=!1,this._stageInvalidated=!1):this._stageInvalidated&&(this._updateRendererDataStage(),this._stageInvalidated=!1),this._renderer}_updateImpl(e){this._renderer.setData(null);const t=this._series.model().timeScale(),s=t.visibleBarsStrictRange(),i=this._series.firstValue(),r=this._series.lastValueData(void 0,!0,!0);if(null===s||null===i||void 0===r.index||void 0===r.price||!s.contains(r.index))return;const a=new gt.Point(t.indexToCoordinate(r.index),this._series.priceScale().priceToCoordinate(r.price,i)),o=r.color,n=this._series.properties().childs();let l;switch(this._series.style()){case 3:l=n.areaStyle.childs().linewidth.value();break;case 10:const t=n.baselineStyle,s=Math.round(e.mediaSize.height*(Math.abs(100-t.childs().baseLevelPercentage.value())/100));l=a.y<=s?t.childs().topLineWidth.value():t.childs().bottomLineWidth.value();break;case 14:l=n.lineWithMarkersStyle.childs().linewidth.value();break;case 15:l=n.steplineStyle.childs().linewidth.value();break;default:l=n.lineStyle.childs().linewidth.value()}const h=zt(this._duration(),o);this._renderer.setData({seriesLineColor:o,seriesLineWidth:l,fillColor:h.fillColor,strokeColor:h.strokeColor,radius:h.radius,center:a})}_updateRendererDataStage(){const e=this._renderer.data();if(null!==e){const t=zt(this._duration(),e.seriesLineColor);e.fillColor=t.fillColor,e.strokeColor=t.strokeColor,e.radius=t.radius}}_duration(){return this.animationActive()?performance.now()-this._startTime:2599}}var $t=s(877009),Xt=s(401580),Qt=s(175878),Yt=s(826989),Kt=s(276871);const Zt=P.enabled("chart_style_hilo_last_price") ;class Jt extends _t{constructor(e){super(e),this._lineRendererData.linestyle=pt.LINESTYLE_DOTTED}_updateImpl(){this._lineRendererData.visible=!1;const e=this._series.properties().childs();if(!e.showPriceLine.value())return;if(!Zt&&12===e.style.value())return;const t=this._series.lastValueData(void 0,!0);t.noData||(this._lineRendererData.visible=!0,this._lineRendererData.y=t.coordinate,this._lineRendererData.color=this._series.priceLineColor(t.color),this._lineRendererData.linewidth=e.priceLineWidth.value())}}var es=s(147664),ts=s(262550),ss=s(142119),is=s(230058),rs=s(756930),as=s(787123);class os extends rs.PaneRendererSeriesBase{constructor(e){super(),this._barSpacing=1,this._barWidth=1,this._isPriceScaleInverted=!1,this._bars=e.bars,this._barSpacing=e.barSpacing,this._isPriceScaleInverted=e.isPriceScaleInverted}_drawImpl(e){const{context:t,horizontalPixelRatio:s,verticalPixelRatio:i}=e;t.save(),this._barWidth=Math.round(this._barSpacing*s),this._drawWicks(t,s,i),this._drawBorder(t,s,i),this._drawBars(t,s,i)}_getTolerance(){return(0,St.interactionTolerance)().series+.5}_drawBars(e,t,s){let i="",r=null;const a=this._calculateBorderWidth(t);for(const o of this._bars){if(this._barWidth<=2*a)continue;let n=Math.round(Math.min(o.open,o.close)*s),l=Math.round(Math.max(o.open,o.close)*s),h=Math.round(o.center*t)-Math.floor(.5*this._barWidth),d=h+this._barWidth-1;if(o.color!==i){const t=o.color;e.fillStyle=t,i=t}null!==r&&(h=Math.max(r+1,h-1),h=Math.min(h,d)),r=d,h+=a,n+=a,d-=a,l-=a,n>l||e.fillRect(h,n,d-h+1,l-n+1)}}_drawBorder(e,t,s){const i=this._calculateBorderWidth(t);let r="",a=null;for(const o of this._bars){o.borderColor!==r&&(e.fillStyle=o.borderColor,r=o.borderColor);let n=Math.round(o.center*t)-Math.floor(.5*this._barWidth);const l=n+this._barWidth-1,h=Math.round(Math.min(o.open,o.close)*s),d=Math.round(Math.max(o.open,o.close)*s);if(null!==a&&(n=Math.max(a+1,n-1),n=Math.min(n,l)),this._barSpacing*t>2*i)(0,as.fillRectInnerBorder)(e,n,h,l-n+1,d-h+1,i);else{const t=l-n+1;e.fillRect(n,h,t,d-h+1)}a=l}}_drawWicks(e,t,s){const i=this._bars;let r=Math.min(Math.floor(t),Math.floor(this._barSpacing*t));r=Math.max(Math.floor(t),Math.min(r,this._barWidth));const a=Math.floor(.5*r);let o="";for(const n of i){n.wickColor!==o&&(e.fillStyle=n.wickColor,o=n.wickColor);let i=Math.round(Math.min(n.open,n.close)*s),l=Math.round(Math.max(n.open,n.close)*s);this._isPriceScaleInverted&&([l,i]=[i,l]);const h=Math.round(n.high*s),d=Math.round(n.low*s),u=Math.round(t*n.center)-a,c=u+r-1-u+1;e.fillRect(u,h,c,i-h),d!==l&&e.fillRect(u,l+1,c,d-l-1)}}_calculateBorderWidth(e){let t=Math.floor(e);this._barWidth<=2*t&&(t=Math.floor(.5*(this._barWidth-1)));const s=Math.max(Math.floor(e),t);return this._barWidth<=2*s?Math.floor(e):s}}class ns extends Pt{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars,barSpacing:this._model.timeScale().barSpacing(),isPriceScaleInverted:this._series.priceScale().isInverted()},t=new ss.CompositeRenderer;return t.append(new os(e)), this._model.selection().isSelected(this._series)&&this._isMarkersEnabled&&this._selectionData&&t.append(new is.SelectionRenderer(this._selectionData)),t}}class ls extends Ct{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars,barSpacing:this._model.timeScale().barSpacing(),isPriceScaleInverted:this._series.priceScale().isInverted()};return new os(e)}}class hs extends Pt{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars,barSpacing:.9*this._model.timeScale().barSpacing(),isPriceScaleInverted:this._series.priceScale().isInverted()},t=new ss.CompositeRenderer;return t.append(new os(e)),this._model.selection().isSelected(this._series)&&this._isMarkersEnabled&&this._selectionData&&t.append(new is.SelectionRenderer(this._selectionData)),t}}class ds extends Ct{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars,barSpacing:.9*this._model.timeScale().barSpacing(),isPriceScaleInverted:this._series.priceScale().isInverted()};return new os(e)}}var us,cs=s(203308);class _s extends rs.PaneRendererSeriesBase{constructor(e){super(),this._bars=e.bars,this._barSpacing=e.barSpacing,this._barLineWidth=Math.max(1,(0,St.optimalBarWidth)(e.barSpacing,1))}_drawImpl(e){const{context:t,horizontalPixelRatio:s,verticalPixelRatio:i}=e;let r,a,o;t.save(),t.lineCap="square";const n=Math.floor(s)%2?1:0;for(const e of this._bars){const l=Math.round(s*this._barLineWidth*.5),h=Math.round(s*e.center-l),d=void 0===a||e.isUp?Math.round(i*e.high-l):a,u=2*l;let c;if(e.isTwoColorBar){const s=Math.round(i*e.additionalPrice-i*e.high+l),a=d+s,o=Math.round(i*e.low-i*e.additionalPrice+l),_=void 0!==r&&e.isUp?r:a+o;t.fillStyle=e.upColor,t.fillRect(h,d,u+n,s),t.fillStyle=e.downColor,t.fillRect(h,a,u+n,_+l-a+1),c=_}else{const s=Math.round(i*e.low-i*e.high+l),a=void 0!==r&&e.isUp?r:d+s;t.fillStyle=e.color,t.fillRect(h,d,u+n,a+l-d+1),c=a}if(!e.combinedWithProjection){e.isTwoColorBar?t.fillStyle=e.isUp?e.downColor:e.upColor:t.fillStyle=e.color;const r=void 0===o?Math.round((e.center-this._barSpacing)*s+l):o+2*l,h=Math.round(e.center*s-l)-r+1,d=2*l+n;if(e.isUp)t.fillRect(r,c-l+1-n,h,d);else{const s=void 0===a?Math.round(e.open*i-l):a;t.fillRect(r,s,h,d)}}o=h,r=c,a=d}t.restore()}_getTolerance(){return(0,St.interactionTolerance)().series+this._barLineWidth/4}}function ps(e,t){const s={};return s.upColor=e.upColor,s.downColor=e.downColor,s.isTwoColorBar=e.isTwoColorBar,(0,cs.default)(t)&&(s.additionalPrice=t),s}class ms extends Pt{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars,barSpacing:this._model.timeScale().barSpacing()},t=new ss.CompositeRenderer;return t.append(new _s(e)),this._model.selection().isSelected(this._series)&&this._isMarkersEnabled&&this._selectionData&&t.append(new is.SelectionRenderer(this._selectionData)),t}_barItem(e,t,s){const i=super._barItem(e,t,s);if(null===i)return null;const r=ps(this._series.barColorer().barStyle(s,!1,e),t[6]);return{...i,...r}}} class ys extends Ct{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars,barSpacing:this._model.timeScale().barSpacing()};return new _s(e)}_barItem(e,t,s){const i=super._barItem(e,t,s);if(null===i)return null;const r=this._series.barColorer().barStyle(s,!0,e),o=t[6],n=ps(r,o);return(0,cs.default)(o)&&i.timePointIndex===(0,a.ensureNotNull)(this.bars().lastIndex())&&(n.combinedWithProjection=!0),{...i,...n}}}!function(e){e[e.EllipseWidth=.9]="EllipseWidth",e[e.EllipseRadius=.95]="EllipseRadius",e[e.SimplifiedEllipseWidth=.86]="SimplifiedEllipseWidth"}(us||(us={}));class bs extends rs.PaneRendererSeriesBase{constructor(e){super(),this._bars=e.bars,this._barSpacing=e.barSpacing,this._barWidth=e.barSpacing}_drawImpl(e){const{context:t,horizontalPixelRatio:s,verticalPixelRatio:i}=e;if(0===this._bars.length)return;t.save();const r=this._bars.reduce(((e,t)=>Math.max(e,(t.low-t.high)/t.additionalNum)),0);this._barSpacing>1&&r>=1?this._drawFillSigns(t,s,i):this._drawSimplified(t,s,i),t.restore()}_getTolerance(){return(0,St.interactionTolerance)().series+this._barWidth/8}_drawBarCross(e,t,s,i){!function(e,t,s,i,r){e.moveTo(t,s),e.lineTo(t+i,s+r),e.moveTo(t+i,s),e.lineTo(t,s+r)}(e,t.center-.5*this._barWidth,t.high+i*s,this._barWidth,s)}_drawBarEllipse(e,t,s,i){!function(e,t,s,i,r){e.save(),e.translate(t+i/2,s+r/2),e.scale(i/2,r/2),e.moveTo(1,0),e.arc(0,0,us.EllipseRadius,0,2*Math.PI,!1),e.restore()}(e,t.center-this._barWidth*us.EllipseWidth*.5,t.high+i*s,this._barWidth*us.EllipseWidth,s)}_drawFillSigns(e,t,s){e.scale(t,s),e.lineCap="butt",e.lineWidth=1;for(const t of this._bars){const s=(t.low-t.high)/t.additionalNum;if(t.isMergedBar&&(e.beginPath(),t.isUp?this._drawBarEllipse(e,t,s,t.additionalNum-1):this._drawBarCross(e,t,s,0),e.strokeStyle=t.isUp?t.downColor:t.upColor,e.stroke()),e.beginPath(),t.isUp)for(let i=t.additionalNum-1-(t.isMergedBar?1:0);i>-1;i--)this._drawBarCross(e,t,s,i);else for(let i=t.isMergedBar?1:0;ie.value.splice(7,1))),t}function Js(e){const{seriesStatus:t,additionalStudyStatus:s}=e;if(v.seriesLoadingStatuses.has(t))return 2;if(s){if(4!==t&&s.type===Ws.StudyStatusType.Error)return 13 ;if(v.seriesReadyStatuses.has(t)&&(s.type===Ws.StudyStatusType.Loading||s.type===Ws.StudyStatusType.Undefined))return 2}return t}class ei extends u.PriceDataSource{constructor(e,t,o,l){var h,u,c;t.removeProperty("currencyId"),super(e,"_seriesId"),this.requestingTicksWhenNotSupported=new Xe.Delegate,this.requestingIntradayWhenNotSupported=new Xe.Delegate,this.requestingStyleIsNotSupported=new Xe.Delegate,this.requestingStyleSupportRecovered=new Xe.Delegate,this.requestingResolutionLessThanFrequency=new Xe.Delegate,this._paneView=null,this._futureBarsPaneView=null,this._projectionBarsPaneView=null,this._waterlineView=null,this._priceLineView=null,this._gotoDateView=null,this._baseHorizontalLineView=null,this._priceStep=null,this._symbolInfo=null,this._isPrePostMarketPricesAvailableProperty=new b.Property(!1),this._isBackAdjustmentForbiddenProperty=new b.Property(!0),this._isSettlementAsCloseForbiddenProperty=new b.Property(!0),this._highLowPriceCache=new Map,this._averagePriceCache=new Map,this._prevClosePriceAxisView=null,this._priceScaleAboutToBeChanged=new Xe.Delegate,this._onRestarted=new Xe.Delegate,this._onStatusChanged=new Xe.Delegate,this._tagsChanged=new Xe.Delegate,this._intervalChanged=new Xe.Delegate,this._sessionIdChanged=new Xe.Delegate,this._requestMoreDataAvailable=!0,this._lineStyleLastPriceCirclePaneView=new Gt(this),this._prevClosePriceLineView=null,this._dataPoweredBy=null,this._symbolResolvingActive=new Xt.WatchedValue(!1),this._predictBars=0,this._syncModel=null,this._data=null,this._lastCompleteFlags=null,this._haStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(8,!0))},this._renkoStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(4,!0))},this._pbStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(7,!0))},this._kagiStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(5,!0))},this._pnfStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(6,!0))},this._rangeStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(11,!0))},this._volFootprintStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(17,!0))},this._tpoStyle={studyId:(0,a.ensureNotNull)((0,S.chartStyleStudyId)(18,!0))},this._barColorerCache=null,this._boxSizeValue=new Xt.WatchedValue,this._base=100,this._pointValue=1,this._formattingDeps=null,this._defaultFormatter=new g.PriceFormatter(this._base),this._formatter=new g.PriceFormatter(this._base),this._ignoreMinMoveFormatter=new g.PriceFormatter(this._base),this._ignoreMinMovePriceStep=null,this._lastBarCloseTime=null,this._onSessionIdPropertyChangedBound=this._onSessionIdPropertyChanged.bind(this),this._ignoreSessionIdProxyPropertyChanges=!1,this._textSourceIsAlwaysTickerRestrictionEnabled=!1,this._lastPriceAnimationActive=!1,this._currentSession="out_of_session",this._onStyleChanged=new Xe.Delegate,this._intervalObj=null,this._obsoleteZOrder=0,this._seriesErrorMessage=null,this._seriesAlwaysFalseHibernatedVW=new Xt.WatchedValue(!1),this._styleToRecover=null,this._precomputedBarStyles=new WeakMap,this._doNotShowLastAvailableBar=!1, this._gotoDateResultCleared=!1,this._endOfDataPaneView=null,this._pendingTimeRange=null,this._replaySubscriber=null,this._symbolIntervalChanged=new Xe.Delegate,this._isReplayResolutionAvailableForUser=null,this._onInReplayStateChanged=new Xe.Delegate,this._replayExitedDueUnsupportedInterval=new Xe.Delegate,this._replayExitedDueUnavailableForUserInterval=new Xe.Delegate,this._onTimeFrameApplied=new Xe.Delegate,this._seriesLoaded=!1,this._seriesCompleted=!1,this._status=new Xt.WatchedValue({seriesStatus:0}),this._prevRequestedInterval="",this._isActingAsSymbolSource=new Xt.WatchedValue(!0),this._countdownUpdateTimer=null,this._deferredDestroyed=(0,d.createDeferredPromise)(),this._volumePointWeights=null,this._studyBindings=null,this._updateTimeScaleTimePointWeights=()=>{this._model.timeScale().setTimePointWeights(19===this.style()?this._volumePointWeights:null)},this._seriesStatus=(0,Ls.combine)(Js,this._status.weakReference()),this._studyBindings=new nt(this),this._studyBindings.onStatusChanged().subscribe(this,(()=>{var e;const t=this.status(),s=this._status.value(),i=null===(e=this._studyBindings)||void 0===e?void 0:e.statusForChartStyle(this.style());this._updateStatus({...this._status.value(),additionalStudyStatus:i}),this.status()!==t&&(this._statusView.update(),this._model.updateSource(this)),(0,r.default)(s,this._status)||this._onStatusChanged.fire()})),this._seriesSource=new Qt.SeriesDataSource(e.chartApi(),"s",l);const _=this._seriesSource.dataEvents();_.symbolResolved().subscribe(this,this._onSymbolResolved),_.symbolError().subscribe(this,this._onSymbolError),_.seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),_.seriesError().subscribe(this,this._onSeriesError),_.loading().subscribe(this,this._onSeriesLoading),_.completed().subscribe(this,this._onSeriesCompleted),_.dataUpdated().subscribe(this,this._onDataUpdated),_.barReceived().subscribe(this,this._onBarReceived),this._quotesProvider=new ve.QuotesProvider(void 0,e.collapsed().spawnOwnership()),this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const p=t.childs();if(t.hasChild("extendedHours")){(0,a.ensureDefined)(p.extendedHours).value()&&!t.hasChild("sessionId")&&t.addChild("sessionId",new b.Property("extended")),t.removeProperty("extendedHours")}t.hasChild("sessionId")||t.addChild("sessionId",new b.Property(i.Regular)),(0,Ns.allChartStyles)().includes(p.style.value())||p.style.setValueSilently(2);const m=p.lineStyle.childs();if(p.lineStyle.hasChild("styleType")){let e,t;const s=m.styleType.value();0===s&&(t=14,e=p.lineWithMarkersStyle.childs()),1===s&&(t=15,e=p.steplineStyle.childs()),e&&(e.color.setValueSilently(m.color.value()),e.linestyle.setValueSilently(m.linestyle.value()),e.linewidth.setValueSilently(m.linewidth.value()),e.priceSource.setValueSilently(m.priceSource.value())),void 0!==t&&2===p.style.value()&&p.style.setValue(t),p.lineStyle.removeProperty("styleType")}null===(h=this._studyBindings)||void 0===h||h.bindToSeriesProperties(t),this._setProperties(t), this._sessionIdProxyProperty=new b.Property(p.sessionId.value()),p.sessionId.subscribe(this,(()=>this._updateSessionIdProxyProperty())),this._sessionIdProxyProperty.subscribe(this,this._onSessionIdProxyPropertyChanged),this._symbolTextSourceProxyProperty=new b.Property,this._recalcSymbolTextSourceProxyProperty(),p.statusViewStyle.childs().symbolTextSource.subscribe(this,this._recalcSymbolTextSourceProxyProperty),this._symbolTextSourceProxyProperty.subscribe(this,(()=>e.lightUpdate())),this._options=(0,ye.merge)((0,ye.clone)(Ys),o),this._prevChartStyle=p.style.value(),this._priceAxisView=new Me(this,e,{alwaysShowGlobalLast:!Hs,showCountdown:o.countdownEnabled});let y=null;Os||Hs||(y=new Me(this,e,{visibleOnHistoryOnly:!0,showSymbolLabel:!1,showCountdown:!1,alwaysShowGlobalLast:!1,useSolidBodyColor:!1})),this._priceLinePriceAxisView=new Tt.SeriesPriceLineAxisView(this),this._priceLineAxisViews=[this._priceLinePriceAxisView];const f=new Vt(this,e,{showCountdown:o.countdownEnabled});this._priceAxisViews=[this._priceAxisView,f],null!==y&&this._priceAxisViews.push(y),this._prevClosePriceAxisView=new ut(this,e),this._priceAxisViews.unshift(this._prevClosePriceAxisView),this._prevClosePriceLineView=new mt(this),this._panePriceAxisView=new Dt.PanePriceAxisView(this._priceAxisView,this,e),this._historyPricePanePriceAxisView=null!==y?new Dt.PanePriceAxisView(y,this,e):null,this._projectionPriceAxisView=new Dt.PanePriceAxisView(f,this,e),this._labelPaneViews=[this._panePriceAxisView,this._projectionPriceAxisView],null!==this._historyPricePanePriceAxisView&&this._labelPaneViews.push(this._historyPricePanePriceAxisView),this._highLowAvgPaneViews=[],this._averagePaneViews=[],this._createHighLowAvgViews(),this._subscribeRestartToSessionIdChange(),p.visible.subscribe(this,this._updateLastPriceAnimationActive),this._updateLastPriceAnimationActive(),p.minTick.subscribe(this,this._onMinTickChanged),this._dataWindowView=new U(this,e),this._legendView=new G(this,e),this._statusView=new R(this,p.statusViewStyle),this._marketStatusModel=new $.MarketStatusModel(this._quotesProvider),this._dataUpdatedModeModel=Us?new _e({getter:this.symbolInfo.bind(this),onChange:_.symbolResolved()},{getter:this.status.bind(this),onChange:this._onStatusChanged},{getter:()=>{var e;return null===(e=this._lastCompleteFlags)||void 0===e?void 0:e.rt_update_period},onChange:_.completed()},p.symbol.listeners()):null,this._dataProblemModel=new ge(this._quotesProvider,p.symbol.listeners()),p.backAdjustment.subscribe(this,(()=>{this.isStarted()&&this.restart()})),p.settlementAsClose.subscribe(this,(()=>{this.isDWM()&&this.isStarted()&&this.restart()})),this._symbolResolvingActive.subscribe((()=>e.realignLineTools())),this._intervalChanged.subscribe(this,(()=>e.realignLineTools())),P.enabled("widget")||Promise.all([s.e(67681),s.e(1893),s.e(42381),s.e(38697),s.e(86282),s.e(47821),s.e(90624),s.e(95348),s.e(17771),s.e(90385),s.e(62526),s.e(66849)]).then(s.bind(s,271804)).then((e=>{this._endOfDataPaneView=new e.EndOfDataLollipopPaneView(this)})), null===(u=this._studyBindings)||void 0===u||u.syncStudy(this.style()),ze.alertsAvailable&&this._symbolResolvingActive.subscribe(this._updateAlertCreationAvailable.bind(this)),this.createPaneView(),this._properties.addExcludedKey("visible",1),this._properties.addExcludedKey("currencyId",1),this._futureBarsPaneView=null,this._priceLineView=null,this._baseHorizontalLineView=new Fs(this);for(const[,e]of Object.entries(v.STYLE_SHORT_NAMES))null===(c=this._properties.child(`${e}Style`))||void 0===c||c.subscribe(this,(()=>this.invalidateBarStylesCache()));const w=p.renkoStyle.childs().inputs.childs();w.boxSize.subscribe(this,this.restart),w.style.subscribe(this,this.restart),w.atrLength.subscribe(this,this.restart),w.wicks.subscribe(this,this.restart),w.sources.subscribe(this,this.restart),p.pbStyle.childs().inputs.childs().lb.subscribe(this,this.restart);const C=p.kagiStyle.childs().inputs.childs();C.reversalAmount.subscribe(this,this.restart),C.style.subscribe(this,this.restart),C.atrLength.subscribe(this,this.restart);const x=p.pnfStyle.childs().inputs.childs();x.boxSize.subscribe(this,this.restart),x.reversalAmount.subscribe(this,this.restart),x.sources.subscribe(this,this.restart),x.style.subscribe(this,this.restart),x.atrLength.subscribe(this,this.restart),x.oneStepBackBuilding.subscribe(this,this.restart),p.rangeStyle.childs().inputs.childs().phantomBars.subscribe(this,this.restart),this._isDWMProperty=new b.Property(this.isDWM()),this._onRestarted.subscribe(this,(()=>this._isDWMProperty.setValue(this.isDWM()))),p.dividendsAdjustment.subscribe(this,(()=>{const e=p.dividendsAdjustment.value();(0,n.trackEvent)("Dividends adjust",!0===e?"On":"Off"),this.restart()})),this._dataPoweredBy=null,p.showCountdown.subscribe(this,this._onShowCountdownChanged),this._onShowCountdownChanged(p.showCountdown),this._recreatePriceFormattingDependencies(),p.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),p.lineWithMarkersStyle.childs().priceSource.subscribe(this,this._updateBarFunction),p.steplineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),p.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),p.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),p.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),p.tpoStyle.childs().priceSource.listeners().subscribe(this,this._updateBarFunction),this._updateBarFunction()}setId(e){var t;super.setId(e),null===(t=(0,lt.getPersistentLogger)())||void 0===t||t.addPersistentLogEntry(`Set series Id to ${e}`,h.LOGLEVEL.INFO,"chart.series")}supportsPressedChunks(){return!0}pressedChunks(e,t){return this.data().pressedChunks(e,t)}seriesErrorMessage(){const{seriesStatus:e,additionalStudyStatus:t}=this._status.value();return this.isFailed()?this._seriesErrorMessage:v.seriesLoadingStatuses.has(e)?null:(null==t?void 0:t.type)===Ws.StudyStatusType.Error?(0,Ws.convertStudyStatusToString)({type:Ws.StudyStatusType.Error,errorDescription:t.errorDescription},!0):null}destroy(){this._seriesStatus.destroy(), this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),this.clearGotoDateResult(),this._legendView.destroy(),this._marketStatusModel.destroy(),this._studyBindings&&this._studyBindings.destroy(),null!==this._dataUpdatedModeModel&&this._dataUpdatedModeModel.destroy(),this._dataProblemModel.destroy(),this._paneView&&this._paneView.destroy&&this._paneView.destroy(),this._seriesSource.destroy(),this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),this._model.timeScale().visibleBarsStrictRangeChanged().unsubscribeAll(this),this._unsubscribeRestartToSessionIdChange(),this._replayExitedDueUnsupportedInterval.destroy(),this._replayExitedDueUnavailableForUserInterval.destroy(),this._onTimeFrameApplied.destroy(),this._deferredDestroyed.resolve(),this._properties.destroy(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}barColorer(){if(this._barColorerCache)return this._barColorerCache;let e=null;const t=this._model.dataSources();for(let s=t.length-1;s>=0;s--){const i=t[s];if((0,Rs.isStudy)(i)&&i.hasBarColorer()&&!i.isSourceHidden()){const t=(0,a.ensureNotNull)(i.barColorer());null===e?e=t:e.pushBackBarColorer(t)}}return null===e?e=new As.SeriesBarColorer(this):e.pushBackBarColorer(new As.SeriesBarColorer(this)),this._barColorerCache=e,e}createPaneView(){this._paneView=null,this._projectionBarsPaneView=null,this._waterlineView=null,this._priceLineView=this.hasClosePrice()?new Jt(this):null;const e=this._properties.childs().style.value();switch(e){case 0:this._paneView=new ws.SeriesBarsPaneView(this,this._model);break;case 17:case 19:case 1:this._paneView=new Ps.SeriesCandlesPaneView(this,this._model,1===e||19===e?1:.2);break;case 2:case 18:case 14:case 15:this._paneView=new Cs.SeriesLinePaneView(this,this._model);break;case 3:this._paneView=new xs.SeriesAreaPaneView(this,this._model);break;case 16:this._paneView=new Is.SeriesHLCAreaPaneView(this,this._model);break;case 8:this._paneView=new Ts(this,this._model);break;case 9:this._paneView=new Vs.SeriesHollowCandlesPaneView(this,this._model);break;case 13:this._paneView=new fs.SeriesColumnsPaneView(this,this._model);break;case 10:{this._paneView=new Ds.SeriesBaselinePaneView(this,this._model);const e=this._properties.childs().baselineStyle.childs();this._waterlineView=new es.SeriesWaterlinePaneView({paneHeight:()=>this.priceScale().height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:this._paneView=new ts.SeriesHiLoPaneView(this,this._model)}switch(e){case 4:this._paneView=new ns(this,this._model),this._projectionBarsPaneView=new ls(this,this._model);break;case 7:this._paneView=new hs(this,this._model),this._projectionBarsPaneView=new ds(this,this._model);break;case 5:this._paneView=new ms(this,this._model),this._projectionBarsPaneView=new ys(this,this._model);break;case 6:this._paneView=new gs(this,this._model),this._projectionBarsPaneView=new vs(this,this._model)} if(11===e&&(this._properties.childs().rangeStyle.childs().barStyle.value()===Es.RangeBarStyle.Bars?(this._paneView=new ws.SeriesBarsPaneView(this,this._model),this._projectionBarsPaneView=new xt(this,this._model)):(this._paneView=new Ps.SeriesCandlesPaneView(this,this._model),this._projectionBarsPaneView=new It(this,this._model))),null===this._paneView)throw Error("Unknown chart style assigned: "+e)}properties(){return this._properties}zorder(){return 0}quotesProvider(){return this._quotesProvider}currentSession(){return this._currentSession}syncModel(){if(!this._syncModel){const e=this.symbolInfo(),t=this.interval();if(!e||!t)return null;this._syncModel=new ee(e,t)}return this._syncModel}labelPaneViews(){return this._labelPaneViews}topPaneViews(){const e=[];if(null!==this._gotoDateView&&e.push(this._gotoDateView),this._lastPriceAnimationActive){const t=this._lineStyleLastPriceCirclePaneView;t.animationActive()&&setTimeout((()=>this._model.invalidate($t.InvalidationMask.cursor())),0),t.invalidateStage(),e.push(t)}return 0!==e.length?e:null}paneViews(e){var t,s;if(!this.properties().childs().visible.value()||!this._model.isSnapshot()&&!this._wasCompletedBefore())return null;const i=[(0,a.ensureNotNull)(this._baseHorizontalLineView),(0,a.ensureNotNull)(this._paneView)];return i.push(...null!==(s=null===(t=this._studyBindings)||void 0===t?void 0:t.paneViews(e))&&void 0!==s?s:[]),this._endOfDataPaneView&&i.push(this._endOfDataPaneView),this._futureBarsPaneView&&i.push(this._futureBarsPaneView),this._projectionBarsPaneView&&i.push(this._projectionBarsPaneView),null!==this._waterlineView&&i.push(this._waterlineView),i.push((0,a.ensureNotNull)(this._prevClosePriceLineView)),null!==this._priceLineView&&i.push(this._priceLineView),window.TradingView.printing&&this._lastPriceAnimationActive&&(this._lineStyleLastPriceCirclePaneView.stopAnimation(),i.push(this._lineStyleLastPriceCirclePaneView)),i.push(...this._highLowAvgPaneViews),i.push(...this._averagePaneViews),i}priceAxisViews(e,t){return e.findTargetPriceAxisViews(this,t,this._priceAxisViews,this._priceLineAxisViews)}clearHighLowPriceCache(){this._highLowPriceCache.clear()}clearAveragePriceCache(){this._averagePriceCache.clear()}priceScale(){return(0,a.ensureNotNull)(this._priceScale)}setPriceScale(e){this._priceScale!==e&&(this._priceScaleAboutToBeChanged.fire(),this._priceScale=e,this._properties.removeProperty("priceAxisProperties"),this._properties.addChild("priceAxisProperties",e.properties()),this._properties.childs().priceAxisProperties.childChanged(null,""),(0,l.emit)("series_event","price_scale_changed"),this._priceScaleChanged.fire(e))}priceScaleChanged(){return this._priceScaleChanged}priceScaleAboutToBeChanged(){return this._priceScaleAboutToBeChanged}applyPreferences(e){const t=(0,ye.clone)(e);this.priceScale().setMode({autoScale:t.priceAxisProperties.autoScale,percentage:t.priceAxisProperties.percentage,log:t.priceAxisProperties.log,lockScale:t.priceAxisProperties.lockScale}),this.setChartStyleWithIntervalIfNeeded(t.style);const{style:s,interval:i,...r}=t ;this._properties.mergePreferences(r),this._properties.saveDefaults(),this.createPaneView(),this.invalidateBarStylesCache()}disconnect(){var e;null===(e=this._studyBindings)||void 0===e||e.stop(),this._seriesSource.stop(),this._predictBars=0,this._updateStatus({...this._status.value(),seriesStatus:0}),this._model.isSnapshot()||(this._symbolInfo=null)}isStarted(){return this._seriesSource.isStarted()}isCompleted(){return this._seriesCompleted}restart(){if(5===this._status.value().seriesStatus)return;this._seriesLoaded=!1,this._seriesCompleted=!1,this._lastCompleteFlags=null,this._onRestarted.fire(),this._setStatus(1),this._updateSymbolInfo(null);let e=this._properties.childs().interval.value();Q.Interval.isEqual(e,this._prevRequestedInterval)&&this._notifyIntervalChanged(e);let t=null;this._pendingTimeRange&&(t=this._pendingTimeRange,this._pendingTimeRange=null),this._removeReplaySubscriber(),this._onBeforeModifySeries(this.getSymbolString(),e),this._onTimeFrameApplied.fire(t),e=(0,Kt.getServerInterval)(e),this._data=null,this.model().recalcVisibleRangeStudies(c.RecalcVisibleRangeStudiesReason.SeriesRestart),this._seriesSource.modifySeries(this._getResolvingSymbolObject(),e,t),this._seriesSource.isStarted()||this._seriesSource.start(),this._prevRequestedInterval=this.interval(),this.updateAllViews((0,De.sourceChangeEvent)(this.id())),this._model.lightUpdate()}isSymbolInvalid(){return 4===this._status.value().seriesStatus}getSymbolString(){return(0,Ot.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject())}invalidateBarStylesCache(e){Xs.logDebug("Invalidate style cache starting from "+e),this._clearStylePlot(this.bars(),e),this._clearStylePlot(this.nsBars())}isLoading(){return v.seriesLoadingStatuses.has(this.statusWV().value())}isFailed(){return 12===this.status()||4===this.status()||10===this.status()}isStatusError(){return 12===this.status()}actualSymbol(){return(0,S.actualSymbol)(this.symbolInfo(),this.symbol())}proSymbol(){return(0,S.proSymbol)(this.symbolInfo(),this.symbol())}onStyleChanged(){return this._onStyleChanged}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}isRangeBasedStyle(){return(0,S.isRangeBasedStyle)(this.style())}symbolSameAsCurrent(e){return this.symbol()===e||(0,Wt.symbolSameAsCurrent)(e,this._symbolInfo)}symbolSameAsResolved(e){return this._model.isSnapshot()?this.symbolSameAsCurrent(e):this._seriesSource.symbolSameAsResolved(e)}status(){return this._seriesStatus.value()}statusWV(){return this._seriesStatus}compositeStatusVW(){return this._status}symbol(){return this.properties().childs().symbol.value()}symbolChanged(){return this.properties().childs().symbol.listeners()}seriesSource(){return this._seriesSource}symbolInfo(){return this._symbolInfo}symbolResolved(){return this.dataEvents().symbolResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._seriesAlwaysFalseHibernatedVW}getSymbolName(){return this._symbolInfo?this._symbolInfo.name:""}firstValue(){const e=this.firstBar() ;return null===e?null:this._barFunction(e,0)}firstBar(){const e=this.model().timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar(),s=this.data().search(t,m.PlotRowSearchMode.NearestRight);return null!==s?s.value:null}formatter(e=!0){return e?this._formatter:this._ignoreMinMoveFormatter}defaultFormatter(){return this._defaultFormatter}priceStep(e=!0){return e?this._priceStep:this._ignoreMinMovePriceStep}bars(){return this.data().bars()}nsBars(){return this.data().nsBars()}interval(){return this.properties().childs().interval.value()}setInterval(e){this.setSymbolParams({interval:e})}intervalObj(){const e=this.interval();if(null!==this._intervalObj&&this._intervalObj.resolutionString===e)return this._intervalObj.interval;const t=Q.Interval.parse(e);return this._intervalObj={resolutionString:e,interval:t},t}prevClose(){const e=this.priceScale();if(e.isEmpty()||this.data().isEmpty())return null;const t=this.quotes(),s=this.firstValue();if(null===t||null===s)return null;const i=t.prev_close_price;return void 0===i?null:{coordinate:e.priceToCoordinate(i,s),floatCoordinate:e.priceToCoordinate(i,s),formattedPricePercentage:e.formatPricePercentage(i,s,!0),formattedPriceAbsolute:e.formatPriceAbsolute(i),formattedPriceIndexedTo100:e.formatPriceIndexedTo100(i,s)}}priceLineColor(e){return this.properties().childs().priceLineColor.value()||e}hasClosePrice(){return $s||12!==this.properties().childs().style.value()}lastValueData(e,t,s){var i;const r={noData:!0},a=this.priceScale();if(this.model().timeScale().isEmpty()||a.isEmpty()||this.data().isEmpty())return r;const o=this.model().timeScale().visibleBarsStrictRange(),n=this.firstValue();if(null===o||null===n)return r;let l,h;if(t){const e=this.data().bars().last();if(null===e)return r;l=e.value,h=e.index}else{const e=this.data().bars().search(o.lastBar(),m.PlotRowSearchMode.NearestLeft);if(null===e)return r;l=e.value,h=e.index}const d=null!==(i=void 0!==e?l[e]:this._barFunction(l,2))&&void 0!==i?i:NaN,u=this.barColorer().barStyle(h,!1),c=a.priceToCoordinate(d,n),_={...a.getFormattedValues(d,n,!0),noData:!1,color:u.barColor,floatCoordinate:c,coordinate:c,index:h};return s&&(_.price=d),_}isDWM(){return this.intervalObj().isDWM()}data(){var e;return null!==(e=this._data)&&void 0!==e?e:this._seriesSource.data()}clearData(){var e;(0,a.assert)(null===this._data,"Cannot clear loaded data"),null===(e=this._studyBindings)||void 0===e||e.clearData(),this._seriesSource.clearData()}nearestData(e,t){var s;return null!==(s=this.data().search(e,t))&&void 0!==s?s:void 0}nearestIndex(e,t){var s;return null===(s=this.nearestData(e,t))||void 0===s?void 0:s.index}nearestValue(e,t,s){var i;const r=this.nearestData(e,s);return null!==(i=null==r?void 0:r.value[t])&&void 0!==i?i:void 0}onSymbolIntervalChanged(){return this._symbolIntervalChanged}onIntervalChanged(){return this._intervalChanged}onStatusChanged(){return this._onStatusChanged}onRestarted(){return this._onRestarted}fixLastBar(e){if(!this._futureBarsPaneView){const t=this.bars().lastIndex() ;t&&(this._futureBarsPaneView=new He(this.model().timeScale(),this,t,e))}}requestMoreData(e){var t,s;if(!v.seriesReadyStatuses.has(this._status.value().seriesStatus))return;if(this._model.timeScale().isEmpty())return;const i=this._model.timeScale().visibleBarsStrictRange();if(null===i)return;if(0===this.bars().size())return;const r=i.lastBar()-(0,a.ensureNotNull)(this.data().last()).index;if(this._predictBarse.isVisible()&&e.metaInfo().hasForceOverlayPlots())).filter((e=>e.priceScale()!==this.priceScale())),r=(e,t)=>void 0===e?t:void 0===t?e:Math.max(e,t),a=i.map((i=>i.autoScaleInfo(e,t,s)));this._studyBindings&&a.push(...this._studyBindings.autoScaleInfos(e,t,s));const o=(e,t)=>({range:e.range?t.range?e.range.merge(t.range):e.range:t.range,topPixelMargin:r(e.topPixelMargin,t.topPixelMargin),bottomPixelMargin:r(e.bottomPixelMargin,t.bottomPixelMargin)});n=a.reduce(o,n)}return n}onChartStyleChanged(){var e,t;this._updateBarFunction(),this.isNeedRestart()&&(this.data().clear(),this.model().timeScale().scrollToRealtime(!1),this.isInReplay()&&!(0,S.isStyleSupportedForReplay)(this.style())&&this._removeReplaySubscriber(),this.restart());const s=this.properties();this._prevChartStyle!==s.childs().style.value()&&(null===(e=this._studyBindings)||void 0===e||e.syncStudy(this.style())),this._prevChartStyle=s.childs().style.value(),this._onStyleChanged.fire(s.childs().style.value()),this.invalidateBarStylesCache(),this._updateLastPriceAnimationActive(),(null===(t=this._styleToRecover)||void 0===t?void 0:t.originalStyle)!==this.style()&&(this._styleToRecover=null),this._updateTimeScaleTimePointWeights()}setChartStyleWithIntervalIfNeeded(e,t){const s=this.interval(),i=null!=t?t:(0,Kt.getResolutionByChartStyle)(e,s,this._model.defaultResolutions()),r=Q.Interval.isEqual(i,s);this.setSymbolParams({interval:r?void 0:i,style:e})}getInputsProperties(){var e;const t=this._properties.child(`${this.getStyleShortName()}Style`);return null!==(e=null==t?void 0:t.childs().inputs)&&void 0!==e?e:new b.Property}getInputsInfoProperties(){var e,t;const s=null===(e=this._studyBindings)||void 0===e?void 0:e.getInputsInfoProperties(this.style());if(s)return s;const i=this._properties.child(`${this.getStyleShortName()}Style`);return null!==(t=null==i?void 0:i.childs().inputInfo)&&void 0!==t?t:new b.Property}getSourceIcon(){return{type:"loadSvg",svgId:`series.${this.style()}`}}purgeSymbolInfo(){this._symbolInfo=null}idForAlert(){return(0,Ne.getSeriesIdForAlert)(this.getSymbolString(),this.interval())}hasStateForAlert(){return super.hasStateForAlert()&&!(0,S.isEconomicSymbol)(this._symbolInfo)}stateForAlert(){var e;const t=this.idForAlert(),s=Fe.FormattersSerializer.serialize(this._formatter);let r;const a=this.isDWM()?i.Regular:this.sessionIdProxyProperty().value();if(this._symbolInfo&&this._symbolInfo.subsessions&&this._symbolInfo.subsessions.length>1){const t=null===(e=this._symbolInfo.subsessions)||void 0===e?void 0:e.find((e=>e.id===a));t&&(r=(0,Le.translateSessionExtendedDescription)(t.description))}const o=this.properties().childs(),n={id:t,uniqueId:t,type:"MainSeries",proSymbol:this.proSymbol(),actualSymbol:this.actualSymbol(),symbolString:this.getSymbolString(),interval:this.interval(),style:o.style.value(),styleInputs:this.getInputsProperties().state(),sessionId:a,sessionDescription:r,dividendsAdjustment:o.dividendsAdjustment.value(), backAdjustment:o.backAdjustment.value()&&!this.isBackAdjustmentForbiddenProperty().value(),settlementAsClose:o.settlementAsClose.value()&&!this.isSettlementAsCloseForbiddenProperty().value(),boxSize:this.data().boxSize,reversalAmount:this.data().reversalAmount,isSpread:this.isSpread(),formatter:s},l=Oe(this);return l&&(n.dangerReason=l),n}styleStudyInfos(){return{haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle,volFootprintStyle:this._volFootprintStyle,tpoStyle:this._tpoStyle}}dataEvents(){return this._seriesSource.dataEvents()}isSpread(){var e;return"spread"===(null===(e=this._symbolInfo)||void 0===e?void 0:e.type)}isYield(){return null!==this._symbolInfo&&(0,Ms.isYield)(this._symbolInfo)}dividendsAdjustmentProperty(){return this._properties.childs().dividendsAdjustment}sessionIdProxyProperty(){return this._sessionIdProxyProperty}symbolTextSourceProxyProperty(){return this._symbolTextSourceProxyProperty}setTextSourceIsAlwaysTickerRestrictionEnabled(e){this._textSourceIsAlwaysTickerRestrictionEnabled=e,this._recalcSymbolTextSourceProxyProperty()}isDWMProperty(){return this._isDWMProperty}isPrePostMarketPricesAvailableProperty(){return this._isPrePostMarketPricesAvailableProperty}isSettlementAsCloseForbiddenProperty(){return this._isSettlementAsCloseForbiddenProperty}isBackAdjustmentForbiddenProperty(){return this._isBackAdjustmentForbiddenProperty}getStyleShortName(){const e=this.style(),t=v.STYLE_SHORT_NAMES[e];return(0,a.assert)(!!t,`Missed short name for style ${e}`),t}invalidateBarColorerCache(){this._barColorerCache=null,this.invalidateBarStylesCache()}replayExitedDueUnsupportedInterval(){return this._replayExitedDueUnsupportedInterval}replayExitedDueUnavailableForUserInterval(){return this._replayExitedDueUnavailableForUserInterval}onTimeFrameApplied(){return this._onTimeFrameApplied}onInReplayStateChanged(){return this._onInReplayStateChanged}dataWindowView(){return this._dataWindowView}statusView(){return js?this._statusView:null}legendView(){return this._legendView}marketStatusModel(){return this._marketStatusModel}isMainSeries(){return!0}dataUpdatedModeModel(){return this._dataUpdatedModeModel}dataProblemModel(){return this._dataProblemModel}setDefaultTimeframe(e){this._pendingTimeRange=e}loadDataTo(e){const t=this._properties.childs().interval.value();this._onTimeFrameApplied.fire(e),this._seriesSource.modifySeries(this._getResolvingSymbolObject(),(0,Kt.getServerInterval)(t),e)}isInReplay(){return null!==this._replaySubscriber}quotes(){return this.data().isEmpty()?null:this._quotesProvider.quotes()}base(){return this._base}pointValue(){return this._pointValue}barCloseTime(){return this._lastBarCloseTime}priceSource(){let e=null;const t=this._properties.childs();switch(t.style.value()){case 2:e=t.lineStyle.childs().priceSource.value();break;case 18:e=t.tpoStyle.childs().priceSource.value();break;case 14:e=t.lineWithMarkersStyle.childs().priceSource.value();break;case 15: e=t.steplineStyle.childs().priceSource.value();break;case 3:e=t.areaStyle.childs().priceSource.value();break;case 10:e=t.baselineStyle.childs().priceSource.value();break;case 13:e=t.columnStyle.childs().priceSource.value()}return e}updateAllViews(e){var t,s,i,r,a,o,n,l,h,d;null===(t=this._paneView)||void 0===t||t.update(e),this._dataWindowView.update(),this._legendView.update(),this._statusView.update(),this._averagePaneViews.forEach((t=>t.update(e))),this._highLowAvgPaneViews.forEach((t=>t.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLineAxisViews.forEach((t=>t.update(e))),null===(s=this._futureBarsPaneView)||void 0===s||s.update(e),null===(i=this._projectionBarsPaneView)||void 0===i||i.update(e),null===(r=this._waterlineView)||void 0===r||r.update(e),null===(a=this._prevClosePriceLineView)||void 0===a||a.update(e),null===(o=this._priceLineView)||void 0===o||o.update(e),null===(n=this._gotoDateView)||void 0===n||n.update(e),null===(l=this._endOfDataPaneView)||void 0===l||l.update(e),null===(h=this._baseHorizontalLineView)||void 0===h||h.update(e);const u=this._model.activeStrategySource().value();null==u||u.updateAllViews(e),this._lineStyleLastPriceCirclePaneView.update(e),null===(d=this._studyBindings)||void 0===d||d.updateAllViews(e)}styleStudyInfo(e){return this.styleStudyInfos()[e]}barFunction(){return this._barFunction}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)}setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}symbolParams(){return(0,Wt.symbolParams)(this)}compareSymbolParams(e){return(0,Wt.compareSymbolParams)(this,e,this._model.unitConversionEnabled(),(e=>this.getSupportedResolution(e,!1)))}setSymbolParams(e){const{symbol:t,currency:s,unit:i,style:r}=e,{symbolChanged:o,intervalChanged:n,currencyChanged:l,unitChanged:h,styleChanged:d,correctedInterval:u}=this.compareSymbolParams(e),c=null!=u?u:e.interval;void 0!==u&&Xs.logWarn(`Change interval value from ${e.interval} to ${u} because first is not supported`);const _=[Ks("symbol",t,o),Ks("interval",c,n),Ks("currency",s,l),Ks("unit",i,h),Ks("style",r,d)].filter((e=>null!==e)).join("; ");Xs.logInfo(`Applying series symbol params: ${_}`);const p=this.properties().childs();void 0!==t&&p.symbol.setValue(t),void 0!==s&&p.currencyId.setValue(s),void 0!==i&&p.unitId.setValue(i),n&&p.interval.setValue((0,a.ensureDefined)(c)),void 0!==r&&d&&p.style.setValue(r);let m=!1;d&&(m=this.isNeedRestart(),this.onChartStyleChanged()),!m&&(o||n||l||h)&&this._applySymbolParamsChanges({symbolChanged:o,currencyChanged:l,unitChanged:h,intervalChanged:n,styleChanged:d}),(o||l||h)&&this.model().checkLineToolSelection()}setSymbol(e){this.setSymbolParams({symbol:e})}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,S.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})} measureUnitId(){return(0,S.measureUnitId)(this.symbolInfo())}isConvertedToOtherUnit(){return(0,S.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}valueAt(e,t){var s,i;return null!==(i=null===(s=this.data().search(e))||void 0===s?void 0:s.value[t])&&void 0!==i?i:null}symbolSource(){return this}barsProvider(){return this}title(e){return this.symbolTitle(e)}name(){return this.symbolTitle(ks.TitleDisplayTarget.StatusLine)}symbolTitle(e,t,s,i="exchange"){let r=this.properties().childs().symbol.value();const a=this.symbolInfo();if(null!==a){const{type:e}=a;r=(0,S.symbolTitle)(a,t,"forex"===e?"exchange":i)}return s?r:`${r}, ${(0,k.translatedIntervalString)(this.properties().childs().interval.value())}`}setObsoleteZOrder(e){this._obsoleteZOrder=e}obsoleteZOrder(){return this._obsoleteZOrder}valuesProvider(){return new j(this,this.model())}statusProvider(e){return new D(this,this.properties().childs().statusViewStyle,e)}moveItem(e,t,s){if(10===this.style()&&0===t){const t=this.priceScale(),s=this.properties().childs().baselineStyle,i=t.height(),r=100-e.y/i*100,a=r<0?0:Math.round(10*r)/10;s.childs().baseLevelPercentage.setValue(Math.max(Math.min(a,100),0))}}rerequestData(){this._applySymbolParamsChanges({force:!0})}switchToReplay(e,t){this._replaySubscriber=e,this._isReplayResolutionAvailableForUser=t,this._onInReplayStateChanged.fire(),this._replaySubscriber.modifySeries(this.getSymbolString(),this._properties.childs().interval.value()),this.rerequestData()}switchToRealtime(){this.isInReplay()&&(this._removeReplaySubscriber(),this.rerequestData())}async canChangeResolution(e){{if(!this.isInReplay())return!0;const t=await(0,a.ensureNotNull)(this._replaySubscriber).canChangeResolution(this.getSymbolString(),e);return t||this._replayExitedDueUnsupportedInterval.fire(),t}}requestMoreDataAvailable(){return this._requestMoreDataAvailable}seriesLoaded(){return this._seriesLoaded}endOfData(){var e;return void 0!==(null===(e=this._lastCompleteFlags)||void 0===e?void 0:e.data_completed)}endOfDataType(){var e,t;return null!==(t=null===(e=this._lastCompleteFlags)||void 0===e?void 0:e.data_completed)&&void 0!==t?t:null}dataPoweredBy(){return this._dataPoweredBy}boxSizeValue(){return this._boxSizeValue}isUserDeletable(){return!1}changeTimeFrame(){(0,n.trackEvent)("GUI","Change timeframe")}onTagsChanged(){return this._tagsChanged}state(e){var t,s;const i=this.obsoleteZOrder();let r={type:"MainSeries",id:this.id(),zorder:i,haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle,volFootprintStyle:this._volFootprintStyle,tpoStyle:this._tpoStyle,formattingDeps:this._formattingDeps,studyBindings:null===(t=this._studyBindings)||void 0===t?void 0:t.state(!!e)};const a=this.properties().state();if(a.symbol=(0,S.symbolToSaveInState)(null!==(s=this._symbolInfo)&&void 0!==s?s:this._model.chartApi().lastSymbolResolveInfo(a.symbol),a.symbol),this._model.unitConversionEnabled()||(a.unitId=null),r.state=a,e){let e=this.bars() ;const t=this._model.timeScale().visibleExtendedDataRange(e,0);null!==t&&(e=e.range(t.firstBar(),t.lastBar())),r={...r,bars:Zs(e),nsBars:Zs(this.nsBars()),symbolInfo:this._symbolInfo,rtPrice:this.data().lastProjectionPrice,boxSize:this.data().boxSize,reversalAmount:this.data().reversalAmount}}return r}restoreState(e,t){var s,i,r;t&&this._setStatus(5),!this._model.unitConversionEnabled()&&e.state&&delete e.state.unitId;const a=e.state;if(void 0!==a){const e=a.style,t=$e.chartStylePermissions.get(e);t&&!this._model.isSnapshot()&&(a.style=2,(0,Ge.runOrGoProWithoutSync)((()=>{a.style=e}),t.feature,{feature:t.featureName}))}if(this._properties.mergeAndFire(e.state),this._properties.hasChild("esdBreaksStyle")&&this._properties.removeProperty("esdBreaksStyle"),this._prevChartStyle=this.properties().childs().style.value(),this.createPaneView(),t){const t=e;this.restoreData(t.bars,t.nsBars,t.symbolInfo,t.rtPrice,t.boxSize,t.reversalAmount)}e.formattingDeps&&(this._formattingDeps=e.formattingDeps,this._recreatePriceFormattingDependencies()),null===(s=this._studyBindings)||void 0===s||s.restoreState(null!==(i=e.studyBindings)&&void 0!==i?i:{},t),null===(r=this._studyBindings)||void 0===r||r.syncStudy(this.style())}restoreData(e,t,s,i,r,a){this._updateStatus({seriesStatus:5}),this._data=new _.SeriesData,this._data.bars().restoreState(e),this._data.nsBars().restoreState(t),this._updateSymbolInfo(s),this._data.lastProjectionPrice=i,this._data.boxSize=r;const o=this.properties().childs();r||(6===o.style.value()?this._data.boxSize=o.pnfStyle.childs().inputs.childs().boxSize.value():4===o.style.value()&&(this._data.boxSize=o.renkoStyle.childs().inputs.childs().boxSize.value())),this._data.reversalAmount=a,a||5===o.style.value()&&(this._data.reversalAmount=o.kagiStyle.childs().inputs.childs().reversalAmount.value())}async setGotoDateResult(e,t){this._gotoDateResultCleared=!1;const i=await s.e(4079).then(s.bind(s,228579));this._gotoDateResultCleared||(this._gotoDateView=new i.GotoDateView(this,e,t),this._gotoDateView.doNotShowLastAvailableBar(this._doNotShowLastAvailableBar),this._model.updateSource(this))}clearGotoDateResult(){this._gotoDateView=null,this._gotoDateResultCleared=!0}doNotShowLastAvailableBar(e){var t;this._doNotShowLastAvailableBar=e,null===(t=this._gotoDateView)||void 0===t||t.doNotShowLastAvailableBar(e)}dataUpdated(){return this.dataEvents().dataUpdated()}moveData(e){this._seriesSource.moveData(e),null!==this._volumePointWeights&&this._volumePointWeights.moveData(e)}getSupportedResolution(e,t=!0){if(null===this._symbolInfo||!(0,Wt.symbolSameAsCurrent)(this.symbol(),this._symbolInfo))return e;if(Q.Interval.isRange(e)&&(0,S.isCloseBasedSymbol)(this._symbolInfo)){const t=this.interval();if(!Q.Interval.isRange(t))return t;e="1D"}const s=this._symbolInfo.data_frequency;if(void 0!==s){let i=(0,Kt.getApplicableIntervalForFrequency)(s,e);if(i!==e){const e=this._model.defaultResolutions();if(!(e.includes(i)||window.is_authenticated&&window.user.is_pro)){const t=e.find((e=>(0,Kt.compareResolutions)(e,i)>=0)) ;i=null!=t?t:e[e.length-1]}return t&&this.requestingResolutionLessThanFrequency.fire(s,i),i}}if(Q.Interval.isIntraday(e)&&!this._symbolInfo.has_intraday)return t&&this.requestingIntradayWhenNotSupported.fire(),"D";if(Q.Interval.isTicks(e)&&!this._symbolInfo["is-tickbars-available"])return t&&this.requestingTicksWhenNotSupported.fire(),"D";if(this._symbolInfo.hasOwnProperty("supported_resolutions")){const t=Q.Interval.normalize(e),s=this._symbolInfo.supported_resolutions;if(null!==t&&-1===s.indexOf(t))return s[0]}return e}async seriesCreated(){const e=this._seriesSource.instanceId();if(null!==e)return e;const t=await Promise.race([this._deferredDestroyed.promise.then((()=>{})),this._model.isSnapshot()?Promise.resolve(null):new Promise((e=>{this.dataEvents().created().subscribe(this,e,!0)}))]);if(void 0===t)throw new Error("Series has been destroyed");return t}_updateBarFunction(){this._barFunction=(0,Bs.barFunctionByStyle)(this.style(),this.priceSource())}_setProperties(e){e.hasChild("timeframe")||e.merge({timeframe:""}),e.hasChild("shortName")||e.merge({shortName:""}),e.hasChild("currencyId")||e.addChild("currencyId",new b.Property(null)),e.hasChild("unitId")||e.addChild("unitId",new b.Property(null)),this._properties=e;const t=e.childs();t.currencyId.subscribe(this,this._onCurrencyChanged),t.unitId.subscribe(this,this._onUnitChanged),t.timeframe.subscribe(this,this.changeTimeFrame),e.subscribe(this,this._onPropertiesChanged)}_updateSessionIdProxyProperty(e){const t=this._properties.childs().sessionId.value();let s=t;if(e){const e=this.symbolInfo();null!==e&&(s=e.subsession_id||t)}this._ignoreSessionIdProxyPropertyChanges=!0,this._sessionIdProxyProperty.setValue(s),this._ignoreSessionIdProxyPropertyChanges=!1}_onSessionIdProxyPropertyChanged(){this._ignoreSessionIdProxyPropertyChanges||this._properties.childs().sessionId.setValue(this._sessionIdProxyProperty.value()),this._updateLastPriceAnimationActive()}_onSymbolResolved(e){this._seriesErrorMessage=null,this._updateSymbolInfo(e),this._model.updateSource(this),this._model.onWidget()||((0,n.trackEvent)("Symbol",e.listed_exchange,e.name),(0,n.trackEvent)("Symbol Type",e.type,e.listed_exchange));const t=e.minmov/e.pricescale,s=this.properties().childs();4===s.style.value()&&s.renkoStyle.childs().inputs.childs().boxSize.value(){e[t]=s[t].toString()})),t=t.format(e)}Gs&&Xs.logNormal("Error reason: "+t),this._seriesErrorMessage=t;const i=zs&&this._symbolInfo?10:4;this._setStatus(i),this._seriesLoaded=!0,this._sendTelemetryCounter("series_error",this._getTelemetryAdditionalData(t)),this._enablePriceRangeReady()}_onSeriesLoading(e){this._setStatus(2)}_onDataUpdated(e,t,s,i){var r;if(i&&this._symbolInfo){let e=0,t=0;if((0,S.hasVolume)(this._symbolInfo))for(const s of this.bars().fullRangeIterator()){const i=s.value[5];0!==i&&(e+=i,t+=1)}this._volumePointWeights=t>0?new dt(e/t):null,this._updateTimeScaleTimePointWeights()}if(null!==this._volumePointWeights){const e=t?this.bars().fullRangeIterator():s?this.bars().rangeIterator(s.index,(0,a.ensureNotNull)(this.bars().lastIndex())):null;if(null!==e)for(const t of e)this._volumePointWeights.setVolume(t.index,t.value[5])}t?this._requestMoreDataAvailable=!0:this._lastPriceAnimationActive&&this._seriesLoaded&&this._lineStyleLastPriceCirclePaneView.update((0,De.sourceChangeEvent)(this.id())),this._lastBarCloseTime=e&&e.closeTime||null,this._boxSizeValue.setValue(this.data().boxSize),this._statusView.update(),this.clearAveragePriceCache(),this.clearHighLowPriceCache();const o=this.model(),n=(0,a.ensureNotNull)(o.paneForSource(this));o.recalculatePane(n,(0,De.sourceChangeEvent)({sourceId:this.id(),realtime:!t,firstUpdatedTimePointIndex:null!==(r=null==s?void 0:s.index)&&void 0!==r?r:void 0})),o.updateSource(this)}_setStatus(e){const t={...this._status.value(),seriesStatus:e};this._updateStatus(t),this._statusView.update(),this.model().updateSource(this),this._onStatusChanged.fire()}_onBarReceived(e){this.model().recalcVisibleRangeStudies(c.RecalcVisibleRangeStudiesReason.DataUpdate)}_recreateFormatter(){var e,t,s;this._defaultFormatter=(0,S.createSeriesFormatter)(null!==(e=this.symbolInfo())&&void 0!==e?e:this._formattingDeps,"default"),this._formatter=(0, S.createSeriesFormatter)(null!==(t=this.symbolInfo())&&void 0!==t?t:this._formattingDeps,this.properties().childs().minTick.value()),this._ignoreMinMoveFormatter=(0,S.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value(),!0),null===(s=this._priceScale)||void 0===s||s.updateFormatter(),this._formatterChanged.fire()}_recreatePriceStep(){const{minMove:e,priceScale:t}=(0,S.getSeriesPriceFormattingState)(this.symbolInfo()),s=e/t;this._ignoreMinMovePriceStep=1/t,this._priceStep!==s&&(this._priceStep=s,this._priceStepChanged.fire())}_recreatePriceFormattingDependencies(){this._recreateFormatter(),this._recreatePriceStep()}_onQuotesUpdate(e,t){if(qs){const e=void 0!==t.values.change||void 0!==t.values.change_percent;e&&this._legendView.update();const s=void 0!==t.values.prev_close_price;s&&((0,a.ensureNotNull)(this._prevClosePriceLineView).update((0,De.sourceChangeEvent)(this.id())),(0,a.ensureNotNull)(this._prevClosePriceAxisView).update((0,De.sourceChangeEvent)(this.id()))),(e||s)&&this.model().updateSource(this)}void 0!==e.values.current_session&&e.values.current_session!==this._currentSession&&(this._currentSession=e.values.current_session,this._updateLastPriceAnimationActive())}_updateIsPrePostMarketPricesForbiddenProperty(){const e=(0,S.symbolHasPreOrPostMarket)(this._symbolInfo)&&(this.isDWM()||(0,S.isRegularSessionId)(this.sessionIdProxyProperty().value()));this._isPrePostMarketPricesAvailableProperty.setValue(e)}_updateSettlementAsCloseForbiddenProperty(){var e;const t=this.isDWM()&&Boolean(null===(e=this._symbolInfo)||void 0===e?void 0:e.has_settlement);this._isSettlementAsCloseForbiddenProperty.setValue(!t)}_updateBackAdjustmentForbiddenProperty(){var e;const t=Boolean(null===(e=this._symbolInfo)||void 0===e?void 0:e.has_backadjustment);this._isBackAdjustmentForbiddenProperty.setValue(!t)}_removeReplaySubscriber(){{if(!this.isInReplay())return;const e=this._replaySubscriber;this._replaySubscriber=null,this._isReplayResolutionAvailableForUser=null,this._onInReplayStateChanged.fire(),null==e||e.destroy()}}_getSymbolForApi(){return this.symbol()}_getSymbolObject(e){const t=this._getExtendedSymbolObject(e),s=this.properties().childs().style.value();if(v.SYMBOL_STRING_DATA.hasOwnProperty(s)&&!v.chartStylesWithAttachedStudies.includes(s)){return{symbol:t,type:this.styleStudyInfo(this.getStyleShortName()+"Style").studyId+"!",inputs:this.getInputsProperties().state()}}return t}_getExtendedSymbolObject(e){const t={symbol:null!=e?e:this._getSymbolForApi()},s=this.properties().childs();null!==this.currency()&&(t["currency-id"]=this.currency());const i=this.unit();return this._model.unitConversionEnabled()&&null!==i&&(t["unit-id"]=i),this.isDWM()||(t.session=s.sessionId.value()),t.adjustment=s.dividendsAdjustment.value()?"dividends":"splits",s.backAdjustment.value()&&(t.backadjustment="default"),s.settlementAsClose.value()||(t["settlement-as-close"]=!1),t}_checkChartStyle(){const e=this.style();(0,S.isCloseBasedSymbol)(this.symbolInfo())?(0, S.isSingleValueBasedStyle)(e)||(this.requestingStyleIsNotSupported.fire(),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.requestingStyleSupportRecovered.fire(this._styleToRecover.originalStyle),this._styleToRecover=null)}_updateSymbolInfo(e){if(this._symbolInfo=e,e){const t=this._properties.childs();t.shortName.setValue(e.name);const s=(0,S.extractSymbolNameFromSymbolInfo)(e,this.symbol());s&&t.symbol.setValue(s);const i=(0,S.symbolCurrency)(e),r=(0,S.symbolUnit)(e,this._model.unitConversionEnabled());"alwaysOff"===(0,X.currencyUnitVisibilityProperty)().value()||i===t.currencyId.value()&&r===t.unitId.value()||this._model.fullUpdate(),t.currencyId.setValue(i),t.unitId.setValue(r),this._updateSessionIdProxyProperty(!0)}this._base=e?e.pricescale/e.minmov:100,this._pointValue=e&&e.pointvalue||1;const t=(0,Ot.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getExtendedSymbolObject());this._quotesProvider.setQuotesSessionSymbol(t),this._marketStatusModel.setSymbolInfo(e),e&&this._recreatePriceFormattingDependencies(),this._statusView.update(),this.priceScale().updateFormatter(),this._symbolResolvingActive.setValue(!e),this._updateIsPrePostMarketPricesForbiddenProperty(),this._dataPoweredBy=(0,Ee.getDataVendorString)(e),this._updateBackAdjustmentForbiddenProperty(),this._updateSettlementAsCloseForbiddenProperty()}_createHighLowAvgViews(){const e=this.properties().childs().highLowAvgPrice,t=this._getHighLowPrice.bind(this),s=function(e,t,s,i){const r=s.childs(),a=Lt(e,t,{label:Nt,labelVisible:r.highLowPriceLabelsVisible,lineVisible:r.highLowPriceLinesVisible,lineColor:r.highLowPriceLinesColor,lineWidth:r.highLowPriceLinesWidth},(()=>i(0))),o=Lt(e,t,{label:Ft,labelVisible:r.highLowPriceLabelsVisible,lineVisible:r.highLowPriceLinesVisible,lineColor:r.highLowPriceLinesColor,lineWidth:r.highLowPriceLinesWidth},(()=>i(1)));return{paneViews:[a.paneView,o.paneView],panePriceAxisViews:[a.panePriceAxisView,o.panePriceAxisView],priceAxisViews:[a.priceAxisView,o.priceAxisView],priceLineAxisViews:[a.priceLineAxisView,o.priceLineAxisView]}}(this._model,this,e,t);this._highLowAvgPaneViews.push(...s.paneViews),this._labelPaneViews.push(...s.panePriceAxisViews),this._priceAxisViews.push(...s.priceAxisViews),this._priceLineAxisViews.push(...s.priceLineAxisViews)}_createAverageViews(){}_getHighLowPrice(e){if(!this._highLowPriceCache.has(e)){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=function(e,t,s){return e.minMaxOnRangeCached(t,s,[{name:"low",offset:0},{name:"high",offset:0}])}(this._model.mainSeries().bars(),e.firstBar(),e.lastBar());if(null===t)return null;this._highLowPriceCache.set(1,t.min),this._highLowPriceCache.set(0,t.max)}return this._highLowPriceCache.get(e)}_getAveragePrice(e){return null}_onSeriesCompleted(e){var t;this._sendTelemetryCounter("series_loaded",this._getTelemetryAdditionalData()),this._seriesErrorMessage=null;let i=e.updateMode;switch("pulsed"===i&&(i="delayed"),i){case"streaming":this._setStatus(3);break ;case"endofday":this._setStatus(6);break;case"delayed":this._setStatus(8);break;case"replay":this._setStatus(11)}i.match(/delayed_streaming/)&&this._setStatus(9),this._lastCompleteFlags=null!==(t=e.flags)&&void 0!==t?t:null;const r=(0,a.ensureNotNull)(this._model.paneForSource(this));r.recalculatePriceScale(this.priceScale(),(0,De.sourceChangeEvent)(this.id()));const o=$t.InvalidationMask.full();if(null!==this._model.appliedTimeFrame().value()&&o.lockVisibleTimeRangeOnResize(),this._model.invalidate(o),!this.priceScale().isLockScale()||this.model().timeScale().isEmpty()||this._seriesLoaded||(this.model().timeScale().correctOffset(),this.model().timeScale().correctBarSpacing(),this.model().resetPriceScale(r,this.priceScale())),this._seriesLoaded=!0,this._seriesCompleted=!0,this.model().recalcVisibleRangeStudies(c.RecalcVisibleRangeStudiesReason.SeriesCompleted),this.model().recalcStudyBasedLineTools(),!Qs){Qs=!0;(0,s(975420).trackTiming)("Chart","Time to series",window.performance.now())}this.requestMoreData(),this._enablePriceRangeReady()}_notifyIntervalChanged(e){var t,s;const i={timeframe:null!==(t=this._pendingTimeRange)&&void 0!==t?t:void 0};this._intervalChanged.fire(e,i),this._pendingTimeRange=null!==(s=i.timeframe)&&void 0!==s?s:null}_onCurrencyChanged(){this._currencyChanged.fire()}_onUnitChanged(){this._unitChanged.fire()}async _applySymbolParamsChanges(e){this._lastCompleteFlags=null,this.clearGotoDateResult();const t=this.interval(),s=this.currency(),i=this.unit(),r=Q.Interval.isRange(t);r&&this._properties.childs().rangeStyle.childs().inputs.childs().range.setValue(Q.Interval.parse(t).multiplier());const{symbolChanged:o,intervalChanged:n,currencyChanged:l,unitChanged:h,force:d}=e,u=n&&Q.Interval.parse(t).isDWM()!=Q.Interval.parse(t).isDWM();if((null!==s&&l||null!==i&&h)&&this.isInReplay()){const e=this.symbolInfo();(null===e||null!==s&&e.original_currency_id!==s||null!==i&&e.original_unit_id!==i)&&this._removeReplaySubscriber()}if(this._syncModel=null,this._prevRequestedInterval=t,5!==this._status.value().seriesStatus&&(!this._seriesSource.isStarted()||o||l||h||u)&&this._updateSymbolInfo(null),this.isInReplay()){const e=()=>this._removeReplaySubscriber();o?e():n&&(r||Q.Interval.isTicks(t)?e():(0,a.ensureNotNull)(this._isReplayResolutionAvailableForUser)(t)?await this.canChangeResolution(t)||(e(),this._replayExitedDueUnsupportedInterval.fire()):(e(),this._replayExitedDueUnavailableForUserInterval.fire()))}if(5===this._status.value().seriesStatus)return void this._model.realignLineTools();this._setStatus(1),this._updateIsPrePostMarketPricesForbiddenProperty(),this._updateBackAdjustmentForbiddenProperty(),this._updateSettlementAsCloseForbiddenProperty(),this._symbolIntervalChanged.fire(),n&&this._notifyIntervalChanged(t),this._onRestarted.fire(),this._seriesLoaded=!1,this._seriesCompleted=!1,this._lineStyleLastPriceCirclePaneView.stopAnimation();let _=null;this._pendingTimeRange&&(_=this._pendingTimeRange,this._pendingTimeRange=null),this._onTimeFrameApplied.fire(_), this._onBeforeModifySeries(this.getSymbolString(),t);const p=this._shouldDefineNumberOfBarsForModifySeries(e)&&this._visibleBarsCount()||null;this.model().recalcVisibleRangeStudies(c.RecalcVisibleRangeStudiesReason.SeriesRestart),this._data=null,this._seriesSource.modifySeries(this._getResolvingSymbolObject(),(0,Kt.getServerInterval)(t),_,d,p),this._seriesSource.isStarted()||(this._predictBars=0,this._seriesSource.start()),(o||l||h)&&this.disablePriceRangeReady(),this.updateAllViews((0,De.sourceChangeEvent)(this.id())),this._model.lightUpdate()}_onBeforeModifySeries(e,t){this._replaySubscriber&&this._replaySubscriber.modifySeries(e,t)}_getResolvingSymbolObject(){let e=this._getSymbolObject(this._symbolForResolve());return this._replaySubscriber&&(e=this._replaySubscriber.generateReplaySymbol(e)),e}_onSessionIdPropertyChanged(){this._sessionIdChanged.fire(),this.isDWM()||(this.restart(),this._updateLastPriceAnimationActive())}_subscribeRestartToSessionIdChange(){this.properties().childs().sessionId.subscribe(this,this._onSessionIdPropertyChangedBound)}_unsubscribeRestartToSessionIdChange(){this.properties().childs().sessionId.unsubscribe(this,this._onSessionIdPropertyChangedBound)}_updateLastPriceAnimationActive(){if(!this._options.lastPriceAnimationEnabled||P.enabled("disable_pulse_animation"))return;const e=this._lastPriceAnimationActive,t=this.properties().childs(),s=t.style.value(),i=3===s||10===s||2===s||14===s||15===s;if(!this._model.isSnapshot()&&t.visible.value()&&i){const e=this.currentSession(),t=!(0,S.isRegularSessionId)(this.sessionIdProxyProperty().value())&&!this.isDWM();this._lastPriceAnimationActive="market"===e||t&&("pre_market"===e||"post_market"===e)}else this._lastPriceAnimationActive=!1;this._lastPriceAnimationActive&&e!==this._lastPriceAnimationActive&&this.model().invalidate($t.InvalidationMask.cursor())}_onPropertiesChanged(e){const t=this._properties.childs();e!==t.symbol&&e!==t.interval&&e!==t.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews((0,De.sourceChangeEvent)(this._id)),this.model().updateSource(this),(0,l.emit)("series_properties_changed",this._id))}_recalcSymbolTextSourceProxyProperty(){this._textSourceIsAlwaysTickerRestrictionEnabled?this._symbolTextSourceProxyProperty.setValue("ticker"):this._symbolTextSourceProxyProperty.setValue(this._properties.childs().statusViewStyle.childs().symbolTextSource.value())}_clearStylePlot(e,t){if(0===e.size())return;if(void 0===t&&e!==this.nsBars())return void(this._precomputedBarStyles=new WeakMap);const s=null!=t?t:(0,a.ensureNotNull)(e.firstIndex()),i=(0,a.ensureNotNull)(e.lastIndex())+1;e.range(s,i).each(((e,t)=>(this._precomputedBarStyles.delete(t),!1)))}_visibleBarsCount(){const e=this._model.timeScale().visibleBarsStrictRange();return null==e?void 0:e.count()}_symbolForResolve(){var e;const t=this.symbol();return this._seriesSource.symbolSameAsResolved(t)&&null!==(e=this._seriesSource.resolvedSymbol())&&void 0!==e?e:t}_shouldDefineNumberOfBarsForModifySeries(e){return!1}_onShowCountdownChanged(e){ e.value()?this._countdownUpdateTimer=this._model.setInterval((()=>{var e,t;return null===(t=(e=this._priceAxisView).updateCountdown)||void 0===t?void 0:t.call(e)}),500):null!==this._countdownUpdateTimer&&(this._model.clearInterval(this._countdownUpdateTimer),this._countdownUpdateTimer=null)}_onMinTickChanged(){this._recreateFormatter(),this._model.fullUpdate()}_updateStatus(e){this._status.setValue(e)}_wasCompletedBefore(){var e,t;return this.isCompleted()&&(null===(t=null===(e=this._studyBindings)||void 0===e?void 0:e.wasCompletedBeforeForStyle(this.style()))||void 0===t||t)}}},100161:(e,t,s)=>{s.d(t,{chartStylePermissions:()=>r});var i=s(833813);const r=new Map([[18,{feature:i.ProductFeatures.TPO_PERIODIC,featureName:"TPOChartStyle"}],[17,{feature:i.ProductFeatures.VOLUME_FOOTPRINT,featureName:"volumeFootprint"}],[19,{feature:i.ProductFeatures.VOLUME_CANDLES,featureName:"volumeCandles"}]])},442410:(e,t,s)=>{s.d(t,{SeriesDataEvents:()=>r});var i=s(707957);class r{constructor(){this._created=new i.Delegate,this._modified=new i.Delegate,this._loading=new i.Delegate,this._completed=new i.Delegate,this._error=new i.Delegate,this._symbolError=new i.Delegate,this._symbolResolved=new i.Delegate,this._seriesError=new i.Delegate,this._symbolNotPermitted=new i.Delegate,this._symbolInvalid=new i.Delegate,this._symbolGroupNotPermitted=new i.Delegate,this._chartTypeNotPermitted=new i.Delegate,this._intradaySpreadNotPermitted=new i.Delegate,this._intradayExchangeNotPermitted=new i.Delegate,this._customIntervalNotPermitted=new i.Delegate,this._secondsIntervalNotPermitted=new i.Delegate,this._ticksIntervalNotPermitted=new i.Delegate,this._tickMarksRangeChanged=new i.Delegate,this._barReceived=new i.Delegate,this._seriesTimeFrame=new i.Delegate,this._dataUpdated=new i.Delegate}destroy(){this._created.destroy(),this._modified.destroy(),this._loading.destroy(),this._completed.destroy(),this._error.destroy(),this._symbolError.destroy(),this._symbolResolved.destroy(),this._seriesError.destroy(),this._symbolInvalid.destroy(),this._symbolNotPermitted.destroy(),this._symbolGroupNotPermitted.destroy(),this._chartTypeNotPermitted.destroy(),this._intradaySpreadNotPermitted.destroy(),this._intradayExchangeNotPermitted.destroy(),this._customIntervalNotPermitted.destroy(),this._secondsIntervalNotPermitted.destroy(),this._ticksIntervalNotPermitted.destroy(),this._tickMarksRangeChanged.destroy(),this._barReceived.destroy(),this._seriesTimeFrame.destroy(),this._dataUpdated.destroy()}created(){return this._created}modified(){return this._modified}loading(){return this._loading}completed(){return this._completed}error(){return this._error}symbolError(){return this._symbolError}symbolResolved(){return this._symbolResolved}seriesError(){return this._seriesError}symbolInvalid(){return this._symbolInvalid}symbolNotPermitted(){return this._symbolNotPermitted}symbolGroupNotPermitted(){return this._symbolGroupNotPermitted}chartTypeNotPermitted(){return this._chartTypeNotPermitted}intradaySpreadNotPermitted(){return this._intradaySpreadNotPermitted} intradayExchangeNotPermitted(){return this._intradayExchangeNotPermitted}customIntervalNotPermitted(){return this._customIntervalNotPermitted}secondsIntervalNotPermitted(){return this._secondsIntervalNotPermitted}ticksIntervalNotPermitted(){return this._ticksIntervalNotPermitted}tickMarksRangeChanged(){return this._tickMarksRangeChanged}barReceived(){return this._barReceived}seriesTimeFrame(){return this._seriesTimeFrame}dataUpdated(){return this._dataUpdated}fireCompleted(e){this._completed.fire(e)}fireCreated(e){this._created.fire(e)}fireModified(){this._modified.fire()}fireLoading(e){this._loading.fire(e)}fireError(){this._error.fire()}fireSymbolError(e){this._symbolError.fire(e),this.fireError()}fireSymbolResolved(e){this._symbolResolved.fire(e)}fireSeriesError(e){this._seriesError.fire(e),this.fireError()}fireSymbolInvalid(){this._symbolInvalid.fire()}fireSymbolNotPermitted(e){this._symbolNotPermitted.fire(e)}fireSymbolGroupNotPermitted(e){this._symbolGroupNotPermitted.fire(e)}fireChartTypeNotPermitted(e){this._chartTypeNotPermitted.fire(e),this.fireError()}fireIntradaySpreadNotPermitted(){this._intradaySpreadNotPermitted.fire(),this.fireError()}fireIntradayExchangeNotPermitted(){this._intradayExchangeNotPermitted.fire(),this.fireError()}fireCustomIntervalNotPermitted(e){this._customIntervalNotPermitted.fire(e),this.fireError()}fireSecondsIntervalNotPermitted(){this._secondsIntervalNotPermitted.fire(),this.fireError()}fireTicksIntervalNotPermitted(){this._ticksIntervalNotPermitted.fire(),this.fireError()}fireTickMarksRangeChanged(e){this._tickMarksRangeChanged.fire(e)}fireBarReceived(e){this._barReceived.fire(e)}fireSeriesTimeFrame(e,t,s,i,r){this._seriesTimeFrame.fire(e,t,s,i,r)}fireDataUpdated(e,t,s,i){this._dataUpdated.fire(e,t,s,i)}}},175878:(e,t,s)=>{s.d(t,{SeriesDataSource:()=>f,initialRequestOptionsToNumBars:()=>S,parseJapaneseProjectionBars:()=>w});var i=s(650151),r=s(389137),a=s(919892),o=s(223699),n=s(544421),l=s(178389),h=s(826989),d=s(442410),u=s(201089),c=s(444331),_=s(25e4);const p=(0,u.getLogger)("Chart.SeriesDataSource");var m;!function(e){e[e.Idle=0]="Idle",e[e.AwaitingConnection=1]="AwaitingConnection",e[e.AwaitingFirstDataUpdate=2]="AwaitingFirstDataUpdate",e[e.Active=3]="Active"}(m||(m={}));let y=1;let b=1;function S(e){return e.startDate?e.endDate||e.count?e.endDate?["from_to",e.startDate,e.endDate]:["bar_count",e.startDate,(0,i.ensure)(e.count)]:["from_to",e.startDate]:e.count||300}function g(e){return(0,r.isString)(e.symbol)?e.symbol:e.symbol.symbol}function v(e,t){(0,r.isString)(e.symbol)?e.symbol=t:e.symbol.symbol=t}class f{constructor(e,t,s,i){this._extSymbol=null,this._lastResolvedSymbol="",this._createSeriesOverriddenParams=0,this._instanceId=null,this._symbolInstanceId=null,this._resolution=null,this._timeFrame=null,this._data=new n.SeriesData,this._dataEvents=new d.SeriesDataEvents,this._status=m.Idle,this._turnaroundCounter=1,this._boundOnGatewayIsConnectedChanged=this._onGatewayIsConnectedChanged.bind(this),this._ongoingDataUpdate=Promise.resolve(),this._gateway=e, this._turnaroundPrefix=t,this._createSeriesParams=S(null!=s?s:{count:300}),this._timeFrame=i||null,this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged)}destroy(){this.stop(),this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged)}modifySeries(e,t,s=null,a=!1,n=null){a&&(p.logNormal("Due to force flag clearing symbol & resolution to force re-requesting data."),this._extSymbol=null,this._resolution=null);const l=g(e),h=!this.symbolSameAsResolved(l);if(h&&(this._lastResolvedSymbol=""),this._extSymbol&&!h){v(e,g(this._extSymbol))}const d=this._extSymbol,u=this._resolution;if(this._extSymbol=e,this._resolution=t,null===this._instanceId)return void(this._timeFrame=s);const c=!(0,r.deepEquals)(d,e)[0];c&&v(this._extSymbol,l);const _=null===u||!o.Interval.isEqual(u,t);(c||_||null!==s)&&(this._timeFrame=null,(c||_)&&this._turnaroundCounter++,c&&this._resolveSymbol(),this._gateway.modifySeries(this._instanceId,this.turnaround(),(0,i.ensureNotNull)(this._symbolInstanceId),this._resolution,n,s,this._onMessage.bind(this)),this._dataEvents.fireModified())}requestMoreData(e){null!==this._instanceId&&this._gateway.requestMoreData(this._instanceId,e,this._onMessage.bind(this))}requestMoreTickmarks(e){null!==this._instanceId&&this._gateway.requestMoreTickmarks(this._instanceId,e,this._onMessage.bind(this))}isStarted(){return this._status!==m.Idle}isActive(){return this._status===m.Active}resolution(){return this._resolution}start(){this.isStarted()?p.logNormal("start: data source is already started, nothing to do"):((0,i.assert)(null!==this._extSymbol,"symbol must be set before start"),(0,i.assert)(null!==this._resolution,"resolution must be set before start"),this._gateway.isConnected().value()?this._createSeries():this._changeStatusTo(m.AwaitingConnection))}stop(){this.isStarted()?(null!==this._instanceId&&(this._gateway.removeSeries(this._instanceId),this._instanceId=null),this._symbolInstanceId=null,this._changeStatusTo(m.Idle)):p.logNormal("stop: data source is already stopped, nothing to do")}instanceId(){return this._instanceId}data(){return this._data}setData(e){this._data=e}clearData(){this.isStarted()?this._enqueueUpdate((()=>this._clearDataImpl())):this._clearDataImpl()}dataEvents(){return this._dataEvents}turnaround(){return`${this._turnaroundPrefix}${this._turnaroundCounter}`}symbolInstanceId(){return this._symbolInstanceId}symbol(){return this._extSymbol}moveData(e){this._enqueueUpdate((()=>this._data.moveData(e)))}setInitialRequestOptions(e){this._createSeriesOverriddenParams=S(e)}symbolSameAsResolved(e){return null!==this._extSymbol&&(0,_.symbolSameAsResolved)(e,g(this._extSymbol),this._lastResolvedSymbol)}resolvedSymbol(){return null===this._extSymbol?null:g(this._extSymbol)}_resolveSymbol(){null!==this._extSymbol&&(this._symbolInstanceId=this._gateway.resolveSymbol("sds_sym_"+y++,(0,a.encodeExtendedSymbolOrGetSimpleSymbolString)(this._extSymbol),this._onMessage.bind(this)))}_clearDataImpl(){this._data.clear()}_changeStatusTo(e){(0, i.assert)(this._status!==e,"Source and destination status should be distinct"),p.logNormal(`Status changed from ${m[this._status]} to ${m[e]}`),this._status=e}_createSeries(){(0,i.assert)(this._status!==m.Active,'Status should not be "Active" when creating a study'),this._instanceId="sds_"+b++,this._resolveSymbol();const e=this._createSeriesOverriddenParams||this._createSeriesParams;this._createSeriesOverriddenParams&&(this._createSeriesOverriddenParams=0),this._gateway.createSeries(this._instanceId,this.turnaround(),(0,i.ensureNotNull)(this._symbolInstanceId),(0,i.ensureNotNull)(this._resolution),e,this._timeFrame,this._onMessage.bind(this)),this._timeFrame=null,this._changeStatusTo(m.AwaitingFirstDataUpdate),this._dataEvents.fireCreated(this._instanceId)}_onGatewayIsConnectedChanged(e){e?this._onGatewayConnected():this._onGatewayDisconnected()}_onGatewayConnected(){this._status===m.AwaitingConnection&&this._createSeries()}_onGatewayDisconnected(){this._status!==m.Idle&&this._status!==m.AwaitingConnection&&(this._instanceId=null,this._changeStatusTo(m.AwaitingConnection)),this._turnaroundCounter=1}_onMessage(e){this._enqueueUpdate((()=>this._onMessageImpl(e)))}async _onMessageImpl(e){switch(e.method){case"symbol_resolved":{const[t,s]=e.params;if(t!==this._symbolInstanceId){null!==this._symbolInstanceId&&p.logNormal(`Resolve for old symbol, expected: ${this._symbolInstanceId}, actual ${e.params[0]}`);break}this._onSymbolResolved(s);break}case"symbol_error":if(e.params[0]!==this._symbolInstanceId){null!==this._symbolInstanceId&&p.logNormal(`Symbol error for old symbol, expected: ${this._symbolInstanceId}, actual ${e.params[0]}`);break}this._onSymbolError(e);break;case"series_timeframe":{const[t,s,i,r,a,o,n]=e.params;if(!this._checkTurnaround(t,s)){p.logNormal(`Time frame for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${s})`);break}this._onSeriesTimeFrame(i,r,a,o,n);break}case"series_error":{const[t,s]=e.params;if(!this._checkTurnaround(t,s)){p.logNormal(`Series error for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${s})`);break}this._onSeriesError(e.params[2]);break}case"series_loading":{const[t,s]=e.params;if(!this._checkTurnaround(t,s))break;this._onSeriesLoading(e.time);break}case"series_completed":{const[t,s,i,r]=e.params;if(!this._checkTurnaround(t,i)){p.logNormal(`Series completed for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${i})`);break}this._onSeriesCompleted(s,e.time,r);break}case"data_update":if(!this._checkTurnaround(e.params.customId,e.params.turnaround)){p.logNormal(`Data update for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${e.params.customId} (${e.params.turnaround})`);break}await this._onDataUpdate(e.params.plots,e.params.nonseries,e.params.lastBar);break;case"clear_data":if(e.params.turnaround!==this.turnaround()){p.logNormal(`Clear data for old data, expected: ${this.turnaround()}, actual ${e.params.turnaround}`);break}this._clearDataImpl(), this._dataEvents.fireDataUpdated(void 0,!1,null,!1)}}_onSeriesError(e){let t,s;if("string"==typeof e)s={error:e},t=e;else if(s=e,e.ctx){const s={};Object.entries(e.ctx).forEach((([e,t])=>{s[e]=t.toString()})),t=e.error.format(s)}else t=e.error;if(t.startsWith("study_not_auth:")){const e=t.split(":",2)[1].split("@",2)[0];if(["BarSetRenko","BarSetPriceBreak","BarSetKagi","BarSetPnF"].includes(e))this._dataEvents.fireChartTypeNotPermitted(e);else if("BarSetSpread"===e)this._dataEvents.fireIntradaySpreadNotPermitted();else if("BarSetRange"===e){const e=`${(0,i.ensureNotNull)(this._extSymbol).inputs.range}R`;this._dataEvents.fireCustomIntervalNotPermitted(e)}}else"resolution_not_entitled"===t?this._dataEvents.fireIntradayExchangeNotPermitted():"custom_resolution"===t?this._dataEvents.fireCustomIntervalNotPermitted((0,i.ensureNotNull)(this._resolution)):"seconds_not_entitled"===t?this._dataEvents.fireSecondsIntervalNotPermitted():"ticks_not_entitled"===t&&this._dataEvents.fireTicksIntervalNotPermitted();this._dataEvents.fireSeriesError(s)}_onSeriesTimeFrame(e,t,s,i,r){this._dataEvents.fireSeriesTimeFrame(e,t,s,null==i||i,r)}_onSymbolError(e){if(e.params[1]===h.permissionDenied)switch(e.params[2]){case h.SymbolErrorPermissionDeniedReason.Symbol:this._dataEvents.fireSymbolNotPermitted(e.params[3]);break;case h.SymbolErrorPermissionDeniedReason.GroupPermission:this._dataEvents.fireSymbolGroupNotPermitted(e.params[3]);break;default:this._dataEvents.fireSymbolNotPermitted(e.params[2])}else e.params[1]===h.invalidSymbol&&this._dataEvents.fireSymbolInvalid();this._dataEvents.fireSymbolError(e.params[1])}_onSymbolResolved(e){this._lastResolvedSymbol=(0,i.ensureNotNull)((0,c.extractSymbolNameFromSymbolInfo)(e,"")),this._dataEvents.fireSymbolResolved(e)}async _onDataUpdate(e,t,s){this._onDataUnpacked(e,s,await w(t))}_enqueueUpdate(e){return this._ongoingDataUpdate=this._ongoingDataUpdate.then(e,e),this._ongoingDataUpdate}_onDataUnpacked(e,t,s){if(this._status===m.Idle)return;this._status===m.AwaitingFirstDataUpdate&&(this._changeStatusTo(m.Active),this._clearDataImpl());const i=this._data.bars().size(),r=this._data.bars().firstIndex(),a=this._data.mergeRegularBars(e);null!==s&&(this._data.nsBars().clear(),this._data.nsBars().merge(s.projectionPlots),this._data.lastProjectionPrice=s.lastPrice,null!==s.boxSize&&(this._data.boxSize=s.boxSize),this._data.reversalAmount=s.reversalAmount);const o=null===r,n=o||null!==a&&a.index{let t;return"factor"in e?t=e.factor:"additionalPrice"in e&&(t=e.additionalPrice),{index:s[e.time],value:[0,e.open,e.high,e.low,e.close,e.volume,t]}})),reversalAmount:o,boxSize:a}}},70843:(e,t,s)=>{s.d(t,{prepareStudyPropertiesState:()=>n,tpoStylePreferencesDefault:()=>o});var i=s(488530),r=s(379048),a=s(396372);const o={...i.lineStyleDefault,styles:{splitByBlocks:!1},inputs:{period:"Day",periodsNum:1,rowSize:"Auto",ticksPerRow:100,vaPercent:70,blockSize:"30m",mergePoints:"",extendPoorHigh:!1,extendPoorLow:!1,extendPOC:!1,extendSingleprints:!1},tpo:{colors:{gradientColors:["","","",""]},showBlocks:!0,showLetters:!0,nonVaOpacity:30},levels:{showPOC:!0,pocColor:"",showPoorHigh:!1,poorHighColor:"",showPoorLow:!1,poorLowColor:"",showSingleprints:!1,singleprintsColor:"",showVAH:!0,vahColor:"",showVAL:!0,valColor:"",showMidpoint:!0,showOpenPrice:!1,showClosePrice:!1,initialBalanceRange:{levels:2,visible:!0}},volumeProfile:{visible:!0,valuesColor:"",showValues:!0,vah:{visible:!1,color:"",linestyle:r.LineStyle.Dashed,linewidth:2},val:{visible:!1,color:"",linestyle:r.LineStyle.Dashed,linewidth:2},poc:{visible:!1,color:"",linestyle:r.LineStyle.Solid,linewidth:2},volumeColor:"",valueAreaColor:"",placement:a.HHistDirection.LeftToRight}};function n(e){const t={...e.inputs};return"Auto"===t.rowSize&&delete t.ticksPerRow,{inputs:t,styles:{splitByBlocks:e.styles.splitByBlocks},graphics:{tpoBlockSets:{tpo:{colors:e.tpo.colors.gradientColors,showBlocks:e.tpo.showBlocks,showLetters:e.tpo.showLetters,nonVaOpacity:e.tpo.nonVaOpacity}},tpoLevels:{tpo:{tpoPoc:{visible:e.levels.showPOC,color:e.levels.pocColor},tpoMidpoint:{visible:e.levels.showMidpoint},tpoPoorHigh:{visible:e.levels.showPoorHigh,color:e.levels.poorHighColor},tpoPoorLow:{visible:e.levels.showPoorLow,color:e.levels.poorLowColor},tpoSingleprints:{visible:e.levels.showSingleprints,color:e.levels.singleprintsColor},tpoVal:{visible:e.levels.showVAL,color:e.levels.valColor},tpoVah:{visible:e.levels.showVAH,color:e.levels.vahColor},volumePoc:{visible:e.volumeProfile.poc.visible,style:e.volumeProfile.poc.linestyle,color:e.volumeProfile.poc.color,width:e.volumeProfile.poc.linewidth},volumeVah:{visible:e.volumeProfile.vah.visible,style:e.volumeProfile.vah.linestyle,color:e.volumeProfile.vah.color,width:e.volumeProfile.vah.linewidth},volumeVal:{visible:e.volumeProfile.val.visible,style:e.volumeProfile.val.linestyle,color:e.volumeProfile.val.color,width:e.volumeProfile.val.linewidth}}},tpos:{tpo:{closePrice:{visible:e.levels.showClosePrice},openPrice:{visible:e.levels.showOpenPrice},initialBalanceRange:{...e.levels.initialBalanceRange}}},tpoVolumeRows:{tpo:{visible:e.volumeProfile.visible,valuesColor:e.volumeProfile.valuesColor,showValues:e.volumeProfile.showValues,direction:e.volumeProfile.placement,colors:{nonVa:e.volumeProfile.volumeColor,va:e.volumeProfile.valueAreaColor}}}}}}},490515:(e,t,s)=>{s.d(t,{VolumeFootprintBgColorsProperty:()=>A,getBgColorsDefaults:()=>B });var i=s(822914),r=s(852290),a=s(650151),o=s(790188),n=s(331633),l=s(86746),h=s(354950);const d=(0,o.getHexColorByName)("color-cold-gray-200"),u=(0,o.getHexColorByName)("color-black"),c=(0,o.getHexColorByName)("color-tv-blue-200"),_=(0,o.getHexColorByName)("color-tv-blue-400"),p=(0,o.getHexColorByName)("color-tv-blue-600"),m=(0,o.getHexColorByName)("color-tv-blue-800"),y=(0,o.getHexColorByName)("color-tv-blue-a800"),b=(0,o.getHexColorByName)("color-ripe-red-200"),S=(0,o.getHexColorByName)("color-ripe-red-400"),g=(0,o.getHexColorByName)("color-ripe-red-600"),v=(0,o.getHexColorByName)("color-ripe-red-800"),f=(0,o.getHexColorByName)("color-ripe-red-a700"),w=(0,o.getHexColorByName)("color-ripe-red-a900"),P=(0,o.getHexColorByName)("color-minty-green-200"),C=(0,o.getHexColorByName)("color-minty-green-400"),x=(0,o.getHexColorByName)("color-minty-green-600"),I=(0,o.getHexColorByName)("color-minty-green-800"),T=(0,o.getHexColorByName)("color-minty-green-a900"),V=new Map([[l.StdTheme.Light,{adjBuyBgColors:[P,C,x,I],adjSellBgColors:[b,S,g,f],adjTotalBgColors:[c,_,p,m],buyBgColor:C,sellBgColor:S,totalBgColor:_,pocColor:u}],[l.StdTheme.Dark,{adjBuyBgColors:[T,I,x,C],adjSellBgColors:[w,v,g,S],adjTotalBgColors:[y,m,p,_],buyBgColor:I,sellBgColor:v,totalBgColor:m,pocColor:d}]]);function D(e){return e===l.StdTheme.Light?(0,a.ensureDefined)(V.get(l.StdTheme.Light)):(0,a.ensureDefined)(V.get(l.StdTheme.Dark))}function B(){return(0,i.default)(D(n.watchedTheme.value()))}class A extends h.Property{constructor(e){super((0,r.default)(B(),e)),this._onThemeChanged=e=>{let t=l.StdTheme.Dark,s=l.StdTheme.Light;e!==l.StdTheme.Dark&&(t=l.StdTheme.Light,s=l.StdTheme.Dark);const i=D(s),r=D(t),a=this.state(),o=this.childs(),n=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3];n(i.adjBuyBgColors,a.adjBuyBgColors)&&o.adjBuyBgColors.merge(r.adjBuyBgColors),n(i.adjSellBgColors,a.adjSellBgColors)&&o.adjSellBgColors.merge(r.adjSellBgColors),n(i.adjTotalBgColors,a.adjTotalBgColors)&&o.adjTotalBgColors.merge(r.adjTotalBgColors),i.buyBgColor===a.buyBgColor&&o.buyBgColor.merge(r.buyBgColor),i.sellBgColor===a.sellBgColor&&o.sellBgColor.merge(r.sellBgColor),i.totalBgColor===a.totalBgColor&&o.totalBgColor.merge(r.totalBgColor),i.pocColor===a.pocColor&&o.pocColor.merge(r.pocColor)},n.watchedTheme.subscribe(this._onThemeChanged)}destroy(){super.destroy(),n.watchedTheme.unsubscribe(this._onThemeChanged)}}},30574:(e,t,s)=>{s.d(t,{translateSessionDescription:()=>a,translateSessionExtendedDescription:()=>l,translateSessionShortDescription:()=>n});var i=s(444372);const r=new Map([["Premarket",i.t(null,{context:"sessions"},s(156935))],["Postmarket",i.t(null,{context:"sessions"},s(798801))],["Regular Trading Hours",i.t(null,{context:"sessions"},s(824380))],["Extended Trading Hours",i.t(null,{context:"sessions"},s(897442))],["Electronic Trading Hours",i.t(null,{context:"sessions"},s(475610))]]);function a(e){var t;return null!==(t=r.get(e))&&void 0!==t?t:e}const o=new Map([["Premarket",i.t(null,{context:"sessions"},s(556137))],["Postmarket",i.t(null,{ context:"sessions"},s(332929))],["Regular Trading Hours",i.t(null,{context:"sessions"},s(663798))],["Extended Trading Hours",i.t(null,{context:"sessions"},s(333021))],["Electronic Trading Hours",i.t(null,{context:"sessions"},s(333021))]]);function n(e){var t;return null!==(t=o.get(e))&&void 0!==t?t:e}function l(e){var t;return null!==(t=r.get(e))&&void 0!==t?t:e}},234271:(e,t,s)=>{s.d(t,{getPersistentLogger:()=>r,setPersistentLogger:()=>a});let i=null;function r(){return i}function a(e){i=e}}}]);