Release v27.002 (from 18ee23e7)

This commit is contained in:
jenkins
2024-02-23 14:54:34 +00:00
parent a1585eb225
commit 5b960a8ec3
10 changed files with 179 additions and 103 deletions

View File

@@ -5,6 +5,24 @@
<!-- markdownlint-disable no-inline-html --> <!-- markdownlint-disable no-inline-html -->
<!-- markdownlint-disable code-block-style --> <!-- markdownlint-disable code-block-style -->
## Version 27.002
*Date: Thu Feb 22 2024*
**Improvements**
- **Add positive and negative filled areas to Spread.** The Spread indicator now has a positive and negative filled area above and below the baseline value of 0. The colors of the filled areas are green and red respectively.
**Bug Fixes**
- **Brush drawing_event is now raising a `create` event when starting drawing.**
**Documentation**
- **Improved drawing documentation.** Explore our latest articles about drawings.
- New [Drawings API](https://www.tradingview.com/charting-library-docs/latest/ui_elements/drawings/drawings-api) article describes how to manage drawings in the code.
- Updated [Drawing Overrides](https://www.tradingview.com/charting-library-docs/latest/customization/overrides/Drawings-Overrides) article now includes more information on how to customize drawings.
## Version 27.001 ## Version 27.001
*Date: Fri Feb 2 2024* *Date: Fri Feb 2 2024*
@@ -457,7 +475,7 @@ Please use [settings_adapter](https://www.tradingview.com/charting-library-docs/
**New Features** **New Features**
- **Added support for specifying custom timezones.** - **Added support for specifying custom timezones.**
- Additional custom timezones can now be specified for use within the library. Please see the [Adding Custom Timezones](../ui_elements/timezones#adding-custom-timezones) section within the Timezones page. - Additional custom timezones can now be specified for use within the library. Please see the [Adding Custom Timezones](../ui_elements/timezones#adding-custom-time-zones) section within the Timezones page.
- **Images within timescale marks.** - **Images within timescale marks.**
- Timescale marks now support the rendering of images within the circular shape by specifying the `imageUrl` property. Please see the [TimescaleMark](../api/interfaces/Charting_Library.TimescaleMark) interface for more details. - Timescale marks now support the rendering of images within the circular shape by specifying the `imageUrl` property. Please see the [TimescaleMark](../api/interfaces/Charting_Library.TimescaleMark) interface for more details.
- **Support different margin rates for different order types.** [6607](https://github.com/tradingview/charting_library/issues/6607) - **Support different margin rates for different order types.** [6607](https://github.com/tradingview/charting_library/issues/6607)
@@ -501,7 +519,7 @@ Please use [settings_adapter](https://www.tradingview.com/charting-library-docs/
**Other** **Other**
- Removed `Australia/ACT` from the list of [timezones](../ui_elements/timezones) within our documentation. Please use either the Sydney timezone or [specify your own custom timezone](../ui_elements/timezones#adding-custom-timezones). - Removed `Australia/ACT` from the list of [timezones](../ui_elements/timezones) within our documentation. Please use either the Sydney timezone or [specify your own custom timezone](../ui_elements/timezones#adding-custom-time-zones).
## Version 24.001 ## Version 24.001

View File

@@ -36,44 +36,45 @@ TradingView.ChartapiMessagerInstances[e]=new a(this,e),this._sessions[e]=t,this.
f.subscribe(null,S,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*r)}.bind(this),0)}function v(e,s){e===t&&s===i&&(g.unsubscribe(null,v),f.unsubscribe(null,S),m())}function S(e,s){e===t&&s===i&&g.unsubscribe(null,v)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,s,o){var a,l,c={},h=!0;if(o.type===u.PeriodBack){var d=this._studyEngine.getSeriesLastBarTime(e,i);if(null===d)return;l=d/1e3;var _=n.parse(o.value),m=this._studyEngine.getSeriesSymbolInfo(e,i);a=r.alignPeriodsBackForVisibleRange(m.session,m.session_holidays,m.corrections,_.letter(),_.multiplier(),1,d)/1e3;var g=p(this._studyEngine.getSeriesInterval(e,i),m);null!==g&&(l=g.timeToExchangeTradingDay(1e3*l)/1e3,a=g.timeToExchangeTradingDay(1e3*a)/1e3),c={applyDefaultRightMargin:!0},h=!1}else a=o.from,l=o.to;this.setVisibleTimeRange(e,i,s,a,l,h,c,void 0,o)},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==o&&(l._applyTimeFrame(e,s,t,i,o),o=null),a(r)}),t),this._studyEngine.modifySeries(e,t,s,r,i,n)},JSServer.ChartApi.prototype.requestMoreData=function(e,t){this._studyEngine.extendSeriesRange(e,t)},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(){return new Promise(((e,t)=>{const i=this.studiesAccessController.getEnabledTools();e({method:"studies_metadata",params:[this._makeNextRequestId(),{errors:[],hash:"",metainfo:i,migrations:[]}]})}))},JSServer.ChartApi.prototype._makeNextRequestId=function(){return"metadata_"+this._metadataRequestNextNumber++},JSServer.ChartApi.prototype.canCreateStudy=function(){return this.studyCounter<TradingView.STUDY_COUNT_LIMIT},JSServer.ChartApi.prototype.getStudyCounter=function(){return this.studyCounter},JSServer.ChartApi.prototype.createStudy=function(e,t,i,s,r,n,o){if(!this.canCreateStudy()){const e=new Error("Exceeded the limit of studies");throw e.cause="TooManyStudies",e}this._notificationHandlers[e][t]=new c(o,t),this._studyEngine.createStudy(e,t,s,i,r,n),this.studyCounter++},JSServer.ChartApi.prototype.rebindStudy=function(e,t,i,s,r,n,o,a){throw new Error("Not implemented")},JSServer.ChartApi.prototype.removeStudy=function(e,t,i){this._notificationHandlers[e][t]&&(delete this._notificationHandlers[e][t],this._studyEngine.removeStudy(e,t),this.studyCounter--)},JSServer.ChartApi.prototype.modifyStudy=function(e,t,i,s,r){this._notificationHandlers[e][t]=new c(r,t),this._studyEngine.modifyStudy(e,t,i,s)},JSServer.ChartApi.prototype.createPointset=function(e,t,i,s,r,n,o){this._notificationHandlers[e][t]=new c(o,t),this._studyEngine.createPointset(e,t,s,r,n)},JSServer.ChartApi.prototype.modifyPointset=function(e,t,i,s,r){throw Error("This call is not implemented")},JSServer.ChartApi.prototype.removePointset=function(e,t,i){this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t) f.subscribe(null,S,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*r)}.bind(this),0)}function v(e,s){e===t&&s===i&&(g.unsubscribe(null,v),f.unsubscribe(null,S),m())}function S(e,s){e===t&&s===i&&g.unsubscribe(null,v)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,s,o){var a,l,c={},h=!0;if(o.type===u.PeriodBack){var d=this._studyEngine.getSeriesLastBarTime(e,i);if(null===d)return;l=d/1e3;var _=n.parse(o.value),m=this._studyEngine.getSeriesSymbolInfo(e,i);a=r.alignPeriodsBackForVisibleRange(m.session,m.session_holidays,m.corrections,_.letter(),_.multiplier(),1,d)/1e3;var g=p(this._studyEngine.getSeriesInterval(e,i),m);null!==g&&(l=g.timeToExchangeTradingDay(1e3*l)/1e3,a=g.timeToExchangeTradingDay(1e3*a)/1e3),c={applyDefaultRightMargin:!0},h=!1}else a=o.from,l=o.to;this.setVisibleTimeRange(e,i,s,a,l,h,c,void 0,o)},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==o&&(l._applyTimeFrame(e,s,t,i,o),o=null),a(r)}),t),this._studyEngine.modifySeries(e,t,s,r,i,n)},JSServer.ChartApi.prototype.requestMoreData=function(e,t){this._studyEngine.extendSeriesRange(e,t)},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(){return new Promise(((e,t)=>{const i=this.studiesAccessController.getEnabledTools();e({method:"studies_metadata",params:[this._makeNextRequestId(),{errors:[],hash:"",metainfo:i,migrations:[]}]})}))},JSServer.ChartApi.prototype._makeNextRequestId=function(){return"metadata_"+this._metadataRequestNextNumber++},JSServer.ChartApi.prototype.canCreateStudy=function(){return this.studyCounter<TradingView.STUDY_COUNT_LIMIT},JSServer.ChartApi.prototype.getStudyCounter=function(){return this.studyCounter},JSServer.ChartApi.prototype.createStudy=function(e,t,i,s,r,n,o){if(!this.canCreateStudy()){const e=new Error("Exceeded the limit of studies");throw e.cause="TooManyStudies",e}this._notificationHandlers[e][t]=new c(o,t),this._studyEngine.createStudy(e,t,s,i,r,n),this.studyCounter++},JSServer.ChartApi.prototype.rebindStudy=function(e,t,i,s,r,n,o,a){throw new Error("Not implemented")},JSServer.ChartApi.prototype.removeStudy=function(e,t,i){this._notificationHandlers[e][t]&&(delete this._notificationHandlers[e][t],this._studyEngine.removeStudy(e,t),this.studyCounter--)},JSServer.ChartApi.prototype.modifyStudy=function(e,t,i,s,r){this._notificationHandlers[e][t]=new c(r,t),this._studyEngine.modifyStudy(e,t,i,s)},JSServer.ChartApi.prototype.createPointset=function(e,t,i,s,r,n,o){this._notificationHandlers[e][t]=new c(o,t),this._studyEngine.createPointset(e,t,s,r,n)},JSServer.ChartApi.prototype.modifyPointset=function(e,t,i,s,r){throw Error("This call is not implemented")},JSServer.ChartApi.prototype.removePointset=function(e,t,i){this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t)
},JSServer.ChartApi.prototype.requestMoreTickmarks=function(e,t){this._studyEngine.requestMoreTickmarks(e,t)},JSServer.ChartApi.prototype.requestFirstBarTime=function(e,t,i,s){this._notificationHandlers[e][t]=new c(s,t)},JSServer.ChartApi.prototype._invokeHandler=function(e,t){e&&e(t)},JSServer.ChartApi.prototype._sendRequest=function(e,t){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._onMessage=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._dispatchNotification=function(e){var t=e.params.shift();if(this._notificationHandlers[t])switch(e.method){case"timescale_update":var i=e.params[0],s=e.params[1];for(var r in s.clear=0===s.changes.length&&0===s.marks.length,this._sessions[t].onMessage({method:"timescale_update",params:s}),i){var n={method:"data_update",params:{customId:r,plots:i[r].series,nonseries:i[r].nonseries,turnaround:i[r].turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"tickmark_update":this._sessions[t].onMessage({method:"timescale_update",params:e.params[0]});break;case"data_update":for(var r in e.params[0]){var o=e.params[0][r];n={method:"data_update",params:{customId:r,plots:o.series?o.series:o.plots,nonseries:o.nonseries,turnaround:o.turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"index_update":for(var r in e.params[0]){n={method:"index_update",params:e.params[0][r]};this._invokeNotificationHandler(t,r,n)}break;case"critical_error":d.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),this._sessions[t].onMessage({method:"critical_error",params:e.params});break;case"timescale_completed":case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._sessions[t].onMessage({method:e.method,params:e.params});break;case"clear_data":for(var a in e.params[0])this._invokeNotificationHandler(t,a,{method:"clear_data",params:e.params[0][a]});break;default:var l=e.params[0];this._invokeNotificationHandler(t,l,e)}},JSServer.ChartApi.prototype._invokeNotificationHandler=function(e,t,i){if(void 0!==t){var s=this._notificationHandlers[e][t];void 0!==s&&s&&this._invokeHandler(s.handler,i)}},JSServer.ChartApi.prototype.searchSymbols=function(e,t,i,s,r,n,o,a,l,c){this._studyEngine.searchSymbols(e,t,i,c)},JSServer.ChartApi.prototype._notifySessions=function(e){for(var t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;var i=this._sessions[t];"function"==typeof i.onMessage&&i.onMessage(e)}},JSServer.ChartApi.prototype.unpack=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.quoteCreateSession=function(e){return this._studyEngine.quoteCreateSession(e)},JSServer.ChartApi.prototype.quoteDeleteSession=function(e){return this._studyEngine.quoteDeleteSession(e)},JSServer.ChartApi.prototype.quoteSetFields=function(e,t){return this._studyEngine.quoteSetFields(e,t)},JSServer.ChartApi.prototype.quoteAddSymbols=function(e,t){ },JSServer.ChartApi.prototype.requestMoreTickmarks=function(e,t){this._studyEngine.requestMoreTickmarks(e,t)},JSServer.ChartApi.prototype.requestFirstBarTime=function(e,t,i,s){this._notificationHandlers[e][t]=new c(s,t)},JSServer.ChartApi.prototype._invokeHandler=function(e,t){e&&e(t)},JSServer.ChartApi.prototype._sendRequest=function(e,t){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._onMessage=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._dispatchNotification=function(e){var t=e.params.shift();if(this._notificationHandlers[t])switch(e.method){case"timescale_update":var i=e.params[0],s=e.params[1];for(var r in s.clear=0===s.changes.length&&0===s.marks.length,this._sessions[t].onMessage({method:"timescale_update",params:s}),i){var n={method:"data_update",params:{customId:r,plots:i[r].series,nonseries:i[r].nonseries,turnaround:i[r].turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"tickmark_update":this._sessions[t].onMessage({method:"timescale_update",params:e.params[0]});break;case"data_update":for(var r in e.params[0]){var o=e.params[0][r];n={method:"data_update",params:{customId:r,plots:o.series?o.series:o.plots,nonseries:o.nonseries,turnaround:o.turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"index_update":for(var r in e.params[0]){n={method:"index_update",params:e.params[0][r]};this._invokeNotificationHandler(t,r,n)}break;case"critical_error":d.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),this._sessions[t].onMessage({method:"critical_error",params:e.params});break;case"timescale_completed":case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._sessions[t].onMessage({method:e.method,params:e.params});break;case"clear_data":for(var a in e.params[0])this._invokeNotificationHandler(t,a,{method:"clear_data",params:e.params[0][a]});break;default:var l=e.params[0];this._invokeNotificationHandler(t,l,e)}},JSServer.ChartApi.prototype._invokeNotificationHandler=function(e,t,i){if(void 0!==t){var s=this._notificationHandlers[e][t];void 0!==s&&s&&this._invokeHandler(s.handler,i)}},JSServer.ChartApi.prototype.searchSymbols=function(e,t,i,s,r,n,o,a,l,c){this._studyEngine.searchSymbols(e,t,i,c)},JSServer.ChartApi.prototype._notifySessions=function(e){for(var t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;var i=this._sessions[t];"function"==typeof i.onMessage&&i.onMessage(e)}},JSServer.ChartApi.prototype.unpack=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.quoteCreateSession=function(e){return this._studyEngine.quoteCreateSession(e)},JSServer.ChartApi.prototype.quoteDeleteSession=function(e){return this._studyEngine.quoteDeleteSession(e)},JSServer.ChartApi.prototype.quoteSetFields=function(e,t){return this._studyEngine.quoteSetFields(e,t)},JSServer.ChartApi.prototype.quoteAddSymbols=function(e,t){
return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((function(e){return!!e}))),this._studyEngine.quoteAddSymbols(e,t)},JSServer.ChartApi.prototype.quoteRemoveSymbols=function(e,t){return this._studyEngine.quoteRemoveSymbols(e,t)},JSServer.ChartApi.prototype.quoteFastSymbols=function(e,t){return this._studyEngine.quoteFastSymbols(e,t)},JSServer.ChartApi.prototype.quoteHibernateAll=function(e){return this._studyEngine.quoteHibernateAll(e)},JSServer.ChartApi.prototype.depthCreateSession=function(e){return this._studyEngine.depthCreateSession(e)},JSServer.ChartApi.prototype.depthDeleteSession=function(e){return this._studyEngine.depthDeleteSession(e)},JSServer.ChartApi.prototype.depthSetSymbol=function(e,t){return this._studyEngine.depthSetSymbol(e,t)},JSServer.ChartApi.prototype.depthClearSymbol=function(e){},JSServer.ChartApi.prototype.depthSetScale=function(e,t){},JSServer.ChartApi.prototype.createStudiesAccessController=function(e,t,i){return new this.StudiesAccessController(this._studyEngine,e&&JSON.parse(e)||{type:"black",tools:[]})},JSServer.ChartApi.prototype.StudiesAccessController=function(e,t){this._studyEngine=e,this._studiesAccess=t},JSServer.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(e){for(var t=null,i=0;i<this._studiesAccess.tools.length;++i){var s=this._studiesAccess.tools[i];if(s.name===e||s===e){t=s;break}}return t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter((function(e){return this.isToolEnabled(e.description)||e.is_hidden_study}),this)},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolEnabled=function(e){var t=this._findTool(e);return"black"===this._studiesAccess.type?!t||t.grayed:!!t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},JSServer.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},JSServer.ChartApi.prototype.serverTime=function(){return this._studyEngine.serverTime()},JSServer.ChartApi.prototype.disconnectCount=function(){return 0},h(JSServer.ChartApi,"JSServer.ChartApi",l,"ChartApiInterface"),e.exports=JSServer.ChartApi},60325:(e,t,i)=>{"use strict";var s=i(57898).Delegate,r=function(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new s,this.seriesError=new s};r.prototype.onSymbolResolved=function(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})},r.prototype.onSymbolError=function(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})},r.prototype.onStudyError=function(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})},r.prototype.onSeriesLoading=function(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})},r.prototype.onSeriesCompleted=function(e,t,i){this.beforeSeriesCompleted.fire(e,t), return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((function(e){return!!e}))),this._studyEngine.quoteAddSymbols(e,t)},JSServer.ChartApi.prototype.quoteRemoveSymbols=function(e,t){return this._studyEngine.quoteRemoveSymbols(e,t)},JSServer.ChartApi.prototype.quoteFastSymbols=function(e,t){return this._studyEngine.quoteFastSymbols(e,t)},JSServer.ChartApi.prototype.quoteHibernateAll=function(e){return this._studyEngine.quoteHibernateAll(e)},JSServer.ChartApi.prototype.depthCreateSession=function(e){return this._studyEngine.depthCreateSession(e)},JSServer.ChartApi.prototype.depthDeleteSession=function(e){return this._studyEngine.depthDeleteSession(e)},JSServer.ChartApi.prototype.depthSetSymbol=function(e,t){return this._studyEngine.depthSetSymbol(e,t)},JSServer.ChartApi.prototype.depthClearSymbol=function(e){},JSServer.ChartApi.prototype.depthSetScale=function(e,t){},JSServer.ChartApi.prototype.createStudiesAccessController=function(e,t,i){return new this.StudiesAccessController(this._studyEngine,e&&JSON.parse(e)||{type:"black",tools:[]})},JSServer.ChartApi.prototype.StudiesAccessController=function(e,t){this._studyEngine=e,this._studiesAccess=t},JSServer.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(e){for(var t=null,i=0;i<this._studiesAccess.tools.length;++i){var s=this._studiesAccess.tools[i];if(s.name===e||s===e){t=s;break}}return t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter((function(e){return this.isToolEnabled(e.description)||e.is_hidden_study}),this)},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolEnabled=function(e){var t=this._findTool(e);return"black"===this._studiesAccess.type?!t||t.grayed:!!t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},JSServer.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},JSServer.ChartApi.prototype.serverTime=function(){return this._studyEngine.serverTime()},JSServer.ChartApi.prototype.disconnectCount=function(){return 0},h(JSServer.ChartApi,"JSServer.ChartApi",l,"ChartApiInterface"),e.exports=JSServer.ChartApi},60325:(e,t,i)=>{"use strict";var s=i(57898).Delegate,r=function(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new s,this.seriesError=new s};r.prototype.onSymbolResolved=function(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})},r.prototype.onSymbolError=function(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})},r.prototype.onStudyError=function(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})},r.prototype.onSeriesLoading=function(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})},r.prototype.onSeriesCompleted=function(e,t,i){this.beforeSeriesCompleted.fire(e,t),
this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})},r.prototype.onSeriesError=function(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)},r.prototype.onStudyCompleted=function(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})},r.prototype.onStudyLoading=function(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})},r.prototype.onTickmarksUpdated=function(e,t){var i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleUpdate=function(e,t){var i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleCompleted=function(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})},r.prototype.onSeriesTimeframeUpdate=function(e,t,i,s,r,n){var o={method:"series_timeframe",params:[this._session,e,t,i,s,n||null,!0,r]};this._server.receiveLocalResponse(o)},r.prototype.onPointsetDataUpdate=function(e,t,i){this.onDataUpdate(e,t,i,null)},r.prototype._prepareDataUpdateObjects=function(e){var t={};return e.forEach((function(e){t[e.objId]={series:e.data,turnaround:e.turnaround},e.nonSeriesData&&(e.nonSeriesData.data?t[e.objId].nonseries={d:JSON.stringify(e.nonSeriesData.data),indexes:e.nonSeriesData.indexes}:t[e.objId].nonseries={d:"",indexes:[]})})),t},r.prototype.onDataUpdate=function(e,t,i,s){var r={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})},r.prototype.onDepthData=function(e){this._server.receiveLocalResponse({method:"dd",params:e})},r.prototype.onDepthUpdate=function(e){this._server.receiveLocalResponse({method:"dpu",params:e})},r.prototype.onClearData=function(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})},TradingView.ChartapiMessagerInstances=[],e.exports=r},79850:(e,t,i)=>{"use strict";i.d(t,{DatafeedRequestsCachedProcessor:()=>_});var s=i(50151),r=i(36274),n=i(78071),o=i(74649),a=i(14483),l=i(60156),c=i(77475),h=i(57333);i(42053);function d(e,t){return e.ticker+(e.currency_code?"_#_"+e.currency_code:"")+(e.unit_id?"_#_"+e.unit_id:"")+(e.subsession_id?"_#_"+e.subsession_id:"")+"_#_"+t}function u(e){return new Date(e).toISOString()}class p{constructor(e,t,i,s,n,o){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._nextTime=null,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._destroyed=!1, this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})},r.prototype.onSeriesError=function(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)},r.prototype.onStudyCompleted=function(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})},r.prototype.onStudyLoading=function(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})},r.prototype.onTickmarksUpdated=function(e,t){var i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleUpdate=function(e,t){var i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleCompleted=function(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})},r.prototype.onSeriesTimeframeUpdate=function(e,t,i,s,r,n){var o={method:"series_timeframe",params:[this._session,e,t,i,s,n||null,!0,r]};this._server.receiveLocalResponse(o)},r.prototype.onPointsetDataUpdate=function(e,t,i){this.onDataUpdate(e,t,i,null)},r.prototype._prepareDataUpdateObjects=function(e){var t={};return e.forEach((function(e){t[e.objId]={series:e.data,turnaround:e.turnaround},e.nonSeriesData&&(e.nonSeriesData.data?t[e.objId].nonseries={d:JSON.stringify(e.nonSeriesData.data),indexes:e.nonSeriesData.indexes}:t[e.objId].nonseries={d:"",indexes:[]})})),t},r.prototype.onDataUpdate=function(e,t,i,s){var r={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})},r.prototype.onDepthData=function(e){this._server.receiveLocalResponse({method:"dd",params:e})},r.prototype.onDepthUpdate=function(e){this._server.receiveLocalResponse({method:"dpu",params:e})},r.prototype.onClearData=function(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})},TradingView.ChartapiMessagerInstances=[],e.exports=r},79850:(e,t,i)=>{"use strict";i.d(t,{DatafeedRequestsCachedProcessor:()=>_});var s=i(50151),r=i(36274),n=i(78071),o=i(14483),a=i(60156),l=i(77475),c=i(57333),h=(i(42053),i(37360));function d(e,t){return e.ticker+(e.currency_code?"_#_"+e.currency_code:"")+(e.unit_id?"_#_"+e.unit_id:"")+(e.subsession_id?"_#_"+e.subsession_id:"")+"_#_"+t}function u(e){return new Date(e).toISOString()}class p{constructor(e,t,i,s,n,o){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._nextTime=null,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,
this._emptyResponsesCount=0,this._firstDataRequest=!0,this._datafeed=e,this._symbolInfo=t,this._interval=r.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=n,this._serverTimeOffsetGetter=s,this._resetCacheTimePeriod=void 0===o?1e4:o,this._sessionSpec=new h.SessionSpec(t.timezone,t.session,t.session_holidays,t.corrections),this._updateDatesFromExpirationDate()}destroy(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed,this._destroyed=!0}addSubscription(e,t,i){const s=this._getNextSubscriptionId();this._pendingSubscribers.push({key:s,range:e,onHistoryCallback:t,onErrorCallback:i}),r.Interval.isDWM(this._resolution)&&void 0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&console.warn(`${this._logMessagePrefix()}Internal error: invalid date for DWM resolution ${u(e.to)}, expected time without a time part`),this._clearResetCacheTimeout();return setTimeout((()=>{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)));console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}_logMessage(e,t){(a.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`FEED [${this._symbolInfo.name}|${this._resolution}${e?"|"+e:""}${t?"|"+t:""}]: `}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._firstDataRequest=!0,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,s.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,r=(0,n.lowerbound)(this._cache.bars,i,((e,t)=>e.time<t));return e.countBack<r?{countBack:0,to:0!==e.countBack&&r<=this._cache.bars.length?this._dealignTime(this._cache.bars[r-e.countBack].time):t}:{countBack:e.countBack-r, this._destroyed=!1,this._emptyResponsesCount=0,this._firstDataRequest=!0,this._datafeed=e,this._symbolInfo=t,this._interval=r.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=n,this._serverTimeOffsetGetter=s,this._resetCacheTimePeriod=void 0===o?1e4:o,this._sessionSpec=new c.SessionSpec(t.timezone,t.session,t.session_holidays,t.corrections),this._updateDatesFromExpirationDate()}destroy(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed,this._destroyed=!0}addSubscription(e,t,i){const s=this._getNextSubscriptionId();this._pendingSubscribers.push({key:s,range:e,onHistoryCallback:t,onErrorCallback:i}),r.Interval.isDWM(this._resolution)&&void 0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&console.warn(`${this._logMessagePrefix()}Internal error: invalid date for DWM resolution ${u(e.to)}, expected time without a time part`),this._clearResetCacheTimeout();return setTimeout((()=>{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)));console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}_logMessage(e,t){(o.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`FEED [${this._symbolInfo.name}|${this._resolution}${e?"|"+e:""}${t?"|"+t:""}]: `}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._firstDataRequest=!0,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,s.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,r=(0,n.lowerbound)(this._cache.bars,i,((e,t)=>e.time<t));return e.countBack<r?{countBack:0,to:0!==e.countBack&&r<=this._cache.bars.length?this._dealignTime(this._cache.bars[r-e.countBack].time):t}:{countBack:e.countBack-r,
to:this._dealignTime(this._cache.bars[0].time)}}_processPendingSubscribers(){const e=this._pendingSubscribers;if(!e.length)return;if(this._requesting)return void this._logMessage("Processing is skipped due active request");if(this._logMessage(`Processing pending subscribers, count=${e.length}`),this._errorMessage){const t=this._errorMessage;return this._logMessage(`Return error: ${t}`),this._pendingSubscribers=[],void e.forEach((e=>{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.to<t.to||i.to===t.to&&i.countBack>t.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${u(t.to)}`);!(null===this._leftDate||t.to<this._leftDate&&(null===this._nextTime||t.to<this._nextTime)||0!==t.countBack)||this._endOfData?(this._pendingSubscribers=[],e.forEach((e=>{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),d(this._symbolInfo,this._resolution),(()=>{this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null===e||a.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})})),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(d(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),u(s.bars[0].time),u(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,this._endOfData&&null!==this._leftDate&&i.to<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)}_createBarsetForRange(e){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,n.lowerbound)(this._cache.bars,t,((e,t)=>e.time<t)),r=new o.BarSet(this._symbolInfo,this._cache.bars.slice(Math.max(0,i-e.countBack))) to:this._dealignTime(this._cache.bars[0].time)}}_processPendingSubscribers(){const e=this._pendingSubscribers;if(!e.length)return;if(this._requesting)return void this._logMessage("Processing is skipped due active request");if(this._logMessage(`Processing pending subscribers, count=${e.length}`),this._errorMessage){const t=this._errorMessage;return this._logMessage(`Return error: ${t}`),this._pendingSubscribers=[],void e.forEach((e=>{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.to<t.to||i.to===t.to&&i.countBack>t.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${u(t.to)}`);!(null===this._leftDate||t.to<this._leftDate&&(null===this._nextTime||t.to<this._nextTime)||0!==t.countBack)||this._endOfData?(this._pendingSubscribers=[],e.forEach((e=>{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),d(this._symbolInfo,this._resolution),(()=>{this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null===e||o.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})})),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(d(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),u(s.bars[0].time),u(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,this._endOfData&&null!==this._leftDate&&i.to<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)}_createBarsetForRange(e){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,n.lowerbound)(this._cache.bars,t,((e,t)=>e.time<t)),r=new h.BarSet(this._symbolInfo,this._cache.bars.slice(Math.max(0,i-e.countBack)))
;return 0!==r.bars.length?r.firstLoadedTimeMs=this._dealignTime(r.bars[0].time):0!==this._cache.bars.length?r.firstLoadedTimeMs=this._dealignTime(this._cache.bars[this._cache.bars.length-1].time):r.firstLoadedTimeMs=this._dealignTime((0,s.ensureNotNull)(this._leftDate)),r}_ensureRequestedTo(e){var t;let i;if(this._requesting&&this._logMessage("Internal error: trying to call getBars while the previous request is active",!0),null!==this._leftDate)i=this._leftDate;else{const e=this._now();if(null===this._dwmAligner)i=e;else{let t=this._sessionSpec.alignToNearestSessionStart(new Date(e),1).getTime();if(t<e){const e=this._sessionSpec.alignToNearestSessionEnd(new Date(t),1).getTime();t=this._sessionSpec.alignToNearestSessionStart(new Date(e+1e3),1).getTime()}i=this._dealignTime(t)}}const s=(0,l.alignPeriodsBackForDataRequest)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.countBack,Math.min(e.to,i,null!==(t=this._nextTime)&&void 0!==t?t:1/0));let r=e.countBack;if(e.to<i){r+=(0,l.getPeriodsBetweenDates)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.to,i)}if(null!==this._leftDate&&this._leftDate<s)return void this._processPendingSubscribers();const n=this._firstDataRequest||(this._isSymbolExpired()?0===this._cache.bars.length:null===this._leftDate);this._firstDataRequest=!1,this._requesting=!0,this._nextTime=null,this._leftDate=s;const o=`[${u(s)} ... ${u(i)}, ${r} bars]`;this._logMessage(`Requesting data: ${o}`);let a=!1;const c=s/1e3,h=i/1e3;this._datafeed.getBars(this._symbolInfo,this._resolution,{from:this._interval.isTicks()?c:Math.floor(c),to:this._interval.isTicks()?h:Math.floor(h),countBack:r,firstDataRequest:n},((e,t)=>{if(!this._destroyed)if(a)this._logMessage("getBars callback is already called before",!0);else{if(a=!0,e.length>0){const t=` [${u(e[0].time)} ... ${u(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${o}`)}else this._logMessage(`Receiving bars: barset is empty, requested range: ${o}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(a?this._logMessage("getBars callback is already called before",!0):(a=!0,this._requesting=!1,this._errorMessage=e||null,this._processPendingSubscribers()))}))}_processBars(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?(this._emptyResponsesCount=0,this._processFullBarset(e,t)):(this._emptyResponsesCount+=1,this._processEmptyBarset(t)),this._processPendingSubscribers()}_processEmptyBarset(e){e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(u(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?(this._logMessage("EOD received"),this._setEndOfData()):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned"),50===this._emptyResponsesCount&&(this._logMessage("EOD detected due 50 empty responses in a row"),this._setEndOfData())} ;return 0!==r.bars.length?r.firstLoadedTimeMs=this._dealignTime(r.bars[0].time):0!==this._cache.bars.length?r.firstLoadedTimeMs=this._dealignTime(this._cache.bars[this._cache.bars.length-1].time):r.firstLoadedTimeMs=this._dealignTime((0,s.ensureNotNull)(this._leftDate)),r}_ensureRequestedTo(e){var t;let i;if(this._requesting&&this._logMessage("Internal error: trying to call getBars while the previous request is active",!0),null!==this._leftDate)i=this._leftDate;else{const e=this._now();if(null===this._dwmAligner)i=e;else{let t=this._sessionSpec.alignToNearestSessionStart(new Date(e),1).getTime();if(t<e){const e=this._sessionSpec.alignToNearestSessionEnd(new Date(t),1).getTime();t=this._sessionSpec.alignToNearestSessionStart(new Date(e+1e3),1).getTime()}i=this._dealignTime(t)}}const s=(0,a.alignPeriodsBackForDataRequest)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.countBack,Math.min(e.to,i,null!==(t=this._nextTime)&&void 0!==t?t:1/0));let r=e.countBack;if(e.to<i){r+=(0,a.getPeriodsBetweenDates)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.to,i)}if(null!==this._leftDate&&this._leftDate<s)return void this._processPendingSubscribers();const n=this._firstDataRequest||(this._isSymbolExpired()?0===this._cache.bars.length:null===this._leftDate);this._firstDataRequest=!1,this._requesting=!0,this._nextTime=null,this._leftDate=s;const o=`[${u(s)} ... ${u(i)}, ${r} bars]`;this._logMessage(`Requesting data: ${o}`);let l=!1;const c=s/1e3,h=i/1e3;this._datafeed.getBars(this._symbolInfo,this._resolution,{from:this._interval.isTicks()?c:Math.floor(c),to:this._interval.isTicks()?h:Math.floor(h),countBack:r,firstDataRequest:n},((e,t)=>{if(!this._destroyed)if(l)this._logMessage("getBars callback is already called before",!0);else{if(l=!0,e.length>0){const t=` [${u(e[0].time)} ... ${u(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${o}`)}else this._logMessage(`Receiving bars: barset is empty, requested range: ${o}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(l?this._logMessage("getBars callback is already called before",!0):(l=!0,this._requesting=!1,this._errorMessage=e||null,this._processPendingSubscribers()))}))}_processBars(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?(this._emptyResponsesCount=0,this._processFullBarset(e,t)):(this._emptyResponsesCount+=1,this._processEmptyBarset(t)),this._processPendingSubscribers()}_processEmptyBarset(e){e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(u(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?(this._logMessage("EOD received"),this._setEndOfData()):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned"),50===this._emptyResponsesCount&&(this._logMessage("EOD detected due 50 empty responses in a row"),this._setEndOfData())}
_setEndOfData(){this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._dealignTime(this._cache.bars[0].time))}_processFullBarset(e,t){this._putToCache(e)?null!==this._leftDate&&0!==this._cache.bars.length&&(this._interval.isTicks()?this._leftDate=this._dealignTime(this._cache.bars[0].time):this._leftDate=Math.min(this._leftDate,this._dealignTime(this._cache.bars[0].time))):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?console.warn(`${this._logMessagePrefix()}nextTime should be set when there is no data in the requested period only`):t&&t.noData&&console.warn(`${this._logMessagePrefix()}noData should be set when there is no data in the requested period and earlier only`)}_getNextSubscriptionId(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(a.enabled("charting_library_debug_mode"))for(let i=1;i<e.length;i++){if(e[i].time<=e[i-1].time){let s=`${this._logMessagePrefix()}Wrong bars time: time ${e[i].time} of bar ${i} should be more than time ${e[i-1].time} of bar ${i-1}`;t&&null!==this._dwmAligner&&(s+="\nCheck that you provide DWM bars without time part, i.e. 00:00 GMT"),console.error(s)}["high","low","open","close","time"].some((t=>"number"!=typeof e[i][t]||!isFinite(e[i][t])))&&console.error(`${this._logMessagePrefix()}Wrong bars values: all OHLC values should be numbers`)}}_putToCache(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||s<i?this._cache.bars.push(e):s===i?(this._interval.isTicks()&&this._logMessage("Received update for the last tick bar"),this._cache.bars[t-1]=e):console.error(`${this._logMessagePrefix()}putToCacheNewBar: time violation, previous bar time: `+u(s)+" should be less or equal to new time: "+u(i))}_alignBarsTime(e){if(this._dwmAligner)for(const t of e)t.time=this._dwmAligner.timeToSessionStart(t.time)}_now(){return Date.now()+1e3*this._serverTimeOffsetGetter()+6e4}}class _{constructor(e,t,i){this._threads={},this._datafeed=e,this._serverTimeOffsetGetter=t,this._resetCacheTimePeriod=i}destroy(){this._forEachThread(((e,t)=>t.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}} _setEndOfData(){this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._dealignTime(this._cache.bars[0].time))}_processFullBarset(e,t){this._putToCache(e)?null!==this._leftDate&&0!==this._cache.bars.length&&(this._interval.isTicks()?this._leftDate=this._dealignTime(this._cache.bars[0].time):this._leftDate=Math.min(this._leftDate,this._dealignTime(this._cache.bars[0].time))):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?console.warn(`${this._logMessagePrefix()}nextTime should be set when there is no data in the requested period only`):t&&t.noData&&console.warn(`${this._logMessagePrefix()}noData should be set when there is no data in the requested period and earlier only`)}_getNextSubscriptionId(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(o.enabled("charting_library_debug_mode"))for(let i=1;i<e.length;i++){if(e[i].time<=e[i-1].time){let s=`${this._logMessagePrefix()}Wrong bars time: time ${e[i].time} of bar ${i} should be more than time ${e[i-1].time} of bar ${i-1}`;t&&null!==this._dwmAligner&&(s+="\nCheck that you provide DWM bars without time part, i.e. 00:00 GMT"),console.error(s)}["high","low","open","close","time"].some((t=>"number"!=typeof e[i][t]||!isFinite(e[i][t])))&&console.error(`${this._logMessagePrefix()}Wrong bars values: all OHLC values should be numbers`)}}_putToCache(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||s<i?this._cache.bars.push(e):s===i?(this._interval.isTicks()&&this._logMessage("Received update for the last tick bar"),this._cache.bars[t-1]=e):console.error(`${this._logMessagePrefix()}putToCacheNewBar: time violation, previous bar time: `+u(s)+" should be less or equal to new time: "+u(i))}_alignBarsTime(e){if(this._dwmAligner)for(const t of e)t.time=this._dwmAligner.timeToSessionStart(t.time)}_now(){return Date.now()+1e3*this._serverTimeOffsetGetter()+6e4}}class _{constructor(e,t,i){this._threads={},this._datafeed=e,this._serverTimeOffsetGetter=t,this._resetCacheTimePeriod=i}destroy(){this._forEachThread(((e,t)=>t.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}
subscribe(e,t,i,s,r){const n=d(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,r)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void console.warn("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):console.warn("Data thread doesnt exist: "+e)}_createThread(e,t){return new p(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,c.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}}},13041:(e,t,i)=>{"use strict";i.d(t,{barTimeToEndOfPeriod:()=>r,endOfPeriodToBarTime:()=>n});var s=i(60062);function r(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(s.SessionStage.LASTBAR_SESSION)/1e3}function n(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return t=e.startOfBar(0)/1e3}},48739:(e,t,i)=>{"use strict";i.d(t,{replaceGraphicsTimesWithTimePointIndexIndex:()=>n});const s=new Map([["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["backgrounds",e=>[e.start,e.stop]]]),r=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);function n(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,n=new Set;s.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data){const t=e(s);for(const e of t)i.set(e,-1),n.add(e)}}));const o=Array.from(n).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),r.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data)e(s,i)})),o}},26665:(e,t,i)=>{"use strict";var s=i(14483);window.onload=function(){location.hostname.indexOf(".")>=0&&!function(){try{return/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(e){return!1}}()&&setTimeout((function(){try{var e=function(){var e=0;return JSON.parse(urlParams.logo).image&&(e="C",s.enabled("link_to_tradingview")||(e="D")),e}();window.ga&&(0!==e&&window.ga("send","event","s",e),urlParams.utm||window.ga("send","event","l"))}catch(e){}}),3e4)} subscribe(e,t,i,s,r){const n=d(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,r)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void console.warn("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):console.warn("Data thread doesnt exist: "+e)}_createThread(e,t){return new p(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,l.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}}},13041:(e,t,i)=>{"use strict";i.d(t,{barTimeToEndOfPeriod:()=>r,endOfPeriodToBarTime:()=>n});var s=i(60062);function r(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(s.SessionStage.LASTBAR_SESSION)/1e3}function n(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return t=e.startOfBar(0)/1e3}},48739:(e,t,i)=>{"use strict";i.d(t,{replaceGraphicsTimesWithTimePointIndexIndex:()=>n});const s=new Map([["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["backgrounds",e=>[e.start,e.stop]]]),r=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);function n(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,n=new Set;s.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data){const t=e(s);for(const e of t)i.set(e,-1),n.add(e)}}));const o=Array.from(n).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),r.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data)e(s,i)})),o}},26665:(e,t,i)=>{"use strict";var s=i(14483);window.onload=function(){location.hostname.indexOf(".")>=0&&!function(){try{return/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(e){return!1}}()&&setTimeout((function(){try{var e=function(){var e=0;return JSON.parse(urlParams.logo).image&&(e="C",s.enabled("link_to_tradingview")||(e="D")),e}();window.ga&&(0!==e&&window.ga("send","event","s",e),urlParams.utm||window.ga("send","event","l"))}catch(e){}}),3e4)}
},3035:(e,t,i)=>{"use strict";var s,r=i(60156),n={};e.exports=function(e,t,i){var o,a,l,c,h={},d=n[i]||"out_of_session",u=!1,p=i,_=t,m=null,g=null;function f(){var e={};e.symbolname=p,e.status="ok",e.values={},e.values.current_session=d,n[p]=d,TradingView.ChartapiMessagerInstances[_].onQuotesData([_].concat([e]))}function v(){if(o)if(c)d="out_of_session";else{var e=(new Date).getTime(),t=r.isTradingNow(e,o)?"market":"out_of_session";a&&r.isTradingNow(e,a)?t="pre_market":l&&r.isTradingNow(e,l)&&(t="post_market"),t!==d&&(d=t)}}return e(i,null,(function(e){u||function(e){o=new r.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),c=e.expired,e.subsession_id&&e.subsessions?e.subsessions.forEach((t=>{switch(t.id){case"premarket":a=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-premarket-correction"]||e.corrections);break;case"postmarket":l=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-postmarket-correction"]||e.corrections)}})):(a=void 0,l=void 0);const t=60-new Date(Date.now()).getSeconds();s&&s?.ticker===e.ticker||(s={ticker:e.ticker,timer:t},clearTimeout(s.timeout)),g=setTimeout((()=>{m=setInterval((()=>{v(),f()}),6e4),v(),f()}),1e3*s.timer),s&&void 0!==s?.timeout||(s.timeout=g),v(),f()}(e)}),(function(){})),h.stop=function(){u=!0,m&&clearInterval(m),g&&clearInterval(g)},h.marketStatus=function(){return d},h}},36454:(e,t,i)=>{"use strict";i.d(t,{getChartStyleStudy:()=>n});var s=i(81337);class r{main(e){const t=e.new_var(s.Std.open(e)),i=e.new_var(s.Std.close(e)),r=t.get(1),n=i.get(1),o=s.Std.ohlc4(e),a=s.Std.na(t.get(1))?(s.Std.open(e)+s.Std.close(e))/2:(r+n)/2;t.set(a),i.set(o);const l=s.Std.max(s.Std.high(e),s.Std.max(a,o)),c=s.Std.min(s.Std.low(e),s.Std.min(a,o)),h=s.Std.volume(e),d=e.symbol;return[d.time,a,l,c,o,h,d.updatetime,d.isBarClosed]}}function n(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))return new r;const t=`unknown builder type: ${e.type}`;throw console.error(t),new Error(t)}},61476:(e,t,i)=>{"use strict";var s=i(36274).Interval,r=i(77475).isAlignmentEnabled,n=i(36454).getChartStyleStudy,o=i(27856).decodeExtendedSymbol,a=i(47609).findSuitableResolutionToBuildFrom,l=i(66846).SubsessionId,c=function(){var e=i(74649),t=e.StudyEngine,c=e.BarBuilder,h=e.BarSet;function d(e){this.host=e,this.cache={}}function u(t){console.error(t),e.Std.error(t)}d.prototype.getCache=function(e){return this.cache[e]},d.prototype.putCache=function(e,t){this.cache[e]=t},d.prototype.subscribe=function(e,t,i,s,r,n,o,a,l,c,h){var d=l(o),u=function(e,t,i,s,r,n,o,a,l){var c=r.has_empty_bars?"_":"";return n+e+s+(t||"")+(i||"")+(l||"")+c+"_"+o.countBack+"_"+o.to+"_"+Boolean(a)}(e,t,i,s,o,a,d,c,h),p=this.getCache(u);return p||(p=this.createItem(e,t,i,s,o,d,a,c,h),this.putCache(u,p)),p.listeners.addListener(r,n),{key:u,listener:r}},d.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},d.prototype.removeUnused=function(){var e=[];for(var t in this.cache){ },3035:(e,t,i)=>{"use strict";var s,r=i(60156),n={};e.exports=function(e,t,i){var o,a,l,c,h={},d=n[i]||"out_of_session",u=!1,p=i,_=t,m=null,g=null;function f(){var e={};e.symbolname=p,e.status="ok",e.values={},e.values.current_session=d,n[p]=d,TradingView.ChartapiMessagerInstances[_].onQuotesData([_].concat([e]))}function v(){if(o)if(c)d="out_of_session";else{var e=(new Date).getTime(),t=r.isTradingNow(e,o)?"market":"out_of_session";a&&r.isTradingNow(e,a)?t="pre_market":l&&r.isTradingNow(e,l)&&(t="post_market"),t!==d&&(d=t)}}return e(i,null,(function(e){u||function(e){o=new r.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),c=e.expired,e.subsession_id&&e.subsessions?e.subsessions.forEach((t=>{switch(t.id){case"premarket":a=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-premarket-correction"]||e.corrections);break;case"postmarket":l=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-postmarket-correction"]||e.corrections)}})):(a=void 0,l=void 0);const t=60-new Date(Date.now()).getSeconds();s&&s?.ticker===e.ticker||(s={ticker:e.ticker,timer:t},clearTimeout(s.timeout)),g=setTimeout((()=>{m=setInterval((()=>{v(),f()}),6e4),v(),f()}),1e3*s.timer),s&&void 0!==s?.timeout||(s.timeout=g),v(),f()}(e)}),(function(){})),h.stop=function(){u=!0,m&&clearInterval(m),g&&clearInterval(g)},h.marketStatus=function(){return d},h}},37360:(e,t,i)=>{"use strict";i.d(t,{BarSet:()=>s});class s{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){const t=this.bars[e];if(void 0===t)throw new Error(`BarSet has no value at index ${e}`);return t}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);const s=e,r=this.bars,n=r.length,o=s.time,a=0===n?NaN:r[n-1].time;0===n||a<o?(r.push(s),i&&(this._emptyBarCount+=1,this._lastBarIsEmpty=!0)):a===o?(i!==this._lastBarIsEmpty&&(this._emptyBarCount+=i?1:-1,this._lastBarIsEmpty=i),r[n-1]=s):console.error("time order violation, prev: "+new Date(a).toUTCString()+", cur: "+new Date(o).toUTCString()),this.isBarClosed=!!t}}},69580:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DataFeed:()=>w,setupFeed:()=>v,unsubscribeUnused:()=>S});var s=i(50151),r=i(36274);class n{constructor(){this._listeners=[]}listenersCount(){return this._listeners.reduce(((e,t)=>e+(t?1:0)),0)}addListener(e,t){this._listeners.push({dataListener:e,onErrorCallback:t}),this._barset&&e(this._barset),this._errorMsg&&t(this._errorMsg)}removeListener(e){const t=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;const i=this._listeners.indexOf(t[0]);delete this._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";const t=this._listeners,i=t.length;for(let s=0;s<i;s++){const i=t[s];i&&i.onErrorCallback&&i.onErrorCallback(e)}}fire(e,t){t||(this._barset=e)
if(this.cache[t])0===this.cache[t].listeners.listenersCount()&&e.push(t)}if(0!==e.length){for(var i=0;i<e.length;i++){var s=e[i],r=this.cache[s];this.cache[s]=null,r.stop()}this.removeUnused()}},d.prototype.rebuildFrom=function(e,t){var i=a(e,t);return i.error&&u(i.errorMessage),i.resolution};var p=s.parse("1M").inMilliseconds(0);d.prototype.createItem=function(e,t,i,a,h,d,f,v,S){var y=new g,b=o(e),w="string"!=typeof b.symbol?b.symbol:b;t=w["currency-id"]||t,i=w["unit-id"]||i;var C=w.symbol,P=w.session&&w.session!==l.Extended;if((S=w.session||S)===l.Regular&&(S=void 0),"type"in b){var x=Object.assign({},h);return h.has_empty_bars&&(x.has_empty_bars=!1),new m(y,C,t,i,a,n(b),x,d,f,S)}v&&!r()&&u("Internal error: rebuilding is requested but it is disabled."),!v&&h.has_empty_bars&&u('Misconfiguration error: attempt to request data for symbol with "has_empty_bars" flag, but "disable_resolution_rebuild" featureset is enabled');var T,I,M=this.rebuildFrom(a,h);if(!s.isTicks(a)&&(!s.isEqual(a,M)||v)){r()||u('Misconfiguration error: remove "disable_resolution_rebuild" featureset or provide '+a+" data by yourself");var A=h.has_empty_bars;x=Object.assign({},h);h.has_empty_bars&&(x.has_empty_bars=!1);var L=Math.ceil((T=s.parse(a),I=s.parse(M),T.kind()===I.kind()?T.multiplier()/I.multiplier():(T.isMonths()?T.multiplier()*p:T.inMilliseconds())/(I.isMonths()?I.multiplier()*p:I.inMilliseconds())));return d=Object.assign({},d,{countBack:d.countBack*L}),new m(y,e,t,i,M,new c(a,A),x,d,f,S)}return new _(y,C,{currency:t,unit:i,session:S},a,P,this.host,h,d)};var _=function(e,t,i,s,r,n,o,a){this.listeners=e,this.host=n;var l=this;this.host.resolve(t,i,(function(e){r&&e.regular_session&&(e.session=e.regular_session),l.subs=l.host.subscribe(e,s,a,(function(e){l.listeners.fire(e)}),(function(e){l.listeners.onError(e)}))}),(function(e){l.listeners.onError(e)}))};_.prototype.stop=function(){this.subs&&this.host.unsubscribe(this.subs)};var m=function(e,i,s,r,n,o,a,l,c,h){this.listeners=e,this.isRecalculated=!1,this.symbolInfo=a;var d=this;this.engine=new t({tickerid:i,currencyCode:s,unitId:r,subsessionId:h,period:n,body:o,sessionId:c,symbolInfo:a,dataRange:l,forceAlignBars:!1,enableDwmAligning:!1,recalc:function(e,t){d._recalc(t)},out:function(e,t){d._out(e,t)},nonseriesOut:function(e,t){d._nonseriesOut(e,t)},setNoMoreData:function(){d.barset&&(d.barset.endOfData=!0)},onErrorCallback:function(e){d.listeners.onError(e)}})};m.prototype.stop=function(){this.engine?this.engine.stop():console.error("Internal library error 0x1")},m.prototype._recalc=function(e){this.isRecalculated&&console.error("recalc called twice!"),this.barset||(this.barset=new h(this.symbolInfo)),e&&(this.barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this.barset.endOfData=e.endOfData),this.listeners.fire(this.barset),this.isRecalculated=!0},m.prototype._nonseriesOut=function(e,t){var i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this.barset?this.barset.count():0,i.lastBar=this.barset?this.barset.bar(this.barset.count()-1):null, ;const i=this._listeners,s=i.length;for(let t=0;t<s;t++){const s=i[t];s&&s.dataListener(e)}}}var o=i(27856),a=i(43910),l=i(37360);class c{constructor(e,t,i,s,r,n,o,l,c,h){this.listeners=e,this._isRecalculated=!1,this._symbolInfo=o,this.engine=new a.StudyEngine({tickerid:t,currencyCode:i,unitId:s,subsessionId:h,period:r,body:n,sessionId:c,symbolInfo:o,dataRange:l,forceAlignBars:!1,enableDwmAligning:!1,input:()=>{throw new Error("BarBuildItem scripts should not need to access any input values")},recalc:(e,t)=>{this._recalc(t)},out:(e,t)=>{this._out(e,t)},nonseriesOut:(e,t)=>{this._nonseriesOut(e,t)},setNoMoreData:()=>{this._barset&&(this._barset.endOfData=!0)},onErrorCallback:e=>{this.listeners.onError(e)}})}stop(){this.engine?this.engine.stop():console.error("Internal library error 0x1")}_recalc(e){this._isRecalculated&&console.error("recalc called twice!"),this._barset||(this._barset=new l.BarSet(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){const i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this._barset?this._barset.count():0,i.lastBar=this._barset?this._barset.bar(this._barset.count()-1):null,this.listeners.fire(i,!0)}_out(e,t){const i=t[0];if(isNaN(i))return;const r={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},n=t[7];this._barset||(this._barset=new l.BarSet((0,s.ensureDefined)(e.info,"bar builder item output symbol info")));const o=t[8],a=t[9];if(o instanceof Array&&a)for(let e=0;e<o.length;e++){const t=o[e],i={time:t,open:a,high:a,low:a,close:a,volume:0,updatetime:t};this._barset.add(i,!0,!0),this._isRecalculated&&this.listeners.fire(this._barset)}this._barset.add(r,n),this._barset.isBarClosed=!!n,this._isRecalculated&&this.listeners.fire(this._barset)}}var h=i(49581);class d{main(e){const t=e.new_var(h.Std.open(e)),i=e.new_var(h.Std.close(e)),s=t.get(1),r=i.get(1),n=h.Std.ohlc4(e),o=h.Std.na(t.get(1))?(h.Std.open(e)+h.Std.close(e))/2:(s+r)/2;t.set(o),i.set(n);const a=h.Std.max(h.Std.high(e),h.Std.max(o,n)),l=h.Std.min(h.Std.low(e),h.Std.min(o,n)),c=h.Std.volume(e),d=e.symbol;return[d.time,o,a,l,n,c,d.updatetime,d.isBarClosed,void 0,void 0]}}var u=i(77475),p=i(47609),_=i(66846);class m{constructor(e,t,i,s,r,n,o,a){this.listeners=e,this._host=n,this._host.resolve(t,i,(e=>{r&&e.regular_session&&(e.session=e.regular_session),this._subs=this._host.subscribe(e,s,a,(e=>{this.listeners.fire(e)}),(e=>{this.listeners.onError(e)}))}),(e=>{this.listeners.onError(e)}))}stop(){this._subs&&this._host.unsubscribe(this._subs)}}var g=i(852),f=i(59761);const v=e=>{w.instance=new w(e),(0,g.setupFeed)(w.instance)},S=()=>{w.instance.removeUnused()},y=e=>{console.error(e),h.Std.error(e)},b=r.Interval.parse("1M").inMilliseconds(0);class w{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,r,n,o,a,l,c,h){
this.listeners.fire(i,!0)},m.prototype._out=function(e,t){var i=t[0];if(!isNaN(i)){var s={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},r=t[7];this.barset||(this.barset=new h(e.info));var n=t[8];if(n instanceof Array)for(var o=0;o<n.length;o++){var a=t[9],l=n[o],c={time:l,open:a,high:a,low:a,close:a,volume:0,updatetime:l};this.barset.add(c,!0,!0),this.isRecalculated&&this.listeners.fire(this.barset)}this.barset.add(s,r),this.barset.isBarClosed=r,this.isRecalculated&&this.listeners.fire(this.barset)}};var g=function(){this.listeners=[]};return g.prototype.listenersCount=function(){return this.listeners.reduce((function(e,t){return e+(t?1:0)}),0)},g.prototype.addListener=function(e,t){this.listeners.push({dataListener:e,onErrorCallback:t}),this.barset&&e(this.barset),this.errorMsg&&t(this.errorMsg)},g.prototype.removeListener=function(e){var t=this.listeners.filter((function(t){return t.dataListener===e}));if(0!==t.length){var i=this.listeners.indexOf(t[0]);delete this.listeners[i]}},g.prototype.onError=function(e){this.errorMsg=e||"unspecified error";for(var t=this.listeners,i=t.length,s=0;s<i;s++){var r=t[s];r&&r.onErrorCallback&&r.onErrorCallback(e)}},g.prototype.fire=function(e,t){t||(this.barset=e);for(var i=this.listeners,s=i.length,r=0;r<s;r++){var n=i[r];n&&n.dataListener(e)}},{setupFeed:function(t){d.instance=new d(t),e.setupFeed(d.instance)},unsubscribeUnused:function(){d.instance.removeUnused()}}}();e.exports=c},47609:(e,t,i)=>{"use strict";i.d(t,{findSuitableResolutionToBuildFrom:()=>o});var s=i(36274);function r(e,t){const i=t.multiplier();for(let s=e.length-1;s>=0;s--){const r=Number(e[s]);if(i%r==0)return{error:!1,resolution:`${r}${t.letter()}`}}return{error:!0,errorMessage:n(t.value())}}function n(e){return`Misconfiguration error: it is trying to request ${e} but we cannot build it from lower resolution`}function o(e,t){const i=s.Interval.parse(e);if((i.isWeeks()||i.isMonths())&&t.has_weekly_and_monthly){let e=["1"];i.isWeeks()&&void 0!==t.weekly_multipliers&&(e=t.weekly_multipliers),i.isMonths()&&void 0!==t.monthly_multipliers&&(e=t.monthly_multipliers);const s=r(e,i);if(!s.error)return s}if(i.isDWM()&&(void 0===t.has_daily||t.has_daily))return i.isDays()&&void 0!==t.daily_multipliers?r(t.daily_multipliers,i):void 0===t.daily_multipliers||t.daily_multipliers.includes("1")?{error:!1,resolution:"1D"}:{error:!0,errorMessage:"Misconfiguration error: it is trying to request a resolution but symbol does not support it"};if(i.isDWM())return{error:!0,errorMessage:n(i.value())};if(i.isMinutes()&&!t.has_intraday)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request intraday resolution but symbol does not support it"};if(i.isSeconds()&&!t.has_seconds)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request seconds resolution but symbol does not support it"};if(i.isTicks())return!t["is-tickbars-available"]||i.multiplier()>1?{error:!0, const d=l(o),u=((e,t,i,s,r,n,o,a,l)=>n+e+s+(t||"")+(i||"")+(l||"")+(r.has_empty_bars?"_":"")+"_"+o.countBack+"_"+o.to+"_"+Boolean(a))(e,t,i,s,o,a,d,c,h);let p=this._getCache(u);return p||(p=this._createItem(e,t,i,s,o,d,a,c,h),this._putCache(u,p)),p.listeners.addListener(r,n),{key:u,listener:r}}unsubscribe(e){const t=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){const e=[],t=e=>!!this._cache[e];for(const i in this._cache)if(t(i)){0===(0,s.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(let t=0;t<e.length;t++){const i=e[t],r=(0,s.ensureNotNull)(this._cache[i],`unused datafeed cache item ${i}`);this._cache[i]=null,r.stop()}this.removeUnused()}}_getCache(e){return this._cache[e]}_putCache(e,t){this._cache[e]=t}_rebuildFrom(e,t){const i=(0,p.findSuitableResolutionToBuildFrom)(e,t);if(i.error)throw y(i.errorMessage),new Error(i.errorMessage);return i.resolution}_createItem(e,t,i,s,a,l,h,p,g){const v=new n,S=(0,o.decodeExtendedSymbol)(e),w="string"!=typeof S.symbol?S.symbol:S;t=w["currency-id"]||t,i=w["unit-id"]||i;const C=w.symbol,P=w.session&&w.session!==_.SubsessionId.Extended;if((g=w.session||g)===_.SubsessionId.Regular&&(g=void 0),"type"in S){const e=Object.assign({},a);return a.has_empty_bars&&(e.has_empty_bars=!1),new c(v,C,t,i,s,function(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))return new d;const t=`unknown builder type: ${e.type}`;throw console.error(t),new Error(t)}(S),e,l,h,g)}p&&!(0,u.isAlignmentEnabled)()&&y("Internal error: rebuilding is requested but it is disabled."),!p&&a.has_empty_bars&&y('Misconfiguration error: attempt to request data for symbol with "has_empty_bars" flag, but "disable_resolution_rebuild" featureset is enabled');const x=this._rebuildFrom(s,a);if(!r.Interval.isTicks(s)&&(!r.Interval.isEqual(s,x)||p)){(0,u.isAlignmentEnabled)()||y('Misconfiguration error: remove "disable_resolution_rebuild" featureset or provide '+s+" data by yourself");const n=a.has_empty_bars,o=Object.assign({},a);a.has_empty_bars&&(o.has_empty_bars=!1);const d=Math.ceil((T=r.Interval.parse(s),I=r.Interval.parse(x),T.kind()===I.kind()?T.multiplier()/I.multiplier():(T.isMonths()?T.multiplier()*b:T.inMilliseconds())/(I.isMonths()?I.multiplier()*b:I.inMilliseconds())));return l=Object.assign({},l,{countBack:l.countBack*d}),new c(v,e,t,i,x,new f.BarBuilder(s,n),o,l,h,g)}var T,I;return new m(v,C,{currency:t,unit:i,session:g},s,!!P,this._host,a,l)}}},47609:(e,t,i)=>{"use strict";i.d(t,{findSuitableResolutionToBuildFrom:()=>o});var s=i(36274);function r(e,t){const i=t.multiplier();for(let s=e.length-1;s>=0;s--){const r=Number(e[s]);if(i%r==0)return{error:!1,resolution:`${r}${t.letter()}`}}return{error:!0,errorMessage:n(t.value())}}function n(e){return`Misconfiguration error: it is trying to request ${e} but we cannot build it from lower resolution`}function o(e,t){const i=s.Interval.parse(e);if((i.isWeeks()||i.isMonths())&&t.has_weekly_and_monthly){let e=["1"]
errorMessage:`Misconfiguration error: it is trying to request ${i.multiplier()} ticks resolution but symbol does not support it`}:{error:!1,resolution:"1T"};const o=i.isSeconds()?t.seconds_multipliers:t.intraday_multipliers;return void 0===o?{error:!1,resolution:i.value()}:r(o,i)}},74649:(e,t,i)=>{"use strict";var s,r=i(36274).Interval,n=i(77475).createDwmAligner,o=i(77475).createTimeToBarTimeAligner,a=i(81337).Std,l=i(37040).Series,c=i(97651).Script,h=i(15294).SymbolInstrument,d=i(60156),u=i(94421).extrapolateBarsFrontToTime;class p{constructor(e){this.symbols=[],this.barsets=[],this.subscription=[],this.host=e,this.isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,r,n,o){var a=new h(e,t,i,s,r,n,o);return this.symbols.push(a),a}get_sym(e){return this.symbols[e]}out(e,t){if(this.nonseriesUpdate){var i=Object.assign({},this.nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;var e=this.host;this._script=new c(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);var t=this,i=[],s=this.symbols,a=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+t._script.maxAdditionalDepth()}),l=s[0];function h(t,s,r){i.push(p.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))}function d(i,s){"series"===(s.nonseries?"nonseries":"series")?t.update(i,s):s.lastBar?(t.nonseriesUpdate=s,s.lastBar.isLastBar=!0,t.symbols[0].lastbar(s.lastBar),t.nonseriesUpdate=null):e.nonseriesOut(m,s)}function u(){return a}h(l,u,(function(e){!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&function(e){function i(i,s){var r=o(i,s)(e),a=n(i,s);return null!==a&&(r=a.timeToExchangeTradingDay(r)),{to:r,countBack:t._script.maxAdditionalDepth()}}for(var a=1;a<s.length;a++){var c=s[a],u=c.period;r.isEqual(u,l.period)||h(c,i.bind(null,u),d.bind(null,a))}}(e.firstLoadedTimeMs),d(0,e)}));for(var _=1;_<s.length;_++){var m=s[_];r.isEqual(m.period,l.period)&&h(m,u,d.bind(null,_))}this.subscription=i}stop(){var e=this.subscription;if(e||this._script){for(var t=0;t<e.length;t++)p.feed.unsubscribe(e[t]);this.subscription=null,this._script.stop(),this._script=null,this.symbols=null,this.isStarted=!1}else console.warn("Recurring script engine stop happened.")}update(e,t){if(t){var i=this.symbols[e];if(this.isRecalculated){var s=t.bar(t.count()-1);s.isBarClosed=t.isLastBarClosed(),s.isLastBar=!0,i.lastbar(s)}else this.barsets[e]||(this.barsets[e]=t,i.set_symbolinfo(t.symbolinfo()),this.recalc())}else console.error("Unexpected barset = null")}recalc(){for(var e=this.symbols,t=0;t<e.length;t++)if(!this.barsets[t])return;try{for(var i=e.length-1;i>=0;i--)for(var s=e[i],r=this.barsets[i],n=r.count(),o=0;o<n;o++){var a=r.bar(o);a.isLastBar=o===n-1,a.isBarClosed=!a.isLastBar||r.isLastBarClosed(),s.lastbar(a)}this.isRecalculated=!0;var l=this.barsets.every((e=>e.endOfData));l&&this.host.setNoMoreData(), ;i.isWeeks()&&void 0!==t.weekly_multipliers&&(e=t.weekly_multipliers),i.isMonths()&&void 0!==t.monthly_multipliers&&(e=t.monthly_multipliers);const s=r(e,i);if(!s.error)return s}if(i.isDWM()&&(void 0===t.has_daily||t.has_daily))return i.isDays()&&void 0!==t.daily_multipliers?r(t.daily_multipliers,i):void 0===t.daily_multipliers||t.daily_multipliers.includes("1")?{error:!1,resolution:"1D"}:{error:!0,errorMessage:"Misconfiguration error: it is trying to request a resolution but symbol does not support it"};if(i.isDWM())return{error:!0,errorMessage:n(i.value())};if(i.isMinutes()&&!t.has_intraday)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request intraday resolution but symbol does not support it"};if(i.isSeconds()&&!t.has_seconds)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request seconds resolution but symbol does not support it"};if(i.isTicks())return!t["is-tickbars-available"]||i.multiplier()>1?{error:!0,errorMessage:`Misconfiguration error: it is trying to request ${i.multiplier()} ticks resolution but symbol does not support it`}:{error:!1,resolution:"1T"};const o=i.isSeconds()?t.seconds_multipliers:t.intraday_multipliers;return void 0===o?{error:!1,resolution:i.value()}:r(o,i)}},74649:(e,t,i)=>{"use strict";var s,r=i(49581).Std,n=i(37040).Series,o=i(15294).SymbolInstrument,a=i(852).setupFeed,l=i(59761).BarBuilder,c=i(2543).OHLCV,h=i(37360).BarSet,d=i(43910).StudyEngine;e.exports.Std=r,e.exports.Series=n,e.exports.Symbol=o,e.exports.StudyEngine=d,e.exports.BarSet=h,e.exports.OHLCV=c,e.exports.BarBuilder=l,e.exports.setupFeed=a,e.exports.getVolumeProfileResolutionForPeriod=function(e,t,i,r){return void 0!==s?s(e,t,i,r):e},e.exports.overwriteVolumeProfileResolutionForPeriodGetter=function(e){s=e}},852:(e,t,i)=>{"use strict";i.d(t,{ScriptRunner:()=>_,setupFeed:()=>p});var s=i(50151),r=i(36274),n=i(15294),o=i(37040),a=i(49581);class l{constructor(e){this.minimumAdditionalDepth=null,this._vars=[],this._varsIndex=0,this._ctx=[],this._ctxIndex=0,this.symbol=e}new_sym(e,t,i,s,r){return this.symbol.script.add_sym(e,t,i,s,r)}select_sym(e){const t=this.symbol.script.get_sym(e);null==t&&a.Std.error(`Attempted to select symbol at index ${e} but there is no such symbol`),this.symbol=t}is_main_symbol(e){return void 0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new o.Series(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new o.UnlimitedSeries(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new l(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;t<this._vars.length;t++)this._vars[t].prepare(e);for(let t=0;t<this._ctx.length;t++)this._ctx[t].prepare(e)}maxAdditionalDepth(){if(null!==this.minimumAdditionalDepth)return this.minimumAdditionalDepth;let e=0
this.host.recalc(this,{endOfData:l,firstLoadedTimeMs:this.barsets[0].firstLoadedTimeMs,emptyBarCount:this.barsets[0].emptyBarCount()})}catch(e){if(!e.studyError)throw e;this.host.onErrorCallback(e.message)}}}p.feed={subscribe:function(e,t,i,s,r){console.error("must be initialized with setupFeed")},unsubscribe:function(e){console.error("must be initialized with setupFeed")}};e.exports.Std=a,e.exports.Series=l,e.exports.Symbol=h,e.exports.StudyEngine=class{constructor(e){this.runner=new p(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}},e.exports.BarSet=class{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){return this.bars[e]}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);var s=e,r=this.bars,n=r.length,o=s.time,a=0===n?NaN:r[n-1].time;0===n||a<o?(r.push(s),i&&(this._emptyBarCount+=1,this._lastBarIsEmpty=!0)):a===o?(i!==this._lastBarIsEmpty&&(this._emptyBarCount+=i?1:-1,this._lastBarIsEmpty=i),r[n-1]=s):console.error("time order violation, prev: "+new Date(a).toUTCString()+", cur: "+new Date(o).toUTCString()),this.isBarClosed=!!t}},e.exports.OHLCV=class{main(e){return[a.open(e),a.high(e),a.low(e),a.close(e),a.volume(e),a.updatetime(e)]}},e.exports.BarBuilder=class{constructor(e,t){this.period=e,this.generateEmptyBars=!!t}init(e){this.bb=d.newBarBuilder(this.period,e.symbol.session),this.bbEmptyBars=this.generateEmptyBars?d.newBarBuilder(this.period,e.symbol.session):void 0,e.setMinimumAdditionalDepth(0)}extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:u(this.bbEmptyBars,e,t,Number.MAX_SAFE_INTEGER,!0).times}main(e){var t=e.symbol.time,i=this.bb.alignTime(t),s=e.new_var(i),r=a.na(i),n=s.get(1),o=a.na(n)?1:a.neq(i,n),l=e.new_var(),c=e.new_var(),h=e.new_var(),d=e.new_var(),u=l.get(1),p=c.get(1),_=h.get(1),m=d.get(1),g=r?NaN:o?a.open(e):u,f=r?NaN:o?a.high(e):a.max(a.high(e),p),v=r?NaN:o?a.low(e):a.min(a.low(e),_),S=r?NaN:a.close(e),y=r?NaN:o?a.volume(e):a.volume(e)+m,b=r?NaN:t,w=e.symbol.isBarClosed&&this.bb.isLastBar(0,t),C=this.generateEmptyBars&&o?this.extrapolate(n,i):void 0,P=e.new_var(a.close(e)).get(1),x=C instanceof Array?P:NaN;return l.set(g),c.set(f),h.set(v),d.set(y),[i,g,f,v,S,y,b,w,C,x]}},e.exports.setupFeed=function(e){p.feed=e},e.exports.getVolumeProfileResolutionForPeriod=function(e,t,i,r){return void 0!==s?s(e,t,i,r):e},e.exports.overwriteVolumeProfileResolutionForPeriodGetter=function(e){s=e}},97651:(e,t,i)=>{"use strict";i.d(t,{Script:()=>o});var s=i(37040),r=i(81337);class n{constructor(e){this.minimumAdditionalDepth=null,this._vars=[],this._varsIndex=0,this._ctx=[],this._ctxIndex=0,this.symbol=e}new_sym(e,t,i,s,r){return this.symbol.script.add_sym(e,t,i,s,r)}select_sym(e){const t=this.symbol.script.get_sym(e) ;for(let t=0;t<this._vars.length;t++){const i=this._vars[t].mindepth;!isNaN(i)&&i>e&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}function c(e){return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}class h{constructor(e,t,i,s,r,n,o,a,c,h,d){this._body=n,this._symbols=[],this._runner=r,this._inputCallback=a,this._out=o,this._nonseriesOut=c,this._ctx=new l(this.add_sym(e,t,i,s,h,d)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);var r;if(null!=s)if(null===(r=s)||Array.isArray(r)||"composite"!==r.type)this._processResult(s);else for(let e=0;e<s.data.length;++e)this._processResult(s.data[e])}init(){const e=this._ctx,t=this._body;t.init&&t.init(e,this._inputCallback),t.main(e,this._inputCallback)}add_sym(e,t,i,s,r,n){const o=this._runner.add_sym(e,t,i,s,this,r,n);return this._symbols.push(o),o.isdwm()&&this._symbols.length>1&&this._runner.host.enableDwmAligning&&o.enable_dwm_aligning(this._symbols[0].session,o.session),o}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){var e;this._symbols=null,null===(e=this._ctx)||void 0===e||e.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;var i;this._out&&e&&(!isNaN(t.symbol.time)||c(e))&&(c(e)?(i=e,Array.isArray(i)||"projection"!==i.type||(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):!function(e){return!Array.isArray(e)&&("non_series_bars"===e.type||"projection"===e.type)}(e)?this._out(t.symbol,e):e.bars.forEach((e=>{this._out(t.symbol,e)})))}}var d=i(77475),u=i(85898);function p(e){_.feed=e}class _{constructor(e){this._nonseriesUpdate=null,this._script=null,this._symbols=[],this._barsets=[],this._subscription=[],this.host=e,this._isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,r,o,a){const l=new n.SymbolInstrument(e,t,i,s,r,o,a);return this._symbols.push(l),l}get_sym(e){return this._symbols[e]}out(e,t){if(this._nonseriesUpdate){const i=Object.assign({},this._nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;const e=this.host,t=new h(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);this._script=t;const i=[],n=this._symbols,o=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+this._script.maxAdditionalDepth()}),a=n[0],l=(t,s,r)=>{i.push(_.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))},c=(t,i)=>{"series"===(i.nonseries?"nonseries":"series")?this.update(t,i):i.lastBar?(this._nonseriesUpdate=i,i.lastBar.isLastBar=!0,this._symbols[0].lastbar(i.lastBar),this._nonseriesUpdate=null):e.nonseriesOut(n[0],i)},u=()=>o;l(a,u,(e=>{!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&(e=>{function i(i,r){let n=(0,
;null==t&&r.Std.error(`Attempted to select symbol at index ${e} but there is no such symbol`),this.symbol=t}is_main_symbol(e){return void 0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new s.Series(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new s.UnlimitedSeries(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new n(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;t<this._vars.length;t++)this._vars[t].prepare(e);for(let t=0;t<this._ctx.length;t++)this._ctx[t].prepare(e)}maxAdditionalDepth(){if(null!==this.minimumAdditionalDepth)return this.minimumAdditionalDepth;let e=0;for(let t=0;t<this._vars.length;t++){const i=this._vars[t].mindepth;!isNaN(i)&&i>e&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}class o{constructor(e,t,i,s,r,o,a,l,c,h,d){this._body=o,this._symbols=[],this._runner=r,this._inputCallback=l,this._out=a,this._nonseriesOut=c,this._ctx=new n(this.add_sym(e,t,i,s,h,d)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);if(s&&"composite"===s.type)for(let e=0;e<s.data.length;++e)this._processResult(s.data[e]);else this._processResult(s)}init(){const e=this._ctx,t=this._body;t.init&&t.init(e,this._inputCallback),t.main(e,this._inputCallback)}add_sym(e,t,i,s,r,n){const o=this._runner.add_sym(e,t,i,s,this,r,n);return this._symbols.push(o),o.isdwm()&&this._symbols.length>1&&this._runner.host.enableDwmAligning&&o.enable_dwm_aligning(this._symbols[0].session,o.session),o}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){var e;this._symbols=null,null===(e=this._ctx)||void 0===e||e.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;this._out&&e&&(!isNaN(t.symbol.time)||e.nonseries)&&(e.nonseries?("projection"===e.type&&(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):e.bars?e.bars.forEach((e=>{this._out(t.symbol,e)})):this._out(t.symbol,e))}}},37040:(e,t,i)=>{"use strict";i.d(t,{Series:()=>n,UnlimitedSeries:()=>o});var s=i(78071),r=i(81337);class n{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=r.Std.max(this.mindepth,e),NaN)}set(e){this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){ d.createTimeToBarTimeAligner)(i,r)(e);const o=(0,d.createDwmAligner)(i,r);return null!==o&&(n=o.timeToExchangeTradingDay(n)),{to:n,countBack:(0,s.ensureNotNull)(t,"script runner script").maxAdditionalDepth()}}for(let e=1;e<n.length;e++){const t=n[e],s=t.period;r.Interval.isEqual(s,a.period)||l(t,i.bind(null,s),c.bind(null,e))}})(e.firstLoadedTimeMs),c(0,e)}));for(let e=1;e<n.length;e++){const t=n[e];r.Interval.isEqual(t.period,a.period)&&l(t,u,c.bind(null,e))}this._subscription=i}stop(){var e;const t=this._subscription;if(t||this._script){if(null!==t)for(let e=0;e<(null==t?void 0:t.length);e++)_.feed.unsubscribe(t[e]);this._subscription=null,null===(e=this._script)||void 0===e||e.stop(),this._script=null,this._symbols=null,this.isStarted=!1}else console.warn("Recurring script engine stop happened.")}update(e,t){if(!t)return void console.error("Unexpected barset = null");const i=this._symbols[e];if(this._isRecalculated){const e=t.bar(t.count()-1);e.isBarClosed=t.isLastBarClosed(),e.isLastBar=!0,i.lastbar(e)}else this._barsets[e]||(this._barsets[e]=t,i.set_symbolinfo(t.symbolinfo()),this.recalc())}recalc(){const e=this._symbols;for(let t=0;t<e.length;t++)if(!this._barsets[t])return;try{for(let t=e.length-1;t>=0;t--){const i=e[t],s=this._barsets[t],r=s.count();for(let e=0;e<r;e++){const t=s.bar(e);t.isLastBar=e===r-1,t.isBarClosed=!t.isLastBar||s.isLastBarClosed(),i.lastbar(t)}}this._isRecalculated=!0;const t=this._barsets.every((e=>e.endOfData));t&&this.host.setNoMoreData(),this.host.recalc(this,{endOfData:t,firstLoadedTimeMs:this._barsets[0].firstLoadedTimeMs,emptyBarCount:this._barsets[0].emptyBarCount()})}catch(e){if(!(e instanceof u.StudyError))throw e;this.host.onErrorCallback(e.message)}}}_.feed={subscribe(){throw console.error("must be initialized with setupFeed"),new Error("must be initialized with setupFeed")},unsubscribe(){throw console.error("must be initialized with setupFeed"),new Error("must be initialized with setupFeed")}}},37040:(e,t,i)=>{"use strict";i.d(t,{Series:()=>n,UnlimitedSeries:()=>o});var s=i(78071),r=i(49581);class n{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=r.Std.max(this.mindepth,e),NaN)}set(e){this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){let e=r.Std.na(this.mindepth)?r.Std.max_series_default_size:r.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i<e;i++)t[i]=NaN;this._hist=t,this._histPos=-1}this._histPos=Math.min(this._histPos+1,this._hist.length),this._histPos===this._hist.length&&(this._histPos=this._hist.length-1,this._hist.shift(),this._hist.push(NaN)),this._hist[this._histPos]=this.original}reset_hist(){this._hist=null,
let e=r.Std.na(this.mindepth)?r.Std.max_series_default_size:r.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i<e;i++)t[i]=NaN;this._hist=t,this._histPos=-1}this._histPos=Math.min(this._histPos+1,this._hist.length),this._histPos===this._hist.length&&(this._histPos=this._hist.length-1,this._hist.shift(),this._hist.push(NaN)),this._hist[this._histPos]=this.original}reset_hist(){this._hist=null,this.add_hist()}adopt(e,t,i){this._hist||(this.mindepth=NaN);const s=t.get();let n=e.indexOf(s);if(0!==i){const i=t.get(1);if(!r.Std.na(i)){n=n===e.indexOf(i)?-1:n}}return n<0?NaN:this._get(n)}indexOf(e){if(!this._hist)return this.mindepth=NaN,-1;if(r.Std.na(e))return-1;const t=this._hist.length,i=this.symbol.index+1,n=Math.min(t,i),o=(0,s.upperbound_int)(this._hist,e,0,n);return 0===o?-1:n-o}_get(e){if(null===this._hist)return NaN;let t=this._histPos-e;return t<0&&(t+=this._hist.length),this._hist[t]}}class o extends n{add_hist(){if(this._hist||(this._hist=new Float64Array(2e3),this._histPos=-1),this._histPos=this._histPos+1,this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e}this._hist[this._histPos]=this.original}}},46544:(e,t,i)=>{"use strict";const s=i(14483),r=i(33013).getHexColorByName;var n=i(74649);i(24172);var o=i(82808).pivotPointsStandardStudyItem,a=i(72365).volumeProfileVisibleRangeStudyItem,l=i(82597).volumeProfileFixedRangeVbPStudyItem,c=i(82597).volumeProfileFixedRangeBSStudyItem,h=i(39944).spreadStudyItem,d=i(81821).ratioStudyItem,u=i(65097).regressionTrendStudyItem,p=i(53130).anchoredVWAPStudyItem;const _=r("color-ripe-red-400"),m=r("color-minty-green-400"),g=s.enabled("secondary_series_extend_time_scale");JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#9C27B0"}},inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol",isHidden:!0}],id:"Compare@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(1),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),r=n.Std[t(0)](this._context),o=this._context.new_unlimited_var(r);return this._context.select_sym(0),[o.adopt(s,i,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},inputs:{symbol:"",extendTimeScale:!1}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{ this.add_hist()}adopt(e,t,i){this._hist||(this.mindepth=NaN);const s=t.get();let n=e.indexOf(s);if(0!==i){const i=t.get(1);if(!r.Std.na(i)){n=n===e.indexOf(i)?-1:n}}return n<0?NaN:this._get(n)}indexOf(e){if(!this._hist)return this.mindepth=NaN,-1;if(r.Std.na(e))return-1;const t=this._hist.length,i=this.symbol.index+1,n=Math.min(t,i),o=(0,s.upperbound_int)(this._hist,e,0,n);return 0===o?-1:n-o}_get(e){if(null===this._hist)return NaN;let t=this._histPos-e;return t<0&&(t+=this._hist.length),this._hist[t]}}class o extends n{add_hist(){if(this._hist||(this._hist=new Float64Array(2e3),this._histPos=-1),this._histPos=this._histPos+1,this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e}this._hist[this._histPos]=this.original}}},46544:(e,t,i)=>{"use strict";const s=i(14483),r=i(33013).getHexColorByName;var n=i(74649);i(24172);var o=i(82808).pivotPointsStandardStudyItem,a=i(72365).volumeProfileVisibleRangeStudyItem,l=i(82597).volumeProfileFixedRangeVbPStudyItem,c=i(82597).volumeProfileFixedRangeBSStudyItem,h=i(39944).spreadStudyItem,d=i(81821).ratioStudyItem,u=i(65097).regressionTrendStudyItem,p=i(53130).anchoredVWAPStudyItem;const _=r("color-ripe-red-400"),m=r("color-minty-green-400"),g=s.enabled("secondary_series_extend_time_scale");JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#9C27B0"}},inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol",isHidden:!0}],id:"Compare@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(1),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),r=n.Std[t(0)](this._context),o=this._context.new_unlimited_var(r);return this._context.select_sym(0),[o.adopt(s,i,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},inputs:{symbol:"",extendTimeScale:!1}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{title:"Open"},high:{title:"High"},low:{title:"Low"},close:{title:"Close"}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0},{id:"extendTimeScale",name:"extendTimeScale",defval:!1,type:"boolean",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4},
id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{title:"Open"},high:{title:"High"},low:{title:"Low"},close:{title:"Close"}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0},{id:"extendTimeScale",name:"extendTimeScale",defval:!1,type:"boolean",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4},canExtendTimeScale:!0},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(0),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=!g||!0!==t(1),s=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),o=this._context.new_unlimited_var(n.Std.open(this._context)),a=this._context.new_unlimited_var(n.Std.high(this._context)),l=this._context.new_unlimited_var(n.Std.low(this._context)),c=this._context.new_unlimited_var(n.Std.close(this._context));return i?(this._context.select_sym(0),[o.adopt(r,s,1),a.adopt(r,s,1),l.adopt(r,s,1),c.adopt(r,s,1)]):[o.get(0),a.get(0),l.get(0),c.get(0)]}}},{name:"Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:50,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"}},palettes:{volumePalette:{colors:{0:{color:_,width:1,style:0},1:{color:m,width:1,style:0}}}},inputs:{showMA:!1,length:20,col_prev_close:!1,symbol:"",smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"},{id:"smoothedMA",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0},smoothedMA:{title:"Smoothed MA",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Falling"},1:{name:"Growing"}}}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"showMA",name:"show MA",defval:!1,type:"bool",isHidden:!0},{id:"length",name:"MA Length",defval:20,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["vol_ma"]},{defval:!1,id:"col_prev_close",name:"Color based on previous close",type:"bool"},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Volume@tv-basicstudies-1",format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),n.Std.period(this._context))},this.f_0=function(e,t){return n.Std.gt(e,t)?0:1},this.main=function(e,t){this._context=e, canExtendTimeScale:!0},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(0),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=!g||!0!==t(1),s=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),o=this._context.new_unlimited_var(n.Std.open(this._context)),a=this._context.new_unlimited_var(n.Std.high(this._context)),l=this._context.new_unlimited_var(n.Std.low(this._context)),c=this._context.new_unlimited_var(n.Std.close(this._context));return i?(this._context.select_sym(0),[o.adopt(r,s,1),a.adopt(r,s,1),l.adopt(r,s,1),c.adopt(r,s,1)]):[o.get(0),a.get(0),l.get(0),c.get(0)]}}},{name:"Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:50,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"}},palettes:{volumePalette:{colors:{0:{color:_,width:1,style:0},1:{color:m,width:1,style:0}}}},inputs:{showMA:!1,length:20,col_prev_close:!1,symbol:"",smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"},{id:"smoothedMA",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0},smoothedMA:{title:"Smoothed MA",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Falling"},1:{name:"Growing"}}}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"showMA",name:"show MA",defval:!1,type:"bool",isHidden:!0},{id:"length",name:"MA Length",defval:20,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["vol_ma"]},{defval:!1,id:"col_prev_close",name:"Color based on previous close",type:"bool"},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Volume@tv-basicstudies-1",format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),n.Std.period(this._context))},this.f_0=function(e,t){return n.Std.gt(e,t)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=n.Std.volume(this._context),s=n.Std.open(this._context),r=n.Std.close(this._context),o=this._context.new_var(this._context.symbol.time),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(this._input(2)+l),""!==this._input(0)){this._context.select_sym(1)
this._input=t;var i=n.Std.volume(this._context),s=n.Std.open(this._context),r=n.Std.close(this._context),o=this._context.new_var(this._context.symbol.time),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(this._input(2)+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=this._context.new_var(n.Std.volume(this._context)),d=this._context.new_var(n.Std.open(this._context)),u=this._context.new_var(n.Std.close(this._context));i=h.adopt(c,o,1),s=d.adopt(c,o,1),r=u.adopt(c,o,1),this._context.select_sym(0)}var p,_,m=this._context.new_var(i),g=n.Std.sma(m,this._input(2),this._context),f=this._context.new_var(g),v=this._context.new_var(r);return p=v.get(1)&&this._input(3)?this.f_0(v.get(1),r):this.f_0(s,r),"EMA"===a?_=n.Std.ema(f,l,this._context):"WMA"===a?_=n.Std.wma(f,l,this._context):"SMA"===a&&(_=n.Std.sma(f,l,this._context)),[i,p,g,_]}}},{name:"ZigZag",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Zig Zag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"float",min:.001,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),r=i/100,o=Math.ceil(s/2);return[n.Std.zigzag(r,o,this._context),n.Std.zigzagbars(r,o,this._context)]}}},{name:"Sessions",metainfo:{_metainfoVersion:52,defaults:{graphics:{vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}},backgrounds:{preMarket:{color:"#FF9800",transparency:92,visible:!0},postMarket:{color:"#2196F3",transparency:92,visible:!0}}},linkedToSeries:!0},description:"Sessions",graphics:{vertlines:{sessBreaks:{name:"Session Break",halign:"left"}},backgrounds:{preMarket:{name:"Pre market"},postMarket:{name:"Post market"}}},id:"Sessions@tv-basicstudies-1",inputs:[],is_hidden_study:!0,is_price_study:!0,name:"Sessions@tv-basicstudies",palettes:{},plots:[],shortDescription:"Sessions",format:{type:"inherit"}},constructor:function(){function e(e,t){return{id:e,index:e,extendBottom:!0,extendTop:!0}}function t(e){return{id:e.start,start:e.start,stop:e.stop}}this.init=function(){this._times=[]},this._getVerticalLineData=function(t){return n.Std.selectSessionBreaks(t,this._times).map(e)},this._getPreAndPostMarketBackgroundsData=function(e){const i=n.Std.selectPreAndPostMarketTimes(e,this._times);return{preMarket:i.preMarket.map(t),postMarket:i.postMarket.map(t)}},this.main=function(e,t){if(n.Std.isdwm(e))return null;var i=n.Std.time(e);if(isNaN(i))return null;var s=this._times.length ;var c=this._context.new_var(this._context.symbol.time),h=this._context.new_var(n.Std.volume(this._context)),d=this._context.new_var(n.Std.open(this._context)),u=this._context.new_var(n.Std.close(this._context));i=h.adopt(c,o,1),s=d.adopt(c,o,1),r=u.adopt(c,o,1),this._context.select_sym(0)}var p,_,m=this._context.new_var(i),g=n.Std.sma(m,this._input(2),this._context),f=this._context.new_var(g),v=this._context.new_var(r);return p=v.get(1)&&this._input(3)?this.f_0(v.get(1),r):this.f_0(s,r),"EMA"===a?_=n.Std.ema(f,l,this._context):"WMA"===a?_=n.Std.wma(f,l,this._context):"SMA"===a&&(_=n.Std.sma(f,l,this._context)),[i,p,g,_]}}},{name:"ZigZag",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Zig Zag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"float",min:.001,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),r=i/100,o=Math.ceil(s/2);return[n.Std.zigzag(r,o,this._context),n.Std.zigzagbars(r,o,this._context)]}}},{name:"Sessions",metainfo:{_metainfoVersion:52,defaults:{graphics:{vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}},backgrounds:{preMarket:{color:"#FF9800",transparency:92,visible:!0},postMarket:{color:"#2196F3",transparency:92,visible:!0}}},linkedToSeries:!0},description:"Sessions",graphics:{vertlines:{sessBreaks:{name:"Session Break",halign:"left"}},backgrounds:{preMarket:{name:"Pre market"},postMarket:{name:"Post market"}}},id:"Sessions@tv-basicstudies-1",inputs:[],is_hidden_study:!0,is_price_study:!0,name:"Sessions@tv-basicstudies",palettes:{},plots:[],shortDescription:"Sessions",format:{type:"inherit"}},constructor:function(){function e(e,t){return{id:e,index:e,extendBottom:!0,extendTop:!0}}function t(e){return{id:e.start,start:e.start,stop:e.stop}}this.init=function(){this._times=[]},this._getVerticalLineData=function(t){return n.Std.selectSessionBreaks(t,this._times).map(e)},this._getPreAndPostMarketBackgroundsData=function(e){const i=n.Std.selectPreAndPostMarketTimes(e,this._times);return{preMarket:i.preMarket.map(t),postMarket:i.postMarket.map(t)}},this.main=function(e,t){if(n.Std.isdwm(e))return null;var i=n.Std.time(e);if(isNaN(i))return null;var s=this._times.length;if(0!==s&&this._times[s-1]===i||this._times.push(i),!e.symbol.isLastBar||!e.symbol.isNewBar)return null;var r=this._getVerticalLineData(e),o=this._getPreAndPostMarketBackgroundsData(e);return 0===r.length&&0===o.preMarket.length&&0===o.postMarket?null:{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{vertlines:[{
;if(0!==s&&this._times[s-1]===i||this._times.push(i),!e.symbol.isLastBar||!e.symbol.isNewBar)return null;var r=this._getVerticalLineData(e),o=this._getPreAndPostMarketBackgroundsData(e);return 0===r.length&&0===o.preMarket.length&&0===o.postMarket?null:{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{vertlines:[{styleId:"sessBreaks",data:r}],backgrounds:[{styleId:"preMarket",data:o.preMarket},{styleId:"postMarket",data:o.postMarket}]},erase:[{action:"all"}]}}}}}},{name:"SuperTrend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:3,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_2:{linestyle:0,linewidth:3,plottype:"shape_arrow_up",trackPrice:!1,location:"BelowBar",transparency:35,visible:!0,color:"#00FF00"},plot_3:{linestyle:0,linewidth:3,plottype:"shape_arrow_down",trackPrice:!1,location:"AboveBar",transparency:35,visible:!0,color:"#FF0000"}},palettes:{palette_0:{colors:{0:{color:"#008000",width:3,style:0},1:{color:"#800000",width:3,style:0}}}},inputs:{in_0:10,in_1:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"},{id:"plot_2",type:"shapes"},{id:"plot_3",type:"shapes"}],styles:{plot_0:{title:"SuperTrend",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Up Arrow",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Down Arrow",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"SuperTrend",shortDescription:"SuperTrend",is_price_study:!0,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:100},{id:"in_1",name:"Factor",defval:3,type:"float",min:1,max:100}],id:"SuperTrend@tv-basicstudies-1",scriptIdPart:"",name:"SuperTrend",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0),s=t(1),[r,o]=n.Std.supertrend(s,i,e),a=e.new_var(o).get(1);return[r,-1===o?0:1,-1===o&&a!==o?1:NaN,1===o&&a!==o?1:NaN]}}},o,a,l,c,h,d,u,p])},81337:(e,t,i)=>{"use strict";i.d(t,{Std:()=>h});var s=i(60156),r=i(41249);class n{constructor(e,t,i){var s,r;this._timezone=e,this._preMarketSessionEntries=null!==(s=null==t?void 0:t.entries())&&void 0!==s?s:[],this._postMarketSessionEntries=null!==(r=null==i?void 0:i.entries())&&void 0!==r?r:[]}getPreAndPostMarketTimes(e){if(0===e.length)return{preMarket:[],postMarket:[]};const t=[],i=[];let s=null,n=null,o=e[0],a=(0,r.utc_to_cal)(this._timezone,o);this._isInPreMarketSession(a)&&(n=o),this._isInPostMarketSession(a)&&(s=o);for(let l=1;l<e.length;l++){const c=e[l],h=(0,r.utc_to_cal)(this._timezone,c);null!==s&&this._isInPostMarketSession(a)&&!this._isInPostMarketSession(h)&&(i.push({start:s,stop:o}),s=null),null===n&&this._isInPreMarketSession(h)&&(n=c),null===s&&this._isInPostMarketSession(h)&&(s=c),null!==n&&this._isInPreMarketSession(a)&&!this._isInPreMarketSession(h)&&(t.push({start:n,stop:o}),n=null),o=c,a=h}return null!==n&&t.push({start:n,stop:e[e.length-1]}), styleId:"sessBreaks",data:r}],backgrounds:[{styleId:"preMarket",data:o.preMarket},{styleId:"postMarket",data:o.postMarket}]},erase:[{action:"all"}]}}}}}},{name:"SuperTrend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:3,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_2:{linestyle:0,linewidth:3,plottype:"shape_arrow_up",trackPrice:!1,location:"BelowBar",transparency:35,visible:!0,color:"#00FF00"},plot_3:{linestyle:0,linewidth:3,plottype:"shape_arrow_down",trackPrice:!1,location:"AboveBar",transparency:35,visible:!0,color:"#FF0000"}},palettes:{palette_0:{colors:{0:{color:"#008000",width:3,style:0},1:{color:"#800000",width:3,style:0}}}},inputs:{in_0:10,in_1:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"},{id:"plot_2",type:"shapes"},{id:"plot_3",type:"shapes"}],styles:{plot_0:{title:"SuperTrend",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Up Arrow",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Down Arrow",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"SuperTrend",shortDescription:"SuperTrend",is_price_study:!0,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:100},{id:"in_1",name:"Factor",defval:3,type:"float",min:1,max:100}],id:"SuperTrend@tv-basicstudies-1",scriptIdPart:"",name:"SuperTrend",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0),s=t(1),[r,o]=n.Std.supertrend(s,i,e),a=e.new_var(o).get(1);return[r,-1===o?0:1,-1===o&&a!==o?1:NaN,1===o&&a!==o?1:NaN]}}},o,a,l,c,h,d,u,p])},49581:(e,t,i)=>{"use strict";i.d(t,{Std:()=>h});var s=i(60156),r=i(41249);class n{constructor(e,t,i){var s,r;this._timezone=e,this._preMarketSessionEntries=null!==(s=null==t?void 0:t.entries())&&void 0!==s?s:[],this._postMarketSessionEntries=null!==(r=null==i?void 0:i.entries())&&void 0!==r?r:[]}getPreAndPostMarketTimes(e){if(0===e.length)return{preMarket:[],postMarket:[]};const t=[],i=[];let s=null,n=null,o=e[0],a=(0,r.utc_to_cal)(this._timezone,o);this._isInPreMarketSession(a)&&(n=o),this._isInPostMarketSession(a)&&(s=o);for(let l=1;l<e.length;l++){const c=e[l],h=(0,r.utc_to_cal)(this._timezone,c);null!==s&&this._isInPostMarketSession(a)&&!this._isInPostMarketSession(h)&&(i.push({start:s,stop:o}),s=null),null===n&&this._isInPreMarketSession(h)&&(n=c),null===s&&this._isInPostMarketSession(h)&&(s=c),null!==n&&this._isInPreMarketSession(a)&&!this._isInPreMarketSession(h)&&(t.push({start:n,stop:o}),n=null),o=c,a=h}return null!==n&&t.push({start:n,stop:e[e.length-1]}),null!==s&&i.push({start:s,stop:e[e.length-1]}),{preMarket:t,postMarket:i}}_isInPreMarketSession(e){return this._anyEntryContains(this._preMarketSessionEntries,e)}_isInPostMarketSession(e){return this._anyEntryContains(this._postMarketSessionEntries,e)}_anyEntryContains(e,t){if(void 0===e)return!1
null!==s&&i.push({start:s,stop:e[e.length-1]}),{preMarket:t,postMarket:i}}_isInPreMarketSession(e){return this._anyEntryContains(this._preMarketSessionEntries,e)}_isInPostMarketSession(e){return this._anyEntryContains(this._postMarketSessionEntries,e)}_anyEntryContains(e,t){if(void 0===e)return!1;for(let i=0;i<e.length;i++)if(e[i].contains(t))return!0;return!1}}var o=i(60062);class a extends Error{constructor(e){super(e),this.studyError=!0}}const l=1e-10,c=e=>e?1:0,h={};function d(e,t,i,s,r){let n=r,o=0;if(isNaN(e.get(t-1)))return{index:NaN,value:NaN};for(let i=0;i<t;++i)s(e.get(i),n)&&(o=i,n=e.get(i));return{index:o,value:n}}h.max_series_default_size=10001,h.n=e=>e.symbol.index+1,h.nz=(e,t=0)=>isFinite(e)?e:t,h.na=function(e){return 0===arguments.length?NaN:isNaN(e)?1:0},h.isZero=e=>Math.abs(e)<=1e-10?1:0,h.toBool=e=>isFinite(e)&&!h.isZero(e),h.eq=(e,t)=>h.isZero(e-t),h.neq=(e,t)=>c(!h.eq(e,t)),h.ge=(e,t)=>c(h.isZero(e-t)||e>t),h.gt=(e,t)=>c(!h.isZero(e-t)&&e>t),h.lt=(e,t)=>c(!h.isZero(e-t)&&e<t),h.le=(e,t)=>c(h.isZero(e-t)||e<t),h.and=(e,t)=>isNaN(e)||isNaN(t)?NaN:h.isZero(e)||h.isZero(t)?0:1,h.or=(e,t)=>isNaN(e)||isNaN(t)?NaN:h.isZero(e)&&h.isZero(t)?0:1,h.not=e=>isNaN(e)?NaN:h.isZero(e)?1:0,h.eps=()=>l,h.greaterOrEqual=(e,t,i)=>t-e<(i||l),h.lessOrEqual=(e,t,i)=>e-t<(i||l),h.equal=(e,t,i)=>Math.abs(e-t)<(i||l),h.greater=(e,t,i)=>e-t>(i||l),h.less=(e,t,i)=>t-e>(i||l),h.compare=(e,t,i)=>h.equal(e,t,i)?0:h.greater(e,t,i)?1:-1,h.max=Math.max,h.min=Math.min,h.pow=Math.pow,h.abs=Math.abs,h.log=Math.log,h.log10=e=>Math.log(e)/Math.LN10,h.sqrt=Math.sqrt,h.sign=e=>isNaN(e)?NaN:h.isZero(e)?0:e>0?1:-1,h.exp=Math.exp,h.sin=Math.sin,h.cos=Math.cos,h.tan=Math.tan,h.asin=Math.asin,h.acos=Math.acos,h.atan=Math.atan,h.floor=Math.floor,h.ceil=Math.ceil,h.round=Math.round,h.avg=(...e)=>{if(2===e.length)return(e[0]+e[1])/2;let t=0;for(let i=0;i<e.length;i++)t+=e[i];return t/e.length},h.open=e=>e.symbol.open,h.high=e=>e.symbol.high,h.low=e=>e.symbol.low,h.close=e=>e.symbol.close,h.hl2=e=>(e.symbol.high+e.symbol.low)/2,h.hlc3=e=>(e.symbol.high+e.symbol.low+e.symbol.close)/3,h.ohlc4=e=>(e.symbol.open+e.symbol.high+e.symbol.low+e.symbol.close)/4,h.volume=e=>e.symbol.volume,h.updatetime=e=>e.symbol.updatetime,h.time=e=>e.symbol.bartime(),h.period=e=>e.symbol.period,h.tickerid=e=>e.symbol.tickerid,h.currencyCode=e=>e.symbol.currencyCode,h.unitId=e=>e.symbol.unitId,h.ticker=e=>e.symbol.ticker,h.interval=e=>e.symbol.interval,h.isdwm=e=>e.symbol.isdwm(),h.isintraday=e=>!e.symbol.isdwm(),h.isdaily=e=>"D"===e.symbol.resolution,h.isweekly=e=>"W"===e.symbol.resolution,h.ismonthly=e=>"M"===e.symbol.resolution,h.year=(e,t)=>h.timepart(e.symbol,r.YEAR,t),h.month=(e,t)=>h.timepart(e.symbol,r.MONTH,t),h.weekofyear=(e,t)=>h.timepart(e.symbol,r.WEEK_OF_YEAR,t),h.dayofmonth=(e,t)=>h.timepart(e.symbol,r.DAY_OF_MONTH,t),h.dayofweek=(e,t)=>h.timepart(e.symbol,r.DAY_OF_WEEK,t),h.hour=(e,t)=>h.timepart(e.symbol,r.HOUR_OF_DAY,t),h.minute=(e,t)=>h.timepart(e.symbol,r.MINUTE,t),h.second=(e,t)=>h.timepart(e.symbol,r.SECOND,t), ;for(let i=0;i<e.length;i++)if(e[i].contains(t))return!0;return!1}}var o=i(60062),a=i(85898);const l=1e-10,c=e=>e?1:0,h={};function d(e,t,i,s,r){let n=r,o=0;if(isNaN(e.get(t-1)))return{index:NaN,value:NaN};for(let i=0;i<t;++i)s(e.get(i),n)&&(o=i,n=e.get(i));return{index:o,value:n}}h.max_series_default_size=10001,h.n=e=>e.symbol.index+1,h.nz=(e,t=0)=>isFinite(e)?e:t,h.na=function(e){return 0===arguments.length?NaN:isNaN(e)?1:0},h.isZero=e=>Math.abs(e)<=1e-10?1:0,h.toBool=e=>isFinite(e)&&!h.isZero(e),h.eq=(e,t)=>h.isZero(e-t),h.neq=(e,t)=>c(!h.eq(e,t)),h.ge=(e,t)=>c(h.isZero(e-t)||e>t),h.gt=(e,t)=>c(!h.isZero(e-t)&&e>t),h.lt=(e,t)=>c(!h.isZero(e-t)&&e<t),h.le=(e,t)=>c(h.isZero(e-t)||e<t),h.and=(e,t)=>isNaN(e)||isNaN(t)?NaN:h.isZero(e)||h.isZero(t)?0:1,h.or=(e,t)=>isNaN(e)||isNaN(t)?NaN:h.isZero(e)&&h.isZero(t)?0:1,h.not=e=>isNaN(e)?NaN:h.isZero(e)?1:0,h.eps=()=>l,h.greaterOrEqual=(e,t,i)=>t-e<(i||l),h.lessOrEqual=(e,t,i)=>e-t<(i||l),h.equal=(e,t,i)=>Math.abs(e-t)<(i||l),h.greater=(e,t,i)=>e-t>(i||l),h.less=(e,t,i)=>t-e>(i||l),h.compare=(e,t,i)=>h.equal(e,t,i)?0:h.greater(e,t,i)?1:-1,h.max=Math.max,h.min=Math.min,h.pow=Math.pow,h.abs=Math.abs,h.log=Math.log,h.log10=e=>Math.log(e)/Math.LN10,h.sqrt=Math.sqrt,h.sign=e=>isNaN(e)?NaN:h.isZero(e)?0:e>0?1:-1,h.exp=Math.exp,h.sin=Math.sin,h.cos=Math.cos,h.tan=Math.tan,h.asin=Math.asin,h.acos=Math.acos,h.atan=Math.atan,h.floor=Math.floor,h.ceil=Math.ceil,h.round=Math.round,h.avg=(...e)=>{if(2===e.length)return(e[0]+e[1])/2;let t=0;for(let i=0;i<e.length;i++)t+=e[i];return t/e.length},h.open=e=>e.symbol.open,h.high=e=>e.symbol.high,h.low=e=>e.symbol.low,h.close=e=>e.symbol.close,h.hl2=e=>(e.symbol.high+e.symbol.low)/2,h.hlc3=e=>(e.symbol.high+e.symbol.low+e.symbol.close)/3,h.ohlc4=e=>(e.symbol.open+e.symbol.high+e.symbol.low+e.symbol.close)/4,h.volume=e=>e.symbol.volume,h.updatetime=e=>e.symbol.updatetime,h.time=e=>e.symbol.bartime(),h.period=e=>e.symbol.period,h.tickerid=e=>e.symbol.tickerid,h.currencyCode=e=>e.symbol.currencyCode,h.unitId=e=>e.symbol.unitId,h.ticker=e=>e.symbol.ticker,h.interval=e=>e.symbol.interval,h.isdwm=e=>e.symbol.isdwm(),h.isintraday=e=>!e.symbol.isdwm(),h.isdaily=e=>"D"===e.symbol.resolution,h.isweekly=e=>"W"===e.symbol.resolution,h.ismonthly=e=>"M"===e.symbol.resolution,h.year=(e,t)=>h.timepart(e.symbol,r.YEAR,t),h.month=(e,t)=>h.timepart(e.symbol,r.MONTH,t),h.weekofyear=(e,t)=>h.timepart(e.symbol,r.WEEK_OF_YEAR,t),h.dayofmonth=(e,t)=>h.timepart(e.symbol,r.DAY_OF_MONTH,t),h.dayofweek=(e,t)=>h.timepart(e.symbol,r.DAY_OF_WEEK,t),h.hour=(e,t)=>h.timepart(e.symbol,r.HOUR_OF_DAY,t),h.minute=(e,t)=>h.timepart(e.symbol,r.MINUTE,t),h.second=(e,t)=>h.timepart(e.symbol,r.SECOND,t),h.add_days_considering_dst=(e,t,i)=>r.add_days_considering_dst(r.get_timezone(e),t,i),h.add_years_considering_dst=(e,t,i)=>r.add_years_considering_dst(r.get_timezone(e),t,i),h.selectSessionBreaks=(e,t)=>{if(h.isdwm(e)||void 0===e.symbol.session.timezone)return[];const i=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null),r=[],n=t.length;if(i.moveTo(t[n-1]),
h.add_days_considering_dst=(e,t,i)=>r.add_days_considering_dst(r.get_timezone(e),t,i),h.add_years_considering_dst=(e,t,i)=>r.add_years_considering_dst(r.get_timezone(e),t,i),h.selectSessionBreaks=(e,t)=>{if(h.isdwm(e)||void 0===e.symbol.session.timezone)return[];const i=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null),r=[],n=t.length;if(i.moveTo(t[n-1]),1===n&&i.startOfBar(0)===t[0])r.push(t[0]);else{for(let e=n-2;e>=0;--e){const s=t[e];if(s>=i.startOfBar(0))continue;i.moveTo(s);const n=t[e+1];r.push(n)}r.reverse()}return r},h.selectPreAndPostMarketTimes=(e,t)=>{var i,s;if(h.isdwm(e)||void 0===e.symbol.session.timezone)return{preMarket:[],postMarket:[]};return new n(e.symbol.session.timezone,null!==(i=e.symbol.preMarketSubsession)&&void 0!==i?i:null,null!==(s=e.symbol.postMarketSubsession)&&void 0!==s?s:null).getPreAndPostMarketTimes(t)},h.iff=(e,t,i)=>h.not(e)?i:t,h.rising=(e,t)=>{for(let i=1;i<t+1;++i)if(e.get(i)>e.get(0))return 0;return 1},h.falling=(e,t)=>{for(let i=1;i<t+1;++i)if(e.get(i)<e.get(0))return 0;return 1},h.timepart=(e,t,i)=>{const s=r.utc_to_cal(e.session.timezone,i||e.bartime());return r.get_part(s,t)},h.rsi=(e,t)=>h.isZero(t)?100:h.isZero(e)?0:100-100/(1+e/t),h.sum=(e,t,i)=>{const s=i.new_var(),r=h.nz(e.get())+h.nz(s.get(1))-h.nz(e.get(t));return s.set(r),r},h.sma=(e,t,i)=>{const s=h.sum(e,t,i);return h.na(e.get(t-1))?NaN:s/t},h.smma=(e,t,i)=>{const s=i.new_var(e),r=h.sma(s,t,i),n=i.new_var(),o=(n.get(1)*(t-1)+e)/t;return n.set(h.na(n.get(1))?r:o),n.get(0)},h.rma=(e,t,i)=>{const s=h.sum(e,t,i),r=t-1,n=e.get(r),o=i.new_var(),a=o.get(1),l=e.get(),c=h.na(n)?NaN:h.na(a)?s/t:(l+a*r)/t;return o.set(c),c},h.fixnan=(e,t)=>{const i=t.new_var();return isNaN(e)?i.get(1):(i.set(e),e)},h.tr=(e,t)=>{let i=t.new_var(h.close(t)).get(1);return e&&isNaN(i)&&(i=h.close(t)),h.max(h.max(h.high(t)-h.low(t),h.abs(h.high(t)-i)),h.abs(h.low(t)-i))},h.atr=(e,t)=>{const i=t.new_var(h.tr(void 0,t));return h.rma(i,e,t)},h.ema=(e,t,i)=>{const s=h.sum(e,t,i),r=i.new_var(),n=e.get(0),o=e.get(t-1),a=r.get(1),l=h.na(o)?NaN:h.na(a)?s/t:2*(n-a)/(t+1)+a;return r.set(l),l},h.wma=(e,t,i)=>{let s=0;for(let i=t=Math.round(t);i>=0;i--){s+=(t-i)*e.get(i)}return 2*s/(t*(t+1))},h.vwma=(e,t,i)=>{const s=i.new_var(h.volume(i)),r=i.new_var(e.get(0)*h.volume(i));return h.sma(r,t,i)/h.sma(s,t,i)},h.swma=(e,t)=>(e.get(0)+2*e.get(1)+2*e.get(2)+e.get(3))/6,h.supertrend=(e,t,i)=>{const s=h.atr(t,i),r=i.new_var(s).get(1),n=h.hl2(i);let o=n+s*e,a=n-s*e;const l=h.close(i),c=i.new_var(l).get(1),d=i.new_var(),u=h.nz(d.get(1)),p=i.new_var(),_=h.nz(p.get(1));a=h.gt(a,u)||h.lt(c,u)?a:u,d.set(a),o=h.lt(o,_)||h.gt(c,_)?o:_,p.set(o);let m=h.na();const g=i.new_var(),f=g.get(1);m=h.na(r)?1:f===_?l>o?-1:1:l<a?1:-1;const v=-1===m?a:o;return g.set(v),h.n(i)<=t?[Number.NaN,0]:[v,m]},h.lowestbars=(e,t,i)=>-d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).index,h.lowest=(e,t,i)=>d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).value,h.highestbars=(e,t,i)=>-d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).index, 1===n&&i.startOfBar(0)===t[0])r.push(t[0]);else{for(let e=n-2;e>=0;--e){const s=t[e];if(s>=i.startOfBar(0))continue;i.moveTo(s);const n=t[e+1];r.push(n)}r.reverse()}return r},h.selectPreAndPostMarketTimes=(e,t)=>{var i,s;if(h.isdwm(e)||void 0===e.symbol.session.timezone)return{preMarket:[],postMarket:[]};return new n(e.symbol.session.timezone,null!==(i=e.symbol.preMarketSubsession)&&void 0!==i?i:null,null!==(s=e.symbol.postMarketSubsession)&&void 0!==s?s:null).getPreAndPostMarketTimes(t)},h.iff=(e,t,i)=>h.not(e)?i:t,h.rising=(e,t)=>{for(let i=1;i<t+1;++i)if(e.get(i)>e.get(0))return 0;return 1},h.falling=(e,t)=>{for(let i=1;i<t+1;++i)if(e.get(i)<e.get(0))return 0;return 1},h.timepart=(e,t,i)=>{const s=r.utc_to_cal(e.session.timezone,i||e.bartime());return r.get_part(s,t)},h.rsi=(e,t)=>h.isZero(t)?100:h.isZero(e)?0:100-100/(1+e/t),h.sum=(e,t,i)=>{const s=i.new_var(),r=h.nz(e.get())+h.nz(s.get(1))-h.nz(e.get(t));return s.set(r),r},h.sma=(e,t,i)=>{const s=h.sum(e,t,i);return h.na(e.get(t-1))?NaN:s/t},h.smma=(e,t,i)=>{const s=i.new_var(e),r=h.sma(s,t,i),n=i.new_var(),o=(n.get(1)*(t-1)+e)/t;return n.set(h.na(n.get(1))?r:o),n.get(0)},h.rma=(e,t,i)=>{const s=h.sum(e,t,i),r=t-1,n=e.get(r),o=i.new_var(),a=o.get(1),l=e.get(),c=h.na(n)?NaN:h.na(a)?s/t:(l+a*r)/t;return o.set(c),c},h.fixnan=(e,t)=>{const i=t.new_var();return isNaN(e)?i.get(1):(i.set(e),e)},h.tr=(e,t)=>{let i=t.new_var(h.close(t)).get(1);return e&&isNaN(i)&&(i=h.close(t)),h.max(h.max(h.high(t)-h.low(t),h.abs(h.high(t)-i)),h.abs(h.low(t)-i))},h.atr=(e,t)=>{const i=t.new_var(h.tr(void 0,t));return h.rma(i,e,t)},h.ema=(e,t,i)=>{const s=h.sum(e,t,i),r=i.new_var(),n=e.get(0),o=e.get(t-1),a=r.get(1),l=h.na(o)?NaN:h.na(a)?s/t:2*(n-a)/(t+1)+a;return r.set(l),l},h.wma=(e,t,i)=>{let s=0;for(let i=t=Math.round(t);i>=0;i--){s+=(t-i)*e.get(i)}return 2*s/(t*(t+1))},h.vwma=(e,t,i)=>{const s=i.new_var(h.volume(i)),r=i.new_var(e.get(0)*h.volume(i));return h.sma(r,t,i)/h.sma(s,t,i)},h.swma=(e,t)=>(e.get(0)+2*e.get(1)+2*e.get(2)+e.get(3))/6,h.supertrend=(e,t,i)=>{const s=h.atr(t,i),r=i.new_var(s).get(1),n=h.hl2(i);let o=n+s*e,a=n-s*e;const l=h.close(i),c=i.new_var(l).get(1),d=i.new_var(),u=h.nz(d.get(1)),p=i.new_var(),_=h.nz(p.get(1));a=h.gt(a,u)||h.lt(c,u)?a:u,d.set(a),o=h.lt(o,_)||h.gt(c,_)?o:_,p.set(o);let m=h.na();const g=i.new_var(),f=g.get(1);m=h.na(r)?1:f===_?l>o?-1:1:l<a?1:-1;const v=-1===m?a:o;return g.set(v),h.n(i)<=t?[Number.NaN,0]:[v,m]},h.lowestbars=(e,t,i)=>-d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).index,h.lowest=(e,t,i)=>d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).value,h.highestbars=(e,t,i)=>-d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).index,h.highest=(e,t,i)=>d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).value,h.cum=(e,t)=>{const i=t.new_var(),s=h.nz(i.get(1))+e;return i.set(s),s},h.accdist=e=>{const t=h.high(e),i=h.low(e),s=h.close(e),r=h.volume(e);return h.cum(s===t&&s===i||t===i?0:r*(2*s-i-t)/(t-i),e)},h.correlation=(e,t,i,s)=>{const r=h.sma(e,i,s),n=h.sma(t,i,s),o=s.new_var(e.get()*t.get())
h.highest=(e,t,i)=>d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).value,h.cum=(e,t)=>{const i=t.new_var(),s=h.nz(i.get(1))+e;return i.set(s),s},h.accdist=e=>{const t=h.high(e),i=h.low(e),s=h.close(e),r=h.volume(e);return h.cum(s===t&&s===i||t===i?0:r*(2*s-i-t)/(t-i),e)},h.correlation=(e,t,i,s)=>{const r=h.sma(e,i,s),n=h.sma(t,i,s),o=s.new_var(e.get()*t.get());return(h.sma(o,i,s)-r*n)/Math.sqrt(h.variance2(e,r,i)*h.variance2(t,n,i))},h.stoch=(e,t,i,s,r)=>{const n=h.highest(t,s,r),o=h.lowest(i,s,r);return h.fixnan(100*(e.get()-o)/(n-o),r)},h.tsi=(e,t,i,s)=>{const r=s.new_var(h.change(e)),n=s.new_var(h.abs(h.change(e))),o=s.new_var(h.ema(r,i,s)),a=s.new_var(h.ema(n,i,s));return h.ema(o,t,s)/h.ema(a,t,s)},h.cross=(e,t,i)=>{if(isNaN(e)||isNaN(t))return!1;const s=i.new_var((r=e-t)<0?-1:0===r?0:1);var r;return!isNaN(s.get(1))&&s.get(1)!==s.get()},h.linreg=(e,t,i)=>{let s=0,r=0,n=0,o=0;for(let i=0;i<t;++i){const a=e.get(i),l=t-1-i+1;s+=l,r+=a,n+=l*l,o+=a*l}const a=(t*o-s*r)/(t*n-s*s);return r/t-a*s/t+a+a*(t-1-i)},h.sar=(e,t,i,s)=>{const r=s.new_var(),n=s.new_var(),o=s.new_var(),a=h.high(s),l=h.low(s),c=h.close(s),d=s.new_var(a),u=s.new_var(l),p=s.new_var(c),_=s.new_var();let m=_.get(1),g=n.get(1),f=o.get(1);n.set(g),o.set(f);let v=!1;const S=u.get(1),y=u.get(2),b=d.get(1),w=d.get(2),C=p.get(),P=p.get(1);2===h.n(s)&&(h.greater(C,P)?(r.set(1),o.set(d.get()),m=S,f=d.get()):(r.set(-1),o.set(u.get()),m=b,f=u.get()),v=!0,n.set(e),g=e);let x=m+g*(f-m);return 1===r.get()?h.greater(x,u.get())&&(v=!0,r.set(-1),x=Math.max(d.get(),o.get()),o.set(u.get()),n.set(e)):h.less(x,d.get())&&(v=!0,r.set(1),x=Math.min(u.get(),o.get()),o.set(d.get()),n.set(e)),v||(1===r.get()?h.greater(d.get(),o.get())&&(o.set(d.get()),n.set(Math.min(n.get()+t,i))):h.less(u.get(),o.get())&&(o.set(u.get()),n.set(Math.min(n.get()+t,i)))),1===r.get()?(x=Math.min(x,S),h.n(s)>2&&(x=Math.min(x,y))):(x=Math.max(x,b),h.n(s)>2&&(x=Math.max(x,w))),_.set(x),x},h.alma=(e,t,i,s)=>{const r=Math.floor(i*(t-1)),n=t/s*(t/s),o=[];let a=0;for(let e=0;e<t;++e){const t=Math.exp(-1*Math.pow(e-r,2)/(2*n));a+=t,o.push(t)}for(let e=0;e<t;++e)o[e]/=a;let l=0;for(let i=0;i<t;++i)l+=o[i]*e.get(t-i-1);return l},h.change=e=>e.get()-e.get(1),h.roc=(e,t)=>{const i=e.get(t);return 100*(e.get()-i)/i},h.dev=(e,t,i)=>{const s=h.sma(e,t,i);return h.dev2(e,t,s)},h.dev2=(e,t,i)=>{let s=0;for(let r=0;r<t;r++){const t=e.get(r);s+=h.abs(t-i)}return s/t},h.stdev=(e,t,i)=>{const s=h.variance(e,t,i);return h.sqrt(s)},h.variance=(e,t,i)=>{const s=h.sma(e,t,i);return h.variance2(e,s,t)},h.variance2=(e,t,i)=>{let s=0;for(let r=0;r<i;r++){const i=e.get(r),n=h.abs(i-t);s+=n*n}return s/i},h.percentrank=(e,t)=>{if(h.na(e.get(t-1)))return NaN;let i=0;const s=e.get();for(let r=1;r<t;r++){const t=e.get(r);h.ge(s,t)&&i++}return 100*i/t},h.createNewSessionCheck=e=>{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null);return e=>t.indexOfBar(e)===o.SessionStage.POST_SESSION&&(t.moveTo(e),!0)},h.error=e=>{throw new a(e)},h.dmi=(e,t,i)=>{ ;return(h.sma(o,i,s)-r*n)/Math.sqrt(h.variance2(e,r,i)*h.variance2(t,n,i))},h.stoch=(e,t,i,s,r)=>{const n=h.highest(t,s,r),o=h.lowest(i,s,r);return h.fixnan(100*(e.get()-o)/(n-o),r)},h.tsi=(e,t,i,s)=>{const r=s.new_var(h.change(e)),n=s.new_var(h.abs(h.change(e))),o=s.new_var(h.ema(r,i,s)),a=s.new_var(h.ema(n,i,s));return h.ema(o,t,s)/h.ema(a,t,s)},h.cross=(e,t,i)=>{if(isNaN(e)||isNaN(t))return!1;const s=i.new_var((r=e-t)<0?-1:0===r?0:1);var r;return!isNaN(s.get(1))&&s.get(1)!==s.get()},h.linreg=(e,t,i)=>{let s=0,r=0,n=0,o=0;for(let i=0;i<t;++i){const a=e.get(i),l=t-1-i+1;s+=l,r+=a,n+=l*l,o+=a*l}const a=(t*o-s*r)/(t*n-s*s);return r/t-a*s/t+a+a*(t-1-i)},h.sar=(e,t,i,s)=>{const r=s.new_var(),n=s.new_var(),o=s.new_var(),a=h.high(s),l=h.low(s),c=h.close(s),d=s.new_var(a),u=s.new_var(l),p=s.new_var(c),_=s.new_var();let m=_.get(1),g=n.get(1),f=o.get(1);n.set(g),o.set(f);let v=!1;const S=u.get(1),y=u.get(2),b=d.get(1),w=d.get(2),C=p.get(),P=p.get(1);2===h.n(s)&&(h.greater(C,P)?(r.set(1),o.set(d.get()),m=S,f=d.get()):(r.set(-1),o.set(u.get()),m=b,f=u.get()),v=!0,n.set(e),g=e);let x=m+g*(f-m);return 1===r.get()?h.greater(x,u.get())&&(v=!0,r.set(-1),x=Math.max(d.get(),o.get()),o.set(u.get()),n.set(e)):h.less(x,d.get())&&(v=!0,r.set(1),x=Math.min(u.get(),o.get()),o.set(d.get()),n.set(e)),v||(1===r.get()?h.greater(d.get(),o.get())&&(o.set(d.get()),n.set(Math.min(n.get()+t,i))):h.less(u.get(),o.get())&&(o.set(u.get()),n.set(Math.min(n.get()+t,i)))),1===r.get()?(x=Math.min(x,S),h.n(s)>2&&(x=Math.min(x,y))):(x=Math.max(x,b),h.n(s)>2&&(x=Math.max(x,w))),_.set(x),x},h.alma=(e,t,i,s)=>{const r=Math.floor(i*(t-1)),n=t/s*(t/s),o=[];let a=0;for(let e=0;e<t;++e){const t=Math.exp(-1*Math.pow(e-r,2)/(2*n));a+=t,o.push(t)}for(let e=0;e<t;++e)o[e]/=a;let l=0;for(let i=0;i<t;++i)l+=o[i]*e.get(t-i-1);return l},h.change=e=>e.get()-e.get(1),h.roc=(e,t)=>{const i=e.get(t);return 100*(e.get()-i)/i},h.dev=(e,t,i)=>{const s=h.sma(e,t,i);return h.dev2(e,t,s)},h.dev2=(e,t,i)=>{let s=0;for(let r=0;r<t;r++){const t=e.get(r);s+=h.abs(t-i)}return s/t},h.stdev=(e,t,i)=>{const s=h.variance(e,t,i);return h.sqrt(s)},h.variance=(e,t,i)=>{const s=h.sma(e,t,i);return h.variance2(e,s,t)},h.variance2=(e,t,i)=>{let s=0;for(let r=0;r<i;r++){const i=e.get(r),n=h.abs(i-t);s+=n*n}return s/i},h.percentrank=(e,t)=>{if(h.na(e.get(t-1)))return NaN;let i=0;const s=e.get();for(let r=1;r<t;r++){const t=e.get(r);h.ge(s,t)&&i++}return 100*i/t},h.createNewSessionCheck=e=>{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null);return e=>t.indexOfBar(e)===o.SessionStage.POST_SESSION&&(t.moveTo(e),!0)},h.error=e=>{throw new a.StudyError(e)},h.dmi=(e,t,i)=>{const s=i.new_var(h.high(i)),r=i.new_var(h.low(i)),n=h.change(s),o=-h.change(r),a=i.new_var(h.na(n)||h.na(o)?h.na():h.and(h.gt(n,o),h.gt(n,0))?n:0),l=i.new_var(h.na(o)?h.na():h.and(h.gt(o,n),h.gt(o,0))?o:0),c=h.atr(e,i),d=h.fixnan(100*h.rma(a,e,i)/c,i),u=h.fixnan(100*h.rma(l,e,i)/c,i);let p=d+u;h.isZero(p)&&(p+=1)
const s=i.new_var(h.high(i)),r=i.new_var(h.low(i)),n=h.change(s),o=-h.change(r),a=i.new_var(h.na(n)||h.na(o)?h.na():h.and(h.gt(n,o),h.gt(n,0))?n:0),l=i.new_var(h.na(o)?h.na():h.and(h.gt(o,n),h.gt(o,0))?o:0),c=h.atr(e,i),d=h.fixnan(100*h.rma(a,e,i)/c,i),u=h.fixnan(100*h.rma(l,e,i)/c,i);let p=d+u;h.isZero(p)&&(p+=1);const _=Math.abs(d-u)/p*100,m=i.new_var(_),g=h.rma(m,t,i),f=i.new_var(g);return[d,u,_,g,(f.get(0)+f.get(e-1))/2]},h.zigzag=(e,t,i)=>new m(e,t,i).lastPrice(),h.zigzagbars=(e,t,i)=>{const s=new m(e,t,i);return-1===s.lastIndex()?NaN:s.lastIndex()-h.n(i)};const u=0,p=1;class _{constructor(e,t,i,s,r){this._areaRight=e,this._areaLeft=t,this._pivotType=i,this._series=s,this._currentIndex=r.new_var(0),this._currentValue=r.new_var(NaN),this._pivotIndex=r.new_var(-1),this._index=h.n(r),this._isNewBar=r.symbol.isNewBar;const n=this._currentIndex.get(1),o=this._currentValue.get(1),a=this._pivotIndex.get(1);this._index>1&&(this._currentIndex.set(n),this._currentValue.set(o),this._pivotIndex.set(a))}isPivotFound(){return-1!==this._pivotIndex.get()}pivotIndex(){return this._pivotIndex.get()}currentValue(){return this._currentValue.get()}pivotType(){return this._pivotType}reset(){this._currentValue.set(NaN),this._currentIndex.set(0),this._pivotIndex.set(-1)}isRightSideOk(e){return e-this._currentIndex.get()===this._areaRight}isViolate(e,t){if(e<1||isNaN(this._currentValue.get()))return!0;const i=this._series.get(this._index-e);return!!isNaN(i)||(i===this._currentValue.get()?t:this._pivotType===p?i>this._currentValue.get():i<this._currentValue.get())}processPoint(e){this.isViolate(e,!1)&&(this._currentValue.set(this._series.get()),this._currentIndex.set(e))}isRestartNeeded(e){return e-this._currentIndex.get()>this._areaRight}update(){if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(-1===this._pivotIndex.get()){let e=!0;for(let t=0;t<this._areaLeft;++t)if(this.isViolate(this._currentIndex.get()-1-t,!0)){e=!1;break}e&&this._pivotIndex.set(this._currentIndex.get())}}else-1!==this._pivotIndex.get()&&this._pivotIndex.set(-1);if(this.isRestartNeeded(this._index)){this.reset();for(let e=0;e<=this._areaRight;++e)this.processPoint(this._index-this._areaRight+e)}}}_.LOW=0,_.HIGH=1;class m{constructor(e,t,i){this._deviation=e;const s=i.new_var(h.high(i)),r=i.new_var(h.low(i));s.get(2*t+1),r.get(2*t+1),this._pivotHigh=new _(t,t,p,s,i),this._pivotLow=new _(t,t,u,r,i),this._lastVal=i.new_var(NaN),this._lastIndex=i.new_var(-1),this._lastType=i.new_var(),this._index=h.n(i),this._isBarClosed=i.symbol.isBarClosed;const n=this._lastIndex.get(1),o=this._lastVal.get(1),a=this._lastType.get(1);this._index>1&&this.addPivot(n,o,a),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}addPivot(e,t,i){this._lastIndex.set(e),this._lastVal.set(t),this._lastType.set(i)}updatePivot(e,t){this._lastIndex.set(e),this._lastVal.set(t)}lastPrice(){return this._lastVal.get()}lastIndex(){return this._lastIndex.get()}addPoint(e,t,i){ ;const _=Math.abs(d-u)/p*100,m=i.new_var(_),g=h.rma(m,t,i),f=i.new_var(g);return[d,u,_,g,(f.get(0)+f.get(e-1))/2]},h.zigzag=(e,t,i)=>new m(e,t,i).lastPrice(),h.zigzagbars=(e,t,i)=>{const s=new m(e,t,i);return-1===s.lastIndex()?NaN:s.lastIndex()-h.n(i)};const u=0,p=1;class _{constructor(e,t,i,s,r){this._areaRight=e,this._areaLeft=t,this._pivotType=i,this._series=s,this._currentIndex=r.new_var(0),this._currentValue=r.new_var(NaN),this._pivotIndex=r.new_var(-1),this._index=h.n(r),this._isNewBar=r.symbol.isNewBar;const n=this._currentIndex.get(1),o=this._currentValue.get(1),a=this._pivotIndex.get(1);this._index>1&&(this._currentIndex.set(n),this._currentValue.set(o),this._pivotIndex.set(a))}isPivotFound(){return-1!==this._pivotIndex.get()}pivotIndex(){return this._pivotIndex.get()}currentValue(){return this._currentValue.get()}pivotType(){return this._pivotType}reset(){this._currentValue.set(NaN),this._currentIndex.set(0),this._pivotIndex.set(-1)}isRightSideOk(e){return e-this._currentIndex.get()===this._areaRight}isViolate(e,t){if(e<1||isNaN(this._currentValue.get()))return!0;const i=this._series.get(this._index-e);return!!isNaN(i)||(i===this._currentValue.get()?t:this._pivotType===p?i>this._currentValue.get():i<this._currentValue.get())}processPoint(e){this.isViolate(e,!1)&&(this._currentValue.set(this._series.get()),this._currentIndex.set(e))}isRestartNeeded(e){return e-this._currentIndex.get()>this._areaRight}update(){if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(-1===this._pivotIndex.get()){let e=!0;for(let t=0;t<this._areaLeft;++t)if(this.isViolate(this._currentIndex.get()-1-t,!0)){e=!1;break}e&&this._pivotIndex.set(this._currentIndex.get())}}else-1!==this._pivotIndex.get()&&this._pivotIndex.set(-1);if(this.isRestartNeeded(this._index)){this.reset();for(let e=0;e<=this._areaRight;++e)this.processPoint(this._index-this._areaRight+e)}}}_.LOW=0,_.HIGH=1;class m{constructor(e,t,i){this._deviation=e;const s=i.new_var(h.high(i)),r=i.new_var(h.low(i));s.get(2*t+1),r.get(2*t+1),this._pivotHigh=new _(t,t,p,s,i),this._pivotLow=new _(t,t,u,r,i),this._lastVal=i.new_var(NaN),this._lastIndex=i.new_var(-1),this._lastType=i.new_var(),this._index=h.n(i),this._isBarClosed=i.symbol.isBarClosed;const n=this._lastIndex.get(1),o=this._lastVal.get(1),a=this._lastType.get(1);this._index>1&&this.addPivot(n,o,a),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}addPivot(e,t,i){this._lastIndex.set(e),this._lastVal.set(t),this._lastType.set(i)}updatePivot(e,t){this._lastIndex.set(e),this._lastVal.set(t)}lastPrice(){return this._lastVal.get()}lastIndex(){return this._lastIndex.get()}addPoint(e,t,i){if(isNaN(this._lastVal.get()))return void this.addPivot(e,t,i);const s=this._lastVal.get();if(this._lastType.get()===i){return void((i===p?t>s:t<s)&&this.updatePivot(e,t))}Math.abs(s-t)/t>this._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}},
if(isNaN(this._lastVal.get()))return void this.addPivot(e,t,i);const s=this._lastVal.get();if(this._lastType.get()===i){return void((i===p?t>s:t<s)&&this.updatePivot(e,t))}Math.abs(s-t)/t>this._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}},53130:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>n});var s=i(50151),r=i(81337);const n={name:"Anchored VWAP",metainfo:{_metainfoVersion:51,description:"Anchored VWAP",shortDescription:"Anchored VWAP",format:{type:"inherit"},id:"AnchoredVWAP@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,defaults:{inputs:{start_time:0,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Start time",type:"time"},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"}}},constructor:class{constructor(){this._isNewSession=null,this._firstBarTime=0}init(e,t){this._firstBarTime=t(0),this._isNewSession=null}main(e,t,i){if(void 0===i)return[NaN];(0,s.assert)(e.symbol.time===i.time);const n=i.time;if(n&&n<this._firstBarTime)return[NaN];const o=r.Std.volume(e),a=r.Std[t(1)](e),l=e.new_unlimited_var(),c=e.new_unlimited_var(),h=e.symbol.time;null!==h&&(null===this._isNewSession&&(this._isNewSession=r.Std.createNewSessionCheck(e)),this._isNewSession&&this._isNewSession(h)&&(this._resetHist(l),this._resetHist(c))),l.set(r.Std.nz(l.get())+a*o),c.set(r.Std.nz(c.get())+o);return[l.get()/c.get()]}_resetHist(e){e.reset_hist()}}}},82808:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>d});var s=i(36274),r=i(47609),n=i(81337);class o{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class a{constructor(){this.pivots=[]}}function l(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function c(e,t){if(n.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()<function(e,t){return new Date(t,e,0).getDate()}(i.getUTCMonth(),i.getUTCFullYear())?(l(i,n.Std.interval(e)),i=n.Std.add_days_considering_dst("Etc/UTC",i,1-i.getUTCDay())):(i=n.Std.add_days_considering_dst("Etc/UTC",i,1),l(i,n.Std.interval(e))),i.valueOf()}return t+s.Interval.parse(e.symbol.resolution).inMilliseconds(t)}function h(e,t){switch(t){case"Auto":return function(e){const t=s.Interval.parse(e.symbol.interval+e.symbol.resolution);switch(t.kind()){case s.ResolutionKind.Weeks:case s.ResolutionKind.Months:return"12M";case s.ResolutionKind.Days:return"1M";case s.ResolutionKind.Minutes:return t.multiplier()>=1&&t.multiplier()<=15?"1D":"1W";case s.ResolutionKind.Seconds:case s.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily": 53130:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>n});var s=i(50151),r=i(49581);const n={name:"Anchored VWAP",metainfo:{_metainfoVersion:51,description:"Anchored VWAP",shortDescription:"Anchored VWAP",format:{type:"inherit"},id:"AnchoredVWAP@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,defaults:{inputs:{start_time:0,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Start time",type:"time"},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"}}},constructor:class{constructor(){this._isNewSession=null,this._firstBarTime=0}init(e,t){this._firstBarTime=t(0),this._isNewSession=null}main(e,t,i){if(void 0===i)return[NaN];(0,s.assert)(e.symbol.time===i.time);const n=i.time;if(n&&n<this._firstBarTime)return[NaN];const o=r.Std.volume(e),a=r.Std[t(1)](e),l=e.new_unlimited_var(),c=e.new_unlimited_var(),h=e.symbol.time;null!==h&&(null===this._isNewSession&&(this._isNewSession=r.Std.createNewSessionCheck(e)),this._isNewSession&&this._isNewSession(h)&&(this._resetHist(l),this._resetHist(c))),l.set(r.Std.nz(l.get())+a*o),c.set(r.Std.nz(c.get())+o);return[l.get()/c.get()]}_resetHist(e){e.reset_hist()}}}},59761:(e,t,i)=>{"use strict";i.d(t,{BarBuilder:()=>a});var s=i(50151),r=i(60156),n=i(94421),o=i(49581);class a{constructor(e,t){this._period=e,this._generateEmptyBars=!!t}init(e){this._bb=(0,r.newBarBuilder)(this._period,e.symbol.session,null),this._bbEmptyBars=this._generateEmptyBars?(0,r.newBarBuilder)(this._period,e.symbol.session,null):void 0,e.setMinimumAdditionalDepth(0)}main(e){const t=(0,s.ensureDefined)(this._bb,"bar builder study bar builder"),i=e.symbol.time,r=t.alignTime(i),n=e.new_var(r),a=o.Std.na(r),l=n.get(1),c=o.Std.na(l)?1:o.Std.neq(r,l),h=e.new_var(),d=e.new_var(),u=e.new_var(),p=e.new_var(),_=h.get(1),m=d.get(1),g=u.get(1),f=p.get(1),v=a?NaN:c?o.Std.open(e):_,S=a?NaN:c?o.Std.high(e):o.Std.max(o.Std.high(e),m),y=a?NaN:c?o.Std.low(e):o.Std.min(o.Std.low(e),g),b=a?NaN:o.Std.close(e),w=a?NaN:c?o.Std.volume(e):o.Std.volume(e)+f,C=a?NaN:i,P=e.symbol.isBarClosed&&t.isLastBar(0,i),x=this._generateEmptyBars&&c?this._extrapolate(l,r):void 0,T=e.new_var(o.Std.close(e)).get(1),I=x instanceof Array?T:NaN;return h.set(v),d.set(S),u.set(y),p.set(w),[r,v,S,y,b,w,C,P,x,I]}_extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:(0,n.extrapolateBarsFrontToTime)((0,s.ensureDefined)(this._bbEmptyBars,"bar builder study empty bar builder"),e,t,Number.MAX_SAFE_INTEGER,!0).times}}},2543:(e,t,i)=>{"use strict";i.d(t,{OHLCV:()=>r});var s=i(49581);class r{main(e){return[s.Std.open(e),s.Std.high(e),s.Std.low(e),s.Std.close(e),s.Std.volume(e),s.Std.updatetime(e),void 0,void 0,void 0,void 0]}}},82808:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>d});var s=i(36274),r=i(47609),n=i(49581);class o{
return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const d={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla","Floor"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:1,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN}init(e,t){const i=t(0),s=t(1),o=t(2),l=t(3);this._data=new a,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=l,this._pivTimeFrame=o,this._isValidResolution=function(e,t){return!(n.Std.isdaily(e)&&"Daily"===t||n.Std.isweekly(e)&&("Daily"===t||"Weekly"===t)||n.Std.ismonthly(e)&&("Daily"===t||"Weekly"===t||"Monthly"===t))}(e,this._pivTimeFrame),this._isValidResolution||n.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=h(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,r.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,n.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e,t,i){if(!this._isValidResolution)return null;if(e.is_main_symbol(i))return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const s=e.new_var(n.Std.open(e)),r=e.new_var(n.Std.high(e)),a=e.new_var(n.Std.low(e)),l=e.new_var(n.Std.close(e)),h=e.new_var(n.Std.time(e)),d=this._data,u=s.get(0),p=h.get(0),_=s.get(1),m=r.get(1),g=a.get(1),f=l.get(1),v=e.symbol.isLastBar;if(0!==d.pivots.length&&e.symbol.isNewBar){const e=d.pivots[d.pivots.length-1];e.endIndex__t!==p&&(e.endIndex__t=p)}if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const S=function(e,t,i,s,r,a,l,c){const h=new o;let d=NaN;const u=i-s;switch(c){case 0:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=2*d+(i-2*s),h.s3=2*d-(2*i-s),h.r4=3*d+(i-3*s),h.s4=3*d-(3*i-s),h.r5=4*d+(i-4*s),h.s5=4*d-(4*i-s);break;case 1:d=(i+s+r)/3,h.p=d, constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class a{constructor(){this.pivots=[]}}function l(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function c(e,t){if(n.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()<function(e,t){return new Date(t,e,0).getDate()}(i.getUTCMonth(),i.getUTCFullYear())?(l(i,n.Std.interval(e)),i=n.Std.add_days_considering_dst("Etc/UTC",i,1-i.getUTCDay())):(i=n.Std.add_days_considering_dst("Etc/UTC",i,1),l(i,n.Std.interval(e))),i.valueOf()}return t+s.Interval.parse(e.symbol.resolution).inMilliseconds(t)}function h(e,t){switch(t){case"Auto":return function(e){const t=s.Interval.parse(e.symbol.interval+e.symbol.resolution);switch(t.kind()){case s.ResolutionKind.Weeks:case s.ResolutionKind.Months:return"12M";case s.ResolutionKind.Days:return"1M";case s.ResolutionKind.Minutes:return t.multiplier()>=1&&t.multiplier()<=15?"1D":"1W";case s.ResolutionKind.Seconds:case s.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily":return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const d={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla","Floor"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:1,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN}init(e,t){const i=t(0),s=t(1),o=t(2),l=t(3);this._data=new a,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=l,this._pivTimeFrame=o,this._isValidResolution=function(e,t){return!(n.Std.isdaily(e)&&"Daily"===t||n.Std.isweekly(e)&&("Daily"===t||"Weekly"===t)||n.Std.ismonthly(e)&&("Daily"===t||"Weekly"===t||"Monthly"===t))}(e,this._pivTimeFrame),this._isValidResolution||n.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=h(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,
h.r1=d+.382*u,h.s1=d-.382*u,h.r2=d+.618*u,h.s2=d-.618*u,h.r3=d+u,h.s3=d-u;break;case 2:d=(i+s+2*e)/4,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=i+2*(d-s),h.s3=s-2*(i-d),h.r4=h.r3+u,h.s4=h.s3-u;break;case 3:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=d+2*u,h.s3=d-2*u,h.r4=d+3*u,h.s4=d-3*u;break;case 4:let o=NaN;o=n.Std.equal(t,r)?i+s+2*r:n.Std.greater(r,t)?2*i+s+r:2*s+i+r,d=o/4,h.p=d,h.r1=o/2-s,h.s1=o/2-i;break;case 5:d=(i+s+r)/3,h.p=d,h.r1=r+1.1*u/12,h.s1=r-1.1*u/12,h.r2=r+1.1*u/6,h.s2=r-1.1*u/6,h.r3=r+1.1*u/4,h.s3=r-1.1*u/4,h.r4=r+1.1*u/2,h.s4=r-1.1*u/2;break;case 6:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=d-h.s1+h.r2,h.s3=2*d-(2*i-s);break;default:throw new Error("Unknown kind")}return h.startIndex__t=a,h.endIndex__t=l,h}(u,_,m,g,f,p,c(e,p),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(d.pivots=[]),d.pivots.push(S),d.pivots.length>this._historicalPivotsToKeep&&d.pivots.shift(),v?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},81821:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},65097:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(81337);function r(e,t,i){const r={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,r=0,n=0;for(let t=0;t<e.length;++t){const o=e[t],a=t+1;i+=a,s+=o,r+=a*a,n+=o*a}t.slope=(e.length*n-i*s)/(e.length*r-i*i),t.average=s/e.length,t.intercept=t.average-t.slope*i/e.length+t.slope}(e,r),function(e,t,i,r){let n=0,o=0,a=0,l=0,c=0,h=0,d=r.intercept;const u=e.length-1,p=r.intercept+r.slope*u/2;for(let s=0;s<=u;++s){let u=t[s]-d;u>n&&(n=u),u=d-i[s],u>o&&(o=u),u=e[s];const _=u-r.average,m=d-p;u-=d,a+=u*u,l+=_*_,c+=m*m,h+=_*m,d+=r.slope}r.stdDev=Math.sqrt(a/(0===u?1:u)),r.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),r.upDev=n,r.downDev=o}(e,t,i,r)),r}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2, r.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,n.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e,t,i){if(!this._isValidResolution)return null;if(e.is_main_symbol(i))return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const s=e.new_var(n.Std.open(e)),r=e.new_var(n.Std.high(e)),a=e.new_var(n.Std.low(e)),l=e.new_var(n.Std.close(e)),h=e.new_var(n.Std.time(e)),d=this._data,u=s.get(0),p=h.get(0),_=s.get(1),m=r.get(1),g=a.get(1),f=l.get(1),v=e.symbol.isLastBar;if(0!==d.pivots.length&&e.symbol.isNewBar){const e=d.pivots[d.pivots.length-1];e.endIndex__t!==p&&(e.endIndex__t=p)}if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const S=function(e,t,i,s,r,a,l,c){const h=new o;let d=NaN;const u=i-s;switch(c){case 0:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=2*d+(i-2*s),h.s3=2*d-(2*i-s),h.r4=3*d+(i-3*s),h.s4=3*d-(3*i-s),h.r5=4*d+(i-4*s),h.s5=4*d-(4*i-s);break;case 1:d=(i+s+r)/3,h.p=d,h.r1=d+.382*u,h.s1=d-.382*u,h.r2=d+.618*u,h.s2=d-.618*u,h.r3=d+u,h.s3=d-u;break;case 2:d=(i+s+2*e)/4,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=i+2*(d-s),h.s3=s-2*(i-d),h.r4=h.r3+u,h.s4=h.s3-u;break;case 3:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=d+2*u,h.s3=d-2*u,h.r4=d+3*u,h.s4=d-3*u;break;case 4:let o=NaN;o=n.Std.equal(t,r)?i+s+2*r:n.Std.greater(r,t)?2*i+s+r:2*s+i+r,d=o/4,h.p=d,h.r1=o/2-s,h.s1=o/2-i;break;case 5:d=(i+s+r)/3,h.p=d,h.r1=r+1.1*u/12,h.s1=r-1.1*u/12,h.r2=r+1.1*u/6,h.s2=r-1.1*u/6,h.r3=r+1.1*u/4,h.s3=r-1.1*u/4,h.r4=r+1.1*u/2,h.s4=r-1.1*u/2;break;case 6:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=d-h.s1+h.r2,h.s3=2*d-(2*i-s);break;default:throw new Error("Unknown kind")}return h.startIndex__t=a,h.endIndex__t=l,h}(u,_,m,g,f,p,c(e,p),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(d.pivots=[]),d.pivots.push(S),d.pivots.length>this._historicalPivotsToKeep&&d.pivots.shift(),v?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},81821:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},65097:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(49581);function r(e,t,i){const r={
id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),o=e.new_unlimited_var(s.Std.high(e)),a=e.new_unlimited_var(s.Std.low(e)),l=e.new_unlimited_var(s.Std[i](e));if(!e.symbol.isLastBar)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),p=t(4),_=t(5),m=n.indexOf(p),g=n.indexOf(_),f=[],v=[],S=[],y=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),S.push(a.get(e)),y.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(y,v,S)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,r,n,o,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*r:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=o}}}},87302:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>r,spreadRatioDefaults:()=>n,spreadRatioInputs:()=>o,spreadRatioPlots:()=>a,spreadRatioStyles:()=>l});var s=i(81337);class r{init(e,t){e.new_sym(t(1),s.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,r=s.Std[this._source](e);e.select_sym(1);const n=s.Std[this._source](e),o=e.new_unlimited_var(n),a=e.new_unlimited_var(e.symbol.time);if(e.select_sym(0),isNaN(i))return null;let l=a.indexOf(i);-1!==l&&a.get(l)!==i&&(l=-1);const c=l<0?NaN:o.get(l);return[this._doCalculation(this._scaleFactor1,r,this._scaleFactor2,c)]}}const n={styles:{plot1:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,color:"#800080",display:15}},precision:2,inputs:{source:"close",symbol2:""}},o=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],a=[{id:"plot1",type:"line"}],l={plot1:{title:"Plot",histogramBase:0}}},39944:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{ slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,r=0,n=0;for(let t=0;t<e.length;++t){const o=e[t],a=t+1;i+=a,s+=o,r+=a*a,n+=o*a}t.slope=(e.length*n-i*s)/(e.length*r-i*i),t.average=s/e.length,t.intercept=t.average-t.slope*i/e.length+t.slope}(e,r),function(e,t,i,r){let n=0,o=0,a=0,l=0,c=0,h=0,d=r.intercept;const u=e.length-1,p=r.intercept+r.slope*u/2;for(let s=0;s<=u;++s){let u=t[s]-d;u>n&&(n=u),u=d-i[s],u>o&&(o=u),u=e[s];const _=u-r.average,m=d-p;u-=d,a+=u*u,l+=_*_,c+=m*m,h+=_*m,d+=r.slope}r.stdDev=Math.sqrt(a/(0===u?1:u)),r.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),r.upDev=n,r.downDev=o}(e,t,i,r)),r}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),o=e.new_unlimited_var(s.Std.high(e)),a=e.new_unlimited_var(s.Std.low(e)),l=e.new_unlimited_var(s.Std[i](e));if(!e.symbol.isLastBar)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),p=t(4),_=t(5),m=n.indexOf(p),g=n.indexOf(_),f=[],v=[],S=[],y=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),S.push(a.get(e)),y.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(y,v,S)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,r,n,o,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*r:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=o}}}},87302:(e,t,i)=>{
_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},56437:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(81337);class r{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},89529:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>_});var s=i(50151),r=i(37160),n=i(36274),o=i(29779);class a extends o.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t<i),this._priceLow=this._mixinJSONObject.createDoubleField(t,"priceLow"),this._priceHigh=this._mixinJSONObject.createDoubleField(i,"priceHigh"),this._rate=this._mixinJSONObject.createDoubleArrayField(r,"rate"),this._firstBarTime=this._mixinJSONObject.createTimeField(n,"firstBarTime"),this._lastBarTime=this._mixinJSONObject.createTimeField(o,"lastBarTime")}isNaN(){return super.isNaN()||Number.isNaN(this._priceLow.get())||Number.isNaN(this._priceHigh.get())||0===this._rate.get().length}jsonName(){return"hhists"}primitiveData(){return{id:this.id(),priceHigh:this._priceHigh.get(),priceLow:this._priceLow.get(),rate:this._rate.get().slice(),firstBarTime:this._firstBarTime.get(),lastBarTime:this._lastBarTime.get()}}setPriceLow(e){this._priceLow.set(e)&&this._processObjUpdate()}priceLow(){return this._priceLow.get()}priceHigh(){return this._priceHigh.get()}setPriceHigh(e){this._priceHigh.set(e)&&this._processObjUpdate()}rate(){return this._rate.get().slice()}setRate(e){this._rate.set(e)&&this._processObjUpdate()}rateAt(e){return this._rate.get()[e]}ratesSum(){let e=0;for(const t of this._rate.get())!Number.isNaN(t)&&Number.isFinite(t)&&(e+=t);return e}firstBarTime(){return this._firstBarTime.get()}setFirstBarTime(e){this._firstBarTime.set(e)&&this._processObjUpdate()}lastBarTime(){return this._lastBarTime.get()}setLastBarTime(e){this._lastBarTime.set(e)&&this._processObjUpdate()}}var l=i(31584),c=i(81337);class h{constructor(e,t,i){this.index=e,this.offset=i,this.level=t}isNaN(){return Number.isNaN(this.level)}equals(e){return e instanceof h&&(!this.isNaN()&&(!e.isNaN()&&(this.index===e.index&&this.offset===e.offset&&c.Std.equal(this.level,e.level))))}getLevel(){return this.level}getIndex(){return this.index}}class d extends o.GraphicsObj{constructor(e,t){super(e),this._points=[],t&&(this._points=t)}addPoint(e){this._processObjUpdate(),this._points.push(e)}addPoints(e){this._processObjUpdate(),this._points.push(...e)}setPoint(e,t){const i=this._points[e];t.equals(i)||(this._processObjUpdate(),this._points[e]=t)}point(e){const t=this._points[e];return new h(t.index,t.level,t.offset)}points(){return this._points}pointsCount(){ "use strict";i.d(t,{SpreadRatioBase:()=>l,spreadRatioDefaults:()=>c,spreadRatioFilledAreas:()=>_,spreadRatioInputs:()=>h,spreadRatioPalettes:()=>p,spreadRatioPlots:()=>d,spreadRatioStyles:()=>u});var s=i(33013),r=i(72877),n=i(49581),o=i(87095);const a="rgba(0, 0, 0, 0)";class l{init(e,t){e.new_sym(t(1),n.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,s=n.Std[this._source](e);e.select_sym(1);const r=n.Std[this._source](e),o=e.new_unlimited_var(r),a=e.new_unlimited_var(e.symbol.time);if(e.select_sym(0),isNaN(i))return null;let l=a.indexOf(i);-1!==l&&a.get(l)!==i&&(l=-1);const c=l<0?NaN:o.get(l),h=this._doCalculation(this._scaleFactor1,s,this._scaleFactor2,c);return[h,0,n.Std.ge(h,0),n.Std.lt(h,0)]}}const c={styles:{plot1:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:35,color:"#800080",display:15},plotBaseline:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0,color:a,display:0}},palettes:{negativePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-ripe-red-500"),.5),style:0,width:0},{color:a,style:0,width:0}]},positivePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-minty-green-500"),.5),style:0,width:0},{color:a,style:0,width:0}]}},filledAreasStyle:{negativeFill:{color:"",transparency:0,visible:!0,fillType:void 0},positiveFill:{color:"",transparency:0,visible:!0,fillType:void 0}},precision:2,inputs:{source:"close",symbol2:""}},h=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],d=[{id:"plot1",type:"line"},{id:"plotBaseline",type:"line"},{id:"plotNegativeFill",type:"colorer",target:"negativeFill",palette:"negativePalette"},{id:"plotPositiveFill",type:"colorer",target:"positiveFill",palette:"positivePalette"}],u={plot1:{title:"Plot",histogramBase:0},plotBaseline:{title:"Baseline",isHidden:!0}},p={negativePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]},positivePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]}},_=[{id:"negativeFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Negative fill",palette:"negativePalette",fillToIntersection:!0},{id:"positiveFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Positive fill",palette:"positivePalette",fillToIntersection:!0}]},39944:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,palettes:s.spreadRatioPalettes,filledAreas:s.spreadRatioFilledAreas,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},56437:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(49581);class r{
return this._points.length}setPoints(e){if(e.length===this._points.length){let t=!0;for(let i=0;i<e.length;++i)if(!e[i].equals(this._points[i])){t=!1;break}if(t)return}this._processObjUpdate(),this._points=[],this._points.push(...e)}clearPoints(){this._processObjUpdate(),this._points=[]}isNaN(){return super.isNaN()||this._points.length<3}jsonName(){return"polygons"}primitiveData(){return{id:this.id(),points:this._points.map((e=>({index:e.index,offset:e.offset,level:e.level})))}}}class u extends o.GraphicsObj{constructor(e,t,i,s,r=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(r,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}class p{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class _{constructor(e,t,i,r,n,o,a,c,h,d,u,_,m,g,f){this._freezedBoxes=new l.GraphicsList,this._freezedHists=new l.GraphicsList,this._freezedPocs=new l.GraphicsList,this._freezedVAHists=new l.GraphicsList,this._currentHistsGr=new l.GraphicsList,this._currentVAHistsGr=new l.GraphicsList,this._currentHists=[],this._currentHistsMap=new p,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e), constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},89529:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>_});var s=i(50151),r=i(37160),n=i(36274),o=i(29779);class a extends o.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t<i),this._priceLow=this._mixinJSONObject.createDoubleField(t,"priceLow"),this._priceHigh=this._mixinJSONObject.createDoubleField(i,"priceHigh"),this._rate=this._mixinJSONObject.createDoubleArrayField(r,"rate"),this._firstBarTime=this._mixinJSONObject.createTimeField(n,"firstBarTime"),this._lastBarTime=this._mixinJSONObject.createTimeField(o,"lastBarTime")}isNaN(){return super.isNaN()||Number.isNaN(this._priceLow.get())||Number.isNaN(this._priceHigh.get())||0===this._rate.get().length}jsonName(){return"hhists"}primitiveData(){return{id:this.id(),priceHigh:this._priceHigh.get(),priceLow:this._priceLow.get(),rate:this._rate.get().slice(),firstBarTime:this._firstBarTime.get(),lastBarTime:this._lastBarTime.get()}}setPriceLow(e){this._priceLow.set(e)&&this._processObjUpdate()}priceLow(){return this._priceLow.get()}priceHigh(){return this._priceHigh.get()}setPriceHigh(e){this._priceHigh.set(e)&&this._processObjUpdate()}rate(){return this._rate.get().slice()}setRate(e){this._rate.set(e)&&this._processObjUpdate()}rateAt(e){return this._rate.get()[e]}ratesSum(){let e=0;for(const t of this._rate.get())!Number.isNaN(t)&&Number.isFinite(t)&&(e+=t);return e}firstBarTime(){return this._firstBarTime.get()}setFirstBarTime(e){this._firstBarTime.set(e)&&this._processObjUpdate()}lastBarTime(){return this._lastBarTime.get()}setLastBarTime(e){this._lastBarTime.set(e)&&this._processObjUpdate()}}var l=i(31584),c=i(49581);class h{constructor(e,t,i){this.index=e,this.offset=i,this.level=t}isNaN(){return Number.isNaN(this.level)}equals(e){return e instanceof h&&(!this.isNaN()&&(!e.isNaN()&&(this.index===e.index&&this.offset===e.offset&&c.Std.equal(this.level,e.level))))}getLevel(){return this.level}getIndex(){return this.index}}class d extends o.GraphicsObj{constructor(e,t){super(e),this._points=[],t&&(this._points=t)}addPoint(e){this._processObjUpdate(),this._points.push(e)}addPoints(e){this._processObjUpdate(),this._points.push(...e)}setPoint(e,t){const i=this._points[e];t.equals(i)||(this._processObjUpdate(),this._points[e]=t)}point(e){const t=this._points[e];return new h(t.index,t.level,t.offset)}points(){return this._points}pointsCount(){return this._points.length}setPoints(e){if(e.length===this._points.length){let t=!0;for(let i=0;i<e.length;++i)if(!e[i].equals(this._points[i])){t=!1;break}if(t)return}this._processObjUpdate(),this._points=[],this._points.push(...e)}clearPoints(){this._processObjUpdate(),this._points=[]}isNaN(){return super.isNaN()||this._points.length<3}jsonName(){return"polygons"}
this._numOfSubHists=e,this._outHists=r,this._outBoxLines=n,this._outPocLines=o,this._extendPocLeftRight=a,this._outVAHists=c,this._vaVolumePercent=h,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=m,this._actualRightBoxTime=null!=f?f:m,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=c.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),c.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,c.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low, primitiveData(){return{id:this.id(),points:this._points.map((e=>({index:e.index,offset:e.offset,level:e.level})))}}}class u extends o.GraphicsObj{constructor(e,t,i,s,r=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(r,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}class p{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class _{constructor(e,t,i,r,n,o,a,c,h,d,u,_,m,g,f){this._freezedBoxes=new l.GraphicsList,this._freezedHists=new l.GraphicsList,this._freezedPocs=new l.GraphicsList,this._freezedVAHists=new l.GraphicsList,this._currentHistsGr=new l.GraphicsList,this._currentVAHistsGr=new l.GraphicsList,this._currentHists=[],this._currentHistsMap=new p,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),this._numOfSubHists=e,this._outHists=r,this._outBoxLines=n,this._outPocLines=o,this._extendPocLeftRight=a,this._outVAHists=c,this._vaVolumePercent=h,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=m,
this._needRecalc=!0),c.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)c.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):c.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const r=e[s];c.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new u(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e<this._currentHists.length;e++)if(this._currentHists[e]===this._largestHistItem)return e;return-1}_calculateValueArea(){const e=this._getPocHistItemIndex();(0,s.assert)(e>=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),r=0,n=null;for(;c.Std.lessOrEqual(i+r,t)&&(i+=r,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEnd<this._currentHists.length)if(i=this._currentHists[this._currentVAEnd].ratesSum(),c.Std.greater(t,i))r=t,n=0;else if(c.Std.greater(i,t))r=i,n=1;else{const s=Math.abs(e-this._currentVAStart),o=Math.abs(e-this._currentVAEnd);s<o?(r=t,n=0):o<=s&&(r=i,n=1)}else r=t,n=0;else r=this._currentHists[this._currentVAEnd].ratesSum(),n=1}this._currentVAStart++,this._currentVAEnd--}_isVA(e){return e.priceHigh()>this._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()<this._getMidLevel(this._currentHists[this._currentVAEnd])}_updateValueArea(){if(this._calculateValueArea(), this._actualRightBoxTime=null!=f?f:m,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=c.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),c.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,c.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),c.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,
this._needRecalc||this._previousVAStart!==this._currentVAStart||this._previousVAEnd!==this._currentVAEnd){let e=0,t=0;for(;e<this._currentHistsGr.size()&&t<this._currentVAHistsGr.size();){for(;e<this._currentHistsGr.size()&&!this._isVA(this._currentHistsGr.get(e));)e++;for(;t<this._currentVAHistsGr.size()&&this._isVA(this._currentVAHistsGr.get(t));)t++;if(e<this._currentHistsGr.size()&&t<this._currentVAHistsGr.size()){const i=this._currentHistsGr.get(e);this._currentHistsGr.set(e,this._currentVAHistsGr.get(t)),this._currentVAHistsGr.set(t,i)}}for(;e<this._currentHistsGr.size();e++){const t=this._currentHistsGr.get(e);this._isVA(t)&&(this._currentHistsGr.remove(e),e--,this._currentVAHistsGr.add(t))}for(;t<this._currentVAHistsGr.size();t++){const e=this._currentVAHistsGr.get(t);this._isVA(e)||(this._currentVAHistsGr.remove(t),t--,this._currentHistsGr.add(e))}}this._previousVAStart=this._currentVAStart,this._previousVAEnd=this._currentVAEnd}_initCurrentBox(){this._currentBox=new d(this)}_updateCurrentBox(){let e=this._minPrice,t=this._maxPrice;this._currentHists.length>0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],r=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new h(r,e)),i.push(new h(r,t)),i.push(new h(n,t)),i.push(new h(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e<this._currentHists.length;++e)this._currentHists[e].erase();this._currentHists=[],this._currentHistsGr.clear(),this._currentVAHistsGr.clear(),this._currentHistsMap.clear();for(let e=0;e<this._historyBarSet.length;e++)this._addHistoryBarToHistogram(this._historyBarSet[e],e,this._currentHists,this._currentHistsMap,1);this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc()),this._updateCurrentBox()}_applyUpdateToCurrentResults(e,t){t&&null!==this._prevRtBar&&this._addHistoryBarToHistogram(this._prevRtBar,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,-1),this._addHistoryBarToHistogram(e,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,1),this._updateLastBarTimeInHistogram(this._currentHists)}_addHistoryBarToHistogram(e,t,i,r,n){(0,s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");const o=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,h=e.isUp,d=(0,s.ensureNotNull)(this._rowsLayout);d.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,o,a);const u=d.rowWidth();if(!c.Std.greater(u,0))return;d.calculate();const p=d.getIndexLowVbP(),_=d.getIndexHighVbP(),m=d.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*l,h,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,c=(t+1)*u+m,d=this._rowCoeff(s,c,o,a),p=d*l;e+=d,this._updateResult({start:s,end:c},n*p,h,i,r)}(0,s.assert)(c.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,r,n){const o=this._createRates(i,t);(0, s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)c.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):c.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const r=e[s];c.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new u(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e<this._currentHists.length;e++)if(this._currentHists[e]===this._largestHistItem)return e;return-1}_calculateValueArea(){const e=this._getPocHistItemIndex();(0,s.assert)(e>=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),r=0,n=null;for(;c.Std.lessOrEqual(i+r,t)&&(i+=r,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEnd<this._currentHists.length)if(i=this._currentHists[this._currentVAEnd].ratesSum(),c.Std.greater(t,i))r=t,n=0;else if(c.Std.greater(i,t))r=i,n=1;else{const s=Math.abs(e-this._currentVAStart),o=Math.abs(e-this._currentVAEnd);s<o?(r=t,n=0):o<=s&&(r=i,n=1)}else r=t,n=0;else r=this._currentHists[this._currentVAEnd].ratesSum(),n=1}this._currentVAStart++,this._currentVAEnd--}_isVA(e){return e.priceHigh()>this._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()<this._getMidLevel(this._currentHists[this._currentVAEnd])}_updateValueArea(){if(this._calculateValueArea(),this._needRecalc||this._previousVAStart!==this._currentVAStart||this._previousVAEnd!==this._currentVAEnd){let e=0,t=0;for(;e<this._currentHistsGr.size()&&t<this._currentVAHistsGr.size();){for(;e<this._currentHistsGr.size()&&!this._isVA(this._currentHistsGr.get(e));)e++;for(;t<this._currentVAHistsGr.size()&&this._isVA(this._currentVAHistsGr.get(t));)t++
s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),h=(0,s.ensureNotNull)(this._actualRightBoxTime);let d=n.get(e);if(void 0===d)d=new a(this,e.start,e.end,o,l,h),n.set(e,d),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(d),_._addInOrder(d,r,0,r.length,((e,t)=>{let i=c.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=c.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:c.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t<o.length;t++)e[t]=d.rateAt(t)+o[t];d.setRate(e)}}_rebuildOutData(){const e=this._currentHistsMap.size(),t=this._currentHists.length,i=this._currentHistsGr.size(),r=this._currentVAHistsGr.size();(0,s.assert)(e===t&&t===i+r,`Collections of HHistItems are out of sync ${e} ${t} ${i} ${r}`),this._outPocLines.clear(),this._outPocLines.addAll(this._freezedPocs),c.Std.greater(this._getVolume(this._currentHists),0)?(this._outHists.setVariable(this._currentHistsGr),this._outPocLines.add((0,s.ensureNotNull)(this._currentPoc)),this._outVAHists.setVariable(this._currentVAHistsGr)):(this._outHists.setVariable(null),this._outVAHists.setVariable(null)),this._outBoxLines.clear(),this._outBoxLines.addAll(this._freezedBoxes),this._outBoxLines.add((0,s.ensureNotNull)(this._currentBox))}_verifyHistogramSizeIsNotTooLarge(e){if(this._layoutIsAutoselected)return;if(e<=this._maxHHistItems)return;const t=(0,s.ensureNotNull)(this._rowsLayout);0===t.type()?c.Std.error('Histogram is too large, please reduce "Row Size" input.'):((0,s.assert)(1===t.type(),`Unexpected rowsLayout type ${t.type()}`),c.Std.error('Histogram is too large, please increase "Row Size" input.'))}_createRates(e,t){if(1===this._numOfSubHists)return[t];if(2===this._numOfSubHists){const i=[0,0];return i[e?0:1]=t,i}return(0,s.assert)(!1,`Incorrect value of numOfSubHists = ${this._numOfSubHists}`),[]}_updateLastBarTimeInHistogram(e){const t=(0,s.ensureNotNull)(this._actualRightBoxTime);for(const i of e)i.setLastBarTime(t)}_rowCoeff(e,t,i,s){const r=s-i;return(t-e-Math.max(t-s,0)-Math.max(0,i-e))/r}static _addInOrder(e,t,i,s,n){if(i===s)return void t.splice(i,0,e);const o=(0,r.toInt)((i+s)/2),a=t[o];n(e,a)<0?_._addInOrder(e,t,i,o,n):n(e,a)>0?_._addInOrder(e,t,o+1,s,n):t.splice(o,0,e)}}},19762:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>u,maxHHistItems:()=>h,numOfSubHists:()=>d});var s=i(74649),r=i(36274);class n{constructor(e,t){this._minTick=NaN,this._minPrice=NaN,this._maxPrice=NaN,this._low=NaN,this._high=NaN,this._startPrice=NaN,this._indexLowVbP=NaN,this._indexHighVbP=NaN,this._rowSize=e,this._type=t}init(e,t,i,s,r){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=r}getStartPrice(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){ ;if(e<this._currentHistsGr.size()&&t<this._currentVAHistsGr.size()){const i=this._currentHistsGr.get(e);this._currentHistsGr.set(e,this._currentVAHistsGr.get(t)),this._currentVAHistsGr.set(t,i)}}for(;e<this._currentHistsGr.size();e++){const t=this._currentHistsGr.get(e);this._isVA(t)&&(this._currentHistsGr.remove(e),e--,this._currentVAHistsGr.add(t))}for(;t<this._currentVAHistsGr.size();t++){const e=this._currentVAHistsGr.get(t);this._isVA(e)||(this._currentVAHistsGr.remove(t),t--,this._currentHistsGr.add(e))}}this._previousVAStart=this._currentVAStart,this._previousVAEnd=this._currentVAEnd}_initCurrentBox(){this._currentBox=new d(this)}_updateCurrentBox(){let e=this._minPrice,t=this._maxPrice;this._currentHists.length>0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],r=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new h(r,e)),i.push(new h(r,t)),i.push(new h(n,t)),i.push(new h(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e<this._currentHists.length;++e)this._currentHists[e].erase();this._currentHists=[],this._currentHistsGr.clear(),this._currentVAHistsGr.clear(),this._currentHistsMap.clear();for(let e=0;e<this._historyBarSet.length;e++)this._addHistoryBarToHistogram(this._historyBarSet[e],e,this._currentHists,this._currentHistsMap,1);this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc()),this._updateCurrentBox()}_applyUpdateToCurrentResults(e,t){t&&null!==this._prevRtBar&&this._addHistoryBarToHistogram(this._prevRtBar,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,-1),this._addHistoryBarToHistogram(e,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,1),this._updateLastBarTimeInHistogram(this._currentHists)}_addHistoryBarToHistogram(e,t,i,r,n){(0,s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");const o=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,h=e.isUp,d=(0,s.ensureNotNull)(this._rowsLayout);d.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,o,a);const u=d.rowWidth();if(!c.Std.greater(u,0))return;d.calculate();const p=d.getIndexLowVbP(),_=d.getIndexHighVbP(),m=d.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*l,h,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,c=(t+1)*u+m,d=this._rowCoeff(s,c,o,a),p=d*l;e+=d,this._updateResult({start:s,end:c},n*p,h,i,r)}(0,s.assert)(c.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,r,n){const o=this._createRates(i,t);(0,s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),h=(0,s.ensureNotNull)(this._actualRightBoxTime);let d=n.get(e);if(void 0===d)d=new a(this,e.start,e.end,o,l,h),n.set(e,d),this._verifyHistogramSizeIsNotTooLarge(n.size()),
return this._type}}class o extends n{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class a extends n{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var l=i(14483),c=i(81337);function h(){return 6e3}function d(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:c.Std.error(`Invalid study argument value: ${e}`)}}class u{findBasicResolutionForFromTo(e,t,i,n){const o=(0,s.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return l.enabled("charting_library_debug_mode")&&console.log(`Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&c.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new o(t):new a(t)}}},82597:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(50151),r=i(19762),n=i(72877),o=i(90164),a=i(36274),l=i(79999),c=i(748),h=i(43945),d=i(31584),u=i(1386),p=i(56437),_=i(95586),m=i(89529);class g extends m.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(e,t,i,n,o,a,!1,l,c,(()=>h),d,s,r,!1,u),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t<this._lastBarTime}}var f=i(19999),v=i(81337);class S extends r.VolumeProfileBase{constructor(){super(...arguments),this._rowsLayout="Number Of Rows",this._rowSize=24,this._volume="Up/Down",this._firstBarTime=0,this._lastBarTime=0,this._vaVolumePercent=70,this._anInt=0,this._eraseCmds=[]}nextGraphicsObjId(){return++this._anInt}pushEraseObjCmd(e,t){this._eraseCmds.push(new h.EraseObj(e,t))}popEraseCmds(){const e=this._eraseCmds;return this._eraseCmds=[],e}init(e,t){this._studyDataUpdate=new u.JStudyDataUpdate(!0),this._hists=new l.GraphicsListColl,this._boxPolygons=new d.GraphicsList,this._pocLines=new d.GraphicsList,this._valueAreaHists=new l.GraphicsListColl;const i=new c.StudyGraphicsData;i.getObjsContainer("hhists").push(new c.Container("histBars2",this._hists)),i.getObjsContainer("hhists").push(new c.Container("histBarsVA",this._valueAreaHists)),i.getObjsContainer("horizlines").push(new c.Container("pocLines",this._pocLines)),i.getObjsContainer("polygons").push(new c.Container("histBoxBg",this._boxPolygons)),this._studyDataUpdate.init(i),this._rowsLayout=t(0),this._rowSize=t(1), this._currentHistsGr.add(d),_._addInOrder(d,r,0,r.length,((e,t)=>{let i=c.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=c.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:c.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t<o.length;t++)e[t]=d.rateAt(t)+o[t];d.setRate(e)}}_rebuildOutData(){const e=this._currentHistsMap.size(),t=this._currentHists.length,i=this._currentHistsGr.size(),r=this._currentVAHistsGr.size();(0,s.assert)(e===t&&t===i+r,`Collections of HHistItems are out of sync ${e} ${t} ${i} ${r}`),this._outPocLines.clear(),this._outPocLines.addAll(this._freezedPocs),c.Std.greater(this._getVolume(this._currentHists),0)?(this._outHists.setVariable(this._currentHistsGr),this._outPocLines.add((0,s.ensureNotNull)(this._currentPoc)),this._outVAHists.setVariable(this._currentVAHistsGr)):(this._outHists.setVariable(null),this._outVAHists.setVariable(null)),this._outBoxLines.clear(),this._outBoxLines.addAll(this._freezedBoxes),this._outBoxLines.add((0,s.ensureNotNull)(this._currentBox))}_verifyHistogramSizeIsNotTooLarge(e){if(this._layoutIsAutoselected)return;if(e<=this._maxHHistItems)return;const t=(0,s.ensureNotNull)(this._rowsLayout);0===t.type()?c.Std.error('Histogram is too large, please reduce "Row Size" input.'):((0,s.assert)(1===t.type(),`Unexpected rowsLayout type ${t.type()}`),c.Std.error('Histogram is too large, please increase "Row Size" input.'))}_createRates(e,t){if(1===this._numOfSubHists)return[t];if(2===this._numOfSubHists){const i=[0,0];return i[e?0:1]=t,i}return(0,s.assert)(!1,`Incorrect value of numOfSubHists = ${this._numOfSubHists}`),[]}_updateLastBarTimeInHistogram(e){const t=(0,s.ensureNotNull)(this._actualRightBoxTime);for(const i of e)i.setLastBarTime(t)}_rowCoeff(e,t,i,s){const r=s-i;return(t-e-Math.max(t-s,0)-Math.max(0,i-e))/r}static _addInOrder(e,t,i,s,n){if(i===s)return void t.splice(i,0,e);const o=(0,r.toInt)((i+s)/2),a=t[o];n(e,a)<0?_._addInOrder(e,t,i,o,n):n(e,a)>0?_._addInOrder(e,t,o+1,s,n):t.splice(o,0,e)}}},19762:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>u,maxHHistItems:()=>h,numOfSubHists:()=>d});var s=i(74649),r=i(36274);class n{constructor(e,t){this._minTick=NaN,this._minPrice=NaN,this._maxPrice=NaN,this._low=NaN,this._high=NaN,this._startPrice=NaN,this._indexLowVbP=NaN,this._indexHighVbP=NaN,this._rowSize=e,this._type=t}init(e,t,i,s,r){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=r}getStartPrice(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){return this._type}}class o extends n{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){
this._volume=t(2),this._firstBarTime=t(3),this._lastBarTime=t(4),this._vaVolumePercent=t(5),this.verifyRowSizeInput(this._rowSize,this._rowsLayout),this._originalResolution=a.Interval.parse(e.symbol.interval+e.symbol.resolution);const n=this._lastBarTime+this._originalResolution.inMilliseconds(this._lastBarTime);0===this._firstBarTime&&0===this._lastBarTime?this._basicResolution=this._originalResolution:this._basicResolution=this.findBasicResolutionForFromTo(this._originalResolution,this._firstBarTime,n,(0,s.ensureDefined)(e.symbol.info)),this._hasSecondarySymbol=!this._originalResolution.isEqualTo(this._basicResolution),this._hasSecondarySymbol&&e.new_sym(e.symbol.tickerid,this._basicResolution.value());const o=this._getRowsLayout(this._rowsLayout,this._rowSize);this._vbPCheckHaveVolumeExpr=new p.VbPCheckHaveVolumeExpr(this),this._volumeByPriceExpr=new g((0,r.numOfSubHists)(this._volume),e,this,this._firstBarTime,n,this._hists,this._boxPolygons,this._pocLines,this._valueAreaHists,this._vaVolumePercent,o,(0,r.maxHHistItems)(),this._lastBarTime),this._volumeByPriceExpr.setIdsGeneratorProxy(this),this._developingPocSeries=new f.VolumeProfileOutputSeries,this._developingVAHighSeries=new f.VolumeProfileOutputSeries,this._developingVALowSeries=new f.VolumeProfileOutputSeries}main(e,t,i){this._hasSecondarySymbol&&e.select_sym(1),this._timeSeries=e.new_unlimited_var(),this._openSeries=e.new_unlimited_var(),this._highSeries=e.new_unlimited_var(),this._lowSeries=e.new_unlimited_var(),this._closeSeries=e.new_unlimited_var(),this._volumeSeries=e.new_unlimited_var();const r={type:"composite",data:[]};if(i&&i.period===this._basicResolution.value()&&(this._timeSeries.set(v.Std.time(e)),this._openSeries.set(v.Std.open(e)),this._highSeries.set(v.Std.high(e)),this._lowSeries.set(v.Std.low(e)),this._closeSeries.set(v.Std.close(e)),this._volumeSeries.set(v.Std.volume(e)),this._developingPocSeries.addHist(v.Std.time(e)),this._developingVAHighSeries.addHist(v.Std.time(e)),this._developingVALowSeries.addHist(v.Std.time(e)),this._vbPCheckHaveVolumeExpr.update(0,e.symbol.isLastBar),this._volumeByPriceExpr.update(0),this._developingPocSeries.removeLastIfNaN(),this._developingVAHighSeries.removeLastIfNaN(),this._developingVALowSeries.removeLastIfNaN(),e.symbol.isLastBar)){this._studyDataUpdate.setEraseCmds(this.popEraseCmds()),this._studyDataUpdate.update();const e=this._studyDataUpdate.getUpdate();e.json&&r.data.push({nonseries:!0,type:"study_graphics",data:e.json}),e.jsonUpdate&&r.data.push({nonseries:!0,type:"study_graphics",data:e.jsonUpdate})}if(this._hasSecondarySymbol&&e.select_sym(0),i&&i.period===this._originalResolution.value()){(0,s.assert)(e.symbol.time===i.time);const t=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(t&&t>=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){ return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class a extends n{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var l=i(14483),c=i(49581);function h(){return 6e3}function d(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:c.Std.error(`Invalid study argument value: ${e}`)}}class u{findBasicResolutionForFromTo(e,t,i,n){const o=(0,s.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return l.enabled("charting_library_debug_mode")&&console.log(`Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&c.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new o(t):new a(t)}}},82597:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(50151),r=i(19762),n=i(72877),o=i(90164),a=i(36274),l=i(79999),c=i(748),h=i(43945),d=i(31584),u=i(1386),p=i(56437),_=i(95586),m=i(89529);class g extends m.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(e,t,i,n,o,a,!1,l,c,(()=>h),d,s,r,!1,u),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t<this._lastBarTime}}var f=i(19999),v=i(49581);class S extends r.VolumeProfileBase{constructor(){super(...arguments),this._rowsLayout="Number Of Rows",this._rowSize=24,this._volume="Up/Down",this._firstBarTime=0,this._lastBarTime=0,this._vaVolumePercent=70,this._anInt=0,this._eraseCmds=[]}nextGraphicsObjId(){return++this._anInt}pushEraseObjCmd(e,t){this._eraseCmds.push(new h.EraseObj(e,t))}popEraseCmds(){const e=this._eraseCmds;return this._eraseCmds=[],e}init(e,t){this._studyDataUpdate=new u.JStudyDataUpdate(!0),this._hists=new l.GraphicsListColl,this._boxPolygons=new d.GraphicsList,this._pocLines=new d.GraphicsList,this._valueAreaHists=new l.GraphicsListColl;const i=new c.StudyGraphicsData;i.getObjsContainer("hhists").push(new c.Container("histBars2",this._hists)),i.getObjsContainer("hhists").push(new c.Container("histBarsVA",this._valueAreaHists)),i.getObjsContainer("horizlines").push(new c.Container("pocLines",this._pocLines)),i.getObjsContainer("polygons").push(new c.Container("histBoxBg",this._boxPolygons)),this._studyDataUpdate.init(i),this._rowsLayout=t(0),this._rowSize=t(1),this._volume=t(2),this._firstBarTime=t(3),this._lastBarTime=t(4),this._vaVolumePercent=t(5),this.verifyRowSizeInput(this._rowSize,this._rowsLayout),this._originalResolution=a.Interval.parse(e.symbol.interval+e.symbol.resolution);const n=this._lastBarTime+this._originalResolution.inMilliseconds(this._lastBarTime)
return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function y(e){return{constructor:S,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:_.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"#37a6ef",transparency:94}}},inputs:{first_bar_time:0,last_bar_time:0,rows:24,rowsLayout:"Number Of Rows",subscribeRealtime:!0,vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:o.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:o.HHistLocation.Absolute,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}},polygons:{histBoxBg:{mouseTouchable:!1,name:"Histogram Box",showBorder:!1}}},inputs:[{defval:"Number Of Rows",id:"rowsLayout",name:"Rows Layout",options:["Number Of Rows","Ticks Per Row"],type:"text"},{defval:24,id:"rows",max:1e6,min:1,name:"Row Size",type:"integer"},{defval:"Up/Down",id:"volume",name:"Volume",options:["Up/Down","Total","Delta"],type:"text"},{defval:0,id:"first_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"First Bar Time",type:"time"},{defval:0,id:"last_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last Bar Time",type:"time"},{defval:70,id:"vaVolume",max:100,min:0,name:"Value Area Volume",type:"integer"},{defval:!0,id:"subscribeRealtime",isHidden:!0,name:"SubscribeRealtime",type:"bool"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}},...e}}}const b=y({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=y({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},19999:(e,t,i)=>{"use strict";i.d(t,{ ;0===this._firstBarTime&&0===this._lastBarTime?this._basicResolution=this._originalResolution:this._basicResolution=this.findBasicResolutionForFromTo(this._originalResolution,this._firstBarTime,n,(0,s.ensureDefined)(e.symbol.info)),this._hasSecondarySymbol=!this._originalResolution.isEqualTo(this._basicResolution),this._hasSecondarySymbol&&e.new_sym(e.symbol.tickerid,this._basicResolution.value());const o=this._getRowsLayout(this._rowsLayout,this._rowSize);this._vbPCheckHaveVolumeExpr=new p.VbPCheckHaveVolumeExpr(this),this._volumeByPriceExpr=new g((0,r.numOfSubHists)(this._volume),e,this,this._firstBarTime,n,this._hists,this._boxPolygons,this._pocLines,this._valueAreaHists,this._vaVolumePercent,o,(0,r.maxHHistItems)(),this._lastBarTime),this._volumeByPriceExpr.setIdsGeneratorProxy(this),this._developingPocSeries=new f.VolumeProfileOutputSeries,this._developingVAHighSeries=new f.VolumeProfileOutputSeries,this._developingVALowSeries=new f.VolumeProfileOutputSeries}main(e,t,i){this._hasSecondarySymbol&&e.select_sym(1),this._timeSeries=e.new_unlimited_var(),this._openSeries=e.new_unlimited_var(),this._highSeries=e.new_unlimited_var(),this._lowSeries=e.new_unlimited_var(),this._closeSeries=e.new_unlimited_var(),this._volumeSeries=e.new_unlimited_var();const r={type:"composite",data:[]};if(i&&i.period===this._basicResolution.value()&&(this._timeSeries.set(v.Std.time(e)),this._openSeries.set(v.Std.open(e)),this._highSeries.set(v.Std.high(e)),this._lowSeries.set(v.Std.low(e)),this._closeSeries.set(v.Std.close(e)),this._volumeSeries.set(v.Std.volume(e)),this._developingPocSeries.addHist(v.Std.time(e)),this._developingVAHighSeries.addHist(v.Std.time(e)),this._developingVALowSeries.addHist(v.Std.time(e)),this._vbPCheckHaveVolumeExpr.update(0,e.symbol.isLastBar),this._volumeByPriceExpr.update(0),this._developingPocSeries.removeLastIfNaN(),this._developingVAHighSeries.removeLastIfNaN(),this._developingVALowSeries.removeLastIfNaN(),e.symbol.isLastBar)){this._studyDataUpdate.setEraseCmds(this.popEraseCmds()),this._studyDataUpdate.update();const e=this._studyDataUpdate.getUpdate();e.json&&r.data.push({nonseries:!0,type:"study_graphics",data:e.json}),e.jsonUpdate&&r.data.push({nonseries:!0,type:"study_graphics",data:e.jsonUpdate})}if(this._hasSecondarySymbol&&e.select_sym(0),i&&i.period===this._originalResolution.value()){(0,s.assert)(e.symbol.time===i.time);const t=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(t&&t>=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function y(e){return{constructor:S,
VolumeProfileOutputSeries:()=>n});var s=i(50151),r=i(78071);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,r.upperbound)(this._times,e,((e,t)=>e<t),0,this._histPos+1);return 0===t?NaN:this._hist[t-1]}set(e){this._hist[this._histPos]=e}indexOf(e){throw new Error("Not implemented")}adopt(e,t,i){throw new Error("Method not implemented.")}}},72365:(e,t,i)=>{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(50151),r=i(19762),n=i(90164),o=i(36274),a=i(79999),l=i(89529),c=i(31584);class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,h,d){super(e,t,i,n,new c.GraphicsList,o,!0,a,l,(()=>h),d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t<this._lastBarTime}}var d=i(748),u=i(43945),p=i(1386),_=i(56437),m=i(19999),g=i(81337);class f extends r.VolumeProfileBase{constructor(){super(...arguments),this._rowsLayout="Number Of Rows",this._rowSize=24,this._volume="Up/Down",this._firstBarTime=0,this._lastBarTime=0,this._vaVolumePercent=70,this._anInt=0,this._eraseCmds=[]}nextGraphicsObjId(){return++this._anInt}pushEraseObjCmd(e,t){this._eraseCmds.push(new u.EraseObj(e,t))}popEraseCmds(){const e=this._eraseCmds;return this._eraseCmds=[],e}init(e,t){this._studyDataUpdate=new p.JStudyDataUpdate(!0),this._hists=new a.GraphicsListColl,this._pocLines=new c.GraphicsList,this._valueAreaHists=new a.GraphicsListColl;const i=new d.StudyGraphicsData;i.getObjsContainer("hhists").push(new d.Container("histBars2",this._hists)),i.getObjsContainer("hhists").push(new d.Container("histBarsVA",this._valueAreaHists)),i.getObjsContainer("horizlines").push(new d.Container("pocLines",this._pocLines)),this._studyDataUpdate.init(i),this._rowsLayout=t(0),this._rowSize=t(1),this._volume=t(2),this._firstBarTime=t(3),this._lastBarTime=t(4),this._vaVolumePercent=t(5),this.verifyRowSizeInput(this._rowSize,this._rowsLayout),this._originalResolution=o.Interval.parse(e.symbol.interval+e.symbol.resolution);const n=this._lastBarTime+this._originalResolution.inMilliseconds(this._lastBarTime);0===this._firstBarTime&&0===this._lastBarTime?this._basicResolution=this._originalResolution:this._basicResolution=this.findBasicResolutionForFromTo(this._originalResolution,this._firstBarTime,n,(0,s.ensureDefined)(e.symbol.info)), name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:_.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"#37a6ef",transparency:94}}},inputs:{first_bar_time:0,last_bar_time:0,rows:24,rowsLayout:"Number Of Rows",subscribeRealtime:!0,vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:o.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:o.HHistLocation.Absolute,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}},polygons:{histBoxBg:{mouseTouchable:!1,name:"Histogram Box",showBorder:!1}}},inputs:[{defval:"Number Of Rows",id:"rowsLayout",name:"Rows Layout",options:["Number Of Rows","Ticks Per Row"],type:"text"},{defval:24,id:"rows",max:1e6,min:1,name:"Row Size",type:"integer"},{defval:"Up/Down",id:"volume",name:"Volume",options:["Up/Down","Total","Delta"],type:"text"},{defval:0,id:"first_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"First Bar Time",type:"time"},{defval:0,id:"last_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last Bar Time",type:"time"},{defval:70,id:"vaVolume",max:100,min:0,name:"Value Area Volume",type:"integer"},{defval:!0,id:"subscribeRealtime",isHidden:!0,name:"SubscribeRealtime",type:"bool"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}},...e}}}const b=y({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=y({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},19999:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});var s=i(50151),r=i(78071);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1
this._hasSecondarySymbol=!this._originalResolution.isEqualTo(this._basicResolution),this._hasSecondarySymbol&&e.new_sym(e.symbol.tickerid,this._basicResolution.value());const l=this._getRowsLayout(this._rowsLayout,this._rowSize);this._vbPCheckHaveVolumeExpr=new _.VbPCheckHaveVolumeExpr(this),this._volumeByPriceExpr=new h((0,r.numOfSubHists)(this._volume),e,this,this._firstBarTime,n,this._hists,this._pocLines,this._valueAreaHists,this._vaVolumePercent,l,(0,r.maxHHistItems)()),this._volumeByPriceExpr.setIdsGeneratorProxy(this),this._developingPocSeries=new m.VolumeProfileOutputSeries,this._developingVAHighSeries=new m.VolumeProfileOutputSeries,this._developingVALowSeries=new m.VolumeProfileOutputSeries}main(e,t,i){this._hasSecondarySymbol&&e.select_sym(1),this._timeSeries=e.new_unlimited_var(),this._openSeries=e.new_unlimited_var(),this._highSeries=e.new_unlimited_var(),this._lowSeries=e.new_unlimited_var(),this._closeSeries=e.new_unlimited_var(),this._volumeSeries=e.new_unlimited_var();const r={type:"composite",data:[]};if(i&&i.period===this._basicResolution.value()&&(this._timeSeries.set(g.Std.time(e)),this._openSeries.set(g.Std.open(e)),this._highSeries.set(g.Std.high(e)),this._lowSeries.set(g.Std.low(e)),this._closeSeries.set(g.Std.close(e)),this._volumeSeries.set(g.Std.volume(e)),this._developingPocSeries.addHist(g.Std.time(e)),this._developingVAHighSeries.addHist(g.Std.time(e)),this._developingVALowSeries.addHist(g.Std.time(e)),this._vbPCheckHaveVolumeExpr.update(0,e.symbol.isLastBar),this._volumeByPriceExpr.update(0),this._developingPocSeries.removeLastIfNaN(),this._developingVAHighSeries.removeLastIfNaN(),this._developingVALowSeries.removeLastIfNaN(),e.symbol.isLastBar)){this._studyDataUpdate.setEraseCmds(this.popEraseCmds()),this._studyDataUpdate.update();const e=this._studyDataUpdate.getUpdate();e.json&&r.data.push({nonseries:!0,type:"study_graphics",data:e.json}),e.jsonUpdate&&r.data.push({nonseries:!0,type:"study_graphics",data:e.jsonUpdate})}if(this._hasSecondarySymbol&&e.select_sym(0),i&&i.period===this._originalResolution.value()){(0,s.assert)(e.symbol.time===i.time);const t=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(t&&t>=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const v={constructor:f,name:"Volume Profile Visible Range",metainfo:{_metainfoVersion:51,id:"VbPVisible@tv-basicstudies-49",description:"Volume Profile Visible Range",shortDescription:"VPVR",format:{type:"volume"},is_price_study:!0,linkedToSeries:!0,palettes:{},inputs:[{id:"rowsLayout", }else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,r.upperbound)(this._times,e,((e,t)=>e<t),0,this._histPos+1);return 0===t?NaN:this._hist[t-1]}set(e){this._hist[this._histPos]=e}indexOf(e){throw new Error("Not implemented")}adopt(e,t,i){throw new Error("Method not implemented.")}}},72365:(e,t,i)=>{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(50151),r=i(19762),n=i(90164),o=i(36274),a=i(79999),l=i(89529),c=i(31584);class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,h,d){super(e,t,i,n,new c.GraphicsList,o,!0,a,l,(()=>h),d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t<this._lastBarTime}}var d=i(748),u=i(43945),p=i(1386),_=i(56437),m=i(19999),g=i(49581);class f extends r.VolumeProfileBase{constructor(){super(...arguments),this._rowsLayout="Number Of Rows",this._rowSize=24,this._volume="Up/Down",this._firstBarTime=0,this._lastBarTime=0,this._vaVolumePercent=70,this._anInt=0,this._eraseCmds=[]}nextGraphicsObjId(){return++this._anInt}pushEraseObjCmd(e,t){this._eraseCmds.push(new u.EraseObj(e,t))}popEraseCmds(){const e=this._eraseCmds;return this._eraseCmds=[],e}init(e,t){this._studyDataUpdate=new p.JStudyDataUpdate(!0),this._hists=new a.GraphicsListColl,this._pocLines=new c.GraphicsList,this._valueAreaHists=new a.GraphicsListColl;const i=new d.StudyGraphicsData;i.getObjsContainer("hhists").push(new d.Container("histBars2",this._hists)),i.getObjsContainer("hhists").push(new d.Container("histBarsVA",this._valueAreaHists)),i.getObjsContainer("horizlines").push(new d.Container("pocLines",this._pocLines)),this._studyDataUpdate.init(i),this._rowsLayout=t(0),this._rowSize=t(1),this._volume=t(2),this._firstBarTime=t(3),this._lastBarTime=t(4),this._vaVolumePercent=t(5),this.verifyRowSizeInput(this._rowSize,this._rowsLayout),this._originalResolution=o.Interval.parse(e.symbol.interval+e.symbol.resolution);const n=this._lastBarTime+this._originalResolution.inMilliseconds(this._lastBarTime);0===this._firstBarTime&&0===this._lastBarTime?this._basicResolution=this._originalResolution:this._basicResolution=this.findBasicResolutionForFromTo(this._originalResolution,this._firstBarTime,n,(0,s.ensureDefined)(e.symbol.info)),this._hasSecondarySymbol=!this._originalResolution.isEqualTo(this._basicResolution),this._hasSecondarySymbol&&e.new_sym(e.symbol.tickerid,this._basicResolution.value());const l=this._getRowsLayout(this._rowsLayout,this._rowSize);this._vbPCheckHaveVolumeExpr=new _.VbPCheckHaveVolumeExpr(this),this._volumeByPriceExpr=new h((0,
name:"Rows Layout",defval:"Number Of Rows",options:["Number Of Rows","Ticks Per Row"],type:"text"},{id:"rows",name:"Row Size",defval:24,max:1e6,min:1,type:"integer"},{id:"volume",name:"Volume",defval:"Up/Down",options:["Up/Down","Total","Delta"],type:"text"},{id:"first_visible_bar_time",name:"First Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"last_visible_bar_time",name:"Last Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"vaVolume",name:"Value Area Volume",defval:70,max:100,min:0,type:"integer"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],graphics:{hhists:{histBars2:{location:n.HHistLocation.Relative,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:n.HHistLocation.Relative,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}}},defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:0,visible:!0,width:2}}},inputs:{first_visible_bar_time:0,last_visible_bar_time:0,rows:24,rowsLayout:"Number Of Rows",vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0}}},styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}}}}},43945:(e,t,i)=>{"use strict";i.d(t,{EraseAll:()=>r,EraseObj:()=>s,GraphicsCmds:()=>n});class s{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class r{primitiveData(){return{action:"all"}}}class n{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},79999:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{constructor(){this._stable=[],this._variable=null,this._owner=null} r.numOfSubHists)(this._volume),e,this,this._firstBarTime,n,this._hists,this._pocLines,this._valueAreaHists,this._vaVolumePercent,l,(0,r.maxHHistItems)()),this._volumeByPriceExpr.setIdsGeneratorProxy(this),this._developingPocSeries=new m.VolumeProfileOutputSeries,this._developingVAHighSeries=new m.VolumeProfileOutputSeries,this._developingVALowSeries=new m.VolumeProfileOutputSeries}main(e,t,i){this._hasSecondarySymbol&&e.select_sym(1),this._timeSeries=e.new_unlimited_var(),this._openSeries=e.new_unlimited_var(),this._highSeries=e.new_unlimited_var(),this._lowSeries=e.new_unlimited_var(),this._closeSeries=e.new_unlimited_var(),this._volumeSeries=e.new_unlimited_var();const r={type:"composite",data:[]};if(i&&i.period===this._basicResolution.value()&&(this._timeSeries.set(g.Std.time(e)),this._openSeries.set(g.Std.open(e)),this._highSeries.set(g.Std.high(e)),this._lowSeries.set(g.Std.low(e)),this._closeSeries.set(g.Std.close(e)),this._volumeSeries.set(g.Std.volume(e)),this._developingPocSeries.addHist(g.Std.time(e)),this._developingVAHighSeries.addHist(g.Std.time(e)),this._developingVALowSeries.addHist(g.Std.time(e)),this._vbPCheckHaveVolumeExpr.update(0,e.symbol.isLastBar),this._volumeByPriceExpr.update(0),this._developingPocSeries.removeLastIfNaN(),this._developingVAHighSeries.removeLastIfNaN(),this._developingVALowSeries.removeLastIfNaN(),e.symbol.isLastBar)){this._studyDataUpdate.setEraseCmds(this.popEraseCmds()),this._studyDataUpdate.update();const e=this._studyDataUpdate.getUpdate();e.json&&r.data.push({nonseries:!0,type:"study_graphics",data:e.json}),e.jsonUpdate&&r.data.push({nonseries:!0,type:"study_graphics",data:e.jsonUpdate})}if(this._hasSecondarySymbol&&e.select_sym(0),i&&i.period===this._originalResolution.value()){(0,s.assert)(e.symbol.time===i.time);const t=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(t&&t>=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const v={constructor:f,name:"Volume Profile Visible Range",metainfo:{_metainfoVersion:51,id:"VbPVisible@tv-basicstudies-49",description:"Volume Profile Visible Range",shortDescription:"VPVR",format:{type:"volume"},is_price_study:!0,linkedToSeries:!0,palettes:{},inputs:[{id:"rowsLayout",name:"Rows Layout",defval:"Number Of Rows",options:["Number Of Rows","Ticks Per Row"],type:"text"},{id:"rows",name:"Row Size",defval:24,max:1e6,min:1,type:"integer"},{id:"volume",name:"Volume",defval:"Up/Down",options:["Up/Down","Total","Delta"],type:"text"},{id:"first_visible_bar_time",name:"First Visible Bar Time",defval:0,isHidden:!0,
addStable(e){e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},31584:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(29779),r=i(76958);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);return this._setCachedDataValid(!1),true}addAll(e){this.setOwner(e),this._items.push(...e._items);return this._setCachedDataValid(!1),true}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);return this._setCachedDataValid(!1),true}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,r.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},29779:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(81337);class r{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class o extends r{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new r(e,t,this)}createDoubleField(e,t){return new r(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new o(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let r=0;r<i;r++){const i=e[r],n=t[r];if(!s.Std.equal(i,n))return!0}return!1}))}createTimeField(e,t){return new n(e,t,this)} max:253370764800,min:-253370764800,type:"time"},{id:"last_visible_bar_time",name:"Last Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"vaVolume",name:"Value Area Volume",defval:70,max:100,min:0,type:"integer"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],graphics:{hhists:{histBars2:{location:n.HHistLocation.Relative,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:n.HHistLocation.Relative,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}}},defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:0,visible:!0,width:2}}},inputs:{first_visible_bar_time:0,last_visible_bar_time:0,rows:24,rowsLayout:"Number Of Rows",vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0}}},styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}}}}},43910:(e,t,i)=>{"use strict";i.d(t,{StudyEngine:()=>r});var s=i(852);class r{constructor(e){this.runner=new s.ScriptRunner(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}},85898:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});class s extends Error{constructor(e){super(e),this.studyError=!0}}},43945:(e,t,i)=>{"use strict";i.d(t,{EraseAll:()=>r,EraseObj:()=>s,GraphicsCmds:()=>n});class s{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class r{primitiveData(){return{action:"all"}}}class n{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},79999:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{constructor(){this._stable=[],this._variable=null,this._owner=null}addStable(e){
dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}}class l{constructor(e){this._mixinJSONObject=new a(this),this._state=0,this._owner=null,this._gen=e,this._id=e.nextGraphicsObjId(),this._id2=this._mixinJSONObject.createField(this.id(),"id")}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}id(){return this._id}unsetOwner(e){this._owner===e&&(this._owner=null)}state(){return this._state}erase(){1===this._state&&this._gen.pushEraseObjCmd(this._id,this.jsonName()),this._state=2,this.dirty()}markAsPosted(){1!==this._state&&(this._state=1,this.dirty())}isErased(){return 2===this._state}isPosted(){return 1===this._state}isNaN(){return!1}_processObjUpdate(){1===this._state&&(this._gen.pushEraseObjCmd(this._id,this.jsonName()),this._id=this._gen.nextGraphicsObjId(),this._id2.set(this._id),this._state=0),this.dirty()}}},76958:(e,t,i)=>{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},1386:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>d});var s=i(43945);class r{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}var n=i(1722),o=i(76958);function a(e){return Boolean(e.isPosted)}class l{isIgnoredObj(e,t){return l.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return l.isIgnoredObjNaNable(e);const i=e[t];return l.isIgnoredByGeneralRules(e,t)||l.isIgnoredObjNaNable(i)||l.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,o.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,n.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,o.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return a(e)&&e.isPosted()}static isIgnoredObjErased(e){return a(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,n.isArray)(i)&&0===i.length}}class c{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)}}class h{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e)||l.isIgnoredObjPosted(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)||l.isIgnoredObjPosted(i)}}class d extends class extends class{constructor(e){this._dataObj=new r,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){ e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},31584:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(29779),r=i(76958);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);return this._setCachedDataValid(!1),true}addAll(e){this.setOwner(e),this._items.push(...e._items);return this._setCachedDataValid(!1),true}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);return this._setCachedDataValid(!1),true}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,r.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},29779:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(49581);class r{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class o extends r{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new r(e,t,this)}createDoubleField(e,t){return new r(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new o(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let r=0;r<i;r++){const i=e[r],n=t[r];if(!s.Std.equal(i,n))return!0}return!1}))}createTimeField(e,t){return new n(e,t,this)}dirty(){
null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}}class l{constructor(e){this._mixinJSONObject=new a(this),this._state=0,this._owner=null,this._gen=e,this._id=e.nextGraphicsObjId(),this._id2=this._mixinJSONObject.createField(this.id(),"id")}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}id(){return this._id}unsetOwner(e){this._owner===e&&(this._owner=null)}state(){return this._state}erase(){1===this._state&&this._gen.pushEraseObjCmd(this._id,this.jsonName()),this._state=2,this.dirty()}markAsPosted(){1!==this._state&&(this._state=1,this.dirty())}isErased(){return 2===this._state}isPosted(){return 1===this._state}isNaN(){return!1}_processObjUpdate(){1===this._state&&(this._gen.pushEraseObjCmd(this._id,this.jsonName()),this._id=this._gen.nextGraphicsObjId(),this._id2.set(this._id),this._state=0),this.dirty()}}},76958:(e,t,i)=>{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},1386:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>d});var s=i(43945);class r{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}var n=i(1722),o=i(76958);function a(e){return Boolean(e.isPosted)}class l{isIgnoredObj(e,t){return l.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return l.isIgnoredObjNaNable(e);const i=e[t];return l.isIgnoredByGeneralRules(e,t)||l.isIgnoredObjNaNable(i)||l.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,o.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,n.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,o.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return a(e)&&e.isPosted()}static isIgnoredObjErased(e){return a(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,n.isArray)(i)&&0===i.length}}class c{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)}}class h{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e)||l.isIgnoredObjPosted(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)||l.isIgnoredObjPosted(i)}}class d extends class extends class{constructor(e){this._dataObj=new r,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){
this._dataObj.disable()}}{constructor(e){super(e),this._snapshotPredicate=new c,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}{constructor(e){super(e),this._updatePredicate=new h,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},748:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n,StudyGraphicsData:()=>r});var s=i(50151);class r{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const r=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&r.push(i)}r.length>0&&(t[s]=r,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},24172:(e,t,i)=>{"use strict";const s=i(33013).getHexColorByName;var r=i(74649) this._dataObj.disable()}}{constructor(e){super(e),this._snapshotPredicate=new c,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}{constructor(e){super(e),this._updatePredicate=new h,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},748:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n,StudyGraphicsData:()=>r});var s=i(50151);class r{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const r=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&r.push(i)}r.length>0&&(t[s]=r,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},24172:(e,t,i)=>{"use strict";const s=i(33013).getHexColorByName;var r=i(74649)
;const n=s("color-ripe-red-100"),o=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return r.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(r.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context));return[r.Std.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(r.Std.open(t)),s=t.new_var(r.Std.high(t)),n=t.new_var(r.Std.low(t)),o=t.new_var(r.Std.close(t)),a=r.Std.abs(s-o.get(1)),l=r.Std.abs(n-o.get(1)),c=r.Std.abs(s-n),h=r.Std.abs(o.get(1)-i.get(1)),d=r.Std.max(a,l),u=r.Std.iff(a>=r.Std.max(l,c),a-.5*l+.25*h,r.Std.iff(l>=r.Std.max(a,c),l-.5*a+.25*h,c+.25*h));return r.Std.iff(0===u,0,(o-o.get(1)+.5*(o-i)+.25*(o.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return r.Std.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){ ;const n=s("color-ripe-red-100"),o=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return r.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(r.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context));return[r.Std.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(r.Std.open(t)),s=t.new_var(r.Std.high(t)),n=t.new_var(r.Std.low(t)),o=t.new_var(r.Std.close(t)),a=r.Std.abs(s-o.get(1)),l=r.Std.abs(n-o.get(1)),c=r.Std.abs(s-n),h=r.Std.abs(o.get(1)-i.get(1)),d=r.Std.max(a,l),u=r.Std.iff(a>=r.Std.max(l,c),a-.5*l+.25*h,r.Std.iff(l>=r.Std.max(a,c),l-.5*a+.25*h,c+.25*h));return r.Std.iff(0===u,0,(o-o.get(1)+.5*(o-i)+.25*(o.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return r.Std.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){
return r.Std.gt(e,t)},this.f_1=function(e,t){return r.Std.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=this.f_1(r.Std.close(this._context),r.Std.open(this._context)),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context);return[this.f_2(o,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.Std.alma(a,s,n,o)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.high(this._context),n=i+1,o=this._context.new_var(s),a=r.Std.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.Std.low(this._context),h=this._context.new_var(c),d=r.Std.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}}, return r.Std.gt(e,t)},this.f_1=function(e,t){return r.Std.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=this.f_1(r.Std.close(this._context),r.Std.open(this._context)),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context);return[this.f_2(o,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.Std.alma(a,s,n,o)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.high(this._context),n=i+1,o=this._context.new_var(s),a=r.Std.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.Std.low(this._context),h=this._context.new_var(c),d=r.Std.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},
@@ -97,10 +98,10 @@ objAId:"plot_3",objBId:"plot_4",type:"plot_plot",title:"Plots Background",isHidd
metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Klinger Oscillator",shortDescription:"Klinger Oscillator",is_price_study:!1,inputs:[],id:"Klinger Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Klinger Oscillator",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){return r.Std.ge(e,0)?t:-t},this.f_1=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hlc3(this._context);this._context.setMinimumAdditionalDepth(66);var s=this._context.new_var(i),n=r.Std.change(s),o=this.f_0(n,r.Std.volume(this._context)),a=this._context.new_var(o),l=r.Std.ema(a,34,this._context),c=this._context.new_var(o),h=r.Std.ema(c,55,this._context),d=this.f_1(l,h),u=this._context.new_var(d);return[d,r.Std.ema(u,13,this._context)]}}},{name:"Know Sure Thing",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:15,in_2:20,in_3:30,in_4:10,in_5:10,in_6:10,in_7:15,in_8:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"KST",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Know Sure Thing",shortDescription:"KST",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"roclen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"roclen2",defval:15,type:"integer",min:1,max:2e3},{id:"in_2",name:"roclen3",defval:20,type:"integer",min:1,max:2e3},{id:"in_3",name:"roclen4",defval:30,type:"integer",min:1,max:2e3},{id:"in_4",name:"smalen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_5",name:"smalen2",defval:10,type:"integer",min:1,max:2e3},{id:"in_6",name:"smalen3",defval:10,type:"integer",min:1,max:2e3},{id:"in_7",name:"smalen4",defval:15,type:"integer",min:1,max:2e3},{id:"in_8",name:"siglen",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]}],id:"Know Sure Thing@tv-basicstudies-1",scriptIdPart:"",name:"Know Sure Thing",format:{type:"price",precision:4},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return e+2*t+3*i+4*s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=this._input(3),a=this._input(4),l=this._input(5),c=this._input(6),h=this._input(7),d=this._input(8) metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Klinger Oscillator",shortDescription:"Klinger Oscillator",is_price_study:!1,inputs:[],id:"Klinger Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Klinger Oscillator",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){return r.Std.ge(e,0)?t:-t},this.f_1=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hlc3(this._context);this._context.setMinimumAdditionalDepth(66);var s=this._context.new_var(i),n=r.Std.change(s),o=this.f_0(n,r.Std.volume(this._context)),a=this._context.new_var(o),l=r.Std.ema(a,34,this._context),c=this._context.new_var(o),h=r.Std.ema(c,55,this._context),d=this.f_1(l,h),u=this._context.new_var(d);return[d,r.Std.ema(u,13,this._context)]}}},{name:"Know Sure Thing",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:15,in_2:20,in_3:30,in_4:10,in_5:10,in_6:10,in_7:15,in_8:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"KST",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Know Sure Thing",shortDescription:"KST",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"roclen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"roclen2",defval:15,type:"integer",min:1,max:2e3},{id:"in_2",name:"roclen3",defval:20,type:"integer",min:1,max:2e3},{id:"in_3",name:"roclen4",defval:30,type:"integer",min:1,max:2e3},{id:"in_4",name:"smalen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_5",name:"smalen2",defval:10,type:"integer",min:1,max:2e3},{id:"in_6",name:"smalen3",defval:10,type:"integer",min:1,max:2e3},{id:"in_7",name:"smalen4",defval:15,type:"integer",min:1,max:2e3},{id:"in_8",name:"siglen",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]}],id:"Know Sure Thing@tv-basicstudies-1",scriptIdPart:"",name:"Know Sure Thing",format:{type:"price",precision:4},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return e+2*t+3*i+4*s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=this._input(3),a=this._input(4),l=this._input(5),c=this._input(6),h=this._input(7),d=this._input(8)
;this._context.setMinimumAdditionalDepth(Math.max(a+i,l+s,c+n,h+o)+d);var u=r.Std.close(this._context),p=i,_=this._context.new_var(u),m=r.Std.roc(_,p),g=a,f=this._context.new_var(m),v=r.Std.sma(f,g,this._context),S=s,y=this._context.new_var(u),b=r.Std.roc(y,S),w=l,C=this._context.new_var(b),P=r.Std.sma(C,w,this._context),x=n,T=this._context.new_var(u),I=r.Std.roc(T,x),M=c,A=this._context.new_var(I),L=r.Std.sma(A,M,this._context),k=o,D=this._context.new_var(u),E=r.Std.roc(D,k),V=h,B=this._context.new_var(E),R=r.Std.sma(B,V,this._context),N=this.f_0(v,P,L,R),O=this._context.new_var(N);return[N,r.Std.sma(O,d,this._context)]}}},{name:"Least Squares Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:25,in_1:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Least Squares Moving Average",shortDescription:"LSMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:25,type:"integer",min:1,max:1e12},{id:"in_1",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Least Squares Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Least Squares Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n);return[r.Std.linreg(o,i,s)]}}},{name:"Linear Regression Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Linear Regression Curve",shortDescription:"LRC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3}],id:"Linear Regression Curve@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Curve",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.Std.linreg(n,s,0)]}}},{name:"Linear Regression Slope",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Linear Regression Slope@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Slope",description:"Linear Regression Slope",shortDescription:"Linear Regression Slope",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:14}},styles:{plot_0:{title:"Plot",histogramBase:0}},inputs:[{id:"periods",type:"integer",name:"Periods",min:2}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)}, ;this._context.setMinimumAdditionalDepth(Math.max(a+i,l+s,c+n,h+o)+d);var u=r.Std.close(this._context),p=i,_=this._context.new_var(u),m=r.Std.roc(_,p),g=a,f=this._context.new_var(m),v=r.Std.sma(f,g,this._context),S=s,y=this._context.new_var(u),b=r.Std.roc(y,S),w=l,C=this._context.new_var(b),P=r.Std.sma(C,w,this._context),x=n,T=this._context.new_var(u),I=r.Std.roc(T,x),M=c,A=this._context.new_var(I),L=r.Std.sma(A,M,this._context),k=o,D=this._context.new_var(u),E=r.Std.roc(D,k),V=h,B=this._context.new_var(E),R=r.Std.sma(B,V,this._context),N=this.f_0(v,P,L,R),O=this._context.new_var(N);return[N,r.Std.sma(O,d,this._context)]}}},{name:"Least Squares Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:25,in_1:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Least Squares Moving Average",shortDescription:"LSMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:25,type:"integer",min:1,max:1e12},{id:"in_1",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Least Squares Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Least Squares Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n);return[r.Std.linreg(o,i,s)]}}},{name:"Linear Regression Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Linear Regression Curve",shortDescription:"LRC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3}],id:"Linear Regression Curve@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Curve",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.Std.linreg(n,s,0)]}}},{name:"Linear Regression Slope",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Linear Regression Slope@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Slope",description:"Linear Regression Slope",shortDescription:"Linear Regression Slope",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:14}},styles:{plot_0:{title:"Plot",histogramBase:0}},inputs:[{id:"periods",type:"integer",name:"Periods",min:2}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},
this.linregSlope=function(e,t,i){var s,r,n,o=0,a=0,l=0,c=0;for(s=0;s<t;++s)o+=n=t-1-s+1,a+=r=e.get(s),l+=n*n,c+=r*n;return(t*c-o*a)/(t*l-o*o)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context));return[this.linregSlope(i,this.period,0)]}}},{name:"MA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA Cross",shortDescription:"MA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"MA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.Std.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.sma(o,i,this._context),l=this._context.new_var(n),c=r.Std.sma(l,s,this._context),h=a,d=c,u=r.Std.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"MA with EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"MA",histogramBase:0,joinPoints:!1},plot_1:{title:"EMA",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA with EMA Cross",shortDescription:"MA/EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Length MA",defval:10,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Length EMA",defval:10,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"MA with EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA with EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.Std.na()},this.main=function(e,t){this._context=e,this._input=t this.linregSlope=function(e,t,i){var s,r,n,o=0,a=0,l=0,c=0;for(s=0;s<t;++s)o+=n=t-1-s+1,a+=r=e.get(s),l+=n*n,c+=r*n;return(t*c-o*a)/(t*l-o*o)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context));return[this.linregSlope(i,this.period,0)]}}},{name:"MA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA Cross",shortDescription:"MA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"MA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.Std.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.sma(o,i,this._context),l=this._context.new_var(n),c=r.Std.sma(l,s,this._context),h=a,d=c,u=r.Std.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"MA with EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"MA",histogramBase:0,joinPoints:!1},plot_1:{title:"EMA",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA with EMA Cross",shortDescription:"MA/EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Length MA",defval:10,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Length EMA",defval:10,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"MA with EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA with EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.Std.na()},this.main=function(e,t){this._context=e,this._input=t
;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.sma(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context),h=a,d=c,u=r.Std.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Mass Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Mass Index",shortDescription:"Mass Index",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Mass Index@tv-basicstudies-1",scriptIdPart:"",name:"Mass Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.high(this._context),r.Std.low(this._context)),n=this._context.new_var(s),o=r.Std.ema(n,9,this._context),a=this._context.new_var(o),l=r.Std.ema(a,9,this._context),c=this.f_1(o,l),h=this._context.new_var(c);return[r.Std.sum(h,i,this._context)]}}},{name:"McGinley Dynamic",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"McGinley Dynamic",shortDescription:"McGinley Dynamic",is_price_study:!0,is_hidden_study:!1,id:"mcginley_dynamic@tv-basicstudies-1",inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],scriptIdPart:"",name:"McGinley Dynamic",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r.Std.close(this._context),i=this._context.new_var(t),s=r.Std.ema(i,e,this._context),n=this._context.new_var(),o=n.get(1)+(t-n.get(1))/(e*r.Std.pow(t/n.get(1),4));return n.set(r.Std.na(n.get(1))?s:o),[n.get(0)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Median Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Median Price@tv-basicstudies-1",scriptIdPart:"",name:"Median Price",description:"Median Price",shortDescription:"Median Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.Std.hl2(this._context)]}}},{name:"Momentum",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86", ;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.sma(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context),h=a,d=c,u=r.Std.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Mass Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Mass Index",shortDescription:"Mass Index",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Mass Index@tv-basicstudies-1",scriptIdPart:"",name:"Mass Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.high(this._context),r.Std.low(this._context)),n=this._context.new_var(s),o=r.Std.ema(n,9,this._context),a=this._context.new_var(o),l=r.Std.ema(a,9,this._context),c=this.f_1(o,l),h=this._context.new_var(c);return[r.Std.sum(h,i,this._context)]}}},{name:"McGinley Dynamic",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"McGinley Dynamic",shortDescription:"McGinley Dynamic",is_price_study:!0,is_hidden_study:!1,id:"mcginley_dynamic@tv-basicstudies-1",inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],scriptIdPart:"",name:"McGinley Dynamic",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r.Std.close(this._context),i=this._context.new_var(t),s=r.Std.ema(i,e,this._context),n=this._context.new_var(),o=n.get(1)+(t-n.get(1))/(e*r.Std.pow(t/n.get(1),4));return n.set(r.Std.na(n.get(1))?s:r.Std.nz(o,s)),[n.get(0)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Median Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Median Price@tv-basicstudies-1",scriptIdPart:"",name:"Median Price",description:"Median Price",shortDescription:"Median Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.Std.hl2(this._context)]}}},{name:"Momentum",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{
linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Mom",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:0}},description:"Momentum",shortDescription:"Mom",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Momentum@tv-basicstudies-1",scriptIdPart:"",name:"Momentum",format:{type:"inherit"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std[this._input(1)](this._context),n=this._context.new_var(s).get(i);return[n?s-n:null]}}},{name:"Money Flow Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Money Flow Index",shortDescription:"MFI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"Length",defval:14,type:"integer",min:1,max:2e3}],id:"Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Money Flow Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){return e*(r.Std.le(t,0)?0:i)},this.f_1=function(e,t,i){return e*(r.Std.ge(t,0)?0:i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.hlc3(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(r.Std.volume(this._context),o,s),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context),h=this.f_1(r.Std.volume(this._context),o,s),d=this._context.new_var(h),u=r.Std.sum(d,i,this._context);return[r.Std.rsi(c,u)]}}},{name:"Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{symbol:"",length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average",shortDescription:"MA",is_price_study:!0,inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{ color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Mom",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:0}},description:"Momentum",shortDescription:"Mom",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Momentum@tv-basicstudies-1",scriptIdPart:"",name:"Momentum",format:{type:"inherit"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std[this._input(1)](this._context),n=this._context.new_var(s).get(i);return[n?s-n:null]}}},{name:"Money Flow Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Money Flow Index",shortDescription:"MFI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"Length",defval:14,type:"integer",min:1,max:2e3}],id:"Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Money Flow Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){return e*(r.Std.le(t,0)?0:i)},this.f_1=function(e,t,i){return e*(r.Std.ge(t,0)?0:i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.hlc3(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(r.Std.volume(this._context),o,s),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context),h=this.f_1(r.Std.volume(this._context),o,s),d=this._context.new_var(h),u=r.Std.sum(d,i,this._context);return[r.Std.rsi(c,u)]}}},{name:"Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{symbol:"",length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average",shortDescription:"MA",is_price_study:!0,inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,
id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average",format:{type:"inherit"},symbolSource:{type:"symbolInputSymbolSource",inputId:"symbol"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),r.Std.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time),s=r.Std[this._input(2)](this._context),n=this._input(1),o=this._input(3),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(n+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=r.Std[this._input(2)](this._context);s=this._context.new_var(h).adopt(c,i,1),this._context.select_sym(0)}var d,u=this._context.new_var(s),p=r.Std.sma(u,n,this._context),_=this._context.new_var(p);return"EMA"===a?d=r.Std.ema(_,l,this._context):"WMA"===a?d=r.Std.wma(_,l,this._context):"SMA"===a&&(d=r.Std.sma(_,l,this._context)),[{value:p,offset:o},{value:d,offset:o}]}}},{name:"Moving Average Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,in_1:20,in_2:0,in_3:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_1",type:"plot_plot",title:"Plots Background"}],description:"Moving Average Channel",shortDescription:"MAC",is_price_study:!0,inputs:[{id:"in_0",name:"Upper Length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"Lower Length",defval:20,type:"integer",min:1,max:1e4},{id:"in_2",name:"Upper Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"in_3",name:"Lower Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Channel@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.high(this._context),s=r.Std.low(this._context),n=this._input(0),o=this._input(1),a=this._input(2),l=this._input(3),c=this._context.new_var(i),h=this._context.new_var(s);return[{value:r.Std.sma(c,n,this._context),offset:a},{ isHidden:!1},{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average",format:{type:"inherit"},symbolSource:{type:"symbolInputSymbolSource",inputId:"symbol"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),r.Std.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time),s=r.Std[this._input(2)](this._context),n=this._input(1),o=this._input(3),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(n+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=r.Std[this._input(2)](this._context);s=this._context.new_var(h).adopt(c,i,1),this._context.select_sym(0)}var d,u=this._context.new_var(s),p=r.Std.sma(u,n,this._context),_=this._context.new_var(p);return"EMA"===a?d=r.Std.ema(_,l,this._context):"WMA"===a?d=r.Std.wma(_,l,this._context):"SMA"===a&&(d=r.Std.sma(_,l,this._context)),[{value:p,offset:o},{value:d,offset:o}]}}},{name:"Moving Average Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,in_1:20,in_2:0,in_3:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_1",type:"plot_plot",title:"Plots Background"}],description:"Moving Average Channel",shortDescription:"MAC",is_price_study:!0,inputs:[{id:"in_0",name:"Upper Length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"Lower Length",defval:20,type:"integer",min:1,max:1e4},{id:"in_2",name:"Upper Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"in_3",name:"Lower Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Channel@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.high(this._context),s=r.Std.low(this._context),n=this._input(0),o=this._input(1),a=this._input(2),l=this._input(3),c=this._context.new_var(i),h=this._context.new_var(s);return[{value:r.Std.sma(c,n,this._context),offset:a
value:r.Std.sma(h,o,this._context),offset:l}]}}},{name:"Moving Average Convergence/Divergence",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:c},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},palettes:{palette_0:{colors:{0:{color:d,width:1,style:0},1:{color:h,width:1,style:0},2:{color:n,width:1,style:0},3:{color:"#FF5252",width:1,style:0}}}},inputs:{in_0:12,in_1:26,in_3:"close",in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Histogram",histogramBase:0,joinPoints:!1},plot_1:{title:"MACD",histogramBase:0,joinPoints:!1},plot_2:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"MACD",shortDescription:"MACD",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"}}}},inputs:[{id:"in_0",name:"fastLength",defval:12,type:"integer",min:1,max:2e3},{id:"in_1",name:"slowLength",defval:26,type:"integer",min:1,max:2e3},{id:"in_3",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"signalLength",defval:9,type:"integer",min:1,max:50}],id:"Moving Average Convergence/Divergence@tv-basicstudies-1",scriptIdPart:"",name:"MACD",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){var t=e>0?1:3,i=r.Std.change(this._context.new_var(e));return t-(r.Std.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(2)](this._context),s=this._input(0),n=this._input(1),o=this._input(3);this._context.setMinimumAdditionalDepth(Math.max(s,n)+o);var a=this._context.new_var(i),l=r.Std.ema(a,s,this._context),c=this._context.new_var(i),h=r.Std.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.ema(u,o,this._context),_=this.f_0(d,p);return[_,d,p,this.f_1(_)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source", },{value:r.Std.sma(h,o,this._context),offset:l}]}}},{name:"Moving Average Convergence/Divergence",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:c},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},palettes:{palette_0:{colors:{0:{color:d,width:1,style:0},1:{color:h,width:1,style:0},2:{color:n,width:1,style:0},3:{color:"#FF5252",width:1,style:0}}}},inputs:{in_0:12,in_1:26,in_3:"close",in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Histogram",histogramBase:0,joinPoints:!1},plot_1:{title:"MACD",histogramBase:0,joinPoints:!1},plot_2:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"MACD",shortDescription:"MACD",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"}}}},inputs:[{id:"in_0",name:"fastLength",defval:12,type:"integer",min:1,max:2e3},{id:"in_1",name:"slowLength",defval:26,type:"integer",min:1,max:2e3},{id:"in_3",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"signalLength",defval:9,type:"integer",min:1,max:50}],id:"Moving Average Convergence/Divergence@tv-basicstudies-1",scriptIdPart:"",name:"MACD",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){var t=e>0?1:3,i=r.Std.change(this._context.new_var(e));return t-(r.Std.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(2)](this._context),s=this._input(0),n=this._input(1),o=this._input(3);this._context.setMinimumAdditionalDepth(Math.max(s,n)+o);var a=this._context.new_var(i),l=r.Std.ema(a,s,this._context),c=this._context.new_var(i),h=r.Std.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.ema(u,o,this._context),_=this.f_0(d,p);return[_,d,p,this.f_1(_)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",
options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=r.Std.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.Std.ema(d,a,this._context):"WMA"===o?l=r.Std.wma(d,a,this._context):"SMA"===o&&(l=r.Std.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.Std.wma(o,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){ options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=r.Std.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.Std.ema(d,a,this._context):"WMA"===o?l=r.Std.wma(d,a,this._context):"SMA"===o&&(l=r.Std.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.Std.wma(o,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){
this.main=function(e,t){this._context=e,this._input=t;var i,s,n=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(2)?(i=r.Std.ema(n,this._input(0),this._context),s=r.Std.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.Std.wma(n,this._input(0),this._context),s=r.Std.wma(n,this._input(1),this._context)):(i=r.Std.sma(n,this._input(0),this._context),s=r.Std.sma(n,this._input(1),this._context)),[i,s]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n,o=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(3)?(i=r.Std.ema(o,this._input(0),this._context),s=r.Std.ema(o,this._input(1),this._context),n=r.Std.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.Std.wma(o,this._input(0),this._context),s=r.Std.wma(o,this._input(1),this._context),n=r.Std.wma(o,this._input(2),this._context)):(i=r.Std.sma(o,this._input(0),this._context),s=r.Std.sma(o,this._input(1),this._context),n=r.Std.sma(o,this._input(2),this._context)),[i,s,n]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e, this.main=function(e,t){this._context=e,this._input=t;var i,s,n=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(2)?(i=r.Std.ema(n,this._input(0),this._context),s=r.Std.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.Std.wma(n,this._input(0),this._context),s=r.Std.wma(n,this._input(1),this._context)):(i=r.Std.sma(n,this._input(0),this._context),s=r.Std.sma(n,this._input(1),this._context)),[i,s]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n,o=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(3)?(i=r.Std.ema(o,this._input(0),this._context),s=r.Std.ema(o,this._input(1),this._context),n=r.Std.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.Std.wma(o,this._input(0),this._context),s=r.Std.wma(o,this._input(1),this._context),n=r.Std.wma(o,this._input(2),this._context)):(i=r.Std.sma(o,this._input(0),this._context),s=r.Std.sma(o,this._input(1),this._context),n=r.Std.sma(o,this._input(2),this._context)),[i,s,n]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,
this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),o=r.Std.stdev(t,i,this._context),a=r.Std.log(n/e.get(i))/(o*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context)),s=this._context.new_var(r.Std.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,r=1;r<=this.periods;++r){var n=Math.sin((1+r)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;s<t;++s)i+=e.get(t-s-1)*this.hmaFactors[s];return i/=this.hmaFactorsSum},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context));return[this.hma(i)]}}},{name:"Moving Average Multiple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Multiple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Multiple",description:"Moving Average Multiple",shortDescription:"Moving Average Multiple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"},{id:"plot_5",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#9C27B0"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#FF6D00"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#43A047"},plot_3:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"},plot_4:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#F50057"},plot_5:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,fourthPeriods:50,fifthPeriods:100,sixthPeriods:200,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"},plot_3:{title:"Plot 4"},plot_4:{title:"Plot 5"},plot_5:{title:"Plot 6"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{ this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),o=r.Std.stdev(t,i,this._context),a=r.Std.log(n/e.get(i))/(o*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context)),s=this._context.new_var(r.Std.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,r=1;r<=this.periods;++r){var n=Math.sin((1+r)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;s<t;++s)i+=e.get(t-s-1)*this.hmaFactors[s];return i/=this.hmaFactorsSum},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context));return[this.hma(i)]}}},{name:"Moving Average Multiple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Multiple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Multiple",description:"Moving Average Multiple",shortDescription:"Moving Average Multiple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"},{id:"plot_5",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#9C27B0"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#FF6D00"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#43A047"},plot_3:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"},plot_4:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#F50057"},plot_5:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,fourthPeriods:50,fifthPeriods:100,sixthPeriods:200,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"},plot_3:{title:"Plot 4"},plot_4:{title:"Plot 5"},plot_5:{title:"Plot 6"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{
@@ -128,7 +129,7 @@ this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.minTick=NaN
if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(e<this._sortedTimePoints[0].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[0].timeMs);if(null===t||null===i)return null;let s=t.index-i.index;return i.timeMs!==this._sortedTimePoints[0].timeMs&&(s-=1),{index:s,timeMs:t.timeMs}}if(e>this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,o.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs<t));return this._sortedTimePoints[t].timeMs!==e&&(t-=1),{index:t,timeMs:this._sortedTimePoints[t].timeMs}}setMainSymbolExtrapolator(e){this._mainSymbolExtrapolator=e,this._updateFutureBars(),this._fillPointsData(this._sortedTimePoints,0)}setMinFutureBarsCount(e){this._minFutureBarsCount=e,this._updateFutureBars()}minFutureBarsCount(){return this._minFutureBarsCount}firstFutureBarIndex(){return this._sortedTimePoints.length}firstSessionBarIndex(){return 0===this._sortedTimePoints.length?null:0}lastSessionBarIndex(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}tickMarks(e=0){const t=this.firstFutureBarIndex();(0,s.assert)(e<=t,"tickmarks cannot be filtered in the future");const i=this._futureBars().map(((e,t)=>({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let t=e;t<this._sortedTimePoints.length;++t)r.push(g(this._sortedTimePoints[t],t));const n=i.map(((e,i)=>g(e,i+t)));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMs<t));for(const r of e){const e=Math.round(1e3*r.value[0]);for(;i<this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs<e;)i+=1;i!==this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs===e||(i-=1),(0,s.assert)(i!==t,"data must have unique times"),t=i,r.index=i}(0,s.assert)(i<this._sortedTimePoints.length,"data must be within a data range")}convertTimesToIndexes(e){if(0===e.length)return[];let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,e[0],((e,t)=>e.timeMs<t));return e.map((e=>{for(;i<this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs<e;)i+=1;if(0===i&&e<this._sortedTimePoints[0].timeMs)return l.INVALID_TIME_POINT_INDEX;if(i>=this._sortedTimePoints.length){const t=this.indexOfTime(e) if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(e<this._sortedTimePoints[0].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[0].timeMs);if(null===t||null===i)return null;let s=t.index-i.index;return i.timeMs!==this._sortedTimePoints[0].timeMs&&(s-=1),{index:s,timeMs:t.timeMs}}if(e>this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,o.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs<t));return this._sortedTimePoints[t].timeMs!==e&&(t-=1),{index:t,timeMs:this._sortedTimePoints[t].timeMs}}setMainSymbolExtrapolator(e){this._mainSymbolExtrapolator=e,this._updateFutureBars(),this._fillPointsData(this._sortedTimePoints,0)}setMinFutureBarsCount(e){this._minFutureBarsCount=e,this._updateFutureBars()}minFutureBarsCount(){return this._minFutureBarsCount}firstFutureBarIndex(){return this._sortedTimePoints.length}firstSessionBarIndex(){return 0===this._sortedTimePoints.length?null:0}lastSessionBarIndex(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}tickMarks(e=0){const t=this.firstFutureBarIndex();(0,s.assert)(e<=t,"tickmarks cannot be filtered in the future");const i=this._futureBars().map(((e,t)=>({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let t=e;t<this._sortedTimePoints.length;++t)r.push(g(this._sortedTimePoints[t],t));const n=i.map(((e,i)=>g(e,i+t)));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMs<t));for(const r of e){const e=Math.round(1e3*r.value[0]);for(;i<this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs<e;)i+=1;i!==this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs===e||(i-=1),(0,s.assert)(i!==t,"data must have unique times"),t=i,r.index=i}(0,s.assert)(i<this._sortedTimePoints.length,"data must be within a data range")}convertTimesToIndexes(e){if(0===e.length)return[];let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,e[0],((e,t)=>e.timeMs<t));return e.map((e=>{for(;i<this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs<e;)i+=1;if(0===i&&e<this._sortedTimePoints[0].timeMs)return l.INVALID_TIME_POINT_INDEX;if(i>=this._sortedTimePoints.length){const t=this.indexOfTime(e)
;if(null===t)return l.INVALID_TIME_POINT_INDEX;i=t.timeMs!==e?t.index+1:t.index}return(0,s.assert)(i>t,"data must have unique sorted times"),t=i,i}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=(0,o.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs<t));for(let t=s;t<this._sortedTimePoints.length;++t){const s=this._sortedTimePoints[t];s.pointData.instances.delete(e)&&0===s.pointData.instances.size&&i.push(s)}const r=this._addBarsTimesToInstance(e,t,!0);this._cleanupPointsData(i);const n=r.map((e=>({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;e<this._sortedTimePoints.length;++e){const t=this._sortedTimePoints[e];0!==t.pointData.instances.size&&n.push(t)}n.sort(((e,t)=>e.timeMs-t.timeMs));const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t){return this._setBarsTimes(e,t)}_setBarsTimes(e,t){const i=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),i&&this._cleanupPointsData(this._sortedTimePoints);const s=[];this._pointDataByTimePoint.forEach(((e,t)=>{s.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),s.sort(((e,t)=>e.timeMs-t.timeMs));const r=this._updateTimeScalePoints(s);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const r={index:0,instances:t};this._pointDataByTimePoint.set(i,r),null!==s&&s.push({timeMs:i,pointData:r})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;i<this._sortedTimePoints.length&&i<e.length;++i){const s=this._sortedTimePoints[i],r=e[i];if(s.timeMs!==r.timeMs){t=i;break} ;if(null===t)return l.INVALID_TIME_POINT_INDEX;i=t.timeMs!==e?t.index+1:t.index}return(0,s.assert)(i>t,"data must have unique sorted times"),t=i,i}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=(0,o.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs<t));for(let t=s;t<this._sortedTimePoints.length;++t){const s=this._sortedTimePoints[t];s.pointData.instances.delete(e)&&0===s.pointData.instances.size&&i.push(s)}const r=this._addBarsTimesToInstance(e,t,!0);this._cleanupPointsData(i);const n=r.map((e=>({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;e<this._sortedTimePoints.length;++e){const t=this._sortedTimePoints[e];0!==t.pointData.instances.size&&n.push(t)}n.sort(((e,t)=>e.timeMs-t.timeMs));const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t){return this._setBarsTimes(e,t)}_setBarsTimes(e,t){const i=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),i&&this._cleanupPointsData(this._sortedTimePoints);const s=[];this._pointDataByTimePoint.forEach(((e,t)=>{s.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),s.sort(((e,t)=>e.timeMs-t.timeMs));const r=this._updateTimeScalePoints(s);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const r={index:0,instances:t};this._pointDataByTimePoint.set(i,r),null!==s&&s.push({timeMs:i,pointData:r})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;i<this._sortedTimePoints.length&&i<e.length;++i){const s=this._sortedTimePoints[i],r=e[i];if(s.timeMs!==r.timeMs){t=i;break}
r.markWeight=s.markWeight,r.displayTime=s.displayTime}if(t=S(t,this._sortedTimePoints.length,e.length),-1===t)return null;for(let i=t;i<e.length;++i){e[i].pointData.index=i}this._fillPointsData(e,t);const i=m(this._sortedTimePoints,e,t);return this._sortedTimePoints=e,this._updateFutureBars(),{pointsIndex:t,indexChange:i}}_updateTimeScalePointsTail(e){if(0===e.length)return null;const t=(0,o.lowerbound)(this._sortedTimePoints,e[0].timeMs,((e,t)=>e.timeMs<t));let i=-1;for(let s=0;s<e.length;++s){const r=e[s],n=t+s;if(r.pointData.index=n,n>=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==r.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=S(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===l.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let r=0;for(;t+r<i.length&&r<e.length;)i[t+r]=e[r],r+=1;for(;r<e.length;++r)i.push(e[r]);i.length=s}return this._updateFutureBars(),{pointsIndex:i,indexChange:r}}_getBaseIndex(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}_fillPointsData(e,t,i=null){this._fillDiplayTimeForPoints(e,t),function(e,t=0,i=null){let s=0===t||0===e.length?i:e[t-1].displayTime,r=null!==s?new Date(1e3*s):null,n=0;for(let i=t;i<e.length;++i){const t=e[i],o=new Date(1e3*t.displayTime);t.markWeight=_(o,r),n+=t.displayTime-(s||t.displayTime),r=o,s=t.displayTime}if(0===t&&e.length>1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let t=e.pointsIndex;t<this._sortedTimePoints.length;++t)s.push(this._sortedTimePoints[t].timeMs/1e3);return{...e,points:s,baseIndex:this._getBaseIndex(),marks:this.tickMarks(i)}}_fillDiplayTimeForPoints(e,t=0){if(null===this._mainSymbolExtrapolator)return;const i=this._mainSymbolExtrapolator.interval(),s=this._mainSymbolExtrapolator.barBuilder(),r=this._mainSymbolExtrapolator.symbolInfo(),o=null===this._displayTimezone?(0,n.get_timezone)(r.timezone):this._displayTimezone,l=1===this._instanceIds.size,h=i.isDWM(),d=h?(0,a.createDwmAligner)(i.value(),{timezone:r.timezone,corrections:l?r.corrections:void 0,session_holidays:l?r.session_holidays:void 0,session:l?r.session:"24x7"}):null,u=!h;for(let r=t;r<e.length;++r){let t=e[r].timeMs/1e3;f&&(t=(0,c.barTimeToEndOfPeriod)(s,t,i)),null!==d&&(t=Math.floor(d.timeToExchangeTradingDay(1e3*t)/1e3)),u&&(t=Math.floor((0,n.utc_to_cal_ts)(o,1e3*t)/1e3)),e[r].displayTime=t}}}function S(e,t,i){ r.markWeight=s.markWeight,r.displayTime=s.displayTime}if(t=S(t,this._sortedTimePoints.length,e.length),-1===t)return null;for(let i=t;i<e.length;++i){e[i].pointData.index=i}this._fillPointsData(e,t);const i=m(this._sortedTimePoints,e,t);return this._sortedTimePoints=e,this._updateFutureBars(),{pointsIndex:t,indexChange:i}}_updateTimeScalePointsTail(e){if(0===e.length)return null;const t=(0,o.lowerbound)(this._sortedTimePoints,e[0].timeMs,((e,t)=>e.timeMs<t));let i=-1;for(let s=0;s<e.length;++s){const r=e[s],n=t+s;if(r.pointData.index=n,n>=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==r.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=S(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===l.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let r=0;for(;t+r<i.length&&r<e.length;)i[t+r]=e[r],r+=1;for(;r<e.length;++r)i.push(e[r]);i.length=s}return this._updateFutureBars(),{pointsIndex:i,indexChange:r}}_getBaseIndex(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}_fillPointsData(e,t,i=null){this._fillDiplayTimeForPoints(e,t),function(e,t=0,i=null){let s=0===t||0===e.length?i:e[t-1].displayTime,r=null!==s?new Date(1e3*s):null,n=0;for(let i=t;i<e.length;++i){const t=e[i],o=new Date(1e3*t.displayTime);t.markWeight=_(o,r),n+=t.displayTime-(s||t.displayTime),r=o,s=t.displayTime}if(0===t&&e.length>1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let t=e.pointsIndex;t<this._sortedTimePoints.length;++t)s.push(this._sortedTimePoints[t].timeMs/1e3);return{...e,points:s,baseIndex:this._getBaseIndex(),marks:this.tickMarks(i)}}_fillDiplayTimeForPoints(e,t=0){if(null===this._mainSymbolExtrapolator)return;const i=this._mainSymbolExtrapolator.interval(),s=this._mainSymbolExtrapolator.barBuilder(),r=this._mainSymbolExtrapolator.symbolInfo(),o=null===this._displayTimezone?(0,n.get_timezone)(r.timezone):this._displayTimezone,l=1===this._instanceIds.size,h=i.isDWM(),d=h?(0,a.createDwmAligner)(i.value(),{timezone:r.timezone,corrections:l?r.corrections:void 0,session_holidays:l?r.session_holidays:void 0,session:l?r.session:"24x7"}):null,u=!h;for(let r=t;r<e.length;++r){let t=e[r].timeMs/1e3;f&&(t=(0,c.barTimeToEndOfPeriod)(s,t,i)),null!==d&&(t=Math.floor(d.timeToExchangeTradingDay(1e3*t)/1e3)),u&&(t=Math.floor((0,n.utc_to_cal_ts)(o,1e3*t)/1e3)),e[r].displayTime=t}}}function S(e,t,i){
return-1===e&&t!==i&&(e=i<t?Math.max(0,i-1):t),e}},94141:(e,t,i)=>{"use strict";var s=i(3035),r=i(74649),n=i(61476),o=i(76537).SymbolExtrapolator,a=i(21125).SessionTimeScale,l=i(34108).PointsetsManager,c=i(60156),h=i(77475).createDwmAligner,d=i(36274).Interval,u=i(76422),p=i(2663).visitObject,_=i(1722).isObject;i(24172),i(60325);var m=i(79850).DatafeedRequestsCachedProcessor,g=i(38618).timezoneIsAvailable,f=i(77475).isAlignmentEnabled,v=i(27856),S=v.isEncodedExtendedSymbol,y=v.decodeExtendedSymbol,b=i(42960).extractSymbolNameFromSymbolInfo,w=i(48739).replaceGraphicsTimesWithTimePointIndexIndex,C=i(14483),P=i(66846).SubsessionId,x=i(60156).getPeriodsBetweenDates;const T="pre_post_market_sessions",I=C.enabled(T);var M=-5e6;function A(e){var t=e.findIndex((function(e){return e.index!==M}));return-1===t?[]:0===t?e:e.slice(t)}function L(e,t,i){if(e){if("string"==typeof e)return void console.warn("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=e}t&&(i.provider_id=t)}function k(e,t){return e+"_"+t}function D(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]:null}}return null}function E(e){const t=y(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===P.Regular?void 0:i.session}]}var V=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&r.overwriteVolumeProfileResolutionForPeriodGetter((function(t,i,s,r){return e.getVolumeProfileResolutionForPeriod(t,i,s,r)})),this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,t._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),t._datafeedConfiguration=t._adoptConfigurationData(window.configurationData),t._fireEvent("configuration_received"),t._externalDatafeed.getServerTime&&t._externalDatafeed.getServerTime((function(e){t._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo=[],this._depthInfo=[],this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new m(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),n.setupFeed({resolve:function(e,i,s,r){t._resolveSymbolByName(e,i,s,r)},subscribe:function(e,i,s,r,n){return t._cachedDatafeed.subscribe(e,i,s,function(e,i,s){var r=new c.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=c.newBarBuilder(i,r,r);return function(e){if(e&&e.count()){var i=1e3*t.getCurrentUTCTime();n.moveTo(i), return-1===e&&t!==i&&(e=i<t?Math.max(0,i-1):t),e}},94141:(e,t,i)=>{"use strict";var s=i(3035),r=i(74649),n=i(69580),o=i(76537).SymbolExtrapolator,a=i(21125).SessionTimeScale,l=i(34108).PointsetsManager,c=i(60156),h=i(77475).createDwmAligner,d=i(36274).Interval,u=i(76422),p=i(2663).visitObject,_=i(1722).isObject;i(24172),i(60325);var m=i(79850).DatafeedRequestsCachedProcessor,g=i(38618).timezoneIsAvailable,f=i(77475).isAlignmentEnabled,v=i(27856),S=v.isEncodedExtendedSymbol,y=v.decodeExtendedSymbol,b=i(42960).extractSymbolNameFromSymbolInfo,w=i(48739).replaceGraphicsTimesWithTimePointIndexIndex,C=i(14483),P=i(66846).SubsessionId,x=i(60156).getPeriodsBetweenDates;const T="pre_post_market_sessions",I=C.enabled(T);var M=-5e6;function A(e){var t=e.findIndex((function(e){return e.index!==M}));return-1===t?[]:0===t?e:e.slice(t)}function L(e,t,i){if(e){if("string"==typeof e)return void console.warn("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=e}t&&(i.provider_id=t)}function k(e,t){return e+"_"+t}function D(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]:null}}return null}function E(e){const t=y(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===P.Regular?void 0:i.session}]}var V=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&r.overwriteVolumeProfileResolutionForPeriodGetter((function(t,i,s,r){return e.getVolumeProfileResolutionForPeriod(t,i,s,r)})),this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,t._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),t._datafeedConfiguration=t._adoptConfigurationData(window.configurationData),t._fireEvent("configuration_received"),t._externalDatafeed.getServerTime&&t._externalDatafeed.getServerTime((function(e){t._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo=[],this._depthInfo=[],this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new m(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),n.setupFeed({resolve:function(e,i,s,r){t._resolveSymbolByName(e,i,s,r)},subscribe:function(e,i,s,r,n){return t._cachedDatafeed.subscribe(e,i,s,function(e,i,s){var r=new c.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=c.newBarBuilder(i,r,r);return function(e){if(e&&e.count()){var i=1e3*t.getCurrentUTCTime();n.moveTo(i),
n.indexOfBar(i)>=0&&e.setLastBarClosed(!1)}s(e)}}(e,i,r),n)},unsubscribe:function(e){return t._cachedDatafeed.unsubscribe(e)}})};function B(e,t){return e+"_"+t}function R(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}V.prototype._getSymbolExtrapolator=function(e,t,i){var s=d.normalize(i),r=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s),n=this._symbolExtrapolators[r];return void 0===n&&(n=new o(t,s),this._symbolExtrapolators[r]=n),n},V.prototype._barsCoefficients=function(e,t){if(void 0===y(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},V.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},V.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((function(e){this._timeScales[e].destroy()}),this),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((function(e){this._symbolExtrapolators[e].destroy()}),this),this._symbolExtrapolators={}},V.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},V.prototype._logMessage=function(e){C.enabled("charting_library_debug_mode")&&console.log(e)},V.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},V.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r<s.length;++r)s[r](t);i||(this._callbacks[e]=[])}},V.prototype._adoptConfigurationData=function(e){var t=TradingView.merge({},e),i=t.supported_resolutions;if(!i||0===i.length)return t.supported_resolutions=void 0,t;for(var s=[],r=0;r<i.length;r++){var n=i[r];if(-1!==s.indexOf(n))throw new Error("Duplicating resolution `"+n+"`");s.push(n)}return t.supported_resolutions=s,t},V.prototype.supportedResolutions=function(){return this._datafeedConfiguration.supported_resolutions},V.prototype.supportedCurrencies=function(){return this._datafeedConfiguration.currency_codes||[]},V.prototype.supportedUnits=function(){return this._datafeedConfiguration.units||[]},V.prototype.supportedPriceSources=function(e){return new Promise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(e.price_sources)}),(e=>{i(e)}))}))},V.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},V.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},V.prototype._findStudyObject=function(e){e.endsWith("!")&&(e=e.slice(0,-1)) n.indexOfBar(i)>=0&&e.setLastBarClosed(!1)}s(e)}}(e,i,r),n)},unsubscribe:function(e){return t._cachedDatafeed.unsubscribe(e)}})};function B(e,t){return e+"_"+t}function R(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}V.prototype._getSymbolExtrapolator=function(e,t,i){var s=d.normalize(i),r=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s),n=this._symbolExtrapolators[r];return void 0===n&&(n=new o(t,s),this._symbolExtrapolators[r]=n),n},V.prototype._barsCoefficients=function(e,t){if(void 0===y(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},V.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},V.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((function(e){this._timeScales[e].destroy()}),this),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((function(e){this._symbolExtrapolators[e].destroy()}),this),this._symbolExtrapolators={}},V.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},V.prototype._logMessage=function(e){C.enabled("charting_library_debug_mode")&&console.log(e)},V.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},V.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r<s.length;++r)s[r](t);i||(this._callbacks[e]=[])}},V.prototype._adoptConfigurationData=function(e){var t=TradingView.merge({},e),i=t.supported_resolutions;if(!i||0===i.length)return t.supported_resolutions=void 0,t;for(var s=[],r=0;r<i.length;r++){var n=i[r];if(-1!==s.indexOf(n))throw new Error("Duplicating resolution `"+n+"`");s.push(n)}return t.supported_resolutions=s,t},V.prototype.supportedResolutions=function(){return this._datafeedConfiguration.supported_resolutions},V.prototype.supportedCurrencies=function(){return this._datafeedConfiguration.currency_codes||[]},V.prototype.supportedUnits=function(){return this._datafeedConfiguration.units||[]},V.prototype.supportedPriceSources=function(e){return new Promise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(e.price_sources)}),(e=>{i(e)}))}))},V.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},V.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},V.prototype._findStudyObject=function(e){e.endsWith("!")&&(e=e.slice(0,-1))
;var t=e.split("@")[0],i=JSServer.studyLibrary.filter((function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t}));return 0===i.length?null:i[0]},V.prototype.getMarks=function(e,t,i,s,r){var n={red:6,green:5,blue:4,yellow:3};if(this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks){this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var o=this;this._externalDatafeed.getMarks(e,t,i,(function(t){var i=t.map((function(e){return e.time=parseInt(e.time),e}));o._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(i)));var a=h(r,e),l=C.enabled("two_character_bar_marks_labels"),c=i.map((function(e){return e.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,e.direction=n[e.color],e.onClicked=function(){u.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},V.prototype.getTimescaleMarks=function(e,t,i,s,r){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var n=this;this._externalDatafeed.getTimescaleMarks(e,t,i,(function(t){n._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(t)));var i=h(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},V.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},V.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},V.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},V.prototype._getSeriesData=function(e,t){return this._objectsDataCache[B(e,t)]||null},V.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,u){var p=!0,_=[];null!==l&&(this._objectsDataCache[l]=null),this._timeScales[e].setCompleted(!1);var m=this._computeStudyCounter++;function g(e,t){if(e<c())return M;if(0===t)return 0;var i=_[t-1].index;return i===M?0:i+1}var v=new Map;var S=!1,y=this,b=function(){return y._studiesCache[e]&&y._studiesCache[e][n]&&y._studiesCache[e][n].activeResolve===m};y._studiesCache[e][n].activeResolve=m;var w,P,T=this._resolvePromisesBySymbolId.get(k(e,i));if(void 0===T)throw new Error("This should never happen");try{var I=await T;w=I.symbolInfo,P=I.requestedSymbol}catch(e){return void(b()&&u.onSymbolErrorCallback(e))}b()&&function(i,c){var m=d.parse(s);if(!m.isIntraday()||i.has_intraday){if(d.isDWM(s)&&void 0!==a.to){var b=h(s,i);null!==b&&(a.to=b.timeToExchangeTradingDay(a.to))}if(a.from&&a.to){const e=x(i.session,i.session_holidays,i.corrections,m.letter(),m.multiplier(),a.from,a.to) ;var t=e.split("@")[0],i=JSServer.studyLibrary.filter((function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t}));return 0===i.length?null:i[0]},V.prototype.getMarks=function(e,t,i,s,r){var n={red:6,green:5,blue:4,yellow:3};if(this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks){this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var o=this;this._externalDatafeed.getMarks(e,t,i,(function(t){var i=t.map((function(e){return e.time=parseInt(e.time),e}));o._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(i)));var a=h(r,e),l=C.enabled("two_character_bar_marks_labels"),c=i.map((function(e){return e.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,e.direction=n[e.color],e.onClicked=function(){u.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},V.prototype.getTimescaleMarks=function(e,t,i,s,r){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var n=this;this._externalDatafeed.getTimescaleMarks(e,t,i,(function(t){n._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(t)));var i=h(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},V.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},V.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},V.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},V.prototype._getSeriesData=function(e,t){return this._objectsDataCache[B(e,t)]||null},V.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,u){var p=!0,_=[];null!==l&&(this._objectsDataCache[l]=null),this._timeScales[e].setCompleted(!1);var m=this._computeStudyCounter++;function g(e,t){if(e<c())return M;if(0===t)return 0;var i=_[t-1].index;return i===M?0:i+1}var v=new Map;var S=!1,y=this,b=function(){return y._studiesCache[e]&&y._studiesCache[e][n]&&y._studiesCache[e][n].activeResolve===m};y._studiesCache[e][n].activeResolve=m;var w,P,T=this._resolvePromisesBySymbolId.get(k(e,i));if(void 0===T)throw new Error("This should never happen");try{var I=await T;w=I.symbolInfo,P=I.requestedSymbol}catch(e){return void(b()&&u.onSymbolErrorCallback(e))}b()&&function(i,c){var m=d.parse(s);if(!m.isIntraday()||i.has_intraday){if(d.isDWM(s)&&void 0!==a.to){var b=h(s,i);null!==b&&(a.to=b.timeToExchangeTradingDay(a.to))}if(a.from&&a.to){const e=x(i.session,i.session_holidays,i.corrections,m.letter(),m.multiplier(),a.from,a.to)
;a.countBack=Math.max(e,a.countBack)}try{var w=new r.StudyEngine({tickerid:c,symbolInfo:i,period:s,body:t,sessionId:e,onErrorCallback:u.onErrorCallback,dataRange:a,subsessionId:i.subsession_id,forceAlignBars:!C.enabled("disable_sameinterval_aligning")&&f(),enableDwmAligning:!y._studyCanExtendTimeScale(e,n),input:function(e){return o[e]},out:function(e,t){!function(e,t,i){for(var s=e.time,r="number"==typeof t?[t]:t,n=0;n<r.length;++n){var o=r[n];o&&"object"==typeof o&&(v.set(n,o.offset),o=o.value),"number"==typeof o&&isNaN(o)&&(o=void 0),r[n]=o}var a=_.length-1,l=a<0||s>_[a].timeMs;l?_.push({index:g(s,_.length),value:[s/1e3].concat(r),timeMs:s}):(_[a].index=g(s,a),_[a].value=[s/1e3].concat(r),_[a].timeMs=s),p||u.onRealtimeCallback([_[_.length-1]],l,_.length,v,i)}(e,t,i)},nonseriesOut:function(e,t){u.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){S=!0},recalc:function(e,s){p=!1,_.endOfData=S,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(y._objectsDataCache[l]=_),u.onDataReadyCallback(_,v,i,s))}});if(!y._studiesCache[e]||!y._studiesCache[e][n])throw Error("This should never happen");y._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;u.onErrorCallback(e.message)}}else u.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,P)},V.prototype._getDataRangeForStudy=function(e,t){var i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)};return this._studyCanExtendTimeScale(e,t)?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s},V.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){const o=l._studiesCache[s][r];if(o.completed=!0,e.length>0&&(o.firstLoadedTimeMs=e[0].timeMs),e=A(e),l._setEndOfData(s,r,n,!l._studyCanExtendTimeScale(s,r)||e.endOfData),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].setStudyBarsTimes(r,t);l._applyTimeScaleUpdate(s,i)}l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,t),TradingView.ChartapiMessagerInstances[s].onStudyCompleted(r,n),l._updateTimeScaleState(s)}function h(e){var t={};if(0!==e.size){var i={},n=l._studiesCache[s][r].metainfo;e.forEach((function(e,t){i[n.plots[t].id]=e})),t.data={offsets:i}}return t}this._studiesCache[s][r].completed=!1,a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n<i.length;n++)t[n]=e[i[n].id];return t}(a),TradingView.ChartapiMessagerInstances[s].onStudyLoading(r,n);var d=null,u=!1;l._computeStudy(s,i,e,t,r,a,this._getDataRangeForStudy(s,r),null,(function(){if(l._studyCanExtendTimeScale(s,r))return-1/0;if(null===d){var e=l._getSeriesData(s,o)[0];if(void 0===e)return 1/0;d=e.timeMs}return d}),{onDataReadyCallback:function(e,t,i){u&&0===e.length||c(e,h(t))},onRealtimeCallback:function(e,t,i,o,a){if(e=A(e),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].replaceBarsTimesTail(r,t);l._applyTimeScaleUpdate(s,i)} ;a.countBack=Math.max(e,a.countBack)}try{var w=new r.StudyEngine({tickerid:c,symbolInfo:i,period:s,body:t,sessionId:e,onErrorCallback:u.onErrorCallback,dataRange:a,subsessionId:i.subsession_id,forceAlignBars:!C.enabled("disable_sameinterval_aligning")&&f(),enableDwmAligning:!y._studyCanExtendTimeScale(e,n),input:function(e){return o[e]},out:function(e,t){!function(e,t,i){for(var s=e.time,r="number"==typeof t?[t]:t,n=0;n<r.length;++n){var o=r[n];o&&"object"==typeof o&&(v.set(n,o.offset),o=o.value),"number"==typeof o&&isNaN(o)&&(o=void 0),r[n]=o}var a=_.length-1,l=a<0||s>_[a].timeMs;l?_.push({index:g(s,_.length),value:[s/1e3].concat(r),timeMs:s}):(_[a].index=g(s,a),_[a].value=[s/1e3].concat(r),_[a].timeMs=s),p||u.onRealtimeCallback([_[_.length-1]],l,_.length,v,i)}(e,t,i)},nonseriesOut:function(e,t){u.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){S=!0},recalc:function(e,s){p=!1,_.endOfData=S,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(y._objectsDataCache[l]=_),u.onDataReadyCallback(_,v,i,s))}});if(!y._studiesCache[e]||!y._studiesCache[e][n])throw Error("This should never happen");y._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;u.onErrorCallback(e.message)}}else u.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,P)},V.prototype._getDataRangeForStudy=function(e,t){var i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)};return this._studyCanExtendTimeScale(e,t)?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s},V.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){const o=l._studiesCache[s][r];if(o.completed=!0,e.length>0&&(o.firstLoadedTimeMs=e[0].timeMs),e=A(e),l._setEndOfData(s,r,n,!l._studyCanExtendTimeScale(s,r)||e.endOfData),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].setStudyBarsTimes(r,t);l._applyTimeScaleUpdate(s,i)}l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,t),TradingView.ChartapiMessagerInstances[s].onStudyCompleted(r,n),l._updateTimeScaleState(s)}function h(e){var t={};if(0!==e.size){var i={},n=l._studiesCache[s][r].metainfo;e.forEach((function(e,t){i[n.plots[t].id]=e})),t.data={offsets:i}}return t}this._studiesCache[s][r].completed=!1,a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n<i.length;n++)t[n]=e[i[n].id];return t}(a),TradingView.ChartapiMessagerInstances[s].onStudyLoading(r,n);var d=null,u=!1;l._computeStudy(s,i,e,t,r,a,this._getDataRangeForStudy(s,r),null,(function(){if(l._studyCanExtendTimeScale(s,r))return-1/0;if(null===d){var e=l._getSeriesData(s,o)[0];if(void 0===e)return 1/0;d=e.timeMs}return d}),{onDataReadyCallback:function(e,t,i){u&&0===e.length||c(e,h(t))},onRealtimeCallback:function(e,t,i,o,a){if(e=A(e),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].replaceBarsTimesTail(r,t);l._applyTimeScaleUpdate(s,i)}
@@ -136,11 +137,11 @@ l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].o
var i=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}},V.prototype._stopSourcesTree=function(e,t){for(var i in this._studiesCache[e]){var s=this._studiesCache[e][i];s&&(("series"===s.type&&i===t||"study"===s.type&&s.parentId===t)&&(s.engine&&s.engine.isStarted()&&s.engine.stop(),s.activeResolve=-1))}n.unsubscribeUnused()},V.prototype._recreateSourcesForDataRange=function(e,t){var i=[];for(var s in this._studiesCache[e]){if((n=this._studiesCache[e][s])&&"series"===n.type&&!this._isEndOfData(e,s,n.turnaround)&&(this._stopSourcesTree(e,s),i.push(s)),n&&"study"===n.type&&this._studyCanExtendTimeScale(e,s)&&!this._isEndOfData(e,s,n.turnaround)){var r=this._studiesCache[e][n.parentId];n.dataRange=t,this._createStudy(r.symbolId,r.resolution,n.studyObject,e,s,n.turnaround,n.parentId,n.inputs)}}for(var s in i.forEach((function(i){this._startSourcesTree(e,i,Object.assign({},t))}),this),this._studiesCache[e]){var n;"series"===(n=this._studiesCache[e][s]).type&&this._isEndOfData(e,s,n.turnaround)&&TradingView.ChartapiMessagerInstances[e].onSeriesCompleted(s,n.turnaround,n.engine.runner.host.symbolInfo.data_status)}this._updateTimeScaleState(e)},V.prototype._startSourcesTree=function(e,t,i){var s=this._studiesCache[e][t];for(var r in this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0),this._studiesCache[e]){var n=this._studiesCache[e][r];n&&"study"===n.type&&n.parentId===t&&this._createStudy(s.symbolId,s.resolution,n.studyObject,e,r,n.turnaround,n.parentId,n.inputs)}},V.prototype.removeStudy=function(e,t){if(this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),n.unsubscribeUnused()),this._studyCanExtendTimeScale(e,t)){this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setStudyBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}delete this._studiesCache[e][t],delete this._studiesNonSeriesTimes[e][t]},V.prototype.removeSeries=function(e,t){this._stopSourcesTree(e,t),delete this._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);var i=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)},V.prototype.modifyStudy=function(e,t,i,s){var r=this._studiesCache[e][t];if(!r)throw Error("This should never happen");var o=this._studiesCache[e][r.parentId];r.inputs=s,r.turnaround=i,r.engine&&(r.engine.stop(),n.unsubscribeUnused()),this._studiesNonSeriesTimes[e][t]=null,this._createStudy(o.symbolId,o.resolution,r.studyObject,e,t,i,r.parentId,s)},V.prototype.createStudy=function(e,t,i,s,r,n){var o=this._studiesCache[e][i],a=this._findStudyObject(r);if(null===a)return console.warn("Study does not exist: "+r),void TradingView.ChartapiMessagerInstances[e].onStudyError(t,s,"unknown study name");var l=new a.constructor;this._studiesCache[e]=this._studiesCache[e]||{},this._studiesCache[e][t]={studyObject:l,guid:t,type:"study",inputs:n,metainfo:a.metainfo,turnaround:s,parentId:i}, var i=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}},V.prototype._stopSourcesTree=function(e,t){for(var i in this._studiesCache[e]){var s=this._studiesCache[e][i];s&&(("series"===s.type&&i===t||"study"===s.type&&s.parentId===t)&&(s.engine&&s.engine.isStarted()&&s.engine.stop(),s.activeResolve=-1))}n.unsubscribeUnused()},V.prototype._recreateSourcesForDataRange=function(e,t){var i=[];for(var s in this._studiesCache[e]){if((n=this._studiesCache[e][s])&&"series"===n.type&&!this._isEndOfData(e,s,n.turnaround)&&(this._stopSourcesTree(e,s),i.push(s)),n&&"study"===n.type&&this._studyCanExtendTimeScale(e,s)&&!this._isEndOfData(e,s,n.turnaround)){var r=this._studiesCache[e][n.parentId];n.dataRange=t,this._createStudy(r.symbolId,r.resolution,n.studyObject,e,s,n.turnaround,n.parentId,n.inputs)}}for(var s in i.forEach((function(i){this._startSourcesTree(e,i,Object.assign({},t))}),this),this._studiesCache[e]){var n;"series"===(n=this._studiesCache[e][s]).type&&this._isEndOfData(e,s,n.turnaround)&&TradingView.ChartapiMessagerInstances[e].onSeriesCompleted(s,n.turnaround,n.engine.runner.host.symbolInfo.data_status)}this._updateTimeScaleState(e)},V.prototype._startSourcesTree=function(e,t,i){var s=this._studiesCache[e][t];for(var r in this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0),this._studiesCache[e]){var n=this._studiesCache[e][r];n&&"study"===n.type&&n.parentId===t&&this._createStudy(s.symbolId,s.resolution,n.studyObject,e,r,n.turnaround,n.parentId,n.inputs)}},V.prototype.removeStudy=function(e,t){if(this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),n.unsubscribeUnused()),this._studyCanExtendTimeScale(e,t)){this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setStudyBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}delete this._studiesCache[e][t],delete this._studiesNonSeriesTimes[e][t]},V.prototype.removeSeries=function(e,t){this._stopSourcesTree(e,t),delete this._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);var i=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)},V.prototype.modifyStudy=function(e,t,i,s){var r=this._studiesCache[e][t];if(!r)throw Error("This should never happen");var o=this._studiesCache[e][r.parentId];r.inputs=s,r.turnaround=i,r.engine&&(r.engine.stop(),n.unsubscribeUnused()),this._studiesNonSeriesTimes[e][t]=null,this._createStudy(o.symbolId,o.resolution,r.studyObject,e,t,i,r.parentId,s)},V.prototype.createStudy=function(e,t,i,s,r,n){var o=this._studiesCache[e][i],a=this._findStudyObject(r);if(null===a)return console.warn("Study does not exist: "+r),void TradingView.ChartapiMessagerInstances[e].onStudyError(t,s,"unknown study name");var l=new a.constructor;this._studiesCache[e]=this._studiesCache[e]||{},this._studiesCache[e][t]={studyObject:l,guid:t,type:"study",inputs:n,metainfo:a.metainfo,turnaround:s,parentId:i},
this._studiesNonSeriesTimes[e][t]=null,this._createStudy(o.symbolId,o.resolution,l,e,t,s,i,n)},V.prototype.sessionTimeScale=function(e){return this._timeScales[e]||null},V.prototype.isTimeScaleExtendedTo=function(e,t){var i=this._mainSeriesRecord(e);if(d.isDWM(i.resolution)&&null!=i.symbolInfo){var s=h(i.resolution,i.symbolInfo);null!==s&&(t=s.timeToSessionStart(t))}var r=this._timeScales[e].indexOfTime(t);return null!==r&&r.index>=0},V.prototype.ensureExtendedTo=function(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");var s=this;setTimeout((function(){s._recreateSourcesForDataRange(t,{to:i})}),0)},V.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(d.isDWM(s.resolution)&&null!=s.symbolInfo){var r=h(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(k(e,s.symbolId)),o=this._barsCoefficients(n,s.resolution),a=o.barsCoefficient||1;if(!o.barsCoefficient){var l=this._getSeriesData(e,s.guid);null!==l&&(o.expectedBarsCount=l.length+t)}var c=this;setTimeout((function(){c._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}else this._logMessage("Nothing to extend - there is no points on time scale")},V.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},V.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},V.prototype._applyTimeScaleUpdate=function(e,t){if(null!==t){var i=[];for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if(r&&"study"===r.type){var n=this._studiesNonSeriesTimes[e][s];if(n){var o={indexes:this._timeScales[e].convertTimesToIndexes(n),data:{indexes_replace:!0}};i.push({objId:s,turnaround:r.turnaround,data:[],nonSeriesData:o})}}}TradingView.ChartapiMessagerInstances[e].onTimescaleUpdate(t,i),Promise.resolve().then(function(){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,i,this._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}.bind(this))}},V.prototype._updateMainTsBuilder=function(e){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}},V.prototype._updateTimeScaleState=function(e){var t=!0,i=!0;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];i=i&&this._isEndOfData(e,s,r.turnaround),t=t&&r.completed}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&TradingView.ChartapiMessagerInstances[e].onTimescaleCompleted(i))},V.prototype._mainSeriesRecord=function(e){var t=null,i=null;for(var s in this._studiesCache[e]){ this._studiesNonSeriesTimes[e][t]=null,this._createStudy(o.symbolId,o.resolution,l,e,t,s,i,n)},V.prototype.sessionTimeScale=function(e){return this._timeScales[e]||null},V.prototype.isTimeScaleExtendedTo=function(e,t){var i=this._mainSeriesRecord(e);if(d.isDWM(i.resolution)&&null!=i.symbolInfo){var s=h(i.resolution,i.symbolInfo);null!==s&&(t=s.timeToSessionStart(t))}var r=this._timeScales[e].indexOfTime(t);return null!==r&&r.index>=0},V.prototype.ensureExtendedTo=function(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");var s=this;setTimeout((function(){s._recreateSourcesForDataRange(t,{to:i})}),0)},V.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(d.isDWM(s.resolution)&&null!=s.symbolInfo){var r=h(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(k(e,s.symbolId)),o=this._barsCoefficients(n,s.resolution),a=o.barsCoefficient||1;if(!o.barsCoefficient){var l=this._getSeriesData(e,s.guid);null!==l&&(o.expectedBarsCount=l.length+t)}var c=this;setTimeout((function(){c._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}else this._logMessage("Nothing to extend - there is no points on time scale")},V.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},V.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},V.prototype._applyTimeScaleUpdate=function(e,t){if(null!==t){var i=[];for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if(r&&"study"===r.type){var n=this._studiesNonSeriesTimes[e][s];if(n){var o={indexes:this._timeScales[e].convertTimesToIndexes(n),data:{indexes_replace:!0}};i.push({objId:s,turnaround:r.turnaround,data:[],nonSeriesData:o})}}}TradingView.ChartapiMessagerInstances[e].onTimescaleUpdate(t,i),Promise.resolve().then(function(){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,i,this._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}.bind(this))}},V.prototype._updateMainTsBuilder=function(e){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}},V.prototype._updateTimeScaleState=function(e){var t=!0,i=!0;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];i=i&&this._isEndOfData(e,s,r.turnaround),t=t&&r.completed}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&TradingView.ChartapiMessagerInstances[e].onTimescaleCompleted(i))},V.prototype._mainSeriesRecord=function(e){var t=null,i=null;for(var s in this._studiesCache[e]){
var r=this._studiesCache[e][s];if("series"===r.type&&(null===t&&(t=r),r.isMain)){i=r;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i},V.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},V.prototype._prepareSeriesNonSeriesData=function(e,t,i){var s=i.data[i.data.length-1],r=this._getSeriesData(e,t),n=null===r?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:n.map((function(e,t){return{time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]}}))}},indexes:this._timeScales[e].convertTimesToIndexes(n.map((function(e){var t=e[0]||0;return t<0?r[r.length+t].timeMs:i.projectionTime+t})))}},V.prototype.createSeries=function(e,t,i,s,n,o,a){this._setEndOfData(e,t,i,!1);var l=new r.OHLCV;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],u=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||d.isEqual(h.resolution,n)&&h.symbolId===s)void 0!==o.countBack&&null!==c&&0!==c.length&&(o.to=c[0].timeMs),h&&null!=h.firstLoadedTimeMs?o.to=void 0!==o.to?Math.min(h.firstLoadedTimeMs,o.to):h.firstLoadedTimeMs:h||0===u||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===u)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_<o.to)&&(o.to=_,o.countBack=0)}if(void 0===o.countBack&&(o.countBack=0),void 0===o.to&&0===o.countBack&&(o.countBack=100),this._studiesCache[e][t]={symbolId:s,resolution:n,studyObject:l,guid:t,type:"series",turnaround:i,dataRange:o,initialDatarange:h&&h.initialDatarange||Object.assign({},o),firstLoadedTimeMs:null,symbolInfo:null,isMain:h&&h.isMain||0===u,completed:!1},null===p||p.guid===t||!p.error){this._updateMainTsBuilder(e),this._updateTimeScaleState(e),TradingView.ChartapiMessagerInstances[e].onSeriesLoading(t,i);var m=this;this._computeStudy(e,l,s,n,t,[],o,B(e,t),(function(){return-1/0}),{onDataReadyCallback:function(r,o,l,c){var h=m._studiesCache[e][t];if(!h)throw Error("This should never happen");if(h.symbolInfo=l,h.firstLoadedTimeMs=c.firstLoadedTimeMs,h.completed=!0,m._updateMainTsBuilder(e),a&&m._pointsetsManagers[e].invalidatePointsetsForSymbol(l.full_name,n),0!==r.length){var d=m._symbolIdToSymbolRequestString.get(k(e,s)),u=m._barsCoefficients(d,n);u.expectedBarsCount&&u.barsCount&&(u.barsCoefficient=Math.min(Math.max(u.barsCoefficient||1,parseInt(u.expectedBarsCount/(r.length-u.barsCount)+.5)),100)),u.barsCount=r.length,m._clearSeriesData(e,t)}else!c.endOfData&&h.isMain&&setTimeout((function(){m._studiesCache[e]&&m._recreateSourcesForDataRange(e,{countBack:10})}),0);g(l),c.endOfData&&(m._logMessage("Series has no more data on server: {0}".format(l.full_name)),m._setEndOfData(e,t,i)),0===r.length&&m._clearSeriesData(e,t),TradingView.ChartapiMessagerInstances[e].onSeriesCompleted(t,i,l.data_status),m._updateTimeScaleState(e)}, var r=this._studiesCache[e][s];if("series"===r.type&&(null===t&&(t=r),r.isMain)){i=r;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i},V.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},V.prototype._prepareSeriesNonSeriesData=function(e,t,i){var s=i.data[i.data.length-1],r=this._getSeriesData(e,t),n=null===r?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:n.map((function(e,t){return{time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]}}))}},indexes:this._timeScales[e].convertTimesToIndexes(n.map((function(e){var t=e[0]||0;return t<0?r[r.length+t].timeMs:i.projectionTime+t})))}},V.prototype.createSeries=function(e,t,i,s,n,o,a){this._setEndOfData(e,t,i,!1);var l=new r.OHLCV;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],u=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||d.isEqual(h.resolution,n)&&h.symbolId===s)void 0!==o.countBack&&null!==c&&0!==c.length&&(o.to=c[0].timeMs),h&&null!=h.firstLoadedTimeMs?o.to=void 0!==o.to?Math.min(h.firstLoadedTimeMs,o.to):h.firstLoadedTimeMs:h||0===u||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===u)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_<o.to)&&(o.to=_,o.countBack=0)}if(void 0===o.countBack&&(o.countBack=0),void 0===o.to&&0===o.countBack&&(o.countBack=100),this._studiesCache[e][t]={symbolId:s,resolution:n,studyObject:l,guid:t,type:"series",turnaround:i,dataRange:o,initialDatarange:h&&h.initialDatarange||Object.assign({},o),firstLoadedTimeMs:null,symbolInfo:null,isMain:h&&h.isMain||0===u,completed:!1},null===p||p.guid===t||!p.error){this._updateMainTsBuilder(e),this._updateTimeScaleState(e),TradingView.ChartapiMessagerInstances[e].onSeriesLoading(t,i);var m=this;this._computeStudy(e,l,s,n,t,[],o,B(e,t),(function(){return-1/0}),{onDataReadyCallback:function(r,o,l,c){var h=m._studiesCache[e][t];if(!h)throw Error("This should never happen");if(h.symbolInfo=l,h.firstLoadedTimeMs=c.firstLoadedTimeMs,h.completed=!0,m._updateMainTsBuilder(e),a&&m._pointsetsManagers[e].invalidatePointsetsForSymbol(l.full_name,n),0!==r.length){var d=m._symbolIdToSymbolRequestString.get(k(e,s)),u=m._barsCoefficients(d,n);u.expectedBarsCount&&u.barsCount&&(u.barsCoefficient=Math.min(Math.max(u.barsCoefficient||1,parseInt(u.expectedBarsCount/(r.length-u.barsCount)+.5)),100)),u.barsCount=r.length,m._clearSeriesData(e,t)}else!c.endOfData&&h.isMain&&setTimeout((function(){m._studiesCache[e]&&m._recreateSourcesForDataRange(e,{countBack:10})}),0);g(l),c.endOfData&&(m._logMessage("Series has no more data on server: {0}".format(l.full_name)),m._setEndOfData(e,t,i)),0===r.length&&m._clearSeriesData(e,t),TradingView.ChartapiMessagerInstances[e].onSeriesCompleted(t,i,l.data_status),m._updateTimeScaleState(e)},
onRealtimeCallback:function(s,r,n,o,a){g(a,s),m._timeScales[e].fillIndexesInRows(s);var l=s[s.length-1];if(r){if(!m._studiesCache[e][t])throw Error("This should never happen");m._logMessage("New bar arrived: symbol {0}, bar {1}".format(a.full_name,JSON.stringify(l)))}else m._logMessage("Last bar update: symbol {0}, bar {1}".format(a.full_name,JSON.stringify(l))),TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,s,null);m._fireEvent("realtime_tick",s[s.length-1],!0)},onSymbolErrorCallback:function(e){m._logMessage("Series symbol resolve error: "+e),f(e||"resolve error")},onErrorCallback:function(e){m._logMessage("Series error: "+e),f(e)},onNonSeriesDataUpdate:function(s,r){if("projection"!==s.type)throw new Error("unexpected non-series data type for series "+s.type);var n=m._getSeriesData(e,t);if(null!==n)g(r,0===n.length?void 0:[n[n.length-1]],s);else{s=m._prepareSeriesNonSeriesData(e,t,s);TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,[],s)}}})}function g(s,r,o){var a=[];if(void 0!==o){var l=(o.data||[]).reduce((function(e,t){return Math.max(e,t[0]||0)}),-1);if(null!=o.projectionTime)for(var c=0;c<=l;++c)a.push(o.projectionTime+c)}var h=null,d=null,u=s?m._getSymbolExtrapolator(e,s,n):null;if(void 0!==r){var p=r.map((function(e){return e.timeMs})).concat(a);null!==u&&u.replaceBarsTimesTail(p,r.length),d=m._timeScales[e].replaceBarsTimesTail(t,p),h=r}else{var _=m._getSeriesData(e,t)||[],g=_.map((function(e){return e.timeMs})).concat(a);null!==u&&u.setBarsTimes(g,_.length),d=m._timeScales[e].setSeriesBarsTimes(t,g),h=_}if(m._applyTimeScaleUpdate(e,d),0!==h.length||void 0!==o){m._timeScales[e].fillIndexesInRows(h);var f=void 0!==o?m._prepareSeriesNonSeriesData(e,t,o):null;TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,h,f)}}function f(s){var r=m._studiesCache[e][t];r.completed=!0,TradingView.ChartapiMessagerInstances[e].onSeriesError(t,i,s),C.enabled("clear_bars_on_series_error")&&(r.isMain?m.onSessionSeriesError(e):m._clearSeriesData(e,t))}},V.prototype._clearSeriesData=function(e,t){var i={};for(var s in i[t]={turnaround:this._studiesCache[e][t].turnaround},this._studiesCache[e]){var r=this._studiesCache[e][s];"study"===r.type&&this._studyCanExtendTimeScale(e,s)||("study"!==r.type||r.parentId!==t||this._studyCanExtendTimeScale(e,s)||(i[s]={turnaround:r.turnaround}))}TradingView.ChartapiMessagerInstances[e].onClearData(i)},V.prototype.requestMoreTickmarks=function(e,t){var i=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);var s=i.firstFutureBarIndex(),r=i.tickMarks(s);TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(s,r)},V.prototype.chartCreateSession=function(e){this._pointsetsManagers[e]=new l,this._timeScales[e]=new a,this._studiesNonSeriesTimes[e]={}},V.prototype.chartDeleteSession=function(e){this._pointsetsManagers[e].destroy(),delete this._pointsetsManagers[e],this._timeScales[e].destroy(),delete this._timeScales[e],delete this._studiesNonSeriesTimes[e]},V.prototype.removePointset=function(e,t){this._pointsetsManagers[e].removePointset(t)}, onRealtimeCallback:function(s,r,o,a,l){g(l,s),m._timeScales[e].fillIndexesInRows(s);var c=s[s.length-1];if(r){if(!m._studiesCache[e][t])throw Error("This should never happen");m._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,n,JSON.stringify(c)))}else m._logMessage("Last bar update: symbol {0}, resolution {1}, bar {2}".format(l.full_name,n,JSON.stringify(c))),TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,s,null);m._fireEvent("realtime_tick",s[s.length-1],!0)},onSymbolErrorCallback:function(e){m._logMessage("Series symbol resolve error: "+e),f(e||"resolve error")},onErrorCallback:function(e){m._logMessage("Series error: "+e),f(e)},onNonSeriesDataUpdate:function(s,r){if("projection"!==s.type)throw new Error("unexpected non-series data type for series "+s.type);var n=m._getSeriesData(e,t);if(null!==n)g(r,0===n.length?void 0:[n[n.length-1]],s);else{s=m._prepareSeriesNonSeriesData(e,t,s);TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,[],s)}}})}function g(s,r,o){var a=[];if(void 0!==o){var l=(o.data||[]).reduce((function(e,t){return Math.max(e,t[0]||0)}),-1);if(null!=o.projectionTime)for(var c=0;c<=l;++c)a.push(o.projectionTime+c)}var h=null,d=null,u=s?m._getSymbolExtrapolator(e,s,n):null;if(void 0!==r){var p=r.map((function(e){return e.timeMs})).concat(a);null!==u&&u.replaceBarsTimesTail(p,r.length),d=m._timeScales[e].replaceBarsTimesTail(t,p),h=r}else{var _=m._getSeriesData(e,t)||[],g=_.map((function(e){return e.timeMs})).concat(a);null!==u&&u.setBarsTimes(g,_.length),d=m._timeScales[e].setSeriesBarsTimes(t,g),h=_}if(m._applyTimeScaleUpdate(e,d),0!==h.length||void 0!==o){m._timeScales[e].fillIndexesInRows(h);var f=void 0!==o?m._prepareSeriesNonSeriesData(e,t,o):null;TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,h,f)}}function f(s){var r=m._studiesCache[e][t];r.completed=!0,TradingView.ChartapiMessagerInstances[e].onSeriesError(t,i,s),C.enabled("clear_bars_on_series_error")&&(r.isMain?m.onSessionSeriesError(e):m._clearSeriesData(e,t))}},V.prototype._clearSeriesData=function(e,t){var i={};for(var s in i[t]={turnaround:this._studiesCache[e][t].turnaround},this._studiesCache[e]){var r=this._studiesCache[e][s];"study"===r.type&&this._studyCanExtendTimeScale(e,s)||("study"!==r.type||r.parentId!==t||this._studyCanExtendTimeScale(e,s)||(i[s]={turnaround:r.turnaround}))}TradingView.ChartapiMessagerInstances[e].onClearData(i)},V.prototype.requestMoreTickmarks=function(e,t){var i=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);var s=i.firstFutureBarIndex(),r=i.tickMarks(s);TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(s,r)},V.prototype.chartCreateSession=function(e){this._pointsetsManagers[e]=new l,this._timeScales[e]=new a,this._studiesNonSeriesTimes[e]={}},V.prototype.chartDeleteSession=function(e){this._pointsetsManagers[e].destroy(),delete this._pointsetsManagers[e],this._timeScales[e].destroy(),delete this._timeScales[e],delete this._studiesNonSeriesTimes[e]},V.prototype.removePointset=function(e,t){
V.prototype.createPointset=async function(e,t,i,s,r){var n,o=this._resolvePromisesBySymbolId.get(k(e,i));try{n=(await o).symbolInfo}catch(e){return}var a=this._getSymbolExtrapolator(e,n,s);if(this._pointsetsManagers[e].createPointset(t,n.full_name,s,r,a),null===this._refreshPointsetsTimerId){var l=this;this._refreshPointsetsTimerId=setTimeout((function(){l._refreshPointsetsTimerId=null,l._refreshPointsets(l._invalidatedPointsetSessions),l._invalidatedPointsetSessions.clear()}),0)}this._invalidatedPointsetSessions.add(e)},V.prototype._refreshPointsets=function(e){var t=this;e.forEach((function(e){var i=t._studiesCache[e];if(null!=i){var s=null;for(var r in i){var n=i[r];if("series"===n.type){s=n;break}}if(null!==s&&null!=s.symbolInfo){var o=t._getSymbolExtrapolator(e,s.symbolInfo,s.resolution);t._pointsetsManagers[e].getUpdatesForSymbol(s.symbolInfo.full_name,s.resolution,o,t._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}}))},V.prototype.studiesMetadata=function(){return 0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map((function(e){return e.metainfo})),this._metainfoCache.push({palettes:{},inputs:[],plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"},{id:"volume",type:"line"}],graphics:{},_metainfoVersion:48,description:"Unnamed Study",format:{type:"inherit"},is_hidden_study:!0,is_price_study:!1,shortDescription:"Unnamed Study",description_localized:"Unnamed Study",id:"BarSetHeikenAshi@tv-prostudies",shortId:"BarSetHeikenAshi",packageId:"tv-basicstudies",version:"13",fullId:"BarSetHeikenAshi@tv-basicstudies-13",productId:"tv-basicstudies",name:"BarSetHeikenAshi@tv-basicstudies"})),this._metainfoCache},V.prototype.searchSymbols=function(e,t,i,s){this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));var r=this;this._externalDatafeed.searchSymbols(e,t,i,(function(e){r._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),e.forEach((e=>{L(e.logo_urls,e.exchange_logo,e)})),s(e)}))},V.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(k(e,t),i),this._resolvePromisesBySymbolId.set(k(e,t),new Promise((function(r,n){s._resolveSymbolImpl(i,(function(s){TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s),r({symbolInfo:s,requestedSymbol:i})}),(function(i){TradingView.ChartapiMessagerInstances[e].onSymbolError(t,i),n(i)}))})))},V.prototype._resolveSymbolImpl=function(e,t,i){S(e)||console.error("Expect to get symbol encoded string, but got the following instead: "+e);const[s,r]=E(e);this._resolveSymbolByName(s,r,t,i)},V.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=R(e,n,o,a);if(this._resolveRequests[l])r=this._resolveRequests[l];else{r=this._resolveSymbolInternal(e,n||void 0,o||void 0,a||void 0),this._resolveRequests[l]=r;var c=this;r.then((function(t){ this._pointsetsManagers[e].removePointset(t)},V.prototype.createPointset=async function(e,t,i,s,r){var n,o=this._resolvePromisesBySymbolId.get(k(e,i));try{n=(await o).symbolInfo}catch(e){return}var a=this._getSymbolExtrapolator(e,n,s);if(this._pointsetsManagers[e].createPointset(t,n.full_name,s,r,a),null===this._refreshPointsetsTimerId){var l=this;this._refreshPointsetsTimerId=setTimeout((function(){l._refreshPointsetsTimerId=null,l._refreshPointsets(l._invalidatedPointsetSessions),l._invalidatedPointsetSessions.clear()}),0)}this._invalidatedPointsetSessions.add(e)},V.prototype._refreshPointsets=function(e){var t=this;e.forEach((function(e){var i=t._studiesCache[e];if(null!=i){var s=null;for(var r in i){var n=i[r];if("series"===n.type){s=n;break}}if(null!==s&&null!=s.symbolInfo){var o=t._getSymbolExtrapolator(e,s.symbolInfo,s.resolution);t._pointsetsManagers[e].getUpdatesForSymbol(s.symbolInfo.full_name,s.resolution,o,t._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}}))},V.prototype.studiesMetadata=function(){return 0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map((function(e){return e.metainfo})),this._metainfoCache.push({palettes:{},inputs:[],plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"},{id:"volume",type:"line"}],graphics:{},_metainfoVersion:48,description:"Unnamed Study",format:{type:"inherit"},is_hidden_study:!0,is_price_study:!1,shortDescription:"Unnamed Study",description_localized:"Unnamed Study",id:"BarSetHeikenAshi@tv-prostudies",shortId:"BarSetHeikenAshi",packageId:"tv-basicstudies",version:"13",fullId:"BarSetHeikenAshi@tv-basicstudies-13",productId:"tv-basicstudies",name:"BarSetHeikenAshi@tv-basicstudies"})),this._metainfoCache},V.prototype.searchSymbols=function(e,t,i,s){this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));var r=this;this._externalDatafeed.searchSymbols(e,t,i,(function(e){r._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),e.forEach((e=>{L(e.logo_urls,e.exchange_logo,e)})),s(e)}))},V.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(k(e,t),i),this._resolvePromisesBySymbolId.set(k(e,t),new Promise((function(r,n){s._resolveSymbolImpl(i,(function(s){TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s),r({symbolInfo:s,requestedSymbol:i})}),(function(i){TradingView.ChartapiMessagerInstances[e].onSymbolError(t,i),n(i)}))})))},V.prototype._resolveSymbolImpl=function(e,t,i){S(e)||console.error("Expect to get symbol encoded string, but got the following instead: "+e);const[s,r]=E(e);this._resolveSymbolByName(s,r,t,i)},V.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=R(e,n,o,a);if(this._resolveRequests[l])r=this._resolveRequests[l];else{r=this._resolveSymbolInternal(e,n||void 0,o||void 0,a||void 0),this._resolveRequests[l]=r;var c=this;r.then((function(t){
c._resolveRequests[R(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},V.prototype._resolveSymbolInternal=function(e,t,i,s){var r=this;return new Promise(function(n,o){const a=[e,t,i,s].filter((e=>!!e)).join("|");this._logMessage("Symbol resolve requested: `{0}` ".format(a));var l=!0;this._externalDatafeed.resolveSymbol(e,(function(e){l&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),r._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(a,JSON.stringify(e))),function(e){const t=e.exchange+":"+e.name;if(e.full_name=t,e.pro_name=t,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.ticker||(e.ticker=e.symbol||e.name),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),e.supported_resolutions)for(var i=0;i<e.supported_resolutions.length;i++){var s=d.parse(e.supported_resolutions[i]);s.isValid()&&(e.supported_resolutions[i]=s.value())}if(e.price_sources||(e.price_sources=[]),e["is-tickbars-available"]=!!e.has_ticks,delete e.has_ticks,I&&Array.isArray(e.subsessions))for(let t=0;t<e.subsessions.length;t++){const i=e.subsessions[t];switch(i.id){case P.Regular:case P.Extended:i.private=!1;break;case P.PreMarket:case P.PostMarket:i.private=!0}}}(e),function(e){function t(e){console.warn("SymbolInfo validation: "+e)}if(void 0!==e.exchange&&0!==e.exchange.length||t("exchange must be provided to the symbol information"),e.has_empty_bars&&!f()&&t('both has_empty_bars field and featureset "disable_resolution_rebuild" are enabled and may cause data issues (see #3329)'),(void 0===e.minmov||e.minmov<=0)&&t("minmov must be positive"),(void 0===e.pricescale||e.pricescale<=0)&&t("pricescale must be positive"),void 0!==e.name&&0!==e.name.length||t("name must be non-empty string"),void 0!==e.session&&0!==e.session.length||t("session must be non-empty string"),void 0!==e.holidays&&t("field holidays is deprecated, use session_holidays instead"),void 0!==e.has_no_volume&&t("field has_no_volume is deprecated, use visible_plots_set instead"),void 0===e.timezone||0===e.timezone.length?t("timezone must be non-empty string"):"exchange"!==e.timezone&&g(e.timezone)||"UTC"!==e.timezone&&t('unsupported timezone "{0}"'.format(e.timezone)),void 0!==e.intraday_multipliers){var i=e.intraday_multipliers c._resolveRequests[R(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},V.prototype._resolveSymbolInternal=function(e,t,i,s){var r=this;return new Promise(function(n,o){const a=[e,t,i,s].filter((e=>!!e)).join("|");this._logMessage("Symbol resolve requested: `{0}` ".format(a));var l=!0;this._externalDatafeed.resolveSymbol(e,(function(e){l&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),r._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(a,JSON.stringify(e))),function(e){const t=e.exchange+":"+e.name;if(e.full_name=t,e.pro_name=t,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.ticker||(e.ticker=e.symbol||e.name),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),e.supported_resolutions)for(var i=0;i<e.supported_resolutions.length;i++){var s=d.parse(e.supported_resolutions[i]);s.isValid()&&(e.supported_resolutions[i]=s.value())}if(e.price_sources||(e.price_sources=[]),e["is-tickbars-available"]=!!e.has_ticks,delete e.has_ticks,I&&Array.isArray(e.subsessions))for(let t=0;t<e.subsessions.length;t++){const i=e.subsessions[t];switch(i.id){case P.Regular:case P.Extended:i.private=!1;break;case P.PreMarket:case P.PostMarket:i.private=!0}}}(e),function(e){function t(e){console.warn("SymbolInfo validation: "+e)}if(void 0!==e.exchange&&0!==e.exchange.length||t("exchange must be provided to the symbol information"),e.has_empty_bars&&!f()&&t('both has_empty_bars field and featureset "disable_resolution_rebuild" are enabled and may cause data issues (see #3329)'),(void 0===e.minmov||e.minmov<=0)&&t("minmov must be positive"),(void 0===e.pricescale||e.pricescale<=0)&&t("pricescale must be positive"),void 0!==e.name&&0!==e.name.length||t("name must be non-empty string"),void 0!==e.session&&0!==e.session.length||t("session must be non-empty string"),void 0!==e.holidays&&t("field holidays is deprecated, use session_holidays instead"),void 0!==e.has_no_volume&&t("field has_no_volume is deprecated, use visible_plots_set instead"),void 0===e.timezone||0===e.timezone.length?t("timezone must be non-empty string"):"exchange"!==e.timezone&&g(e.timezone)||"UTC"!==e.timezone&&t('unsupported timezone "{0}"'.format(e.timezone)),void 0!==e.intraday_multipliers){var i=e.intraday_multipliers
;if(Array.isArray(i))for(var s=0;s<i.length;++s)"string"!=typeof i[s]&&t('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(s+1,i[s],typeof i[s]));else t("intraday_multipliers must be array")}(e.supported_resolutions||[]).filter((function(e){return!d.isValid(e)})).forEach((function(e){t("supported_resolutions field contains invalid value: "+e)})),I||(void 0!==e.subsessions&&t("Symbol info contains subsessions but the pre_post_market_sessions feature is not enabled, so the subsessions will be ignored"),void 0!==e.subsession_id&&t("Symbol info contains a subsession ID but the pre_post_market_sessions feature is not enabled, so the subsession ID will be ignored"))}(e),r._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(a,JSON.stringify(e))),n(e)}),(function(e){r._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(a,e)),o(e)}),{currencyCode:t,unitId:i,session:s}),l=!1}.bind(this))},V.prototype._createMarketStatusWatchers=function(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(let i=0;i<t.length;i+=1){const r=t[i];if(void 0===this._marketStatusWatchers[e][r]){const[t,i]=E(r);this._marketStatusWatchers[e][r]=new s(((s,n,o,a)=>this._resolveSymbolByName(t,i,o,(t=>{this.quoteRemoveSymbols(e,[r]),a(t)}))),e,r)}}},V.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},V.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},V.prototype._startQuotesSubscription=function(e){var t={},i=this;function s(t,s){var r=i._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||r&&r.marketStatus(),t.values.pricescale=s.pricescale,t.values.minmov=s.minmov,t.values.minmove2=s.minmove2||0,t.values.fractional=s.fractional||!1,L(s.logo_urls,s.exchange_logo,t.values),r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function r(e){e.forEach((function(e){void 0!==t[e.n]?null!==t[e.n]&&s(e,t[e.n]):i._resolveSymbolByName(e.n,null,(function(i){t[e.n]=i,s(e,i)}),(function(){t[e.n]=null}))}))}var n=this._quotesInfo[e].symbols;if(0===n.length)return;const o=n.map((e=>E(e)[0]));this._externalDatafeed.getQuotes&&!C.enabled("charting_library")?this._externalDatafeed.getQuotes(o,(function(t){i._quotesInfo[e]&&0!==i._quotesInfo[e].symbols.length&&(r(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(o,i._quotesInfo[e].fastSymbols,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&C.enabled("trading_terminal")&&setTimeout((function(){r(o.map((function(e){return{n:e,s:"ok",v:{}}})))})), ;if(Array.isArray(i))for(var s=0;s<i.length;++s)"string"!=typeof i[s]&&t('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(s+1,i[s],typeof i[s]));else t("intraday_multipliers must be array")}(e.supported_resolutions||[]).filter((function(e){return!d.isValid(e)})).forEach((function(e){t("supported_resolutions field contains invalid value: "+e)})),I||(void 0!==e.subsessions&&t("Symbol info contains subsessions but the pre_post_market_sessions feature is not enabled, so the subsessions will be ignored"),void 0!==e.subsession_id&&t("Symbol info contains a subsession ID but the pre_post_market_sessions feature is not enabled, so the subsession ID will be ignored"))}(e),r._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(a,JSON.stringify(e))),n(e)}),(function(e){r._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(a,e)),o(e)}),{currencyCode:t,unitId:i,session:s}),l=!1}.bind(this))},V.prototype._createMarketStatusWatchers=function(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(let i=0;i<t.length;i+=1){const r=t[i];if(void 0===this._marketStatusWatchers[e][r]){const[t,i]=E(r);this._marketStatusWatchers[e][r]=new s(((s,n,o,a)=>this._resolveSymbolByName(t,i,o,(t=>{this.quoteRemoveSymbols(e,[r]),a(t)}))),e,r)}}},V.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},V.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},V.prototype._startQuotesSubscription=function(e){var t={},i=this;function s(t,s){var r=i._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||r&&r.marketStatus(),t.values.pricescale=s.pricescale,t.values.minmov=s.minmov,t.values.minmove2=s.minmove2||0,t.values.fractional=s.fractional||!1,L(s.logo_urls,s.exchange_logo,t.values),r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function r(e){e.forEach((function(e){if(void 0!==t[e.n])null!==t[e.n]&&s(e,t[e.n]);else{const[r,n]=E(e.n);i._resolveSymbolByName(r,n,(function(i){t[e.n]=i,s(e,i)}),(function(){t[e.n]=null}))}}))}var n=this._quotesInfo[e].symbols;if(0===n.length)return;const o=n.map((e=>E(e)[0])),a=this._quotesInfo[e].fastSymbols.map((e=>E(e)[0]));this._externalDatafeed.getQuotes&&!C.enabled("charting_library")?this._externalDatafeed.getQuotes(o,(function(t){i._quotesInfo[e]&&0!==i._quotesInfo[e].symbols.length&&(r(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(o,a,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&C.enabled("trading_terminal")&&setTimeout((function(){r(o.map((function(e){return{n:e,
this._createMarketStatusWatchers(e,n)},V.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},V.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},V.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},V.prototype.quoteSetFields=function(e,t){},V.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},V.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},V.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},V.prototype.quoteHibernateAll=function(e){},V.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},V.prototype._startDepthSubscription=function(e){var t=this,i=this._depthInfo[e].symbol;function s(e){return e.map((function(e){return{p:e.price,v:e.volume}}))}function r(e){var t={};return t.s=i,t.bids=s(e.bids),t.asks=s(e.asks),t}i&&this._externalDatafeed.subscribeDepth&&(t._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(i,(function(i){var s;t._depthInfo[e]&&((s=i).snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([r(s)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([r(s)])))})))},V.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},V.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},V.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},V.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},V.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},V.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},V.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},V.prototype.serverTimeOffset=function(){return this._serverTimeOffset},V.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},V.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},V.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},V.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo s:"ok",v:{}}})))})),this._createMarketStatusWatchers(e,n)},V.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},V.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},V.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},V.prototype.quoteSetFields=function(e,t){},V.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},V.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},V.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},V.prototype.quoteHibernateAll=function(e){},V.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},V.prototype._startDepthSubscription=function(e){var t=this,i=this._depthInfo[e].symbol;function s(e){return e.map((function(e){return{p:e.price,v:e.volume}}))}function r(e){var t={};return t.s=i,t.bids=s(e.bids),t.asks=s(e.asks),t}i&&this._externalDatafeed.subscribeDepth&&(t._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(i,(function(i){var s;t._depthInfo[e]&&((s=i).snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([r(s)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([r(s)])))})))},V.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},V.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},V.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},V.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},V.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},V.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},V.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},V.prototype.serverTimeOffset=function(){return this._serverTimeOffset},V.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},V.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},V.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},V.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo
;return void 0!==i&&(C.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||C.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=V},76537:(e,t,i)=>{"use strict";i.d(t,{SymbolExtrapolator:()=>c});var s=i(50151),r=i(78071),n=i(60156),o=i(94421),a=i(36274);function l(e,t){return e.length>t}class c{constructor(e,t,i=2e5){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=a.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,n.newBarBuilder)(t,new n.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],n=this._barsTimes[this._barsTimes.length-1],o=i>n?this._barsTimes.length:(0,r.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,s.assert)(-1!==this._projectionFirstIndex,"something went wrong"),n!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this._ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this._timeOfBarIndex(i.index+t);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&&e<this._firstRealBarTimeMs){this._ensureExtrapolatedToHistoryTime(e);let t=(0,r.lowerbound_int)(this._historyBarsCache,e) ;return void 0!==i&&(C.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||C.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=V},76537:(e,t,i)=>{"use strict";i.d(t,{SymbolExtrapolator:()=>c});var s=i(50151),r=i(78071),n=i(60156),o=i(94421),a=i(36274);function l(e,t){return e.length>t}class c{constructor(e,t,i=2e5){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=a.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,n.newBarBuilder)(t,new n.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],n=this._barsTimes[this._barsTimes.length-1],o=i>n?this._barsTimes.length:(0,r.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,s.assert)(-1!==this._projectionFirstIndex,"something went wrong"),n!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this._ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this._timeOfBarIndex(i.index+t);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&&e<this._firstRealBarTimeMs){this._ensureExtrapolatedToHistoryTime(e);let t=(0,r.lowerbound_int)(this._historyBarsCache,e)
;if(0!==this._historyBarsCache.length&&0===t&&e<this._historyBarsCache[0])return null;t!==this._historyBarsCache.length&&this._historyBarsCache[t]===e||(t-=1);return{index:t-this._historyBarsCache.length,timeMs:this._historyBarsCache[t]}}if(null!==this._lastRealBarTimeMs&&e>this._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0,r.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,s.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length)return null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs?{index:0,timeMs:(0,s.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,r.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){this._ensureExtrapolatedToFutureTime(e)}_setLastRealBarTime(e){const t=this._futureBarsCache.length,i=(0,r.upperbound_int)(this._futureBarsCache,e);0===i?this._extendFutureCacheToTimeFromLeft(e):(this._lastRealBarTimeMs=e,this._futureBarsCache=this._futureBarsCache.slice(i)),this._ensureExtrapolatedToFutureBar(Math.max(t,this._minFutureBarsCount))}_timeOfBarIndex(e){var t;if(e<0){const t=Math.abs(e);this._ensureExtrapolatedToHistoryBar(t);const i=this._historyBarsCache.length-t;return i<0?null:{timeMs:this._historyBarsCache[i],exact:!1}}if(0===e&&0===this._barsTimes.length)return{timeMs:(0,s.ensureNotNull)(null!==(t=this._firstRealBarTimeMs)&&void 0!==t?t:this._lastRealBarTimeMs),exact:!1};if(e>=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:e<this._projectionFirstIndex}}_extendFutureCacheFromRight(e){const t=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;const i=e(t,this._futureBarsCache.length);return 0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){const t=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;const i=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,s.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;const t=(0, ;if(0!==this._historyBarsCache.length&&0===t&&e<this._historyBarsCache[0])return null;t!==this._historyBarsCache.length&&this._historyBarsCache[t]===e||(t-=1);return{index:t-this._historyBarsCache.length,timeMs:this._historyBarsCache[t]}}if(null!==this._lastRealBarTimeMs&&e>this._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0,r.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,s.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length)return null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs?{index:0,timeMs:(0,s.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,r.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){this._ensureExtrapolatedToFutureTime(e)}_setLastRealBarTime(e){const t=this._futureBarsCache.length,i=(0,r.upperbound_int)(this._futureBarsCache,e);0===i?this._extendFutureCacheToTimeFromLeft(e):(this._lastRealBarTimeMs=e,this._futureBarsCache=this._futureBarsCache.slice(i)),this._ensureExtrapolatedToFutureBar(Math.max(t,this._minFutureBarsCount))}_timeOfBarIndex(e){var t;if(e<0){const t=Math.abs(e);this._ensureExtrapolatedToHistoryBar(t);const i=this._historyBarsCache.length-t;return i<0?null:{timeMs:this._historyBarsCache[i],exact:!1}}if(0===e&&0===this._barsTimes.length)return{timeMs:(0,s.ensureNotNull)(null!==(t=this._firstRealBarTimeMs)&&void 0!==t?t:this._lastRealBarTimeMs),exact:!1};if(e>=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:e<this._projectionFirstIndex}}_extendFutureCacheFromRight(e){const t=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;const i=e(t,this._futureBarsCache.length);return 0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){const t=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;const i=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,s.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;const t=(0,
o.extrapolateBarsFrontToTime)(this._barBuilder,e,this._futureBarsCache[0]-1,this._extrapolateLimit,!0).times;this._futureBarsCache=t.concat(this._futureBarsCache)}_extendHistoryCacheToTimeFromRight(e){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs>=e)return;if((0,s.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||l(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times))}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||l(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]<e&&this._ensureExtrapolatedToFutureBar(this._futureBarsCache.length+1))}_ensureExtrapolatedToHistoryBar(e){this._historyBarsCache.length>=e||l(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||l(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}},61595:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(58844)},47327:(e,t,i)=>{"use strict";i.d(t,{HandlerInfo:()=>s});class s{constructor(e,t){this.handler=e,this.customId=t}}},17133:(e,t,i)=>{"use strict";var s,r;function n(e,t){return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}i.d(t,{TIMEFRAMETYPE:()=>r,areEqualTimeFrames:()=>n}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={}))},89173:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}}, o.extrapolateBarsFrontToTime)(this._barBuilder,e,this._futureBarsCache[0]-1,this._extrapolateLimit,!0).times;this._futureBarsCache=t.concat(this._futureBarsCache)}_extendHistoryCacheToTimeFromRight(e){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs>=e)return;if((0,s.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||l(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times))}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||l(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]<e&&this._ensureExtrapolatedToFutureBar(this._futureBarsCache.length+1))}_ensureExtrapolatedToHistoryBar(e){this._historyBarsCache.length>=e||l(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||l(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}},61595:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(58844)},47327:(e,t,i)=>{"use strict";i.d(t,{HandlerInfo:()=>s});class s{constructor(e,t){this.handler=e,this.customId=t}}},17133:(e,t,i)=>{"use strict";var s,r;function n(e,t){return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}i.d(t,{TIMEFRAMETYPE:()=>r,areEqualTimeFrames:()=>n}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={}))},89173:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},
@@ -287,12 +288,12 @@ Ve.isDataSource)(e)&&!o.includes(e))&&!u.has(e.id())));_.forEach((e=>u.add(e.id(
return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e,t){var i;let s=null;const r=this._chartModel();if(null!==e&&(s=e.isCustom?r.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==s){const e=this._lastClickedSource.id;let i=this._lastClickedSource.isCustom?r.customSourceForName(e):r.dataSourceForId(e);null!==i||this._lastClickedSource.isCustom||(i=r.dataSourceForId(e)),null!==i&&i.onClickOutside&&(i.onClickOutside(t),this._chartModel().updateSource(i))}this._lastClickedSource=null!==s?{id:s,isCustom:null!==(i=null==e?void 0:e.isCustom)&&void 0!==i&&i}:null}_mouseClickOrTapEvent(e){var t;if(!this.hasState())return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i&&i.source,n=this._chartUndoModel(),o=Boolean(null===(t=null==i?void 0:i.hittest.data())||void 0===t?void 0:t.hideCrosshairLinesOnHover);this._processOutsideClick(i,e),!this._isSelectPointModeEnabled()||o||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||n.crossHairSource().trySelectCurrentPoint(),null!==i&&i.hittest.tryCallClickOrTapHandler(e)&&n.model().updateSource((0,r.ensureNotNull)(s)),!e.isTouch||this._isSelectPointModeEnabled()||i&&i.source===n.crossHairSource()||this._tryExitTrackingMode(),s&&(0,Q.isLineTool)(s)&&this._lastFinishedToolId!==s.id()&&(0,a.emit)("drawing_event",s.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e,t){var i,s,n,o,l,c;if(this._pressedMoveStage=1,this._preventScrollUntilNextMouseDownOrTouchStart=!1,e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null,this._chartModel().stopTimeScaleAnimation(),e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}(0,a.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),this._updateCommonTooltip(null);const h=this._chartUndoModel(),d=new Ee.EnvironmentState(e);h.mainSeries().clearGotoDateResult();const u=this.state().defaultPriceScale();if(u.isEmpty()||h.timeScale().isEmpty())return;const p=h.crossHairSource();if(!e.isTouch&&!(0,Ot.isLineDrawnWithPressedButton)(Be.tool.value())){const t=h.lineBeingCreated(),i=null!==t?h.model().paneForSource(t):null;null!==i&&i!==this._state?this._setCursorPositionOnExternalPane(i,e.localX,e.localY,d):this.setCursorPosition(e.localX,e.localY,d)}e.isTouch&&(0,Ot.isLineToolName)(Be.tool.value())&&((0,Ot.isLineDrawnWithPressedButton)(Be.tool.value())||null!==p.pane?(0, return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e,t){var i;let s=null;const r=this._chartModel();if(null!==e&&(s=e.isCustom?r.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==s){const e=this._lastClickedSource.id;let i=this._lastClickedSource.isCustom?r.customSourceForName(e):r.dataSourceForId(e);null!==i||this._lastClickedSource.isCustom||(i=r.dataSourceForId(e)),null!==i&&i.onClickOutside&&(i.onClickOutside(t),this._chartModel().updateSource(i))}this._lastClickedSource=null!==s?{id:s,isCustom:null!==(i=null==e?void 0:e.isCustom)&&void 0!==i&&i}:null}_mouseClickOrTapEvent(e){var t;if(!this.hasState())return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i&&i.source,n=this._chartUndoModel(),o=Boolean(null===(t=null==i?void 0:i.hittest.data())||void 0===t?void 0:t.hideCrosshairLinesOnHover);this._processOutsideClick(i,e),!this._isSelectPointModeEnabled()||o||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||n.crossHairSource().trySelectCurrentPoint(),null!==i&&i.hittest.tryCallClickOrTapHandler(e)&&n.model().updateSource((0,r.ensureNotNull)(s)),!e.isTouch||this._isSelectPointModeEnabled()||i&&i.source===n.crossHairSource()||this._tryExitTrackingMode(),s&&(0,Q.isLineTool)(s)&&this._lastFinishedToolId!==s.id()&&(0,a.emit)("drawing_event",s.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e,t){var i,s,n,o,l,c;if(this._pressedMoveStage=1,this._preventScrollUntilNextMouseDownOrTouchStart=!1,e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null,this._chartModel().stopTimeScaleAnimation(),e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}(0,a.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),this._updateCommonTooltip(null);const h=this._chartUndoModel(),d=new Ee.EnvironmentState(e);h.mainSeries().clearGotoDateResult();const u=this.state().defaultPriceScale();if(u.isEmpty()||h.timeScale().isEmpty())return;const p=h.crossHairSource();if(!e.isTouch&&!(0,Ot.isLineDrawnWithPressedButton)(Be.tool.value())){const t=h.lineBeingCreated(),i=null!==t?h.model().paneForSource(t):null;null!==i&&i!==this._state?this._setCursorPositionOnExternalPane(i,e.localX,e.localY,d):this.setCursorPosition(e.localX,e.localY,d)}e.isTouch&&(0,Ot.isLineToolName)(Be.tool.value())&&((0,Ot.isLineDrawnWithPressedButton)(Be.tool.value())||null!==p.pane?(0,
Ot.isLineDrawnWithPressedButton)(Be.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const _=(0,r.ensureNotNull)(this.state().mainDataSource()).firstValue();if(null===_)return void(this._chart.readOnly()||(this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,d),null!==t&&(0,Rt.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this)));let m=u.coordinateToPrice(e.localY,_),g=this._chartModel().timeScale().coordinateToIndex(e.localX);if(p.startMeasurePoint()&&p.endMeasurePoint()&&p.clearMeasure(),d.shift()&&(null===t||!(null===(s=null===(i=t.hittest.data())||void 0===i?void 0:i.hasOwnShortcutsBehaviourFor)||void 0===s?void 0:s.shiftKey))&&(0,Be.toolIsCursor)(Be.tool.value())&&h.selection().isEmpty()&&Be.tool.setValue("measure"),(e.isTouch&&!e.stylus||!this._tryStartMeasure(e,p,d,m,g))&&(e.isTouch&&!e.stylus||!this._tryFinishMeasure(e,p))&&!this._tryFinishZoom(e)&&!this._tryStartZoom(e,m,g,d)){if(e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=p.currentPoint(),this._startTrackPoint=new Ae.Point(e.localX,e.localY)):this._isSelectPointModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(e.localX,e.localY),new Ee.EnvironmentState(e))),e.isTouch&&(this._preventSourceChange=null===t||!h.selection().isSelected(t.source)),!this._isSelectPointModeEnabled()&&!this._isScrolling){if(e.isTouch&&!e.stylus&&((0,Be.toolIsMeasure)(Be.tool.value())||null!==p.measurePane().value()))return void this._initToolCreationModeParams(e);if((0,Ot.isLineToolName)(Be.tool.value())||h.lineBeingCreated())return d.shift()||h.selectionMacro((e=>e.clearSelection())),void this._mouseDownEventForLineTool(e,d,g,m)}if(null!==t&&t.hittest.tryCallMouseDownOrTouchStartHandler(e),!this._chart.readOnly()){const i=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,d);if(null!==t&&!this._preventSourceChange){const i=t.hittest.data();if(t.isCustom){if(t.hittest.hasPressedMoveHandler(e))return h.model().setMovingCustomSource(t.source,i),this._preventScrollUntilNextMouseDownOrTouchStart=!0,this._currentMovingHitTest={sourceAtPoint:t,cancelledContainer:null!==(n=h.model().customSourceMovingHitTestData())&&void 0!==n?n:void 0},void h.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,r.ensureNotNull)(t.source),(0,r.ensureNotNull)(i))}))}else if((null==i?void 0:i.areaName)===ke.AreaName.SourceItemMove){const s=null==i?void 0:i.activeItem;if(void 0!==s)return h.startCustomMoving(t.source,s,e),this._currentMovingHitTest={sourceAtPoint:t},void h.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,r.ensureNotNull)(t.source),(0,r.ensureNotNull)(i))}))}}if(null!==t&&this._tryHandleEraserMouseDown(t,d))return;const s=null!==t&&(0,Q.isLineTool)(t.source)&&t.source.isLocked&&t.source.isLocked();if(!((0,Be.lockDrawings)().value()||s)&&null!==t&&!t.isCustom){if(!t.source.userEditEnabled())return Ot.isLineDrawnWithPressedButton)(Be.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const _=(0,r.ensureNotNull)(this.state().mainDataSource()).firstValue();if(null===_)return void(this._chart.readOnly()||(this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,d),null!==t&&(0,Rt.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this)));let m=u.coordinateToPrice(e.localY,_),g=this._chartModel().timeScale().coordinateToIndex(e.localX);if(p.startMeasurePoint()&&p.endMeasurePoint()&&p.clearMeasure(),d.shift()&&(null===t||!(null===(s=null===(i=t.hittest.data())||void 0===i?void 0:i.hasOwnShortcutsBehaviourFor)||void 0===s?void 0:s.shiftKey))&&(0,Be.toolIsCursor)(Be.tool.value())&&h.selection().isEmpty()&&Be.tool.setValue("measure"),(e.isTouch&&!e.stylus||!this._tryStartMeasure(e,p,d,m,g))&&(e.isTouch&&!e.stylus||!this._tryFinishMeasure(e,p))&&!this._tryFinishZoom(e)&&!this._tryStartZoom(e,m,g,d)){if(e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=p.currentPoint(),this._startTrackPoint=new Ae.Point(e.localX,e.localY)):this._isSelectPointModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(e.localX,e.localY),new Ee.EnvironmentState(e))),e.isTouch&&(this._preventSourceChange=null===t||!h.selection().isSelected(t.source)),!this._isSelectPointModeEnabled()&&!this._isScrolling){if(e.isTouch&&!e.stylus&&((0,Be.toolIsMeasure)(Be.tool.value())||null!==p.measurePane().value()))return void this._initToolCreationModeParams(e);if((0,Ot.isLineToolName)(Be.tool.value())||h.lineBeingCreated())return d.shift()||h.selectionMacro((e=>e.clearSelection())),void this._mouseDownEventForLineTool(e,d,g,m)}if(null!==t&&t.hittest.tryCallMouseDownOrTouchStartHandler(e),!this._chart.readOnly()){const i=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,d);if(null!==t&&!this._preventSourceChange){const i=t.hittest.data();if(t.isCustom){if(t.hittest.hasPressedMoveHandler(e))return h.model().setMovingCustomSource(t.source,i),this._preventScrollUntilNextMouseDownOrTouchStart=!0,this._currentMovingHitTest={sourceAtPoint:t,cancelledContainer:null!==(n=h.model().customSourceMovingHitTestData())&&void 0!==n?n:void 0},void h.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,r.ensureNotNull)(t.source),(0,r.ensureNotNull)(i))}))}else if((null==i?void 0:i.areaName)===ke.AreaName.SourceItemMove){const s=null==i?void 0:i.activeItem;if(void 0!==s)return h.startCustomMoving(t.source,s,e),this._currentMovingHitTest={sourceAtPoint:t},void h.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,r.ensureNotNull)(t.source),(0,r.ensureNotNull)(i))}))}}if(null!==t&&this._tryHandleEraserMouseDown(t,d))return;const s=null!==t&&(0,Q.isLineTool)(t.source)&&t.source.isLocked&&t.source.isLocked();if(!((0,Be.lockDrawings)().value()||s)&&null!==t&&!t.isCustom){if(!t.source.userEditEnabled())return
;const s=null===(o=t.hittest.data())||void 0===o?void 0:o.snappingPrice,n=null===(l=t.hittest.data())||void 0===l?void 0:l.snappingIndex;let a=e.localY,h=e.localX;if(void 0!==s&&(a=(0,r.ensure)(null===(c=t.source)||void 0===c?void 0:c.priceScale()).priceToCoordinate(s,_),m=s),void 0!==n&&(h=this._chartModel().timeScale().indexToCoordinate(n),g=n),a===e.localY&&h===e.localX||(e={...e,localY:a,localX:h},this.setCursorPosition(e.localX,e.localY,d)),this._tryStartChangingLineTool(e,t,d,g))return void(this._currentChangingLineToolHitTest=t);if(this._currentChangingLineToolHitTest=null,(f=t.hittest.target())===ke.HitTarget.MovePoint||f===ke.HitTarget.MovePointBackground&&(0,pe.lastMouseOrTouchEventInfo)().isTouch){if(this._tryStartCloning(e,t,d,i))return;if(this._tryStartMovingLineTool(e,t,d,g))return void(this._currentMovingHitTest={sourceAtPoint:t});this._currentMovingHitTest=null}}if(null!==t&&(0,Rt.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this))return}var f;null!==t&&t.hittest.target()===ke.HitTarget.Regular||(this._processing=!0)}}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;this._pressedMoveStage=0;const s=e.isTouch&&null!==this._startTrackPoint,n=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null;const o=this._chartUndoModel(),l=o.model().customSourceMovingHitTestData();null!==l||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1;const c=o.model(),h=c.crossHairSource(),u=this._dataSourceAtPoint(e.localX,e.localY);if(h.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(h.selection());o.selectionMacro((t=>{let i=null;e.forEach((e=>{null===i&&(i=ni(u,e)),t.addSourceToSelection(e,i)}))})),h.clearSelection(),(0,d.trackEvent)("GUI","Multiselect","Area Select")}(0,a.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const p=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const _=new Ee.EnvironmentState(e),m=Be.tool.value();if(e.isTouch&&((0,Be.toolIsMeasure)(m)||null!==h.measurePane().value())){if(!p&&!e.stylus&&null===h.measurePane().value()&&h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY);if(!p&&!e.stylus&&this._tryStartMeasure(e,h,_,h.price,h.index))return;if((!p||e.stylus)&&this._tryFinishMeasure(e,h))return}if(e.isTouch&&!p&&!(0,Ot.isLineDrawnWithPressedButton)(m)&&(0,Ot.isLineToolName)(m)&&!o.lineBeingCreated()){if(this._chart.justActivated())return;if(h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY,_);const i=h.currentPoint(),s=this.state().defaultPriceScale(),n=(0,r.ensure)(null===(t=this.state().mainDataSource())||void 0===t?void 0:t.firstValue()),a={index:Math.round(o.timeScale().coordinateToIndex(i.x)),price:s.coordinateToPrice(i.y,n)},l=(0, ;const s=null===(o=t.hittest.data())||void 0===o?void 0:o.snappingPrice,n=null===(l=t.hittest.data())||void 0===l?void 0:l.snappingIndex;let a=e.localY,h=e.localX;if(void 0!==s&&(a=(0,r.ensure)(null===(c=t.source)||void 0===c?void 0:c.priceScale()).priceToCoordinate(s,_),m=s),void 0!==n&&(h=this._chartModel().timeScale().indexToCoordinate(n),g=n),a===e.localY&&h===e.localX||(e={...e,localY:a,localX:h},this.setCursorPosition(e.localX,e.localY,d)),this._tryStartChangingLineTool(e,t,d,g))return void(this._currentChangingLineToolHitTest=t);if(this._currentChangingLineToolHitTest=null,(f=t.hittest.target())===ke.HitTarget.MovePoint||f===ke.HitTarget.MovePointBackground&&(0,pe.lastMouseOrTouchEventInfo)().isTouch){if(this._tryStartCloning(e,t,d,i))return;if(this._tryStartMovingLineTool(e,t,d,g))return void(this._currentMovingHitTest={sourceAtPoint:t});this._currentMovingHitTest=null}}if(null!==t&&(0,Rt.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this))return}var f;null!==t&&t.hittest.target()===ke.HitTarget.Regular||(this._processing=!0)}}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;this._pressedMoveStage=0;const s=e.isTouch&&null!==this._startTrackPoint,n=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null;const o=this._chartUndoModel(),l=o.model().customSourceMovingHitTestData();null!==l||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1;const c=o.model(),h=c.crossHairSource(),u=this._dataSourceAtPoint(e.localX,e.localY);if(h.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(h.selection());o.selectionMacro((t=>{let i=null;e.forEach((e=>{null===i&&(i=ni(u,e)),t.addSourceToSelection(e,i)}))})),h.clearSelection(),(0,d.trackEvent)("GUI","Multiselect","Area Select")}(0,a.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const p=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const _=new Ee.EnvironmentState(e),m=Be.tool.value();if(e.isTouch&&((0,Be.toolIsMeasure)(m)||null!==h.measurePane().value())){if(!p&&!e.stylus&&null===h.measurePane().value()&&h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY);if(!p&&!e.stylus&&this._tryStartMeasure(e,h,_,h.price,h.index))return;if((!p||e.stylus)&&this._tryFinishMeasure(e,h))return}if(e.isTouch&&!p&&!(0,Ot.isLineDrawnWithPressedButton)(m)&&(0,Ot.isLineToolName)(m)&&!o.lineBeingCreated()){if(this._chart.justActivated())return;if(h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY,_);const i=h.currentPoint(),s=this.state().defaultPriceScale(),n=(0,r.ensure)(null===(t=this.state().mainDataSource())||void 0===t?void 0:t.firstValue()),a={index:Math.round(o.timeScale().coordinateToIndex(i.x)),price:s.coordinateToPrice(i.y,n)},l=(0,
r.ensureNotNull)(o.createLineTool({pane:this.state(),point:a,linetool:m}));return o.selectionMacro((e=>{e.addSourceToSelection(l)})),o.lineBeingCreated()||(this._finishTool(l,u),e.preventDefault()),void(this._startTouchPoint=null)}const g=o.lineBeingCreated();if(g&&!(0,Ot.isLineDrawnWithPressedButton)(g.toolname)&&e.isTouch&&(this._startTouchPoint||e.stylus)){if(this._startTouchPoint=null,!p||e.stylus){const t=g.points()[g.points().length-1],i=o.continueCreatingLine({index:t.index,price:t.price},new Ee.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(g,u),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,o.customMoveBeingProcessed())return void o.endCustomMoving();if(null!==l&&(l.beingMoved&&!l.cancelled&&((0,ke.tryCallHandler)(e,l.mouseUpHandler,l.touchEndHandler),this.setCursorForTool()),c.setMovingCustomSource(null,null),di(e,l)))return;if(c.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if((0,Ot.isLineDrawnWithPressedButton)(m)&&!this._isSelectPointModeEnabled()){const t=o.lineBeingCreated();null!==t&&((0,Nt.trackDrawingCreated)(t),t.finish());const s=this.state().defaultPriceScale();if(s.isEmpty())return;if(!t)return;const n=(0,r.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),a=s.coordinateToPrice(e.localY,n),l={index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:a};return void o.continueCreatingLine(l)}if(c.sourcesBeingMoved().length)return o.endMovingSource(!1,!1),c.sourcesBeingMoved().filter(Q.isLineTool).forEach((e=>{this.setCursorForTool(e)})),void c.invalidate(ue.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=e.localX>=0&&e.localX<this._size.width;if((!u||u.source!==h)&&t){const t=o.timeScale().coordinateToIndex(e.localX);c.onSyncScrollNeeded(t)}}const f=this._isScrolling,v=this._endScroll(e),S=this._paneWidgetsSharedState.draggingSource();if(null!==S){const t=e.target,i=this._chart.paneByCanvas(t);i&&i!==this&&(v&&o.undoHistory().undo(),o.mergeToPane(S,i.state()));if(this._chart.timeAxisByCanvas(t))if(c.isUnmergeAvailableForSource(S))v&&o.undoHistory().undo(),o.unmergeToNewBottomPane(S);else{const e=c.panes(),t=(0,r.ensureNotNull)(c.paneForSource(S)),i=e.indexOf(t);i!==e.length-1&&(v&&o.undoHistory().undo(),t.maximized().value()&&this._chart.toggleMaximizePane(null),o.movePane(i,e.length-1))}this._paneWidgetsSharedState.clearDraggingSource();const s=this._chart.getTimeScale();s&&s.restoreDefaultCursor();const n=this._chart.paneWidgets();for(let e=0;e<n.length;e++){const t=n[e];t===this&&u&&!u.isCustom?t.setCursorForTool(u.source||void 0):t.setCursorForTool(),t.leftPriceAxisesContainer().restoreDefaultCursor(),t.rightPriceAxisesContainer().restoreDefaultCursor()}}this._chart.readOnly()||s||_.mod()||f||n||null!==this._lastFinishedToolId||null!==u&&(u.hittest.target()>ke.HitTarget.MovePointBackground||(0,pe.lastMouseOrTouchEventInfo)().isTouch)&&o.selectionMacro((e=>{ r.ensureNotNull)(o.createLineTool({pane:this.state(),point:a,linetool:m}));return o.selectionMacro((e=>{e.addSourceToSelection(l)})),o.lineBeingCreated()||(this._finishTool(l,u),e.preventDefault()),void(this._startTouchPoint=null)}const g=o.lineBeingCreated();if(g&&!(0,Ot.isLineDrawnWithPressedButton)(g.toolname)&&e.isTouch&&(this._startTouchPoint||e.stylus)){if(this._startTouchPoint=null,!p||e.stylus){const t=g.points()[g.points().length-1],i=o.continueCreatingLine({index:t.index,price:t.price},new Ee.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(g,u),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,o.customMoveBeingProcessed())return void o.endCustomMoving();if(null!==l&&(l.beingMoved&&!l.cancelled&&((0,ke.tryCallHandler)(e,l.mouseUpHandler,l.touchEndHandler),this.setCursorForTool()),c.setMovingCustomSource(null,null),di(e,l)))return;if(c.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if((0,Ot.isLineDrawnWithPressedButton)(m)&&!this._isSelectPointModeEnabled()){const t=o.lineBeingCreated();null!==t&&((0,Nt.trackDrawingCreated)(t),t.finish(),"LineToolBrush"===t.toolname&&(0,a.emit)("drawing_event",t.id(),"create"));const s=this.state().defaultPriceScale();if(s.isEmpty())return;if(!t)return;const n=(0,r.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),l=s.coordinateToPrice(e.localY,n),c={index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:l};return void o.continueCreatingLine(c)}if(c.sourcesBeingMoved().length)return o.endMovingSource(!1,!1),c.sourcesBeingMoved().filter(Q.isLineTool).forEach((e=>{this.setCursorForTool(e)})),void c.invalidate(ue.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=e.localX>=0&&e.localX<this._size.width;if((!u||u.source!==h)&&t){const t=o.timeScale().coordinateToIndex(e.localX);c.onSyncScrollNeeded(t)}}const f=this._isScrolling,v=this._endScroll(e),S=this._paneWidgetsSharedState.draggingSource();if(null!==S){const t=e.target,i=this._chart.paneByCanvas(t);i&&i!==this&&(v&&o.undoHistory().undo(),o.mergeToPane(S,i.state()));if(this._chart.timeAxisByCanvas(t))if(c.isUnmergeAvailableForSource(S))v&&o.undoHistory().undo(),o.unmergeToNewBottomPane(S);else{const e=c.panes(),t=(0,r.ensureNotNull)(c.paneForSource(S)),i=e.indexOf(t);i!==e.length-1&&(v&&o.undoHistory().undo(),t.maximized().value()&&this._chart.toggleMaximizePane(null),o.movePane(i,e.length-1))}this._paneWidgetsSharedState.clearDraggingSource();const s=this._chart.getTimeScale();s&&s.restoreDefaultCursor();const n=this._chart.paneWidgets();for(let e=0;e<n.length;e++){const t=n[e];t===this&&u&&!u.isCustom?t.setCursorForTool(u.source||void 0):t.setCursorForTool(),t.leftPriceAxisesContainer().restoreDefaultCursor(),t.rightPriceAxisesContainer().restoreDefaultCursor()}}
e.clearSelection();const t=(0,r.ensureNotNull)(u.source);e.addSourceToSelection(t,ni(u,t))})),e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._resetMeasureIfRequired();const t=this._dataSourceAtPoint(e.localX,e.localY);this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const s=e.localX,r=e.localY;this._prevMoveEventPosition=new Ae.Point(s,r);const n=new Ee.EnvironmentState(e);if(null===this._firstZoomPoint){if(this._updateHoveredSource(t,n,e),!e.isTouch&&i.lineBeingCreated()){const e=i.lineBeingCreated(),t=null===e?null:i.model().paneForSource(e);if(null!==t&&t!==this._state)return void this._setCursorPositionOnExternalPane(t,s,r,n)}e.isTouch||this.setCursorPosition(s,r,n)}else this._processMouseMoveWhileZoom(e,n)}_pressedMouseOrTouchMoveEvent(e){var t;if(!this.hasState()||this._pinching||e.isTouch&&this._contextMenuOpenedOnLastTap)return;this._pressedMoveStage=2,this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const i=new Ee.EnvironmentState(e),s=this._chartUndoModel(),n=s.crossHairSource(),o=e.localX,a=e.localY;if(this._prevMoveEventPosition=new Ae.Point(o,a),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const l=Be.tool.value();if(e.isTouch&&this._startTouchPoint&&(0,Ot.isLineToolName)(l)&&!(0,Ot.isLineDrawnWithPressedButton)(l)&&!s.lineBeingCreated()&&!this._isSelectPointModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const c=n.measurePane().value();if(e.isTouch&&(this._startTouchPoint||e.stylus)&&((0,Be.toolIsMeasure)(l)||null!==c))return void(e.stylus?this.setCursorPosition(e.localX,e.localY,new Ee.EnvironmentState(e)):this._updateCrosshairPositionInToolCreationMode(e,c||this.state()));const h=s.lineBeingCreated();if(e.isTouch&&!e.stylus&&h&&!(0,Ot.isLineDrawnWithPressedButton)(h.toolname)){if(this._startTouchPoint){const t=(0,r.ensureNotNull)(s.lineBeingCreated()),i=(0,r.ensureNotNull)(s.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=(0,r.ensureNotNull)(this._initCrossHairPosition),t=new Ae.Point(o,a).subtract(this._startTrackPoint),s=e.add(t);this.setCursorPosition(s.x,s.y,i)}else e.isTouch&&this._preventCrossHairMove()||this.setCursorPosition(o,a,i);const d=this._isSelectPointModeEnabled();if((0,Ot.isLineToolName)(l)&&!(0,Ot.isLineDrawnWithPressedButton)(l)&&!d&&!i.mod())return;if((0,Ot.isLineDrawnWithPressedButton)(l)&&!d){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const n=s.lineBeingCreated();if(!n)return;const o=new Ae.Point(e.localX,e.localY),a=(0,r.ensure)(null===(t=n.ownerSource())||void 0===t?void 0:t.firstValue());return o.price=i.coordinateToPrice(e.localY,a),o.index=Math.round(s.timeScale().coordinateToIndex(e.localX)),void s.continueCreatingLine(o)} this._chart.readOnly()||s||_.mod()||f||n||null!==this._lastFinishedToolId||null!==u&&(u.hittest.target()>ke.HitTarget.MovePointBackground||(0,pe.lastMouseOrTouchEventInfo)().isTouch)&&o.selectionMacro((e=>{e.clearSelection();const t=(0,r.ensureNotNull)(u.source);e.addSourceToSelection(t,ni(u,t))})),e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._resetMeasureIfRequired();const t=this._dataSourceAtPoint(e.localX,e.localY);this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const s=e.localX,r=e.localY;this._prevMoveEventPosition=new Ae.Point(s,r);const n=new Ee.EnvironmentState(e);if(null===this._firstZoomPoint){if(this._updateHoveredSource(t,n,e),!e.isTouch&&i.lineBeingCreated()){const e=i.lineBeingCreated(),t=null===e?null:i.model().paneForSource(e);if(null!==t&&t!==this._state)return void this._setCursorPositionOnExternalPane(t,s,r,n)}e.isTouch||this.setCursorPosition(s,r,n)}else this._processMouseMoveWhileZoom(e,n)}_pressedMouseOrTouchMoveEvent(e){var t;if(!this.hasState()||this._pinching||e.isTouch&&this._contextMenuOpenedOnLastTap)return;this._pressedMoveStage=2,this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const i=new Ee.EnvironmentState(e),s=this._chartUndoModel(),n=s.crossHairSource(),o=e.localX,a=e.localY;if(this._prevMoveEventPosition=new Ae.Point(o,a),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const l=Be.tool.value();if(e.isTouch&&this._startTouchPoint&&(0,Ot.isLineToolName)(l)&&!(0,Ot.isLineDrawnWithPressedButton)(l)&&!s.lineBeingCreated()&&!this._isSelectPointModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const c=n.measurePane().value();if(e.isTouch&&(this._startTouchPoint||e.stylus)&&((0,Be.toolIsMeasure)(l)||null!==c))return void(e.stylus?this.setCursorPosition(e.localX,e.localY,new Ee.EnvironmentState(e)):this._updateCrosshairPositionInToolCreationMode(e,c||this.state()));const h=s.lineBeingCreated();if(e.isTouch&&!e.stylus&&h&&!(0,Ot.isLineDrawnWithPressedButton)(h.toolname)){if(this._startTouchPoint){const t=(0,r.ensureNotNull)(s.lineBeingCreated()),i=(0,r.ensureNotNull)(s.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=(0,r.ensureNotNull)(this._initCrossHairPosition),t=new Ae.Point(o,a).subtract(this._startTrackPoint),s=e.add(t);this.setCursorPosition(s.x,s.y,i)}else e.isTouch&&this._preventCrossHairMove()||this.setCursorPosition(o,a,i);const d=this._isSelectPointModeEnabled();if((0,Ot.isLineToolName)(l)&&!(0,Ot.isLineDrawnWithPressedButton)(l)&&!d&&!i.mod())return;if((0,Ot.isLineDrawnWithPressedButton)(l)&&!d){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const n=s.lineBeingCreated();if(!n)return;const o=new Ae.Point(e.localX,e.localY),a=(0,
if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(s.timeScale().isEmpty())return;const u=this._options.handleScroll;if((!u.pressedMouseMove||e.isTouch)&&(!u.horzTouchDrag&&!u.vertTouchDrag||!e.isTouch))return;if(s.customMoveBeingProcessed())return void s.processCustomMove(e);const p=s.model().customSourceMovingHitTestData();if(null!==p&&(this._updateCommonTooltip(null,!0),p.cancelled||(s.model().processingCustomSourceMove(),(0,ke.tryCallHandler)(e,p.pressedMouseMoveHandler,p.touchMoveHandler)),di(e,p)))return;if(s.model().lineBeingEdited())return void this.setCursorPosition(o,a,i);if(s.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(s.model().sourcesBeingMoved(),e.localX,e.localY,i);const _=this._dataSourceAtPoint(e.localX,e.localY);if(this._tryFinishClonning(e,new Ee.EnvironmentState(e),_))return;const m=(0,Be.toolIsMeasure)(l)||n.startMeasurePoint()&&n.endMeasurePoint();this._chart.readOnly()||!i.mod()||(0,Ot.isLineToolName)(l)||m||d?(this._processScroll(e),this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this.setCursorPosition(e.localX,e.localY,new Ee.EnvironmentState(e))):this._isSelecting||(n.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){var t;if(!this.hasState())return;const i=this._chartUndoModel();if(!i)return;const s=i.crossHairSource();e.isTouch||null!==s.measurePane().value()&&null===s.endMeasurePoint()||this._clearCursorPosition(),i.model().setHoveredSource(null,null),null!==this._prevHoveredHittest&&((0,ke.tryCallHandler)(e,null===(t=this._prevHoveredHittest.hittest.data())||void 0===t?void 0:t.mouseLeaveHandler),this._prevHoveredHittest=null),this._updateCommonTooltip(null),this._chart.unsetActivePaneWidget()}_mouseDoubleClickOrDoubleTapEvent(e){if(!this.hasState())return;const t=!this._chart.readOnly()&&!(0,Ot.isLineToolName)(Be.tool.value())&&this._dataSourceAtPoint(e.localX,e.localY)||null;if(null!==t&&t.isCustom)t.hittest.tryCallDblClickOrDblTapHandler(e);else if(null!==t&&(e.isTouch||t.hittest.target()>ke.HitTarget.MovePointBackground))this.processDoubleClickOnSource(t.source,t.hittest?t.hittest:void 0);else if(!this._chart.readOnly()&&!(0,Ot.isLineToolName)(Be.tool.value())&&!this._chartUndoModel().lineBeingCreated()&&this._chartUndoModel().selection().isEmpty()){const t=this.state();new Ee.EnvironmentState(e).mod()&&!t.maximized().value()?(t.collapsed().value()||this._chartModel().paneCollapsingAvailable().value())&&this._chartUndoModel().toggleCollapsedPane(this.state()):this._chart.toggleMaximizePane(this)}}_contextMenuEvent(e){const t=this._chartUndoModel();if(t.crossHairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return t.crossHairSource().clearMeasure(),void(0,Be.resetToCursor)(!0);if(this._pinching)return r.ensure)(null===(t=n.ownerSource())||void 0===t?void 0:t.firstValue());return o.price=i.coordinateToPrice(e.localY,a),o.index=Math.round(s.timeScale().coordinateToIndex(e.localX)),void s.continueCreatingLine(o)}if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(s.timeScale().isEmpty())return;const u=this._options.handleScroll;if((!u.pressedMouseMove||e.isTouch)&&(!u.horzTouchDrag&&!u.vertTouchDrag||!e.isTouch))return;if(s.customMoveBeingProcessed())return void s.processCustomMove(e);const p=s.model().customSourceMovingHitTestData();if(null!==p&&(this._updateCommonTooltip(null,!0),p.cancelled||(s.model().processingCustomSourceMove(),(0,ke.tryCallHandler)(e,p.pressedMouseMoveHandler,p.touchMoveHandler)),di(e,p)))return;if(s.model().lineBeingEdited())return void this.setCursorPosition(o,a,i);if(s.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(s.model().sourcesBeingMoved(),e.localX,e.localY,i);const _=this._dataSourceAtPoint(e.localX,e.localY);if(this._tryFinishClonning(e,new Ee.EnvironmentState(e),_))return;const m=(0,Be.toolIsMeasure)(l)||n.startMeasurePoint()&&n.endMeasurePoint();this._chart.readOnly()||!i.mod()||(0,Ot.isLineToolName)(l)||m||d?(this._processScroll(e),this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this.setCursorPosition(e.localX,e.localY,new Ee.EnvironmentState(e))):this._isSelecting||(n.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){var t;if(!this.hasState())return;const i=this._chartUndoModel();if(!i)return;const s=i.crossHairSource();e.isTouch||null!==s.measurePane().value()&&null===s.endMeasurePoint()||this._clearCursorPosition(),i.model().setHoveredSource(null,null),null!==this._prevHoveredHittest&&((0,ke.tryCallHandler)(e,null===(t=this._prevHoveredHittest.hittest.data())||void 0===t?void 0:t.mouseLeaveHandler),this._prevHoveredHittest=null),this._updateCommonTooltip(null),this._chart.unsetActivePaneWidget()}_mouseDoubleClickOrDoubleTapEvent(e){if(!this.hasState())return;const t=!this._chart.readOnly()&&!(0,Ot.isLineToolName)(Be.tool.value())&&this._dataSourceAtPoint(e.localX,e.localY)||null;if(null!==t&&t.isCustom)t.hittest.tryCallDblClickOrDblTapHandler(e);else if(null!==t&&(e.isTouch||t.hittest.target()>ke.HitTarget.MovePointBackground))this.processDoubleClickOnSource(t.source,t.hittest?t.hittest:void 0);else if(!this._chart.readOnly()&&!(0,Ot.isLineToolName)(Be.tool.value())&&!this._chartUndoModel().lineBeingCreated()&&this._chartUndoModel().selection().isEmpty()){const t=this.state();new Ee.EnvironmentState(e).mod()&&!t.maximized().value()?(t.collapsed().value()||this._chartModel().paneCollapsingAvailable().value())&&this._chartUndoModel().toggleCollapsedPane(this.state()):this._chart.toggleMaximizePane(this)}}_contextMenuEvent(e){const t=this._chartUndoModel()
;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,Be.toolIsCursor)(Be.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,Be.resetToCursor)(!0),this.setCursorForTool(),void(t.lineBeingCreated()&&t.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i?i.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const r=i&&i.hittest?i.hittest.target():0,n=r>=ke.HitTarget.Regular||r>=ke.HitTarget.MovePointBackground&&e.isTouch;this._chart.updateActions(),t.selectionMacro((t=>{null!==s&&n?t.selection().isSelected(s)||(t.clearSelection(),t.addSourceToSelection(s,ni(i,s))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())})),null!==i&&n&&null!==s&&((0,Ve.isDataSource)(s)&&s.hasContextMenu()?s.isSelectionEnabled()?this.showContextMenuForSelection(e):this.showContextMenuForSources([s],e):i.hittest.tryCallContextMenuHandler(e))}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crossHairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(i.x,e.localY),new Ee.EnvironmentState(e))}}async _showContextMenu(e){const t=e=>e instanceof H.Separator,i=this._customActions(),s=(await this._initActions(e)).filter((e=>null!==e));i.remove.forEach((e=>{for(let t=0;t<s.length;t++){const i=s[t];if(i instanceof H.Action&&i.getLabel()===e){s.splice(t,1);break}}}));const r=i.top.concat(s).concat(i.bottom);for(let e=r.length-1;e>0;e--)t(r[e])&&t(r[e-1])&&r.splice(e,1);r.length&&t(r[0])&&r.splice(0,1),r.length&&t(r[r.length-1])&&r.splice(r.length-1,1),qe.ContextMenuManager.showMenu(r,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}async _initActions(e){var t,i;const s=this._chart.actions(),r=[];if(this._chart.model().model().resetScalesAvailable().value()&&(r.push(s.chartReset),r.push(new H.Separator)),!this.state().isEmpty()&&R.enabled("datasource_copypaste")){const t=(0,ot.createActionCopyPrice)(this.state(),e.localY),i=(0,ot.createPasteAction)(this._chart,this.state());(t||i)&&(t&&r.push(t),i&&r.push(i),r.push(new H.Separator))}r[r.length-1]instanceof H.Separator||r.push(new H.Separator);return Boolean(null===(t=window.widgetbar)||void 0===t?void 0:t.widget("watchlist"))&&s.addToWatchlist&&r.push(s.addToWatchlist),R.enabled("text_notes")&&r.push(s.addToTextNotes),r[r.length-1]instanceof H.Separator||r.push(new H.Separator),r.push(this._createLockTimeAxisAction(e)),r.push(new H.Separator), ;if(t.crossHairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return t.crossHairSource().clearMeasure(),void(0,Be.resetToCursor)(!0);if(this._pinching)return;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,Be.toolIsCursor)(Be.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,Be.resetToCursor)(!0),this.setCursorForTool(),void(t.lineBeingCreated()&&t.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i?i.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const r=i&&i.hittest?i.hittest.target():0,n=r>=ke.HitTarget.Regular||r>=ke.HitTarget.MovePointBackground&&e.isTouch;this._chart.updateActions(),t.selectionMacro((t=>{null!==s&&n?t.selection().isSelected(s)||(t.clearSelection(),t.addSourceToSelection(s,ni(i,s))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())})),null!==i&&n&&null!==s&&((0,Ve.isDataSource)(s)&&s.hasContextMenu()?s.isSelectionEnabled()?this.showContextMenuForSelection(e):this.showContextMenuForSources([s],e):i.hittest.tryCallContextMenuHandler(e))}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crossHairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(i.x,e.localY),new Ee.EnvironmentState(e))}}async _showContextMenu(e){const t=e=>e instanceof H.Separator,i=this._customActions(),s=(await this._initActions(e)).filter((e=>null!==e));i.remove.forEach((e=>{for(let t=0;t<s.length;t++){const i=s[t];if(i instanceof H.Action&&i.getLabel()===e){s.splice(t,1);break}}}));const r=i.top.concat(s).concat(i.bottom);for(let e=r.length-1;e>0;e--)t(r[e])&&t(r[e-1])&&r.splice(e,1);r.length&&t(r[0])&&r.splice(0,1),r.length&&t(r[r.length-1])&&r.splice(r.length-1,1),qe.ContextMenuManager.showMenu(r,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}async _initActions(e){var t,i;const s=this._chart.actions(),r=[];if(this._chart.model().model().resetScalesAvailable().value()&&(r.push(s.chartReset),r.push(new H.Separator)),!this.state().isEmpty()&&R.enabled("datasource_copypaste")){const t=(0,ot.createActionCopyPrice)(this.state(),e.localY),i=(0,ot.createPasteAction)(this._chart,this.state());(t||i)&&(t&&r.push(t),i&&r.push(i),r.push(new H.Separator))}r[r.length-1]instanceof H.Separator||r.push(new H.Separator);return Boolean(null===(t=window.widgetbar)||void 0===t?void 0:t.widget("watchlist"))&&s.addToWatchlist&&r.push(s.addToWatchlist),
!R.enabled("charting_library_base")&&s.applyColorTheme&&r.push(s.applyColorTheme),r[r.length-1]instanceof H.Separator||r.push(new H.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(r.push(s.applyStudiesToAllCharts),r.push(new H.Separator)),r.push(s.paneRemoveAllDrawingTools),r.push(s.paneRemoveAllStudies),r.push(new H.Separator),(null===(i=window.pro)||void 0===i?void 0:i.hasPackage("mtp-mtpredictor"))&&this.state().containsMainSeries()&&r.push((0,ot.createMTPredictorActions)(this._chart,this.state(),this._contextMenuX,this._contextMenuY),new H.Separator),r.push(s.hideAllMarks),r.push(new H.Separator),R.enabled("show_chart_property_page")&&r.push(s.chartProperties),r[r.length-1]instanceof H.Separator&&r.pop(),r}_loadAndCreateLegendWidget(){Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,62553)).then((e=>{if(this._isDestroyed)return;const t=e.LegendWidget,i=(0,Le.deepExtend)({},this._options.legendWidget);i.canShowSourceCode=!this._chart.onWidget()&&!l.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled};const s=(0,E.combine)(((e,t)=>ci&&this._chart!==e&&!t),this._chart.chartWidgetCollection().activeChartWidget.weakReference(),this._chart.chartWidgetCollection().lock.crosshair.weakReference()),n=(0,E.combine)(((e,t)=>null!==e?e===this._state:(0,Be.toolIsMeasure)(t)),this._chartModel().crossHairSource().measurePane().weakReference(),Be.tool.weakReference());this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme().spawnOwnership(),s.ownership(),this._visuallyCollapsed.spawnOwnership(),n.ownership(),i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),updateActions:this._chart.updateActions.bind(this._chart),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart)}),this._div.appendChild(this._legendWidget.getElement()),this._legendWidget.updateLayout(),this._legendWidget.updateWidgetModeBySize(this._size),this._legendWidget.updateThemedColors(this._themedTopColor);for(const e of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(e,(0,r.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))}))}_loadAndCreatePaneControlsWidget(){ R.enabled("text_notes")&&r.push(s.addToTextNotes),r[r.length-1]instanceof H.Separator||r.push(new H.Separator),r.push(this._createLockTimeAxisAction(e)),r.push(new H.Separator),!R.enabled("charting_library_base")&&s.applyColorTheme&&r.push(s.applyColorTheme),r[r.length-1]instanceof H.Separator||r.push(new H.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(r.push(s.applyStudiesToAllCharts),r.push(new H.Separator)),r.push(s.paneRemoveAllDrawingTools),r.push(s.paneRemoveAllStudies),r.push(new H.Separator),(null===(i=window.pro)||void 0===i?void 0:i.hasPackage("mtp-mtpredictor"))&&this.state().containsMainSeries()&&r.push((0,ot.createMTPredictorActions)(this._chart,this.state(),this._contextMenuX,this._contextMenuY),new H.Separator),r.push(s.hideAllMarks),r.push(new H.Separator),R.enabled("show_chart_property_page")&&r.push(s.chartProperties),r[r.length-1]instanceof H.Separator&&r.pop(),r}_loadAndCreateLegendWidget(){Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,62553)).then((e=>{if(this._isDestroyed)return;const t=e.LegendWidget,i=(0,Le.deepExtend)({},this._options.legendWidget);i.canShowSourceCode=!this._chart.onWidget()&&!l.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled};const s=(0,E.combine)(((e,t)=>ci&&this._chart!==e&&!t),this._chart.chartWidgetCollection().activeChartWidget.weakReference(),this._chart.chartWidgetCollection().lock.crosshair.weakReference()),n=(0,E.combine)(((e,t)=>null!==e?e===this._state:(0,Be.toolIsMeasure)(t)),this._chartModel().crossHairSource().measurePane().weakReference(),Be.tool.weakReference());this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme().spawnOwnership(),s.ownership(),this._visuallyCollapsed.spawnOwnership(),n.ownership(),i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),updateActions:this._chart.updateActions.bind(this._chart),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart)}),this._div.appendChild(this._legendWidget.getElement()),this._legendWidget.updateLayout(),this._legendWidget.updateWidgetModeBySize(this._size),this._legendWidget.updateThemedColors(this._themedTopColor);for(const e of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(e,(0,r.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))}))}
Promise.all([Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,69289)),Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,59255))]).then((([e,t])=>{var i;if(this._isDestroyed)return;const s=e.PaneControlsWidget;this._paneControls=new s(this._chartUndoModel(),this,{backgroundThemeName:this._chart.backgroundTopTheme()},{toggleMaximizePane:this._chart.toggleMaximizePane.bind(this._chart)},this._div),this._paneControls.updateWidgetModeByWidth(this._size.width),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new t.default(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement()),(null===(i=this._state)||void 0===i?void 0:i.collapsed().value())&&this._chartModel().fullUpdate()}))}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+$t+Yt;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){this._chart.isActive()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift(Ee.EnvironmentState.create((0,j.shiftPressed)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&(0,Ot.isLineToolName)(Be.tool.value())&&t.crossHairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?(Be.isStudyEditingNow.value()&&this.setCursorPosition(t,i,e),this._alignSourcesThatBeingMoved(s,t,i,e)):this.setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&e.userEditEnabled())if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(Y.TabNames.symbol);else if((0,Q.isLineTool)(e)||(0,Z.isStudy)(e)){let i;const s=null==t?void 0:t.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=li.get(e))}this._chart.showChartPropertiesForSource(e,i).then((e=>{this._editDialog=e}))}}_initToolCreationModeParams(e){this._startTouchPoint=new Ae.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crossHairSource() _loadAndCreatePaneControlsWidget(){Promise.all([Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,69289)),Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,59255))]).then((([e,t])=>{var i;if(this._isDestroyed)return;const s=e.PaneControlsWidget;this._paneControls=new s(this._chartUndoModel(),this,{backgroundThemeName:this._chart.backgroundTopTheme()},{toggleMaximizePane:this._chart.toggleMaximizePane.bind(this._chart)},this._div),this._paneControls.updateWidgetModeByWidth(this._size.width),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new t.default(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement()),(null===(i=this._state)||void 0===i?void 0:i.collapsed().value())&&this._chartModel().fullUpdate()}))}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+$t+Yt;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){this._chart.isActive()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift(Ee.EnvironmentState.create((0,j.shiftPressed)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&(0,Ot.isLineToolName)(Be.tool.value())&&t.crossHairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?(Be.isStudyEditingNow.value()&&this.setCursorPosition(t,i,e),this._alignSourcesThatBeingMoved(s,t,i,e)):this.setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&e.userEditEnabled())if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(Y.TabNames.symbol);else if((0,Q.isLineTool)(e)||(0,Z.isStudy)(e)){let i;const s=null==t?void 0:t.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=li.get(e))}this._chart.showChartPropertiesForSource(e,i).then((e=>{this._editDialog=e}))}}_initToolCreationModeParams(e){this._startTouchPoint=new Ae.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crossHairSource()
;this._chart.justActivated()&&(this._initCrossHairPosition=i.currentPoint());const s=e.pageX,n=e.pageY,o=(0,r.ensureNotNull)(this._initCrossHairPosition),a=new Ae.Point(s,n).subtract((0,r.ensureNotNull)(this._startTouchPoint)),l=o.add(a);this.setCursorPosition(l.x,l.y,new Ee.EnvironmentState(e))}_priceAxisesContainer(e){return"left"===e?this._lhsPriceAxisesContainer:this._rhsPriceAxisesContainer}_recalculatePriceScales(e){const t=this.state();for(const i of t.leftPriceScales())t.recalculatePriceScale(i,e);for(const i of t.rightPriceScales())t.recalculatePriceScale(i,e);for(const i of t.sourcesByGroup().overlayPriceScaleSources())(0,Q.isLineTool)(i)||t.recalculatePriceScale(i.priceScale(),e)}_createLockTimeAxisAction(e){var t;const i=0===(null===(t=Be.crosshairLock.value())||void 0===t?void 0:t.type);return new H.Action({actionId:"Chart.Crosshair.LockVerticalCursor",options:{label:Jt,statName:"LockCursorInTime",checkable:!0,checked:i,onExecute:()=>this._toggleLockTimeAxis(e.localX,!i)}})}_toggleLockTimeAxis(e,t){if(t){const t=this._chartUndoModel().timeScale(),i=t.coordinateToIndex(e),s=t.points().roughTime(i);if(null!==s)return void Be.crosshairLock.setValue({type:0,time:s})}Be.crosshairLock.setValue(null)}_preventTouchEventsExceptPinch(){return this._paneWidgetsSharedState.hasTouchesOnOtherPanes(this)||null!==this._paneWidgetsSharedState.pinchingPane()}_updateHoveredSource(e,t,i){var s,r;const n=this._chartUndoModel(),o=n.model();let a=!1;const l=e&&e.source,c=this._chart.readOnly();if(o.crossHairSource().isReplaySelection())this._setCursorClassName("none");else if(!(!c||e&&(0,Q.isLineTool)(e.source))||this._editDialog&&this._editDialog.visible().value())c&&(o.setHoveredSource(null,null),this.setCursorForTool());else{const h=Be.tool.value();let d=null;if(!this._processing&&((0,Be.toolIsCursor)(h)||"eraser"===h&&!c||t.mod()||!n.lineBeingCreated())){const t=null==e?void 0:e.hittest;a=Boolean(null===(s=null==t?void 0:t.data())||void 0===s?void 0:s.hideCrosshairLinesOnHover),t&&t.target()>ke.HitTarget.MovePointBackground?(d=l,!(null==l?void 0:l.isHoveredEnabled())||"eraser"===h&&l===n.mainSeries()?o.setHoveredSource(null,null):o.setHoveredSource(l,t.data())):o.setHoveredSource(null,null)}c?this.setCursorForTool(d,t,Ft.PaneCursorType.Default):this._options.sourceSelectionEnabled&&(this._isSelectPointModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(d,t,null===(r=null==e?void 0:e.hittest.data())||void 0===r?void 0:r.cursorType));const u=o.customSourceBeingMoved(),p=null!==u?[u]:o.sourcesBeingMoved();if((!p.length||null!==e&&-1===p.indexOf(e.source))&&this._updateCommonTooltip(e),!c&&null!==e&&i&&e.hittest.hasPressedMoveHandler(i)){switch((e.hittest.data()||{}).cursorType){case Ft.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case Ft.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case Ft.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case Ft.PaneCursorType.DiagonalNwSeResize: ;this._chart.justActivated()&&(this._initCrossHairPosition=i.currentPoint());const s=e.pageX,n=e.pageY,o=(0,r.ensureNotNull)(this._initCrossHairPosition),a=new Ae.Point(s,n).subtract((0,r.ensureNotNull)(this._startTouchPoint)),l=o.add(a);this.setCursorPosition(l.x,l.y,new Ee.EnvironmentState(e))}_priceAxisesContainer(e){return"left"===e?this._lhsPriceAxisesContainer:this._rhsPriceAxisesContainer}_recalculatePriceScales(e){const t=this.state();for(const i of t.leftPriceScales())t.recalculatePriceScale(i,e);for(const i of t.rightPriceScales())t.recalculatePriceScale(i,e);for(const i of t.sourcesByGroup().overlayPriceScaleSources())(0,Q.isLineTool)(i)||t.recalculatePriceScale(i.priceScale(),e)}_createLockTimeAxisAction(e){var t;const i=0===(null===(t=Be.crosshairLock.value())||void 0===t?void 0:t.type);return new H.Action({actionId:"Chart.Crosshair.LockVerticalCursor",options:{label:Jt,statName:"LockCursorInTime",checkable:!0,checked:i,onExecute:()=>this._toggleLockTimeAxis(e.localX,!i)}})}_toggleLockTimeAxis(e,t){if(t){const t=this._chartUndoModel().timeScale(),i=t.coordinateToIndex(e),s=t.points().roughTime(i);if(null!==s)return void Be.crosshairLock.setValue({type:0,time:s})}Be.crosshairLock.setValue(null)}_preventTouchEventsExceptPinch(){return this._paneWidgetsSharedState.hasTouchesOnOtherPanes(this)||null!==this._paneWidgetsSharedState.pinchingPane()}_updateHoveredSource(e,t,i){var s,r;const n=this._chartUndoModel(),o=n.model();let a=!1;const l=e&&e.source,c=this._chart.readOnly();if(o.crossHairSource().isReplaySelection())this._setCursorClassName("none");else if(!(!c||e&&(0,Q.isLineTool)(e.source))||this._editDialog&&this._editDialog.visible().value())c&&(o.setHoveredSource(null,null),this.setCursorForTool());else{const h=Be.tool.value();let d=null;if(!this._processing&&((0,Be.toolIsCursor)(h)||"eraser"===h&&!c||t.mod()||!n.lineBeingCreated())){const t=null==e?void 0:e.hittest;a=Boolean(null===(s=null==t?void 0:t.data())||void 0===s?void 0:s.hideCrosshairLinesOnHover),t&&t.target()>ke.HitTarget.MovePointBackground?(d=l,!(null==l?void 0:l.isHoveredEnabled())||"eraser"===h&&l===n.mainSeries()?o.setHoveredSource(null,null):o.setHoveredSource(l,t.data())):o.setHoveredSource(null,null)}c?this.setCursorForTool(d,t,Ft.PaneCursorType.Default):this._options.sourceSelectionEnabled&&(this._isSelectPointModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(d,t,null===(r=null==e?void 0:e.hittest.data())||void 0===r?void 0:r.cursorType));const u=o.customSourceBeingMoved(),p=null!==u?[u]:o.sourcesBeingMoved();if((!p.length||null!==e&&-1===p.indexOf(e.source))&&this._updateCommonTooltip(e),!c&&null!==e&&i&&e.hittest.hasPressedMoveHandler(i)){switch((e.hittest.data()||{}).cursorType){case Ft.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case Ft.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case Ft.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case Ft.PaneCursorType.DiagonalNwSeResize:
this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),1!==this._pressedMoveStage&&o.crossHairSource().setLinesShouldBeHidden(a)}async _createErrorBlock(){const e=new(await oe());return this._div.insertBefore(e.container,this._topCanvasBinding.canvasElement.nextSibling),e}_customActions(){const e={top:[],bottom:[],remove:[]},t=this._chartUndoModel().timeScale(),i=this._state&&this._state.defaultPriceScale();if(!R.enabled("custom_items_in_context_menu"))return e;const s=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let n;if(i&&!i.isEmpty()){const e=(0,r.ensureNotNull)(this.state().mainDataSource()).firstValue();n=i.coordinateToPrice(this._contextMenuY,(0,r.ensureNotNull)(e))}return(0,a.emit)("onContextMenu",{unixtime:null!=s?s.getTime()/1e3:void 0,price:n,callback:t=>{[...t].forEach((t=>{if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{let i;i="-"===t.text?new H.Separator:new H.Action({actionId:"Chart.ExternalActionId",options:{label:t.text,onExecute:t.click}}),t.position&&"top"===t.position?e.top.push(i):e.bottom.push(i)}}))}}),e}_highlightPriceAxisByLabel(e){this._lhsPriceAxisesContainer.highlightPriceAxisByLabel(e),this._rhsPriceAxisesContainer.highlightPriceAxisByLabel(e)}_subscribeToState(){const e=this.state();e.onDestroyed().subscribe(this,this._onStateDestroyed,!0),e.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),e.maximized().subscribe(this._updateVisuallyCollapsed),e.collapsed().subscribe(this._updateVisuallyCollapsed)}_unsubscribeFromState(){const e=this.state();e.onDestroyed().unsubscribeAll(this),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.maximized().unsubscribe(this._updateVisuallyCollapsed),e.collapsed().unsubscribe(this._updateVisuallyCollapsed)}_updateAccesibilityAttr(){if(this.state().isMainPane()){const e=this._chartModel().mainSeries(),t=e.symbol(),s=(0,jt.getTranslatedResolutionModel)(e.interval()).hint,r=o.t(null,{replace:{symbol:t,interval:s}},i(69916));this._topCanvasBinding.canvasElement.setAttribute("aria-label",r)}else this._topCanvasBinding.canvasElement.setAttribute("aria-hidden","true")}async _updateEndOfSeriesBanner(){}}class pi{constructor(){this._draggingSource=null,this._activeTouchPanes=new Set,this._scrollingPane=null,this._pinchingPane=null}onPaneDestroyed(e){this._activeTouchPanes.delete(e),this._scrollingPane===e&&(this._scrollingPane=null),this._pinchingPane===e&&(this._pinchingPane=null)}startTouch(e){this._activeTouchPanes.add(e)}endTouch(e){this._activeTouchPanes.delete(e)}hasTouchesOnOtherPanes(e){return this._activeTouchPanes.size>1||1===this._activeTouchPanes.size&&!this._activeTouchPanes.has(e)}trySetDraggingSource(e,t){return!this.hasTouchesOnOtherPanes(t)&&((0,r.assert)(null===this._draggingSource||this._draggingSource===e),this._draggingSource=e,!0)}clearDraggingSource(){null!==this._draggingSource&&(this._draggingSource=null)}draggingSource(){return this._draggingSource}setScrollingPane(e){(0, this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),1!==this._pressedMoveStage&&o.crossHairSource().setLinesShouldBeHidden(a)}async _createErrorBlock(){const e=new(await oe());return this._div.insertBefore(e.container,this._topCanvasBinding.canvasElement.nextSibling),e}_customActions(){const e={top:[],bottom:[],remove:[]},t=this._chartUndoModel().timeScale(),i=this._state&&this._state.defaultPriceScale();if(!R.enabled("custom_items_in_context_menu"))return e;const s=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let n;if(i&&!i.isEmpty()){const e=(0,r.ensureNotNull)(this.state().mainDataSource()).firstValue();n=i.coordinateToPrice(this._contextMenuY,(0,r.ensureNotNull)(e))}return(0,a.emit)("onContextMenu",{unixtime:null!=s?s.getTime()/1e3:void 0,price:n,callback:t=>{[...t].forEach((t=>{if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{let i;i="-"===t.text?new H.Separator:new H.Action({actionId:"Chart.ExternalActionId",options:{label:t.text,onExecute:t.click}}),t.position&&"top"===t.position?e.top.push(i):e.bottom.push(i)}}))}}),e}_highlightPriceAxisByLabel(e){this._lhsPriceAxisesContainer.highlightPriceAxisByLabel(e),this._rhsPriceAxisesContainer.highlightPriceAxisByLabel(e)}_subscribeToState(){const e=this.state();e.onDestroyed().subscribe(this,this._onStateDestroyed,!0),e.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),e.maximized().subscribe(this._updateVisuallyCollapsed),e.collapsed().subscribe(this._updateVisuallyCollapsed)}_unsubscribeFromState(){const e=this.state();e.onDestroyed().unsubscribeAll(this),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.maximized().unsubscribe(this._updateVisuallyCollapsed),e.collapsed().unsubscribe(this._updateVisuallyCollapsed)}_updateAccesibilityAttr(){if(this.state().isMainPane()){const e=this._chartModel().mainSeries(),t=e.symbol(),s=(0,jt.getTranslatedResolutionModel)(e.interval()).hint,r=o.t(null,{replace:{symbol:t,interval:s}},i(69916));this._topCanvasBinding.canvasElement.setAttribute("aria-label",r)}else this._topCanvasBinding.canvasElement.setAttribute("aria-hidden","true")}async _updateEndOfSeriesBanner(){}}class pi{constructor(){this._draggingSource=null,this._activeTouchPanes=new Set,this._scrollingPane=null,this._pinchingPane=null}onPaneDestroyed(e){this._activeTouchPanes.delete(e),this._scrollingPane===e&&(this._scrollingPane=null),this._pinchingPane===e&&(this._pinchingPane=null)}startTouch(e){this._activeTouchPanes.add(e)}endTouch(e){this._activeTouchPanes.delete(e)}hasTouchesOnOtherPanes(e){return this._activeTouchPanes.size>1||1===this._activeTouchPanes.size&&!this._activeTouchPanes.has(e)}trySetDraggingSource(e,t){return!this.hasTouchesOnOtherPanes(t)&&((0,r.assert)(null===this._draggingSource||this._draggingSource===e),this._draggingSource=e,!0)}clearDraggingSource(){null!==this._draggingSource&&(this._draggingSource=null)}draggingSource(){return this._draggingSource}setScrollingPane(e){(0,
r.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,r.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}var _i=i(42609),mi=i(11678);i(658);const gi={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0},fi=new F.TranslatedString("change session",o.t(null,void 0,i(65303))),vi=o.t(null,void 0,i(25866));class Si{constructor(e,t,i,r,n){this._rendererOptions=null,this._onLabelHovered=new B.Delegate,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,C.merge)((0,C.clone)(gi),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("div"),this._element.style.display="flex",this._backgroundBasedTheme=n;const o=()=>this.backgroundColor(),a=()=>{throw new Error("Time axis does not support real price scales")},l={titlesProvider:i,stubContextMenuProvider:(e,t)=>{const i=r(e,t),s=this.getContextMenuActions(!0);return 0===s.length?i:i.concat(new H.Separator,s)},backgroundBasedTheme:n,rendererOptionsProvider:e.model().model().rendererOptionsProvider(),getBackgroundTopColor:o,getBackgroundBottomColor:o,showHorizontalBorder:!0};this._lhsStubContainer=new Xe(this._properties,"left",a,l,this._options.priceAxisLabelsOptions,this),this._lhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._rhsStubContainer=new Xe(this._properties,"right",a,l,this._options.priceAxisLabelsOptions,this),this._rhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("div"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=(0,U.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const c=this._canvasBinding.canvasElement;c.style.position="absolute",c.style.zIndex="1",c.style.left="0",c.style.top="0",this._topCanvasBinding=(0,U.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._topCanvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._dv.setAttribute("aria-hidden","true"),this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=_i.MINUTE_SPAN, r.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,r.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}var _i=i(42609),mi=i(11678);i(658);const gi={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0},fi=new F.TranslatedString("change session",o.t(null,void 0,i(65303))),vi=o.t(null,void 0,i(25866));class Si{constructor(e,t,i,r,n){this._rendererOptions=null,this._onLabelHovered=new B.Delegate,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,C.merge)((0,C.clone)(gi),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("div"),this._element.style.display="flex",this._backgroundBasedTheme=n;const o=()=>this.backgroundColor(),a=()=>{throw new Error("Time axis does not support real price scales")},l={titlesProvider:i,stubContextMenuProvider:(e,t)=>{const i=r(e,t),s=this.getContextMenuActions(!0);return 0===s.length?i:i.concat(new H.Separator,s)},backgroundBasedTheme:n,rendererOptionsProvider:e.model().model().rendererOptionsProvider(),getBackgroundTopColor:o,getBackgroundBottomColor:o,showHorizontalBorder:!0};this._lhsStubContainer=new Xe(this._properties,"left",a,l,this._options.priceAxisLabelsOptions,this),this._lhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._rhsStubContainer=new Xe(this._properties,"right",a,l,this._options.priceAxisLabelsOptions,this),this._rhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("div"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=(0,U.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const c=this._canvasBinding.canvasElement;c.style.position="absolute",c.style.zIndex="1",c.style.left="0",c.style.top="0",this._topCanvasBinding=(0,U.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._topCanvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._dv.setAttribute("aria-hidden","true"),this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=_i.MINUTE_SPAN,
@@ -729,12 +730,12 @@ this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(h
;p[8].value=(0,c.forceLTRStr)(`${a} (${w.format(r,!0)})`)}}let E=null;if(u)p[5].value=null==A?v.notAvailable:D(A),p[5].visible=!0,E=this._getChangeColor(null==L?void 0:L.change),p[6].visible=void 0!==L,p[8].visible=void 0!==k||y;else{p[0].value=null==b?v.notAvailable:D(b),p[1].value=null==I?v.notAvailable:D(I),p[2].value=null==M?v.notAvailable:D(M),p[3].value=null==A?v.notAvailable:D(A),p[4].value=D(this._series.barFunction()(f));const e=f[5];(0,r.isNumber)(e)?p[7].value=C.format(e):p[7].visible=!1,p[8].visible=void 0!==k||y,p[6].visible=void 0!==L;const t=this._series.barColorer().barStyle(m,!1);E=x(S,null!==(a=t.barBorderColor)&&void 0!==a?a:t.barColor)}E=(0,l.resetTransparency)(x(S,E));for(const e of p)e.color||(e.color=E);return p[8].visible&&(p[8].color=(0,l.resetTransparency)(x(S,this._getChangeColor(null===(d=k)||void 0===d?void 0:d.change)))),p}_mobileNonTrackingMode(){return b&&(null===this._model.crossHairSource().pane||(0,f.isLineToolName)(d.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return S.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){var t;const i=void 0===e||e>=0?_.SeriesBarColorer.upColor(this._series.properties()):_.SeriesBarColorer.downColor(this._series.properties());return null!==(t=i.barBorderColor)&&void 0!==t?t:i.barColor}}},16776:(e,t,i)=>{"use strict";i.d(t,{sessionsPreferencesDefault:()=>r});var s=i(33013);const r={graphics:{backgrounds:{outOfSession:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1},preMarket:{color:"#FF9800",transparency:92,visible:!1},postMarket:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1}},vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}}}}},11877:(e,t,i)=>{"use strict";i.d(t,{StatusProviderBase:()=>s});class s{constructor(e){this._colorProperty=e}size(){return"13px"}bold(){return!1}color(){return this._colorProperty.value()}}},79055:(e,t,i)=>{"use strict";i.d(t,{StatusView:()=>s});class s{constructor(e){this._text="",this._color="",this._size="13px",this._bold=!1,this._statusProvider=e}text(){return this._text}getSplitTitle(){return[this._text]}color(){return this._statusProvider.color()}bold(){return this._bold}size(){return this._size}}},9482:(e,t,i)=>{"use strict";var s;i.d(t,{StoriesTimeLineItemType:()=>s}),function(e){e[e.Image=0]="Image",e[e.Emoji=1]="Emoji"}(s||(s={}))},85573:(e,t,i)=>{"use strict";i.d(t,{getNoDataPosition:()=>d,getSeriesPosition:()=>u,noDataBasePosition:()=>c,positionToCoordinate:()=>l,positionVisualDirection:()=>a,seriesBasePosition:()=>h,seriesPrice:()=>n});var s=i(50151),r=i(86094);function n(e,t,i){const s=e.barFunction();switch(e.style()){case 3:case 10:case 2:case 14:case 15:return s(t.value);default:return t.value[-1===i?3:2]}}function o(e){return e>=0?1:-1}function a(e,t){return-1===o(e)!==t?-1:1}function l(e,t,i,s){const r=Math.min(t,Math.max(0,1===s?i:t-i));return i-s*Math.abs(r*e/100)}function c(e,t,i){const s=e.index();return null===s?null:{index:s,price:t.coordinateToPrice(t.height()/2,i) ;p[8].value=(0,c.forceLTRStr)(`${a} (${w.format(r,!0)})`)}}let E=null;if(u)p[5].value=null==A?v.notAvailable:D(A),p[5].visible=!0,E=this._getChangeColor(null==L?void 0:L.change),p[6].visible=void 0!==L,p[8].visible=void 0!==k||y;else{p[0].value=null==b?v.notAvailable:D(b),p[1].value=null==I?v.notAvailable:D(I),p[2].value=null==M?v.notAvailable:D(M),p[3].value=null==A?v.notAvailable:D(A),p[4].value=D(this._series.barFunction()(f));const e=f[5];(0,r.isNumber)(e)?p[7].value=C.format(e):p[7].visible=!1,p[8].visible=void 0!==k||y,p[6].visible=void 0!==L;const t=this._series.barColorer().barStyle(m,!1);E=x(S,null!==(a=t.barBorderColor)&&void 0!==a?a:t.barColor)}E=(0,l.resetTransparency)(x(S,E));for(const e of p)e.color||(e.color=E);return p[8].visible&&(p[8].color=(0,l.resetTransparency)(x(S,this._getChangeColor(null===(d=k)||void 0===d?void 0:d.change)))),p}_mobileNonTrackingMode(){return b&&(null===this._model.crossHairSource().pane||(0,f.isLineToolName)(d.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return S.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){var t;const i=void 0===e||e>=0?_.SeriesBarColorer.upColor(this._series.properties()):_.SeriesBarColorer.downColor(this._series.properties());return null!==(t=i.barBorderColor)&&void 0!==t?t:i.barColor}}},16776:(e,t,i)=>{"use strict";i.d(t,{sessionsPreferencesDefault:()=>r});var s=i(33013);const r={graphics:{backgrounds:{outOfSession:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1},preMarket:{color:"#FF9800",transparency:92,visible:!1},postMarket:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1}},vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}}}}},11877:(e,t,i)=>{"use strict";i.d(t,{StatusProviderBase:()=>s});class s{constructor(e){this._colorProperty=e}size(){return"13px"}bold(){return!1}color(){return this._colorProperty.value()}}},79055:(e,t,i)=>{"use strict";i.d(t,{StatusView:()=>s});class s{constructor(e){this._text="",this._color="",this._size="13px",this._bold=!1,this._statusProvider=e}text(){return this._text}getSplitTitle(){return[this._text]}color(){return this._statusProvider.color()}bold(){return this._bold}size(){return this._size}}},9482:(e,t,i)=>{"use strict";var s;i.d(t,{StoriesTimeLineItemType:()=>s}),function(e){e[e.Image=0]="Image",e[e.Emoji=1]="Emoji"}(s||(s={}))},85573:(e,t,i)=>{"use strict";i.d(t,{getNoDataPosition:()=>d,getSeriesPosition:()=>u,noDataBasePosition:()=>c,positionToCoordinate:()=>l,positionVisualDirection:()=>a,seriesBasePosition:()=>h,seriesPrice:()=>n});var s=i(50151),r=i(86094);function n(e,t,i){const s=e.barFunction();switch(e.style()){case 3:case 10:case 2:case 14:case 15:return s(t.value);default:return t.value[-1===i?3:2]}}function o(e){return e>=0?1:-1}function a(e,t){return-1===o(e)!==t?-1:1}function l(e,t,i,s){const r=Math.min(t,Math.max(0,1===s?i:t-i));return i-s*Math.abs(r*e/100)}function c(e,t,i){const s=e.index();return null===s?null:{index:s,price:t.coordinateToPrice(t.height()/2,i)
}}function h(e,t){const i=e.data().bars(),s=i.first(),a=i.last();if(null===s||null===a)return null;let l;const c=t.index();if(null===c){if(void 0===t.time)return null;const e=t.time(),n=s.value[0],o=a.value[0];if(e<n-86400||e>o)return null;l=i.searchByTime(e,r.PlotRowSearchMode.NearestRight,4)}else l=i.search(c);return null===l?null:{index:l.index,price:n(e,l,o(t.position()))}}function d(e,t,i){const s=c(e,t,i);if(null===s)return null;const r=a(e.position(),t.isInverted());return{index:s.index,price:s.price,poleStartY:t.height(),visualDirection:1,positionPointDirection:r,startsOnSeriesData:!1}}function u(e,t,i=!0){const r=h(e,t),n=e.priceScale(),o=(0,s.ensureNotNull)(e.firstValue());if(null===r)return d(t,n,o);let l=0;const c=e.properties().childs(),u=e.model().timeScale(),p=n.priceToCoordinate(r.price,o),_=a(t.position(),n.isInverted());if(i)switch(e.style()){case 16:l=1===_?c.hlcAreaStyle.childs().highLineWidth.value()/2:c.hlcAreaStyle.childs().lowLineWidth.value()/2;break;case 3:l=c.areaStyle.childs().linewidth.value()/2;break;case 2:l=c.lineStyle.childs().linewidth.value()/2;break;case 14:l=c.lineWithMarkersStyle.childs().linewidth.value()/2;break;case 15:l=c.steplineStyle.childs().linewidth.value()/2;break;case 10:const e=Math.abs(100-c.baselineStyle.childs().baseLevelPercentage.value());l=n.height()*e/100>p?c.baselineStyle.childs().topLineWidth.value()/2:c.baselineStyle.childs().bottomLineWidth.value()/2;break;case 1:case 9:case 8:case 12:case 4:case 7:l=3;break;case 0:l=c.barStyle.childs().thinBars.value()?3:Math.max(3,.25*u.barSpacing());break;case 11:l=c.rangeStyle.childs().thinBars.value()?3:Math.max(3,.25*u.barSpacing());break;case 5:l=Math.max(4,.25*u.barSpacing());break;case 6:l=Math.max(5,.25*u.barSpacing())}const m=p-_*l;return{index:r.index,price:r.price,poleStartY:m,visualDirection:_,positionPointDirection:_,startsOnSeriesData:!0}}},21280:(e,t,i)=>{"use strict";i.d(t,{AbstractFilledAreaPaneView:()=>g});var s=i(50151),r=i(86441),n=i(5531),o=i(78071),a=i(48874),l=i(87095),c=i(42449);var h=i(82386),d=i(36897);function u(e,t){return Array.from({length:e},((e,i)=>({timePointIndex:i+t})))}function p(e,t,i){let s,r;const n=e.length;for(let o=t;o>=0&&o<n;o+=i){const t=e[o];if(void 0===s&&void 0!==t.plot1Value&&(s=o),void 0===r&&void 0!==t.plot2Value&&(r=o),void 0!==s&&void 0!==r)return o}return null}function _(e){return 0===e.type?`${e.color}`:`${e.color1}:${e.color2}:${e.coordinate1}:${e.coordinate2}`}const m={type:0,color:""};class g{constructor(e,t,i){this._isHlineFill=!1,this._bandAKey=null,this._bandBKey=null,this._colorPlotIndex=null,this._areaRenderer=new h.AreaBackgroundRenderer,this._dataInvalidated=null,this._viewportInvalidated=!1,this._plIndex1=null,this._plIndex2=null,this._items=[],this._colorAreas=new h.CachedMap,this._generateColor=function(e=1e3){const t=a.default.Cache;a.default.Cache=c.CircularCacheBuffer.bind(c.CircularCacheBuffer,e);const i=(0,a.default)(l.generateColor,((e,t,i)=>`${e}_${t}_${i}`));return a.default.Cache=t,i}(),this._source=e,this._model=t, }}function h(e,t){const i=e.data().bars(),s=i.first(),a=i.last();if(null===s||null===a)return null;let l;const c=t.index();if(null===c){if(void 0===t.time)return null;const e=t.time(),n=s.value[0],o=a.value[0];if(e<n-86400||e>o)return null;l=i.searchByTime(e,r.PlotRowSearchMode.NearestRight,4)}else l=i.search(c);return null===l?null:{index:l.index,price:n(e,l,o(t.position()))}}function d(e,t,i){const s=c(e,t,i);if(null===s)return null;const r=a(e.position(),t.isInverted());return{index:s.index,price:s.price,poleStartY:t.height(),visualDirection:1,positionPointDirection:r,startsOnSeriesData:!1}}function u(e,t,i=!0){const r=h(e,t),n=e.priceScale(),o=(0,s.ensureNotNull)(e.firstValue());if(null===r)return d(t,n,o);let l=0;const c=e.properties().childs(),u=e.model().timeScale(),p=n.priceToCoordinate(r.price,o),_=a(t.position(),n.isInverted());if(i)switch(e.style()){case 16:l=1===_?c.hlcAreaStyle.childs().highLineWidth.value()/2:c.hlcAreaStyle.childs().lowLineWidth.value()/2;break;case 3:l=c.areaStyle.childs().linewidth.value()/2;break;case 2:l=c.lineStyle.childs().linewidth.value()/2;break;case 14:l=c.lineWithMarkersStyle.childs().linewidth.value()/2;break;case 15:l=c.steplineStyle.childs().linewidth.value()/2;break;case 10:const e=Math.abs(100-c.baselineStyle.childs().baseLevelPercentage.value());l=n.height()*e/100>p?c.baselineStyle.childs().topLineWidth.value()/2:c.baselineStyle.childs().bottomLineWidth.value()/2;break;case 1:case 9:case 8:case 12:case 4:case 7:l=3;break;case 0:l=c.barStyle.childs().thinBars.value()?3:Math.max(3,.25*u.barSpacing());break;case 11:l=c.rangeStyle.childs().thinBars.value()?3:Math.max(3,.25*u.barSpacing());break;case 5:l=Math.max(4,.25*u.barSpacing());break;case 6:l=Math.max(5,.25*u.barSpacing())}const m=p-_*l;return{index:r.index,price:r.price,poleStartY:m,visualDirection:_,positionPointDirection:_,startsOnSeriesData:!0}}},21280:(e,t,i)=>{"use strict";i.d(t,{AbstractFilledAreaPaneView:()=>g});var s=i(50151),r=i(86441),n=i(5531),o=i(78071),a=i(48874),l=i(87095),c=i(42449);var h=i(82386),d=i(36897);function u(e,t){return Array.from({length:e},((e,i)=>({timePointIndex:i+t})))}function p(e,t,i){let s,r;const n=e.length;for(let o=t;o>=0&&o<n;o+=i){const t=e[o];if(void 0===s&&void 0!==t.plot1Value&&(s=o),void 0===r&&void 0!==t.plot2Value&&(r=o),void 0!==s&&void 0!==r)return o}return null}function _(e){return 0===e.type?`${e.color}`:`${e.color1}:${e.color2}:${e.coordinate1}:${e.coordinate2}`}const m={type:0,color:""};class g{constructor(e,t,i){this._isHlineFill=!1,this._bandAKey=null,this._bandBKey=null,this._colorPlotIndex=null,this._areaRenderer=new h.AreaBackgroundRenderer,this._dataInvalidated=null,this._viewportInvalidated=!1,this._plIndex1=null,this._plIndex2=null,this._items=[],this._colorAreas=new h.CachedMap,this._generateColor=function(e=1e3){const t=a.default.Cache;a.default.Cache=c.CircularCacheBuffer.bind(c.CircularCacheBuffer,e);const i=(0,a.default)(l.generateColor,((e,t,i)=>`${e}_${t}_${i}`));return a.default.Cache=t,i}(),this._source=e,this._model=t,
this._fillGaps=!!(null==i?void 0:i.fillgaps),this._fillToIntersection=!!(null==i?void 0:i.fillToIntersection)}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{e.sourceId===this._source.id()&&(this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData}))}}renderer(e,t){return this._dataInvalidated?this._updateImplFull(this._dataInvalidated)&&(this._dataInvalidated=null,this._viewportInvalidated=!1):this._viewportInvalidated&&(this._updateImplLight(),this._viewportInvalidated=!1),this._areaRenderer}_minFirstBarIndex(){return-1/0}_plotNames(){return this._source.metaInfo().plots.map((e=>e.id))}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImplFull(e){var t,i,r,n;if(this._areaRenderer.setData(null),(null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._visible())return!1;if(null===this._source.priceScale())return!1;if(null===this._source.firstValue())return!1;const a=this._source.plots().plottableRange(),l=a.size();if(0===l)return!1;const c=this._source.offset(this._plotAId()),h=this._source.offset(this._plotBId()),d=Math.min(c,h),p=Math.max(c,h);let _=e.firstIndex;const m=l+(p-d)+1,g=this._plotIndex1(),f=this._plotIndex2();m!==this._items.length&&(void 0===_||0===this._items.length||_<this._items[0].timePointIndex+d?(_=void 0,this._items=u(m,1e10)):this._items=this._items.concat(u(m-this._items.length,1e10+this._items.length)));const v=this._colorPlotIndex,S=this._transparency(),y=void 0===_?a.fullRangeIterator():a.rangeIterator(_,(0,s.ensureNotNull)(a.lastIndex()));let b=void 0!==_?(0,o.lowerbound)(this._items,_+d,((e,t)=>e.timePointIndex<t))-d:-d;for(const e of y){const t=e.index+c,s=e.index+h,o=this._items[b+c],a=this._items[b+h];if(o.timePointIndex=t,a.timePointIndex=s,this._isHlineFill||(o.plot1Value=null!==(i=e.value[g])&&void 0!==i?i:void 0,a.plot2Value=null!==(r=e.value[f])&&void 0!==r?r:void 0),null!==v){const t=b+d-1;if(t>=0&&t<this._items.length){const i=this._items[t];let s;s=0===v.type?{type:0,colorIndexOrRgba:e.value[v.colorIndexOrRgba+1]}:{type:1,colorIndexOrRgba1:void 0===v.colorIndexOrRgba1?void 0:e.value[v.colorIndexOrRgba1+1],colorIndexOrRgba2:void 0===v.colorIndexOrRgba2?void 0:e.value[v.colorIndexOrRgba2+1],value1:void 0===v.valueIndex1?void 0:e.value[v.valueIndex1+1],value2:void 0===v.valueIndex2?void 0:e.value[v.valueIndex2+1]};const r=i.color=null!==(n=this._getColorByPlotValue(s))&&void 0!==n?n:void 0;void 0!==r&&(1===r.type?(r.color1=r.color1&&this._generateColor(r.color1,S),r.color2=r.color2&&this._generateColor(r.color2,S)):r.color=this._generateColor(r.color,S))}}b+=1}return this._updateImplLight(),!0} this._fillGaps=!!(null==i?void 0:i.fillgaps),this._fillToIntersection=!!(null==i?void 0:i.fillToIntersection)}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{e.sourceId===this._source.id()&&(this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData}))}}renderer(e,t){return this._dataInvalidated?this._updateImplFull(this._dataInvalidated)&&(this._dataInvalidated=null,this._viewportInvalidated=!1):this._viewportInvalidated&&(this._updateImplLight(),this._viewportInvalidated=!1),this._areaRenderer}_minFirstBarIndex(){return-1/0}_plotNames(){return this._source.metaInfo().plots.map((e=>e.id))}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImplFull(e){var t,i,r,n;if(this._areaRenderer.setData(null),(null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._visible())return!1;if(null===this._source.priceScale())return!1;if(null===this._source.firstValue())return!1;const a=this._source.plots().plottableRange(),l=a.size();if(0===l)return!1;const c=this._source.offset(this._plotAId()),h=this._source.offset(this._plotBId()),d=Math.min(c,h),p=Math.max(c,h);let _=e.firstIndex;const m=l+(p-d)+1,g=this._plotIndex1(),f=this._plotIndex2();m!==this._items.length&&(void 0===_||0===this._items.length||_<this._items[0].timePointIndex+d?(_=void 0,this._items=u(m,1e10)):this._items=this._items.concat(u(m-this._items.length,1e10+this._items.length)));const v=this._colorPlotIndex,S=this._transparency(),y=void 0===_?a.fullRangeIterator():a.rangeIterator(_,(0,s.ensureNotNull)(a.lastIndex()));let b=void 0!==_?(0,o.lowerbound)(this._items,_+d,((e,t)=>e.timePointIndex<t))-d:-d;for(const e of y){const t=e.index+c,s=e.index+h,o=this._items[b+c],a=this._items[b+h];if(o.timePointIndex=t,a.timePointIndex=s,this._isHlineFill||(o.plot1Value=null!==(i=e.value[g])&&void 0!==i?i:void 0,a.plot2Value=null!==(r=e.value[f])&&void 0!==r?r:void 0),null!==v){const t=b+d-1;if(t>=0&&t<this._items.length){const i=this._items[t];let s;s=0===v.type?{type:0,colorIndexOrRgba:e.value[v.colorIndexOrRgba+1]}:{type:1,colorIndexOrRgba1:void 0===v.colorIndexOrRgba1?void 0:e.value[v.colorIndexOrRgba1+1],colorIndexOrRgba2:void 0===v.colorIndexOrRgba2?void 0:e.value[v.colorIndexOrRgba2+1],value1:void 0===v.valueIndex1?void 0:e.value[v.valueIndex1+1],value2:void 0===v.valueIndex2?void 0:e.value[v.valueIndex2+1]};const r=i.color=null!==(n=this._getColorByPlotValue(s))&&void 0!==n?n:void 0;void 0!==r&&(1===r.type?(r.color1=r.color1&&this._generateColor(r.color1,S),r.color2=r.color2&&this._generateColor(r.color2,S)):r.color=this._generateColor(r.color,S))}}b+=1}return this._updateImplLight(),!0}
_updateImplLight(){var e,t,i,a;if(!this._visible())return;const l=this._source.priceScale();if(null===l)return;const c=this._source.firstValue();if(null===c)return;if(0===this._items.length)return;let d;if(this._isHlineFill){const e=this._source.properties().bands[(0,s.ensureNotNull)(this._bandAKey)],t=this._source.properties().bands[(0,s.ensureNotNull)(this._bandBKey)];d={level1:l.priceToCoordinate(e.value.value(),c),level2:l.priceToCoordinate(t.value.value(),c)}}const u=this._model.timeScale(),g=u.visibleBarsStrictRange();if(null===g)return;const f=l.priceToCoordinateFn(c),v=this._transparency(),S=this._minFirstBarIndex(),y=Math.max(S,g.firstBar()),b=(0,o.lowerbound)(this._items,y,((e,t)=>e.timePointIndex<t));if(b>=this._items.length)return;const w=Math.min(this._items.length-1,(0,o.lowerbound)(this._items,g.lastBar(),((e,t)=>e.timePointIndex<t)));let C,P;this._isHlineFill?(C=S===y?b:Math.max(0,b-1),P=Math.min(this._items.length-1,w+1)):(C=S===y?b:null!==(e=p(this._items,b-1,-1))&&void 0!==e?e:b,P=null!==(t=p(this._items,w+1,1))&&void 0!==t?t:w);const x=this._colorAreas;x.invalidateCache();let T,I=null,M=null,A=null;const L=(e,t,i)=>{if(!this._fillToIntersection||void 0===T||void 0===T.xCoordinate||void 0===T.plot1Coordinate||void 0===T.plot2Coordinate||null===M||null===I||0===I.points1.length()||void 0===e||void 0===t)return;const s=new r.Point(T.xCoordinate,T.plot1Coordinate),o=new r.Point(T.xCoordinate,T.plot2Coordinate),a=new r.Point(i,e),l=new r.Point(i,t),c=(0,n.intersectLineSegments)(s,a,o,l);if(null!==c){const e=s.add(s.subtract(a).scaled(-c));M.addPoints1Point(I.points1.at(I.points1.length()-1).x,I.points1.at(I.points1.length()-1).y),M.addPoints2Point(I.points2.at(I.points1.length()-1).x,I.points2.at(I.points1.length()-1).y),M.addPoints1Point(e.x,e.y),M.addPoints1Point(e.x,e.y),I.points1.at(I.points1.length()-1).x=e.x,I.points1.at(I.points1.length()-1).y=e.y,I.points2.at(I.points2.length()-1).x=e.x,I.points2.at(I.points2.length()-1).y=e.y}},k=this._commonColor();let D;1===k.type?(k.coordinate1=f(k.value1),k.coordinate2=f(k.value2),k.color1=k.color1&&this._generateColor(k.color1,v),k.color2=k.color2&&this._generateColor(k.color2,v)):k.color=this._generateColor(k.color,v);for(let e=C;e<=P;e+=1){const t=this._items[e],s=t.timePointIndex;let r,n;!this._fillGaps&&void 0!==D&&s-D>1&&(I=null),void 0!==d?(r=d.level1,n=d.level2):(r=t.plot1Coordinate=void 0===t.plot1Value?void 0:f(t.plot1Value),n=t.plot2Coordinate=void 0===t.plot2Value?void 0:f(t.plot2Value));const o=t.xCoordinate=u.indexToCoordinate(t.timePointIndex);if(t.color&&1===t.color.type&&(t.color.coordinate1=f(t.color.value1),t.color.coordinate2=f(t.color.value2)),this._fillGaps?void 0!==r||void 0!==n:void 0!==r&&void 0!==n){const s=null!==this._colorPlotIndex?t.color||m:k;if(L(r,n,o),V=s,!(null===(E=A)||null===V?E===V:0===E.type&&0===V.type?E.color===V.color:1===E.type&&1===V.type&&E.color1===V.color1&&E.color2===V.color2&&E.coordinate1===V.coordinate1&&E.coordinate2===V.coordinate2)||null===I){if(null!==I&&(void 0!==r&&I.addPoints1Point(o,r), _updateImplLight(){var e,t,i,a;if(!this._visible())return;const l=this._source.priceScale();if(null===l)return;const c=this._source.firstValue();if(null===c)return;if(0===this._items.length)return;let d;if(this._isHlineFill){const e=this._source.properties().bands[(0,s.ensureNotNull)(this._bandAKey)],t=this._source.properties().bands[(0,s.ensureNotNull)(this._bandBKey)];d={level1:l.priceToCoordinate(e.value.value(),c),level2:l.priceToCoordinate(t.value.value(),c)}}const u=this._model.timeScale(),g=u.visibleBarsStrictRange();if(null===g)return;const f=l.priceToCoordinateFn(c),v=this._transparency(),S=this._minFirstBarIndex(),y=Math.max(S,g.firstBar()),b=(0,o.lowerbound)(this._items,y,((e,t)=>e.timePointIndex<t));if(b>=this._items.length)return;const w=Math.min(this._items.length-1,(0,o.lowerbound)(this._items,g.lastBar(),((e,t)=>e.timePointIndex<t)));let C,P;this._isHlineFill?(C=S===y?b:Math.max(0,b-1),P=Math.min(this._items.length-1,w+1)):(C=S===y?b:null!==(e=p(this._items,b-1,-1))&&void 0!==e?e:b,P=null!==(t=p(this._items,w+1,1))&&void 0!==t?t:w);const x=this._colorAreas;x.invalidateCache();let T,I=null,M=null,A=null;const L=(e,t,i)=>{if(this._model.timeScale().barSpacing()<1||!this._fillToIntersection||void 0===T||void 0===T.xCoordinate||void 0===T.plot1Coordinate||void 0===T.plot2Coordinate||null===M||null===I||0===I.points1.length()||void 0===e||void 0===t)return;const s=new r.Point(T.xCoordinate,T.plot1Coordinate),o=new r.Point(T.xCoordinate,T.plot2Coordinate),a=new r.Point(i,e),l=new r.Point(i,t),c=(0,n.intersectLineSegments)(s,a,o,l);if(null!==c){const e=s.add(s.subtract(a).scaled(-c));M.addPoints1Point(I.points1.at(I.points1.length()-1).x,I.points1.at(I.points1.length()-1).y),M.addPoints2Point(I.points2.at(I.points1.length()-1).x,I.points2.at(I.points1.length()-1).y),M.addPoints1Point(e.x,e.y),M.addPoints1Point(e.x,e.y),I.points1.at(I.points1.length()-1).x=e.x,I.points1.at(I.points1.length()-1).y=e.y,I.points2.at(I.points2.length()-1).x=e.x,I.points2.at(I.points2.length()-1).y=e.y}},k=this._commonColor();let D;1===k.type?(k.coordinate1=f(k.value1),k.coordinate2=f(k.value2),k.color1=k.color1&&this._generateColor(k.color1,v),k.color2=k.color2&&this._generateColor(k.color2,v)):k.color=this._generateColor(k.color,v);for(let e=C;e<=P;e+=1){const t=this._items[e],s=t.timePointIndex;let r,n;!this._fillGaps&&void 0!==D&&s-D>1&&(I=null),void 0!==d?(r=d.level1,n=d.level2):(r=t.plot1Coordinate=void 0===t.plot1Value?void 0:f(t.plot1Value),n=t.plot2Coordinate=void 0===t.plot2Value?void 0:f(t.plot2Value));const o=t.xCoordinate=u.indexToCoordinate(t.timePointIndex);if(t.color&&1===t.color.type&&(t.color.coordinate1=f(t.color.value1),t.color.coordinate2=f(t.color.value2)),this._fillGaps?void 0!==r||void 0!==n:void 0!==r&&void 0!==n){const s=null!==this._colorPlotIndex?t.color||m:k;if(L(r,n,o),V=s,!(null===(E=A)||null===V?E===V:0===E.type&&0===V.type?E.color===V.color:1===E.type&&1===V.type&&E.color1===V.color1&&E.color2===V.color2&&E.coordinate1===V.coordinate1&&E.coordinate2===V.coordinate2)||null===I){
void 0!==n&&I.addPoints2Point(o,n)),e===P)continue;A=s;const t=_(s),l=null!==(i=x.get(t))&&void 0!==i?i:new h.AreaBackgroundItemsGroup(s);M=I,I=null!==(a=l.newItem())&&void 0!==a?a:new h.AreaBackgroundItem,l.push(I),x.set(t,l)}void 0!==r&&I.addPoints1Point(o,r),void 0!==n&&I.addPoints2Point(o,n)}else this._fillGaps||(A=null,I=null,M=null);D=s,T=t}var E,V;x.delete(_(m));const B={barSpacing:this._model.timeScale().barSpacing(),colorAreas:x};this._areaRenderer.setData(B)}}},98098:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundPaneView:()=>n});var s=i(50151),r=i(21280);class n extends r.AbstractFilledAreaPaneView{constructor(e,t){super(e,t)}_plotAId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[0].name}_plotBId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[1].name}_commonColor(){return{type:0,color:this._source.properties().areaBackground.backgroundColor.value()}}_transparency(){return this._source.properties().areaBackground.transparency.value()}_visible(){return this._source.properties().areaBackground.fillBackground.value()}_getColorByPlotValue(e){return this._commonColor()}}},93804:(e,t,i)=>{"use strict";i.d(t,{containsBackgroundTimePointIndexes:()=>o,dematerializeBackground:()=>l,isBackgroundInBarsRange:()=>c,materializeBackground:()=>a});var s=i(50151),r=i(61401),n=i(44991);const o=!0;function a(e,t){if(e.start>=t.length||e.stop>=t.length)return null;const i=t[e.start],n=t[e.stop];return n===r.INVALID_TIME_POINT_INDEX?null:((0,s.assert)(i===r.INVALID_TIME_POINT_INDEX||i<=n,"start should not exceed stop"),{start:i===r.INVALID_TIME_POINT_INDEX?null:i,stop:n})}function l(e,t,i){return{id:t,start:(0,n.ensureTimePointIndexIndex)(i.indexOf(null!==e.start?e.start:r.INVALID_TIME_POINT_INDEX)),stop:(0,n.ensureTimePointIndexIndex)(i.indexOf(e.stop))}}function c(e,t){if(null===e.start)return t.firstBar()<=e.stop;const i=Math.min(e.start,e.stop),s=Math.max(e.start,e.stop);return t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar()}},12442:(e,t,i)=>{"use strict";i.d(t,{LiveStudyGraphics:()=>o.LiveStudyGraphics,createGraphicsPaneViews:()=>p,createGraphicsPriceAxisViews:()=>m,emptyStudyGraphics:()=>n.emptyStudyGraphics,isStudyGraphicsEmpty:()=>r.isStudyGraphicsEmpty,loadStudyGraphics:()=>n.loadStudyGraphics,saveStudyGraphics:()=>n.saveStudyGraphics});var s=i(59224),r=i(71409),n=i(12616),o=i(83435),a=i(42275),l=i(87095);class c extends a.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){var s,r;e.visible=!1;const n=this._source.priceScale(),o=this._source.properties().childs(),a=o.visible.value();if(!n||n.isEmpty()||!a)return;const c=null===(r=null===(s=o.graphics.childs()[this._data.lineType])||void 0===s?void 0:s.childs()[this._data.styleId])||void 0===r?void 0:r.childs();if(!(void 0!==c&&c.visible&&c.visible.value()&&c.showPrice&&c.showPrice.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const h=this._source.firstValue();if(null===h)return;const d=this._data.line.level,u=(0,l.resetTransparency)(c.color.value());i.background=u, if(null!==I&&(void 0!==r&&I.addPoints1Point(o,r),void 0!==n&&I.addPoints2Point(o,n)),e===P)continue;A=s;const t=_(s),l=null!==(i=x.get(t))&&void 0!==i?i:new h.AreaBackgroundItemsGroup(s);M=I,I=null!==(a=l.newItem())&&void 0!==a?a:new h.AreaBackgroundItem,l.push(I),x.set(t,l)}void 0!==r&&I.addPoints1Point(o,r),void 0!==n&&I.addPoints2Point(o,n)}else this._fillGaps||(A=null,I=null,M=null);D=s,T=t}var E,V;x.delete(_(m));const B={barSpacing:this._model.timeScale().barSpacing(),colorAreas:x};this._areaRenderer.setData(B)}}},98098:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundPaneView:()=>n});var s=i(50151),r=i(21280);class n extends r.AbstractFilledAreaPaneView{constructor(e,t){super(e,t)}_plotAId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[0].name}_plotBId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[1].name}_commonColor(){return{type:0,color:this._source.properties().areaBackground.backgroundColor.value()}}_transparency(){return this._source.properties().areaBackground.transparency.value()}_visible(){return this._source.properties().areaBackground.fillBackground.value()}_getColorByPlotValue(e){return this._commonColor()}}},93804:(e,t,i)=>{"use strict";i.d(t,{containsBackgroundTimePointIndexes:()=>o,dematerializeBackground:()=>l,isBackgroundInBarsRange:()=>c,materializeBackground:()=>a});var s=i(50151),r=i(61401),n=i(44991);const o=!0;function a(e,t){if(e.start>=t.length||e.stop>=t.length)return null;const i=t[e.start],n=t[e.stop];return n===r.INVALID_TIME_POINT_INDEX?null:((0,s.assert)(i===r.INVALID_TIME_POINT_INDEX||i<=n,"start should not exceed stop"),{start:i===r.INVALID_TIME_POINT_INDEX?null:i,stop:n})}function l(e,t,i){return{id:t,start:(0,n.ensureTimePointIndexIndex)(i.indexOf(null!==e.start?e.start:r.INVALID_TIME_POINT_INDEX)),stop:(0,n.ensureTimePointIndexIndex)(i.indexOf(e.stop))}}function c(e,t){if(null===e.start)return t.firstBar()<=e.stop;const i=Math.min(e.start,e.stop),s=Math.max(e.start,e.stop);return t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar()}},12442:(e,t,i)=>{"use strict";i.d(t,{LiveStudyGraphics:()=>o.LiveStudyGraphics,createGraphicsPaneViews:()=>p,createGraphicsPriceAxisViews:()=>m,emptyStudyGraphics:()=>n.emptyStudyGraphics,isStudyGraphicsEmpty:()=>r.isStudyGraphicsEmpty,loadStudyGraphics:()=>n.loadStudyGraphics,saveStudyGraphics:()=>n.saveStudyGraphics});var s=i(59224),r=i(71409),n=i(12616),o=i(83435),a=i(42275),l=i(87095);class c extends a.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){var s,r;e.visible=!1;const n=this._source.priceScale(),o=this._source.properties().childs(),a=o.visible.value();if(!n||n.isEmpty()||!a)return;const c=null===(r=null===(s=o.graphics.childs()[this._data.lineType])||void 0===s?void 0:s.childs()[this._data.styleId])||void 0===r?void 0:r.childs();if(!(void 0!==c&&c.visible&&c.visible.value()&&c.showPrice&&c.showPrice.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const h=this._source.firstValue();if(null===h)return;const d=this._data.line.level,u=(0,
i.textColor=this.generateTextColor(u),i.coordinate=n.priceToCoordinate(d,h),e.text=n.formatPrice(d,h,!0),e.visible=!0}_isLabelVisibleAccordinglyToProperties(){return!!this._source.model().properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()}}const h=(0,s.getLogger)("Chart.StudyGraphics"),d=new Set(["dwgtablecells","tpoBlockSets","tpoLevels","tpoVolumeRows","logs","performance"]);async function u(e,t,s,r){switch(e){case"hhists":return new((await i.e(507).then(i.bind(i,21335))).HHistPaneView)(t,s,r);case"horizlines":return new((await i.e(507).then(i.bind(i,13369))).HorizLinePaneView)(t,s,r);case"vertlines":return new((await i.e(507).then(i.bind(i,78266))).VertLinePaneView)(t,s,r);case"polygons":return new((await i.e(507).then(i.bind(i,66999))).PolygonPaneView)(t,s,r);case"backgrounds":return new((await i.e(507).then(i.bind(i,47372))).BackgroundPaneView)(t,s,r)}return null}async function p(e,t,i){const s=[],r=Object.keys(e.graphicsInfo());r.sort(((e,t)=>_(e)-_(t)));for(const n of r){const r=await u(n,e,t,i);null!==r?s.push(r):d.has(n)||h.logWarn(`${n} is not supported by this build of graphics subsystem, skipping`)}return s}function _(e){var t;return null!==(t=r.primitivesZOrders.get(e))&&void 0!==t?t:0}function m(e){const t=Object.keys(e.graphicsInfo()),i=[];for(const s of t)switch(s){case"hlines":e.graphics().hlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new c(e,{line:{level:t.level},styleId:r,lineType:s}))}))}));break;case"horizlines":e.graphics().horizlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new c(e,{line:{level:t.level},styleId:r,lineType:s}))}))}))}return i}},90164:(e,t,i)=>{"use strict";i.d(t,{HHistDirection:()=>s,HHistLocation:()=>r,HHistVolumeMode:()=>n,containsHHistTimePointIndexes:()=>c,dematerializeHHist:()=>d,isHHistInBarsRange:()=>u,materializeHHist:()=>h});var s,r,n,o=i(50151),a=i(61401),l=i(44991);!function(e){e.LeftToRight="left_to_right",e.RightToLeft="right_to_left"}(s||(s={})),function(e){e.Relative="relative",e.Absolute="absolute"}(r||(r={})),function(e){e.UpDown="Up/Down",e.Total="Total",e.Delta="Delta"}(n||(n={}));const c=!0;function h(e,t){if(e.firstBarTime>=t.length||e.lastBarTime>=t.length)return null;const i=t[e.firstBarTime],s=t[e.lastBarTime];return i===a.INVALID_TIME_POINT_INDEX||s===a.INVALID_TIME_POINT_INDEX?null:((0,o.assert)(i<=s,"firstBarTime should not exceed lastBarTime"),(0,o.assert)(e.priceLow<=e.priceHigh,"priceLow should not exceed priceHigh"),{firstBarTime:i,lastBarTime:s,rate:e.rate,priceHigh:e.priceHigh,priceLow:e.priceLow})}function d(e,t,i){const s=(0,l.ensureTimePointIndexIndex)(i.indexOf(e.firstBarTime)),r=(0,l.ensureTimePointIndexIndex)(i.indexOf(e.lastBarTime));return{id:t,...e,firstBarTime:s,lastBarTime:r}}function u(e,t){const i=Math.min(e.firstBarTime,e.lastBarTime),s=Math.max(e.firstBarTime,e.lastBarTime);return t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar()}},34522:(e,t,i)=>{"use strict";i.d(t,{ l.resetTransparency)(c.color.value());i.background=u,i.textColor=this.generateTextColor(u),i.coordinate=n.priceToCoordinate(d,h),e.text=n.formatPrice(d,h,!0),e.visible=!0}_isLabelVisibleAccordinglyToProperties(){return!!this._source.model().properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()}}const h=(0,s.getLogger)("Chart.StudyGraphics"),d=new Set(["dwgtablecells","tpoBlockSets","tpoLevels","tpoVolumeRows","logs","performance"]);async function u(e,t,s,r){switch(e){case"hhists":return new((await i.e(507).then(i.bind(i,21335))).HHistPaneView)(t,s,r);case"horizlines":return new((await i.e(507).then(i.bind(i,13369))).HorizLinePaneView)(t,s,r);case"vertlines":return new((await i.e(507).then(i.bind(i,78266))).VertLinePaneView)(t,s,r);case"polygons":return new((await i.e(507).then(i.bind(i,66999))).PolygonPaneView)(t,s,r);case"backgrounds":return new((await i.e(507).then(i.bind(i,47372))).BackgroundPaneView)(t,s,r)}return null}async function p(e,t,i){const s=[],r=Object.keys(e.graphicsInfo());r.sort(((e,t)=>_(e)-_(t)));for(const n of r){const r=await u(n,e,t,i);null!==r?s.push(r):d.has(n)||h.logWarn(`${n} is not supported by this build of graphics subsystem, skipping`)}return s}function _(e){var t;return null!==(t=r.primitivesZOrders.get(e))&&void 0!==t?t:0}function m(e){const t=Object.keys(e.graphicsInfo()),i=[];for(const s of t)switch(s){case"hlines":e.graphics().hlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new c(e,{line:{level:t.level},styleId:r,lineType:s}))}))}));break;case"horizlines":e.graphics().horizlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new c(e,{line:{level:t.level},styleId:r,lineType:s}))}))}))}return i}},90164:(e,t,i)=>{"use strict";i.d(t,{HHistDirection:()=>s,HHistLocation:()=>r,HHistVolumeMode:()=>n,containsHHistTimePointIndexes:()=>c,dematerializeHHist:()=>d,isHHistInBarsRange:()=>u,materializeHHist:()=>h});var s,r,n,o=i(50151),a=i(61401),l=i(44991);!function(e){e.LeftToRight="left_to_right",e.RightToLeft="right_to_left"}(s||(s={})),function(e){e.Relative="relative",e.Absolute="absolute"}(r||(r={})),function(e){e.UpDown="Up/Down",e.Total="Total",e.Delta="Delta"}(n||(n={}));const c=!0;function h(e,t){if(e.firstBarTime>=t.length||e.lastBarTime>=t.length)return null;const i=t[e.firstBarTime],s=t[e.lastBarTime];return i===a.INVALID_TIME_POINT_INDEX||s===a.INVALID_TIME_POINT_INDEX?null:((0,o.assert)(i<=s,"firstBarTime should not exceed lastBarTime"),(0,o.assert)(e.priceLow<=e.priceHigh,"priceLow should not exceed priceHigh"),{firstBarTime:i,lastBarTime:s,rate:e.rate,priceHigh:e.priceHigh,priceLow:e.priceLow})}function d(e,t,i){const s=(0,l.ensureTimePointIndexIndex)(i.indexOf(e.firstBarTime)),r=(0,l.ensureTimePointIndexIndex)(i.indexOf(e.lastBarTime));return{id:t,...e,firstBarTime:s,lastBarTime:r}}function u(e,t){const i=Math.min(e.firstBarTime,e.lastBarTime),s=Math.max(e.firstBarTime,e.lastBarTime);return t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar()}},
containsHorizLineTimePointIndexes:()=>o,dematerializeHorizLine:()=>l,isHorizLineInBarsRange:()=>c,materializeHorizLine:()=>a});var s=i(50151),r=i(61401),n=i(44991);const o=!0;function a(e,t){if(e.startIndex>=t.length||e.endIndex>=t.length)return null;const i=t[e.startIndex],n=t[e.endIndex];return i===r.INVALID_TIME_POINT_INDEX||n===r.INVALID_TIME_POINT_INDEX?null:((0,s.assert)(i<=n,"startIndex should not exceed endIndex"),{startIndex:i,endIndex:n,level:e.level,extendLeft:e.extendLeft,extendRight:e.extendRight})}function l(e,t,i){const s=(0,n.ensureTimePointIndexIndex)(i.indexOf(e.startIndex)),r=(0,n.ensureTimePointIndexIndex)(i.indexOf(e.endIndex));return{id:t,...e,startIndex:s,endIndex:r}}function c(e,t){const i=Math.min(e.startIndex,e.endIndex),s=Math.max(e.startIndex,e.endIndex);if(t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar())return!0;const r=e.startIndex<e.endIndex?e.extendLeft:e.extendRight,n=e.startIndex<e.endIndex?e.extendRight:e.extendLeft;return s<t.firstBar()&&n||i>t.lastBar()&&r}},83435:(e,t,i)=>{"use strict";i.d(t,{LiveStudyGraphics:()=>_});var s=i(50151),r=i(57898),n=i(90164),o=i(34522),a=i(68696),l=i(80009),c=i(93804),h=i(71409),d=i(12616);function u(e,t){return new p(e,t)}class p{constructor(e,t){this._setsByStyleIdAndKey=new Map,this._observableCollections=e,this._keyGetter=t}get(e,t){const i=this._observableCollections.get(e);if(!i)return;let s=this._setsByStyleIdAndKey.get(e);if(!s){s=new Map,this._setsByStyleIdAndKey.set(e,s);for(const e of i)this._addPrimitiveToSet(s,e);"cleared"in i&&(i.cleared().subscribe(this,this._clearSetsByKey.bind(this,s)),i.changed().subscribe(this,this._handleCollectionChanges.bind(this,s)))}return s.get(t)}_addPrimitiveToSet(e,t){const i=this._keyGetter(t);let s=e.get(i);s||(s=new Set,e.set(i,s)),s.add(t)}_clearSetsByKey(e){e.clear()}_handleCollectionChanges(e,t){var i;for(const s of t.removed)null===(i=e.get(this._keyGetter(s)))||void 0===i||i.delete(s);for(const i of t.created)this._addPrimitiveToSet(e,i)}}class _{constructor(e={}){this._indexes=[],this._hhistsByTimePointIndex=new Map,this._primitivesCollection=function(e){const t={};for(const i of h.primitiveNames){t[i]=new Map;const s=e[i];if(void 0!==s)for(const e in s)if(s.hasOwnProperty(e))switch(i){case"horizlines":t[i].set(e,new m(o.materializeHorizLine,o.containsHorizLineTimePointIndexes));break;case"vertlines":t[i].set(e,new m(a.materializeVertLine,a.containsVertLineTimePointIndexes));break;case"backgrounds":t[i].set(e,new m(c.materializeBackground,c.containsBackgroundTimePointIndexes));break;case"polygons":t[i].set(e,new m(l.materializePolygon,l.containsPolygonTimePointIndexes));break;case"hhists":t[i].set(e,new m(n.materializeHHist,n.containsHHistTimePointIndexes))}}0;return t}(e),this._tpoBlockSetsByStyleIdAndTpoId=u(this._primitivesCollection.tpoBlockSets,(e=>e.tpoId)),this._tpoVolumeRowsByStyleIdAndTpoId=u(this._primitivesCollection.tpoVolumeRows,(e=>e.tpoId))}horizlines(){return this._primitivesCollection.horizlines}vertlines(){return this._primitivesCollection.vertlines}lines(){ 34522:(e,t,i)=>{"use strict";i.d(t,{containsHorizLineTimePointIndexes:()=>o,dematerializeHorizLine:()=>l,isHorizLineInBarsRange:()=>c,materializeHorizLine:()=>a});var s=i(50151),r=i(61401),n=i(44991);const o=!0;function a(e,t){if(e.startIndex>=t.length||e.endIndex>=t.length)return null;const i=t[e.startIndex],n=t[e.endIndex];return i===r.INVALID_TIME_POINT_INDEX||n===r.INVALID_TIME_POINT_INDEX?null:((0,s.assert)(i<=n,"startIndex should not exceed endIndex"),{startIndex:i,endIndex:n,level:e.level,extendLeft:e.extendLeft,extendRight:e.extendRight})}function l(e,t,i){const s=(0,n.ensureTimePointIndexIndex)(i.indexOf(e.startIndex)),r=(0,n.ensureTimePointIndexIndex)(i.indexOf(e.endIndex));return{id:t,...e,startIndex:s,endIndex:r}}function c(e,t){const i=Math.min(e.startIndex,e.endIndex),s=Math.max(e.startIndex,e.endIndex);if(t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar())return!0;const r=e.startIndex<e.endIndex?e.extendLeft:e.extendRight,n=e.startIndex<e.endIndex?e.extendRight:e.extendLeft;return s<t.firstBar()&&n||i>t.lastBar()&&r}},83435:(e,t,i)=>{"use strict";i.d(t,{LiveStudyGraphics:()=>_});var s=i(50151),r=i(57898),n=i(90164),o=i(34522),a=i(68696),l=i(80009),c=i(93804),h=i(71409),d=i(12616);function u(e,t){return new p(e,t)}class p{constructor(e,t){this._setsByStyleIdAndKey=new Map,this._observableCollections=e,this._keyGetter=t}get(e,t){const i=this._observableCollections.get(e);if(!i)return;let s=this._setsByStyleIdAndKey.get(e);if(!s){s=new Map,this._setsByStyleIdAndKey.set(e,s);for(const e of i)this._addPrimitiveToSet(s,e);"cleared"in i&&(i.cleared().subscribe(this,this._clearSetsByKey.bind(this,s)),i.changed().subscribe(this,this._handleCollectionChanges.bind(this,s)))}return s.get(t)}_addPrimitiveToSet(e,t){const i=this._keyGetter(t);let s=e.get(i);s||(s=new Set,e.set(i,s)),s.add(t)}_clearSetsByKey(e){e.clear()}_handleCollectionChanges(e,t){var i;for(const s of t.removed)null===(i=e.get(this._keyGetter(s)))||void 0===i||i.delete(s);for(const i of t.created)this._addPrimitiveToSet(e,i)}}class _{constructor(e={}){this._indexes=[],this._hhistsByTimePointIndex=new Map,this._primitivesCollection=function(e){const t={};for(const i of h.primitiveNames){t[i]=new Map;const s=e[i];if(void 0!==s)for(const e in s)if(s.hasOwnProperty(e))switch(i){case"horizlines":t[i].set(e,new m(o.materializeHorizLine,o.containsHorizLineTimePointIndexes));break;case"vertlines":t[i].set(e,new m(a.materializeVertLine,a.containsVertLineTimePointIndexes));break;case"backgrounds":t[i].set(e,new m(c.materializeBackground,c.containsBackgroundTimePointIndexes));break;case"polygons":t[i].set(e,new m(l.materializePolygon,l.containsPolygonTimePointIndexes));break;case"hhists":t[i].set(e,new m(n.materializeHHist,n.containsHHistTimePointIndexes))}}0;return t}(e),this._tpoBlockSetsByStyleIdAndTpoId=u(this._primitivesCollection.tpoBlockSets,(e=>e.tpoId)),this._tpoVolumeRowsByStyleIdAndTpoId=u(this._primitivesCollection.tpoVolumeRows,(e=>e.tpoId))}horizlines(){return this._primitivesCollection.horizlines}vertlines(){
return this._primitivesCollection.lines}hlines(){return this._primitivesCollection.hlines}textmarks(){return this._primitivesCollection.textmarks}shapemarks(){return this._primitivesCollection.shapemarks}backgrounds(){return this._primitivesCollection.backgrounds}polygons(){return this._primitivesCollection.polygons}trendchannels(){return this._primitivesCollection.trendchannels}hhists(){return this._primitivesCollection.hhists}dwglabels(){return this._primitivesCollection.dwglabels}dwglines(){return this._primitivesCollection.dwglines}dwgpolylines(){return this._primitivesCollection.dwgpolylines}dwgboxes(){return this._primitivesCollection.dwgboxes}dwgtables(){return this._primitivesCollection.dwgtables}dwgtablecells(){return this._primitivesCollection.dwgtablecells}dwglinefills(){return this._primitivesCollection.dwglinefills}tpos(){return this._primitivesCollection.tpos}tpoBlockSets(){return this._primitivesCollection.tpoBlockSets}tpoBlockSetsByStyleAndTpoId(e,t){return this._tpoBlockSetsByStyleIdAndTpoId.get(e,t)}tpoLevels(){return this._primitivesCollection.tpoLevels}tpoVolumeRows(){return this._primitivesCollection.tpoVolumeRows}tpoVolumeRowByStyleAndTpoId(e,t){return this._tpoVolumeRowsByStyleIdAndTpoId.get(e,t)}logs(){return this._primitivesCollection.logs}observableLogs(){return this._primitivesCollection.logs}performance(){return this._primitivesCollection.performance}observablePerformance(){return this._primitivesCollection.performance}footprints(){return this._primitivesCollection.footprints}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}clear(){this._indexes=[];for(const e of h.primitiveNames)this._primitivesCollection[e].forEach((e=>e.clear()));this._hhistsByTimePointIndex=new Map}extract(){const e=e=>e.extract(),t={indexes:this._indexes,horizlines:g(this._primitivesCollection.horizlines,e),vertlines:g(this._primitivesCollection.vertlines,e),lines:g(this._primitivesCollection.lines,e),hlines:g(this._primitivesCollection.hlines,e),textmarks:g(this._primitivesCollection.textmarks,e),shapemarks:g(this._primitivesCollection.shapemarks,e),backgrounds:g(this._primitivesCollection.backgrounds,e),polygons:g(this._primitivesCollection.polygons,e),trendchannels:g(this._primitivesCollection.trendchannels,e),hhists:g(this._primitivesCollection.hhists,e),dwglabels:g(this._primitivesCollection.dwglabels,e),dwglines:g(this._primitivesCollection.dwglines,e),dwgpolylines:g(this._primitivesCollection.dwgpolylines,e),dwgboxes:g(this._primitivesCollection.dwgboxes,e),dwgtables:g(this._primitivesCollection.dwgtables,e),dwgtablecells:g(this._primitivesCollection.dwgtablecells,e),dwglinefills:g(this._primitivesCollection.dwglinefills,e),tpos:g(this._primitivesCollection.tpos,e),tpoBlockSets:g(this._primitivesCollection.tpoBlockSets,e),tpoLevels:g(this._primitivesCollection.tpoLevels,e),tpoVolumeRows:g(this._primitivesCollection.tpoVolumeRows,e),logs:new Map,performance:new Map,footprints:g(this._primitivesCollection.footprints,e)};return this._hhistsByTimePointIndex=new Map,new d.StaticStudyGraphics("data",t)} return this._primitivesCollection.vertlines}lines(){return this._primitivesCollection.lines}hlines(){return this._primitivesCollection.hlines}textmarks(){return this._primitivesCollection.textmarks}shapemarks(){return this._primitivesCollection.shapemarks}backgrounds(){return this._primitivesCollection.backgrounds}polygons(){return this._primitivesCollection.polygons}trendchannels(){return this._primitivesCollection.trendchannels}hhists(){return this._primitivesCollection.hhists}dwglabels(){return this._primitivesCollection.dwglabels}dwglines(){return this._primitivesCollection.dwglines}dwgpolylines(){return this._primitivesCollection.dwgpolylines}dwgboxes(){return this._primitivesCollection.dwgboxes}dwgtables(){return this._primitivesCollection.dwgtables}dwgtablecells(){return this._primitivesCollection.dwgtablecells}dwglinefills(){return this._primitivesCollection.dwglinefills}tpos(){return this._primitivesCollection.tpos}tpoBlockSets(){return this._primitivesCollection.tpoBlockSets}tpoBlockSetsByStyleAndTpoId(e,t){return this._tpoBlockSetsByStyleIdAndTpoId.get(e,t)}tpoLevels(){return this._primitivesCollection.tpoLevels}tpoVolumeRows(){return this._primitivesCollection.tpoVolumeRows}tpoVolumeRowByStyleAndTpoId(e,t){return this._tpoVolumeRowsByStyleIdAndTpoId.get(e,t)}logs(){return this._primitivesCollection.logs}observableLogs(){return this._primitivesCollection.logs}performance(){return this._primitivesCollection.performance}observablePerformance(){return this._primitivesCollection.performance}footprints(){return this._primitivesCollection.footprints}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}clear(){this._indexes=[];for(const e of h.primitiveNames)this._primitivesCollection[e].forEach((e=>e.clear()));this._hhistsByTimePointIndex=new Map}extract(){const e=e=>e.extract(),t={indexes:this._indexes,horizlines:g(this._primitivesCollection.horizlines,e),vertlines:g(this._primitivesCollection.vertlines,e),lines:g(this._primitivesCollection.lines,e),hlines:g(this._primitivesCollection.hlines,e),textmarks:g(this._primitivesCollection.textmarks,e),shapemarks:g(this._primitivesCollection.shapemarks,e),backgrounds:g(this._primitivesCollection.backgrounds,e),polygons:g(this._primitivesCollection.polygons,e),trendchannels:g(this._primitivesCollection.trendchannels,e),hhists:g(this._primitivesCollection.hhists,e),dwglabels:g(this._primitivesCollection.dwglabels,e),dwglines:g(this._primitivesCollection.dwglines,e),dwgpolylines:g(this._primitivesCollection.dwgpolylines,e),dwgboxes:g(this._primitivesCollection.dwgboxes,e),dwgtables:g(this._primitivesCollection.dwgtables,e),dwgtablecells:g(this._primitivesCollection.dwgtablecells,e),dwglinefills:g(this._primitivesCollection.dwglinefills,e),tpos:g(this._primitivesCollection.tpos,e),tpoBlockSets:g(this._primitivesCollection.tpoBlockSets,e),tpoLevels:g(this._primitivesCollection.tpoLevels,e),tpoVolumeRows:g(this._primitivesCollection.tpoVolumeRows,e),logs:new Map,performance:new Map,footprints:g(this._primitivesCollection.footprints,e)}
replaceIndexesTo(e){this._indexes=e;const t=e=>e.replaceIndexesTo(this._indexes);for(const e of h.primitiveNames)this._primitivesCollection[e].forEach(t);this._hhistsByTimePointIndex=(0,h.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}processCommands(e){void 0!==e.erase&&this._processEraseCommands(e.erase),void 0!==e.create&&this._processCreateCommands(e.create)}_processCreateCommands(e){for(const t in e){if(!e.hasOwnProperty(t))continue;const i=t;switch(i){case"hhists":f(this._indexes,this._primitivesCollection.hhists,e[i]);break;case"horizlines":f(this._indexes,this._primitivesCollection.horizlines,e[i]);break;case"vertlines":f(this._indexes,this._primitivesCollection.vertlines,e[i]);break;case"polygons":f(this._indexes,this._primitivesCollection.polygons,e[i]);break;case"backgrounds":f(this._indexes,this._primitivesCollection.backgrounds,e[i])}}this._hhistsByTimePointIndex=(0,h.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}_processEraseCommands(e){for(const t of e)if("all"===t.action)for(const e of h.primitiveNames)this._primitivesCollection[e].forEach((e=>e.clearPrimitives()));else{const e=e=>e.deleteById(t.id);this._primitivesCollection[t.type].forEach(e)}this._hhistsByTimePointIndex=(0,h.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}}class m{constructor(e,t){this._primitivesDataById=new Map,this._primitiveById=new Map,this._changed=new r.Delegate,this._cleared=new r.Delegate,this._materializePrimitive=e,this._isRematerializationRequiredWithNewIndexes=t}changed(){return this._changed}cleared(){return this._cleared}forEach(e,t){this._primitiveById.forEach((i=>{e.call(t,i,i,this)}))}has(e){let t=!1;return this._primitiveById.forEach((i=>{t=t||i===e})),t}get size(){return this._primitiveById.size}[Symbol.iterator](){return this._primitiveById.values()}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){return this._primitiveById.values()}hasId(e){return this._primitiveById.has(e)}addData(e,t){const i=[];e.forEach((e=>{this._primitivesDataById.set(e.id,e);const s=this._tryMaterialize(t,e);null!==s&&i.push(s)})),i.length>0&&this._changed.fire({created:i,removed:[]})}deleteById(e){const t=this._primitiveById.get(e);t&&(this._primitiveById.delete(e),this._primitivesDataById.delete(e),this._changed.fire({created:[],removed:[t]}))}clear(){this.clearPrimitives()}clearPrimitives(){this._primitivesDataById.clear(),this._primitiveById.clear(),this._cleared.fire()}replaceIndexesTo(e){if(!this._isRematerializationRequiredWithNewIndexes)return;const t=Array.from(this._primitiveById.values());this._primitiveById.clear(),this._primitivesDataById.forEach(this._tryMaterialize.bind(this,e),this);const i=Array.from(this._primitiveById.values());this._changed.fire({created:i,removed:t})}extract(){const e=new Set(this._primitivesDataById.values());return this.clearPrimitives(),e}_tryMaterialize(e,t){const i=this._materializePrimitive(t,e);return null!==i&&((0, ;return this._hhistsByTimePointIndex=new Map,new d.StaticStudyGraphics("data",t)}replaceIndexesTo(e){this._indexes=e;const t=e=>e.replaceIndexesTo(this._indexes);for(const e of h.primitiveNames)this._primitivesCollection[e].forEach(t);this._hhistsByTimePointIndex=(0,h.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}processCommands(e){void 0!==e.erase&&this._processEraseCommands(e.erase),void 0!==e.create&&this._processCreateCommands(e.create)}_processCreateCommands(e){for(const t in e){if(!e.hasOwnProperty(t))continue;const i=t;switch(i){case"hhists":f(this._indexes,this._primitivesCollection.hhists,e[i]);break;case"horizlines":f(this._indexes,this._primitivesCollection.horizlines,e[i]);break;case"vertlines":f(this._indexes,this._primitivesCollection.vertlines,e[i]);break;case"polygons":f(this._indexes,this._primitivesCollection.polygons,e[i]);break;case"backgrounds":f(this._indexes,this._primitivesCollection.backgrounds,e[i])}}this._hhistsByTimePointIndex=(0,h.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}_processEraseCommands(e){for(const t of e)if("all"===t.action)for(const e of h.primitiveNames)this._primitivesCollection[e].forEach((e=>e.clearPrimitives()));else{const e=e=>e.deleteById(t.id);this._primitivesCollection[t.type].forEach(e)}this._hhistsByTimePointIndex=(0,h.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}}class m{constructor(e,t){this._primitivesDataById=new Map,this._primitiveById=new Map,this._changed=new r.Delegate,this._cleared=new r.Delegate,this._materializePrimitive=e,this._isRematerializationRequiredWithNewIndexes=t}changed(){return this._changed}cleared(){return this._cleared}forEach(e,t){this._primitiveById.forEach((i=>{e.call(t,i,i,this)}))}has(e){let t=!1;return this._primitiveById.forEach((i=>{t=t||i===e})),t}get size(){return this._primitiveById.size}[Symbol.iterator](){return this._primitiveById.values()}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){return this._primitiveById.values()}hasId(e){return this._primitiveById.has(e)}addData(e,t){const i=[];e.forEach((e=>{this._primitivesDataById.set(e.id,e);const s=this._tryMaterialize(t,e);null!==s&&i.push(s)})),i.length>0&&this._changed.fire({created:i,removed:[]})}deleteById(e){const t=this._primitiveById.get(e);t&&(this._primitiveById.delete(e),this._primitivesDataById.delete(e),this._changed.fire({created:[],removed:[t]}))}clear(){this.clearPrimitives()}clearPrimitives(){this._primitivesDataById.clear(),this._primitiveById.clear(),this._cleared.fire()}replaceIndexesTo(e){if(!this._isRematerializationRequiredWithNewIndexes)return;const t=Array.from(this._primitiveById.values());this._primitiveById.clear(),this._primitivesDataById.forEach(this._tryMaterialize.bind(this,e),this);const i=Array.from(this._primitiveById.values());this._changed.fire({created:i,removed:t})}extract(){const e=new Set(this._primitivesDataById.values());return this.clearPrimitives(),e}_tryMaterialize(e,t){const i=this._materializePrimitive(t,e);return null!==i&&((0,
s.assert)(!this._primitiveById.has(t.id),"primitive with specified id should not exist"),this._primitiveById.set(t.id,i)),i}}function g(e,t){const i=new Map;return e.forEach(((e,s)=>i.set(s,t(e)))),i}function f(e,t,i=[]){for(const r of i){const i=r.styleId,n=t.get(i);(0,s.assert)(void 0!==n,"Every style used by graphics primitive should be declared in study metainfo"),n.addData(r.data,e)}}},80009:(e,t,i)=>{"use strict";i.d(t,{containsPolygonTimePointIndexes:()=>n,dematerializePolygon:()=>a,isPolygonInBarsRange:()=>l,materializePolygon:()=>o});var s=i(61401),r=i(44991);const n=!0;function o(e,t){for(const i of e.points){if(i.index>=t.length)return null;if(t[i.index]===s.INVALID_TIME_POINT_INDEX)return null}return{points:e.points.map((e=>({index:t[e.index],offset:e.offset,level:e.level})))}}function a(e,t,i){return{id:t,points:e.points.map((e=>({...e,index:(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index))})))}}function l(e,t){var i;if(e.points.some((e=>{var i;return t.contains(e.index+(null!==(i=e.offset)&&void 0!==i?i:0))})))return!0;let s=!1,r=!1;const n=t.firstBar();for(const t of e.points)t.index+(null!==(i=t.offset)&&void 0!==i?i:0)<n?s=!0:r=!0;return s&&r}},44991:(e,t,i)=>{"use strict";function s(e){if(e<0)throw new Error("TimePointIndexIndex should be non-negative integer");return e}i.d(t,{ensureTimePointIndexIndex:()=>s})},12616:(e,t,i)=>{"use strict";i.d(t,{StaticStudyGraphics:()=>h,emptyStudyGraphics:()=>_,loadStudyGraphics:()=>m,saveStudyGraphics:()=>g});var s=i(61401),r=i(34522),n=i(68696),o=i(90164),a=i(80009),l=i(93804),c=i(71409);class h{constructor(e,t){if(this._indexes=[],this._horizlines=new Map,this._vertlines=new Map,this._lines=new Map,this._hlines=new Map,this._textmarks=new Map,this._shapemarks=new Map,this._backgrounds=new Map,this._polygons=new Map,this._trendchannels=new Map,this._hhists=new Map,this._dwglabels=new Map,this._dwglines=new Map,this._dwgpolylines=new Map,this._dwgboxes=new Map,this._dwgtables=new Map,this._dwgtablecells=new Map,this._dwglinefills=new Map,this._tpos=new Map,this._tpoBlockSets=new Map,this._tpoLevelGroups=new Map,this._tpoVolumeRows=new Map,this._logs=new Map,this._performance=new Map,this._footprints=new Map,"data"===e){const e=t;this._indexes=e.indexes,this._vertlines=d(e.vertlines,this._indexes,n.materializeVertLine),this._horizlines=d(e.horizlines,this._indexes,r.materializeHorizLine),this._polygons=d(e.polygons,this._indexes,a.materializePolygon),this._hhists=d(e.hhists,this._indexes,o.materializeHHist),this._backgrounds=d(e.backgrounds,this._indexes,l.materializeBackground)}else if("state"===e){const e=t;this._indexes=e.indexes||[],this._vertlines=u(e.vertlines,this._indexes,n.materializeVertLine),this._horizlines=u(e.horizlines,this._indexes,r.materializeHorizLine),this._polygons=u(e.polygons,this._indexes,a.materializePolygon),this._hhists=u(e.hhists,this._indexes,o.materializeHHist),this._backgrounds=u(e.backgrounds,this._indexes,l.materializeBackground)}this._hhistsByTimePointIndex=(0,c.splitHHistsByTimePointIndex)(this._hhists)}horizlines(){ s.assert)(!this._primitiveById.has(t.id),"primitive with specified id should not exist"),this._primitiveById.set(t.id,i)),i}}function g(e,t){const i=new Map;return e.forEach(((e,s)=>i.set(s,t(e)))),i}function f(e,t,i=[]){for(const r of i){const i=r.styleId,n=t.get(i);(0,s.assert)(void 0!==n,"Every style used by graphics primitive should be declared in study metainfo"),n.addData(r.data,e)}}},80009:(e,t,i)=>{"use strict";i.d(t,{containsPolygonTimePointIndexes:()=>n,dematerializePolygon:()=>a,isPolygonInBarsRange:()=>l,materializePolygon:()=>o});var s=i(61401),r=i(44991);const n=!0;function o(e,t){for(const i of e.points){if(i.index>=t.length)return null;if(t[i.index]===s.INVALID_TIME_POINT_INDEX)return null}return{points:e.points.map((e=>({index:t[e.index],offset:e.offset,level:e.level})))}}function a(e,t,i){return{id:t,points:e.points.map((e=>({...e,index:(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index))})))}}function l(e,t){var i;if(e.points.some((e=>{var i;return t.contains(e.index+(null!==(i=e.offset)&&void 0!==i?i:0))})))return!0;let s=!1,r=!1;const n=t.firstBar();for(const t of e.points)t.index+(null!==(i=t.offset)&&void 0!==i?i:0)<n?s=!0:r=!0;return s&&r}},44991:(e,t,i)=>{"use strict";function s(e){if(e<0)throw new Error("TimePointIndexIndex should be non-negative integer");return e}i.d(t,{ensureTimePointIndexIndex:()=>s})},12616:(e,t,i)=>{"use strict";i.d(t,{StaticStudyGraphics:()=>h,emptyStudyGraphics:()=>_,loadStudyGraphics:()=>m,saveStudyGraphics:()=>g});var s=i(61401),r=i(34522),n=i(68696),o=i(90164),a=i(80009),l=i(93804),c=i(71409);class h{constructor(e,t){if(this._indexes=[],this._horizlines=new Map,this._vertlines=new Map,this._lines=new Map,this._hlines=new Map,this._textmarks=new Map,this._shapemarks=new Map,this._backgrounds=new Map,this._polygons=new Map,this._trendchannels=new Map,this._hhists=new Map,this._dwglabels=new Map,this._dwglines=new Map,this._dwgpolylines=new Map,this._dwgboxes=new Map,this._dwgtables=new Map,this._dwgtablecells=new Map,this._dwglinefills=new Map,this._tpos=new Map,this._tpoBlockSets=new Map,this._tpoLevelGroups=new Map,this._tpoVolumeRows=new Map,this._logs=new Map,this._performance=new Map,this._footprints=new Map,"data"===e){const e=t;this._indexes=e.indexes,this._vertlines=d(e.vertlines,this._indexes,n.materializeVertLine),this._horizlines=d(e.horizlines,this._indexes,r.materializeHorizLine),this._polygons=d(e.polygons,this._indexes,a.materializePolygon),this._hhists=d(e.hhists,this._indexes,o.materializeHHist),this._backgrounds=d(e.backgrounds,this._indexes,l.materializeBackground)}else if("state"===e){const e=t;this._indexes=e.indexes||[],this._vertlines=u(e.vertlines,this._indexes,n.materializeVertLine),this._horizlines=u(e.horizlines,this._indexes,r.materializeHorizLine),this._polygons=u(e.polygons,this._indexes,a.materializePolygon),this._hhists=u(e.hhists,this._indexes,o.materializeHHist),this._backgrounds=u(e.backgrounds,this._indexes,l.materializeBackground)}this._hhistsByTimePointIndex=(0,c.splitHHistsByTimePointIndex)(this._hhists)}horizlines(){
return this._horizlines}vertlines(){return this._vertlines}lines(){return this._lines}hlines(){return this._hlines}textmarks(){return this._textmarks}shapemarks(){return this._shapemarks}backgrounds(){return this._backgrounds}polygons(){return this._polygons}trendchannels(){return this._trendchannels}hhists(){return this._hhists}dwglabels(){return this._dwglabels}dwglines(){return this._dwglines}dwgpolylines(){return this._dwgpolylines}dwgboxes(){return this._dwgboxes}dwgtables(){return this._dwgtables}dwgtablecells(){return this._dwgtablecells}dwglinefills(){return this._dwglinefills}tpos(){return this._tpos}tpoBlockSets(){return this._tpoBlockSets}tpoLevels(){return this._tpoLevelGroups}tpoBlockSetsByStyleAndTpoId(e,t){var i;return null===(i=this._tpoBlockSetsByStyleIdAndTpoId)||void 0===i?void 0:i.get(e,t)}tpoVolumeRows(){return this._tpoVolumeRows}tpoVolumeRowByStyleAndTpoId(e,t){var i;return null===(i=this._tpoVolumeRowsByStyleIdAndTpoId)||void 0===i?void 0:i.get(e,t)}logs(){return this._logs}performance(){return this._performance}footprints(){return this._footprints}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}}function d(e,t,i){const s=new Map;return e.forEach(((e,r)=>{const n=s.get(r)||new Set;e.forEach((e=>{const s=i(e,t);null!==s&&n.add(s)})),s.set(r,n)})),s}function u(e,t,i){const s=new Map;if(void 0===e)return s;for(const r of e){const e=r.styleId,n=s.get(e)||new Set;r.data.forEach((e=>{const s=i(e,t);null!==s&&n.add(s)})),s.set(e,n)}return s}function p(e,t,i,s,r,n){const o=[];return e.forEach(((e,a)=>{e.forEach((e=>{(null===r||s(e,r))&&function(e,t,i){let s=null;for(const i of e)i.styleId===t&&(s=i);null===s&&(s={styleId:t,data:[]},e.push(s)),s.data.push(i)}(o,a,n(e,t(e),i))}))})),o.length>0?o:void 0}function _(){return new h}function m(e){return new h("state",e)}function g(e,t){const i=function(e){const t=new Set;e.horizlines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.vertlines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.index)}))})),e.lines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.textmarks().forEach(((e,i)=>{e.forEach((e=>{t.add(e.time)}))})),e.shapemarks().forEach(((e,i)=>{e.forEach((e=>{t.add(e.time)}))})),e.backgrounds().forEach(((e,i)=>{e.forEach((e=>{t.add(null!==e.start?e.start:s.INVALID_TIME_POINT_INDEX),t.add(e.stop)}))})),e.polygons().forEach(((e,i)=>{e.forEach((e=>{e.points.forEach((e=>{t.add(e.index)}))}))})),e.trendchannels().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.hhists().forEach(((e,i)=>{e.forEach((e=>{t.add(e.firstBarTime),t.add(e.lastBarTime)}))})),e.dwglabels().forEach(((e,i)=>{e.forEach((e=>{t.add(e.x)}))})),e.dwglines().forEach(((e,i)=>{e.forEach((e=>{var i,r;t.add(null!==(i=e.x1)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX),t.add(null!==(r=e.x2)&&void 0!==r?r:s.INVALID_TIME_POINT_INDEX)}))})),e.dwgpolylines().forEach(((e,i)=>{e.forEach((e=>{var i;for(const r of e.points)t.add(null!==(i=r.x)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX)}))})), return this._horizlines}vertlines(){return this._vertlines}lines(){return this._lines}hlines(){return this._hlines}textmarks(){return this._textmarks}shapemarks(){return this._shapemarks}backgrounds(){return this._backgrounds}polygons(){return this._polygons}trendchannels(){return this._trendchannels}hhists(){return this._hhists}dwglabels(){return this._dwglabels}dwglines(){return this._dwglines}dwgpolylines(){return this._dwgpolylines}dwgboxes(){return this._dwgboxes}dwgtables(){return this._dwgtables}dwgtablecells(){return this._dwgtablecells}dwglinefills(){return this._dwglinefills}tpos(){return this._tpos}tpoBlockSets(){return this._tpoBlockSets}tpoLevels(){return this._tpoLevelGroups}tpoBlockSetsByStyleAndTpoId(e,t){var i;return null===(i=this._tpoBlockSetsByStyleIdAndTpoId)||void 0===i?void 0:i.get(e,t)}tpoVolumeRows(){return this._tpoVolumeRows}tpoVolumeRowByStyleAndTpoId(e,t){var i;return null===(i=this._tpoVolumeRowsByStyleIdAndTpoId)||void 0===i?void 0:i.get(e,t)}logs(){return this._logs}performance(){return this._performance}footprints(){return this._footprints}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}}function d(e,t,i){const s=new Map;return e.forEach(((e,r)=>{const n=s.get(r)||new Set;e.forEach((e=>{const s=i(e,t);null!==s&&n.add(s)})),s.set(r,n)})),s}function u(e,t,i){const s=new Map;if(void 0===e)return s;for(const r of e){const e=r.styleId,n=s.get(e)||new Set;r.data.forEach((e=>{const s=i(e,t);null!==s&&n.add(s)})),s.set(e,n)}return s}function p(e,t,i,s,r,n){const o=[];return e.forEach(((e,a)=>{e.forEach((e=>{(null===r||s(e,r))&&function(e,t,i){let s=null;for(const i of e)i.styleId===t&&(s=i);null===s&&(s={styleId:t,data:[]},e.push(s)),s.data.push(i)}(o,a,n(e,t(e),i))}))})),o.length>0?o:void 0}function _(){return new h}function m(e){return new h("state",e)}function g(e,t){const i=function(e){const t=new Set;e.horizlines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.vertlines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.index)}))})),e.lines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.textmarks().forEach(((e,i)=>{e.forEach((e=>{t.add(e.time)}))})),e.shapemarks().forEach(((e,i)=>{e.forEach((e=>{t.add(e.time)}))})),e.backgrounds().forEach(((e,i)=>{e.forEach((e=>{t.add(null!==e.start?e.start:s.INVALID_TIME_POINT_INDEX),t.add(e.stop)}))})),e.polygons().forEach(((e,i)=>{e.forEach((e=>{e.points.forEach((e=>{t.add(e.index)}))}))})),e.trendchannels().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.hhists().forEach(((e,i)=>{e.forEach((e=>{t.add(e.firstBarTime),t.add(e.lastBarTime)}))})),e.dwglabels().forEach(((e,i)=>{e.forEach((e=>{t.add(e.x)}))})),e.dwglines().forEach(((e,i)=>{e.forEach((e=>{var i,r;t.add(null!==(i=e.x1)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX),t.add(null!==(r=e.x2)&&void 0!==r?r:s.INVALID_TIME_POINT_INDEX)}))})),e.dwgpolylines().forEach(((e,i)=>{e.forEach((e=>{var i;for(const r of e.points)t.add(null!==(i=r.x)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX)}))})),
e.dwgboxes().forEach(((e,i)=>{e.forEach((e=>{var i,r;t.add(null!==(i=e.left)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX),t.add(null!==(r=e.right)&&void 0!==r?r:s.INVALID_TIME_POINT_INDEX)}))})),e.tpos().forEach(((e,i)=>{e.forEach((e=>{t.add(e.firstBarTime),t.add(e.lastBarTime)}))})),e.footprints().forEach((e=>{e.forEach((e=>{t.add(e.index)}))}));const i=Array.from(t);return i.sort(((e,t)=>e-t)),i}(e),c={indexes:i};let h=0;const d=()=>++h;return c.vertlines=p(e.vertlines(),d,i,n.isVertLineInBarsRange,t,n.dematerializeVertLine),c.horizlines=p(e.horizlines(),d,i,r.isHorizLineInBarsRange,t,r.dematerializeHorizLine),c.polygons=p(e.polygons(),d,i,a.isPolygonInBarsRange,t,a.dematerializePolygon),c.hhists=p(e.hhists(),d,i,o.isHHistInBarsRange,t,o.dematerializeHHist),c.backgrounds=p(e.backgrounds(),d,i,l.isBackgroundInBarsRange,t,l.dematerializeBackground),c}},95586:(e,t,i)=>{"use strict";var s,r,n,o;i.r(t),i.d(t,{HAlign:()=>r,LineStyle:()=>o,MarkLocation:()=>s,VAlign:()=>n}),function(e){e.AboveBar="AboveBar",e.BelowBar="BelowBar",e.Top="Top",e.Bottom="Bottom",e.Right="Right",e.Left="Left",e.Absolute="Absolute",e.AbsoluteUp="AbsoluteUp",e.AbsoluteDown="AbsoluteDown"}(s||(s={})),function(e){e.Left="left",e.Center="center",e.Right="right"}(r||(r={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(n||(n={})),function(e){e[e.Solid=0]="Solid",e[e.Dotted=1]="Dotted",e[e.Dashed=2]="Dashed"}(o||(o={}))},71409:(e,t,i)=>{"use strict";i.d(t,{isStudyGraphicsEmpty:()=>n,primitiveNames:()=>s,primitivesZOrders:()=>r,splitHHistsByTimePointIndex:()=>o});const s=["horizlines","vertlines","lines","hlines","textmarks","shapemarks","backgrounds","polygons","trendchannels","hhists","dwglabels","dwglines","dwgpolylines","dwgboxes","dwgtables","dwgtablecells","dwglinefills","tpos","tpoBlockSets","tpoLevels","tpoVolumeRows","logs","performance","footprints"],r=new Map([["logs",-4],["performance",-4],["polygons",-4],["trendchannels",-3],["textmarks",-2],["shapemarks",-2],["backgrounds",-1],["footprints",1],["hlines",1],["horizlines",1],["hhists",1],["dwglinefills",2],["vertlines",3],["lines",3],["dwglines",3],["dwgpolylines",3],["dwgboxes",4],["dwglabels",5],["dwgtables",6],["dwgtablecells",6],["tpos",7],["tpoBlockSets",7],["tpoLevels",7],["tpoVolumeRows",7]]);function n(e){return!s.some((t=>{const i=e[t]();for(const[,e]of i)if(e.size>0)return!0;return!1}))}function o(e){const t=new Map;return e.forEach(((e,i)=>{e.forEach((e=>{const s={...e,styleId:i},r=e.firstBarTime;let n=t.get(r);void 0===n&&(n=new Set,t.set(r,n)),n.add(s)}))})),t}},68696:(e,t,i)=>{"use strict";i.d(t,{containsVertLineTimePointIndexes:()=>n,dematerializeVertLine:()=>a,isVertLineInBarsRange:()=>l,materializeVertLine:()=>o});var s=i(61401),r=i(44991);const n=!0;function o(e,t){if(e.index>=t.length)return null;const i=t[e.index];return i===s.INVALID_TIME_POINT_INDEX?null:{startPrice:e.startPrice,endPrice:e.endPrice,index:i,extendTop:e.extendTop,extendBottom:e.extendBottom}}function a(e,t,i){const s=(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index));return{id:t,...e,index:s e.dwgboxes().forEach(((e,i)=>{e.forEach((e=>{var i,r;t.add(null!==(i=e.left)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX),t.add(null!==(r=e.right)&&void 0!==r?r:s.INVALID_TIME_POINT_INDEX)}))})),e.tpos().forEach(((e,i)=>{e.forEach((e=>{t.add(e.firstBarTime),t.add(e.lastBarTime)}))})),e.footprints().forEach((e=>{e.forEach((e=>{t.add(e.index)}))}));const i=Array.from(t);return i.sort(((e,t)=>e-t)),i}(e),c={indexes:i};let h=0;const d=()=>++h;return c.vertlines=p(e.vertlines(),d,i,n.isVertLineInBarsRange,t,n.dematerializeVertLine),c.horizlines=p(e.horizlines(),d,i,r.isHorizLineInBarsRange,t,r.dematerializeHorizLine),c.polygons=p(e.polygons(),d,i,a.isPolygonInBarsRange,t,a.dematerializePolygon),c.hhists=p(e.hhists(),d,i,o.isHHistInBarsRange,t,o.dematerializeHHist),c.backgrounds=p(e.backgrounds(),d,i,l.isBackgroundInBarsRange,t,l.dematerializeBackground),c}},95586:(e,t,i)=>{"use strict";var s,r,n,o;i.r(t),i.d(t,{HAlign:()=>r,LineStyle:()=>o,MarkLocation:()=>s,VAlign:()=>n}),function(e){e.AboveBar="AboveBar",e.BelowBar="BelowBar",e.Top="Top",e.Bottom="Bottom",e.Right="Right",e.Left="Left",e.Absolute="Absolute",e.AbsoluteUp="AbsoluteUp",e.AbsoluteDown="AbsoluteDown"}(s||(s={})),function(e){e.Left="left",e.Center="center",e.Right="right"}(r||(r={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(n||(n={})),function(e){e[e.Solid=0]="Solid",e[e.Dotted=1]="Dotted",e[e.Dashed=2]="Dashed"}(o||(o={}))},71409:(e,t,i)=>{"use strict";i.d(t,{isStudyGraphicsEmpty:()=>n,primitiveNames:()=>s,primitivesZOrders:()=>r,splitHHistsByTimePointIndex:()=>o});const s=["horizlines","vertlines","lines","hlines","textmarks","shapemarks","backgrounds","polygons","trendchannels","hhists","dwglabels","dwglines","dwgpolylines","dwgboxes","dwgtables","dwgtablecells","dwglinefills","tpos","tpoBlockSets","tpoLevels","tpoVolumeRows","logs","performance","footprints"],r=new Map([["logs",-4],["performance",-4],["polygons",-4],["trendchannels",-3],["textmarks",-2],["shapemarks",-2],["backgrounds",-1],["footprints",1],["hlines",1],["horizlines",1],["hhists",1],["dwglinefills",2],["vertlines",3],["lines",3],["dwglines",3],["dwgpolylines",3],["dwgboxes",4],["dwglabels",5],["dwgtables",6],["dwgtablecells",6],["tpos",7],["tpoBlockSets",7],["tpoLevels",7],["tpoVolumeRows",7]]);function n(e){return!s.some((t=>{const i=e[t]();for(const[,e]of i)if(e.size>0)return!0;return!1}))}function o(e){const t=new Map;return e.forEach(((e,i)=>{e.forEach((e=>{const s={...e,styleId:i},r=e.firstBarTime;let n=t.get(r);void 0===n&&(n=new Set,t.set(r,n)),n.add(s)}))})),t}},68696:(e,t,i)=>{"use strict";i.d(t,{containsVertLineTimePointIndexes:()=>n,dematerializeVertLine:()=>a,isVertLineInBarsRange:()=>l,materializeVertLine:()=>o});var s=i(61401),r=i(44991);const n=!0;function o(e,t){if(e.index>=t.length)return null;const i=t[e.index];return i===s.INVALID_TIME_POINT_INDEX?null:{startPrice:e.startPrice,endPrice:e.endPrice,index:i,extendTop:e.extendTop,extendBottom:e.extendBottom}}function a(e,t,i){const s=(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index));return{id:t,...e,index:s

View File

@@ -1,6 +1,6 @@
(()=>{"use strict";var e,a,d,c,f,t={},b={};function r(e){var a=b[e];if(void 0!==a)return a.exports;var d=b[e]={id:e,loaded:!1,exports:{}};return t[e].call(d.exports,d,d.exports,r),d.loaded=!0,d.exports}r.m=t,r.c=b,e=[],r.O=(a,d,c,f)=>{if(!d){var t=1/0;for(i=0;i<e.length;i++){for(var[d,c,f]=e[i],b=!0,n=0;n<d.length;n++)(!1&f||t>=f)&&Object.keys(r.O).every((e=>r.O[e](d[n])))?d.splice(n--,1):(b=!1,f<t&&(t=f));if(b){e.splice(i--,1);var o=c();void 0!==o&&(a=o)}}return a}f=f||0;for(var i=e.length;i>0&&e[i-1][2]>f;i--)e[i]=e[i-1];e[i]=[d,c,f]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a}),a},d=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var f=Object.create(null);r.r(f);var t={};a=a||[null,d({}),d([]),d(d)];for(var b=2&c&&e;"object"==typeof b&&!~a.indexOf(b);b=d(b))Object.getOwnPropertyNames(b).forEach((a=>t[a]=()=>e[a]));return t.default=()=>e,r.d(f,t),f},r.d=(e,a)=>{for(var d in a)r.o(a,d)&&!r.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,d)=>(r.f[d](e,a),a)),[])),r.u=e=>9417===e?"__LANG__.9417.7ff64779d43389a1bb41.js":3175===e?"__LANG__.3175.e0a2c845c5cba23f42fb.js":3951===e?"__LANG__.3951.babac9be598102fb0d92.js":5362===e?"__LANG__.5362.311bfba5d2c84b13ec2b.js":2578===e?"__LANG__.2578.ab3178e0160c259eac53.js":2547===e?"__LANG__.2547.28b713bedf796244795d.js":2285===e?"__LANG__.2285.1268ecef367debd2960b.js":344===e?"__LANG__.344.a9e566fa1091368f40c7.js":178===e?"__LANG__.178.dd03c0163a8373c0fc5b.js":6306===e?"__LANG__.6306.b88dcc3f0d7db89ebfc1.js":3236===e?"__LANG__.3236.e12bb9a536432e97ec0c.js":({92:"chart-screenshot-hint",139:"get-error-card",507:"study-pane-views",607:"study-property-pages-with-definitions",731:"add-compare-dialog",1583:"lt-pane-views",1584:"context-menu-renderer",1702:"manage-drawings-dialog",1754:"symbol-search-dialog",1859:"go-to-date-dialog-impl",1890:"line-tools-icons",2077:"change-interval-dialog",2183:"study-inputs-pane-views",2306:"floating-toolbars",2377:"hammerjs",2616:"svg-renderer",2704:"currency-label-menu",2878:"drawing-toolbar",3005:"header-toolbar",3030:"new-confirm-inputs-dialog",3596:"general-property-page",4013:"custom-intervals-add-dialog",4079:"series-pane-views",4389:"take-chart-image-impl",4665:"share-chart-to-social-utils",4862:"object-tree-dialog",5009:"load-chart-dialog",5093:"chart-widget-gui",5516:"restricted-toolset",5551:"favorite-drawings-api",5565:"ichart-storage",5598:"lt-stickers-atlas",6124:"chart-storage-library-http",6166:"chart-event-hint",6265:"new-edit-object-dialog",6456:"study-market",6631:"study-template-dialog",6780:"source-properties-editor",7078:"general-chart-properties-dialog",7129:"line-tools-synchronizer",7260:"chart-bottom-toolbar",7271:"compare-model",7648:"show-theme-save-dialog",7987:"lt-icons-atlas",8020:"user-defined-bars-marks-tooltip",8313:"chart-storage-external-adapter", (()=>{"use strict";var e,a,d,c,t,f={},b={};function r(e){var a=b[e];if(void 0!==a)return a.exports;var d=b[e]={id:e,loaded:!1,exports:{}};return f[e].call(d.exports,d,d.exports,r),d.loaded=!0,d.exports}r.m=f,r.c=b,e=[],r.O=(a,d,c,t)=>{if(!d){var f=1/0;for(i=0;i<e.length;i++){for(var[d,c,t]=e[i],b=!0,n=0;n<d.length;n++)(!1&t||f>=t)&&Object.keys(r.O).every((e=>r.O[e](d[n])))?d.splice(n--,1):(b=!1,t<f&&(f=t));if(b){e.splice(i--,1);var o=c();void 0!==o&&(a=o)}}return a}t=t||0;for(var i=e.length;i>0&&e[i-1][2]>t;i--)e[i]=e[i-1];e[i]=[d,c,t]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a}),a},d=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var t=Object.create(null);r.r(t);var f={};a=a||[null,d({}),d([]),d(d)];for(var b=2&c&&e;"object"==typeof b&&!~a.indexOf(b);b=d(b))Object.getOwnPropertyNames(b).forEach((a=>f[a]=()=>e[a]));return f.default=()=>e,r.d(t,f),t},r.d=(e,a)=>{for(var d in a)r.o(a,d)&&!r.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,d)=>(r.f[d](e,a),a)),[])),r.u=e=>9417===e?"__LANG__.9417.7ff64779d43389a1bb41.js":3175===e?"__LANG__.3175.e0a2c845c5cba23f42fb.js":3951===e?"__LANG__.3951.babac9be598102fb0d92.js":5362===e?"__LANG__.5362.311bfba5d2c84b13ec2b.js":2578===e?"__LANG__.2578.ab3178e0160c259eac53.js":2547===e?"__LANG__.2547.28b713bedf796244795d.js":2285===e?"__LANG__.2285.1268ecef367debd2960b.js":344===e?"__LANG__.344.a9e566fa1091368f40c7.js":178===e?"__LANG__.178.dd03c0163a8373c0fc5b.js":6306===e?"__LANG__.6306.b88dcc3f0d7db89ebfc1.js":3236===e?"__LANG__.3236.e12bb9a536432e97ec0c.js":({92:"chart-screenshot-hint",139:"get-error-card",507:"study-pane-views",607:"study-property-pages-with-definitions",731:"add-compare-dialog",1583:"lt-pane-views",1584:"context-menu-renderer",1702:"manage-drawings-dialog",1754:"symbol-search-dialog",1859:"go-to-date-dialog-impl",1890:"line-tools-icons",2077:"change-interval-dialog",2183:"study-inputs-pane-views",2306:"floating-toolbars",2377:"hammerjs",2616:"svg-renderer",2704:"currency-label-menu",2878:"drawing-toolbar",3005:"header-toolbar",3030:"new-confirm-inputs-dialog",3596:"general-property-page",4013:"custom-intervals-add-dialog",4079:"series-pane-views",4389:"take-chart-image-impl",4665:"share-chart-to-social-utils",4862:"object-tree-dialog",5009:"load-chart-dialog",5093:"chart-widget-gui",5516:"restricted-toolset",5551:"favorite-drawings-api",5565:"ichart-storage",5598:"lt-stickers-atlas",6124:"chart-storage-library-http",6166:"chart-event-hint",6265:"new-edit-object-dialog",6456:"study-market",6631:"study-template-dialog",6780:"source-properties-editor",7078:"general-chart-properties-dialog",7129:"line-tools-synchronizer",7260:"chart-bottom-toolbar",7271:"compare-model",7648:"show-theme-save-dialog",7987:"lt-icons-atlas",8020:"user-defined-bars-marks-tooltip",8313:"chart-storage-external-adapter",
8537:"lt-property-pages-with-definitions",8643:"full-tooltips-popup",8890:"simple-dialog",9039:"lollipop-tooltip-renderer",9374:"symbol-info-dialog-impl",9498:"export-data",9685:"series-icons-map",9754:"global-search-dialog"}[e]||e)+"."+{6:"a03a8ff024d47ed075c6",92:"795900ef9e075c847a64",139:"83ba0cba4c0538851e0a",507:"51d0897ba74454ec3423",524:"2b350163c328ac8dce2e",607:"1d3c58ff151a9c7c19a3",731:"5039a5ac2f3556b18cb1",750:"e16edadfacd60574d861",826:"906374d84a8e6c40c6e8",855:"61db310932f8af2c5989",898:"b63568700f1380e37b1a",956:"a325fc0a9a24da09a622",962:"9f54d549868e21286372",1033:"bb804c64fe58de0bace7",1109:"845f0f111ff830ab93c8",1553:"c076714f5e24887f0b94",1583:"077de067da0763f84cb2",1584:"4170e3d150582097504c",1702:"5f8ccee744105adf029e",1740:"4c61de525e940eee4f3c",1754:"e5850d7e02343ee54c52",1762:"9511e5b410d7d629bc49",1803:"5799aa316db71b2f13e5",1859:"851f6bf2bf36fe8fbac4",1890:"ecc8d3a4af49afed6b6d",2052:"e9d07fdfb896fca26166",2077:"ebdeefbf84f9e033ed5b",2109:"291fa715b6ded706c3dd",2183:"6caf467f12b1d6ee408a",2191:"2197cc1b66a1db8969cc",2260:"95dc0a20b147b6b2eeed",2306:"96ac7a46b7738535bc92",2377:"6e30e0c48af40bf2f6c0",2443:"66f44a8bfe8d49aaeaee",2486:"2b718a16270e4168ea54",2544:"225f38946afc6ad55a35",2587:"615babc52637decdb6e2",2616:"f065beaf6b5b37da27d9",2639:"a55d77a7912be54f7b9d",2666:"d28c0fa0a323b8118f22",2676:"a9a5ede4d514162164fa",2704:"8bac01cc43d3f2cbf903",2731:"55eed17fefac5e82c077",2846:"fbbd62afe04b4f9387f2",2878:"37a00c1b0c7a68cc1d44",3005:"df1a95078c18a5da785c",3030:"5ce0d1c060e0d28cde15",3066:"8b1d2ceb22d9fedde67b",3263:"238cd2d620e004adee5a",3353:"de1d5e3e034ab68aa9fc",3502:"1985af3fa836c4248178",3596:"e4f9354142134a911ace",3610:"c79c6bddd919cb78428a",3717:"6f65e91a870250a6e450",3780:"ef366b87d104534e68d8",3842:"8758110ab553b5368121",3896:"14d9e7509c300245c219",3914:"33b17e48eb923e015932",3939:"2ee1e71dbe0bc0d85625",3980:"9d7eeb2bacce45c508b3",3986:"b50fcad4f1b77533bda7",4013:"1aa54900370f7317d3f0",4015:"9b6607a6f543f077c5a5",4062:"9229fac3ef3db26fd5bc",4079:"d3299bca6e9fad2c340a",4102:"67b3d1107a6ec8d571eb",4215:"8934b190aaed2663c300",4370:"18ca7d93e5073f0446c0",4389:"600804a9c180df6a83b1",4403:"bf44a542113a4440984b",4648:"af8e7c4b04b18b9156b0",4665:"d7331dbca4a2aa0909e7",4713:"8582f5ea3328f2cbdfae",4781:"e8294ba5c7c6aef1fce7",4788:"d3e8ad5f514051fcc835",4862:"0b6cab4cb55e2cef2c40",4894:"035fecc664874bb752b0",4987:"a23484dfcca6d5fae195",5009:"9a37c608b4849a6f8a11",5057:"5382614553878fcf337d",5093:"75a373be3b6816e8b55a",5128:"57de9f218989cee8119d",5145:"da831552b3b54ca47682",5163:"953e65e04ed31b0ea0b3",5164:"a45b25a7ca6a0c16f810",5166:"979eb8cba5281ffcb38b",5516:"78732f5a01aa118efb81",5551:"340e60e2342b0d93ebe7",5565:"1144e5a1b4f8503ee572",5598:"52ad6e6d7d7b134ab0ba",5649:"5c1e55c9dad604880876",5664:"87e81959e880fa8ba65d",5866:"039e25226b82968cca61",5940:"c058b0e0ef421f740684",5983:"3c0ae13972f5d3433a77",5993:"0e5f49179c6a516963de",6025:"d669a0315da9d6fda6b3",6036:"5b373caaaa6e1ba4495f",6106:"1d31df88e63bf542ea7b",6124:"f1f53155460ee314f062",6166:"9fb712c61440c609af69", 8537:"lt-property-pages-with-definitions",8643:"full-tooltips-popup",8890:"simple-dialog",9039:"lollipop-tooltip-renderer",9374:"symbol-info-dialog-impl",9498:"export-data",9685:"series-icons-map",9754:"global-search-dialog"}[e]||e)+"."+{6:"a03a8ff024d47ed075c6",92:"795900ef9e075c847a64",139:"83ba0cba4c0538851e0a",507:"51d0897ba74454ec3423",524:"2b350163c328ac8dce2e",607:"1d3c58ff151a9c7c19a3",731:"5039a5ac2f3556b18cb1",750:"e16edadfacd60574d861",826:"906374d84a8e6c40c6e8",855:"61db310932f8af2c5989",898:"b63568700f1380e37b1a",956:"a325fc0a9a24da09a622",962:"9f54d549868e21286372",1033:"bb804c64fe58de0bace7",1109:"845f0f111ff830ab93c8",1553:"c076714f5e24887f0b94",1583:"077de067da0763f84cb2",1584:"4170e3d150582097504c",1702:"5f8ccee744105adf029e",1740:"4c61de525e940eee4f3c",1754:"e5850d7e02343ee54c52",1762:"9511e5b410d7d629bc49",1803:"5799aa316db71b2f13e5",1859:"851f6bf2bf36fe8fbac4",1890:"ecc8d3a4af49afed6b6d",2052:"e9d07fdfb896fca26166",2077:"ebdeefbf84f9e033ed5b",2109:"291fa715b6ded706c3dd",2183:"6caf467f12b1d6ee408a",2191:"2197cc1b66a1db8969cc",2260:"95dc0a20b147b6b2eeed",2306:"96ac7a46b7738535bc92",2377:"6e30e0c48af40bf2f6c0",2443:"66f44a8bfe8d49aaeaee",2486:"2b718a16270e4168ea54",2544:"225f38946afc6ad55a35",2587:"615babc52637decdb6e2",2616:"f065beaf6b5b37da27d9",2639:"a55d77a7912be54f7b9d",2666:"d28c0fa0a323b8118f22",2676:"a9a5ede4d514162164fa",2704:"8bac01cc43d3f2cbf903",2731:"55eed17fefac5e82c077",2846:"fbbd62afe04b4f9387f2",2878:"37a00c1b0c7a68cc1d44",3005:"df1a95078c18a5da785c",3030:"5ce0d1c060e0d28cde15",3066:"8b1d2ceb22d9fedde67b",3263:"238cd2d620e004adee5a",3353:"de1d5e3e034ab68aa9fc",3502:"1985af3fa836c4248178",3596:"e4f9354142134a911ace",3610:"c79c6bddd919cb78428a",3717:"6f65e91a870250a6e450",3780:"ef366b87d104534e68d8",3842:"8758110ab553b5368121",3896:"14d9e7509c300245c219",3914:"33b17e48eb923e015932",3939:"2ee1e71dbe0bc0d85625",3980:"9d7eeb2bacce45c508b3",3986:"b50fcad4f1b77533bda7",4013:"1aa54900370f7317d3f0",4015:"9b6607a6f543f077c5a5",4062:"9229fac3ef3db26fd5bc",4079:"d3299bca6e9fad2c340a",4102:"67b3d1107a6ec8d571eb",4215:"8934b190aaed2663c300",4370:"18ca7d93e5073f0446c0",4389:"600804a9c180df6a83b1",4403:"bf44a542113a4440984b",4648:"af8e7c4b04b18b9156b0",4665:"d7331dbca4a2aa0909e7",4713:"8582f5ea3328f2cbdfae",4781:"e8294ba5c7c6aef1fce7",4788:"d3e8ad5f514051fcc835",4862:"0b6cab4cb55e2cef2c40",4894:"035fecc664874bb752b0",4987:"a23484dfcca6d5fae195",5009:"9a37c608b4849a6f8a11",5057:"5382614553878fcf337d",5093:"75a373be3b6816e8b55a",5128:"57de9f218989cee8119d",5145:"da831552b3b54ca47682",5163:"953e65e04ed31b0ea0b3",5164:"a45b25a7ca6a0c16f810",5166:"979eb8cba5281ffcb38b",5516:"78732f5a01aa118efb81",5551:"340e60e2342b0d93ebe7",5565:"1144e5a1b4f8503ee572",5598:"52ad6e6d7d7b134ab0ba",5649:"5c1e55c9dad604880876",5664:"87e81959e880fa8ba65d",5866:"039e25226b82968cca61",5940:"c058b0e0ef421f740684",5983:"3c0ae13972f5d3433a77",5993:"0e5f49179c6a516963de",6025:"d669a0315da9d6fda6b3",6036:"5b373caaaa6e1ba4495f",6106:"1d31df88e63bf542ea7b",6124:"f1f53155460ee314f062",6166:"9fb712c61440c609af69",
6214:"5a578175aab923a979dc",6221:"56c4d15c823c019ddb39",6265:"b3553940c9159e24d8aa",6408:"e58aaf98d9306e8d9b77",6456:"b04732ea1491ac587015",6494:"7f264af8142cb9910c06",6625:"364cf21fe24d7e675de8",6631:"45bca887c7f2c0d84601",6639:"a1bd5bf1d51c681561a1",6747:"ae7a7ec28d22057d6d0d",6752:"912872ffa56a7243d664",6780:"3b96f58f66e0caa61b15",6884:"07642217627127113fb0",6918:"c8f3265e9286a784038b",6925:"665969c4af4481df0691",6949:"f50051a55eaa8dd5e780",6985:"8d289318ce5fe6dc7763",7051:"cff4509091dbd0706ebe",7078:"cddce4ed266fd9e0629e",7111:"4716f3208dc337521c10",7129:"0bc2d3617dda7143f094",7149:"d450e8145ad7e6fbd67f",7194:"098c1a8da1ddbbda98f6",7260:"6826612f0a41ab0fc35c",7271:"f7e796a37129a93179ee",7350:"aa555ff9e17c4029aedd",7391:"c63bd39c42093cc4130c",7413:"3a52b91975b98e6fe8e4",7550:"087936b2aa6ea51cd6bf",7555:"ea682716c26bc13db765",7648:"02c87d9b20f743b5cf16",7663:"6fabc58c7ddf7c2b076f",7807:"6adfcf6c0792dc9c9363",7871:"df6a9177c293c0c53e80",7987:"5d7c9d668ac98bd5bce1",8020:"71213c4f755723965a80",8056:"c06a1c8fb4a1f18cf217",8149:"9fb525d10e5c8ba95701",8167:"3edae41386acc976c9f8",8287:"7a7977ba76726177fb3c",8313:"9c1267d07e48b8d8f53f",8450:"757d38443ea38bd0165f",8537:"ae758430950906d90d11",8643:"3a92633d0497afb5344c",8882:"9838a8b1e0e6766b6408",8890:"6a6e7744cd3263ce2887",8904:"87e94e93ade13962a48f",9039:"19bbb3fc39665da2e3e6",9138:"f516266ddcf6ca8c7064",9327:"0c38440ca52f144413ac",9374:"6ef1056ef156ddb4caf1",9403:"61498701a4dae3f700c2",9465:"ca5284cff2560957cdd6",9498:"f43b3c60275506b2198a",9685:"f25fb7b89b7e831b726c",9754:"91018047180ff0d9e40b",9789:"458feb5c8c0263b0618b",9842:"581808dd4a8651b16779",9916:"0c2cb2d12479a20efce1"}[e]+".js",r.miniCssF=e=>e+"."+{6:"362fa6a7ab1f3e3b06c4",524:"ef662c4bc3e57dd91171",826:"2effba57f47544e58368",855:"56a5e53c97d91a9f96f7",898:"f909d7c1efc95f635922",956:"1e89775cfd644d656c56",1033:"5197f9f8b8500206d06c",1109:"b1ced88f4a839badfff1",1762:"7ff6b353c441db2276da",1803:"4653bb65d2b0d594d6af",2109:"4d5de3fbde1cd7dc5e9f",2191:"bb0aa12f5e562fd483f3",2260:"b98824e4829a1aa9b444",2486:"82c7dba4839761a57f28",2587:"1f1100dc01693edfe269",2639:"7b1d42eef7b89e0e96d3",2666:"fbb750fd312778403036",2676:"2d3cabbd39a3b0d6e9ea",2731:"ec19f123cabf8efd03a4",3066:"58a325f25b087530293d",3353:"860146c59230ab4bd938",3502:"c49903f7222870ff8aca",3610:"11b7ad14e26429fdfa5d",3717:"856421c70a4dff35762a",3780:"a289557f2e0bcabcc4ca",3842:"8cf6b523fd5a5b6fb022",3896:"96db838d3467bcf68051",3914:"d2b6c577f350629b6837",3939:"4d0187960a564ff5a557",3980:"b2ff45a2d8bb6a131d7c",4015:"1d0e3a62a59d173c81f3",4102:"4abd8542fa3aa3e7fd5d",4215:"d24836a292b1969ab4bb",4781:"cf1365a3bf51d9989978",4788:"3cff897925f7a8dbc837",4894:"99d4c2794da9feef3c70",4987:"ca5d16a7e990d39bfb0e",5145:"a2b224fd27ab2941c565",5163:"950dd1d584f76da1ed3b",5166:"a12c50ad6225ca6de843",5649:"b60ed09c5ea8c55827d4",5866:"f164dd2a584ab0f493cf",5940:"aedc1bdbd324e6042b17",5993:"4705829d0834140ee3f2",6025:"263b457b1a7f9ca139b2",6036:"3b493a9f0ab052e6447c",6106:"f01163745d787b60c86c",6214:"65b7dbf8be6cca5ac143",6221:"bc53670dfb8f982908a2", 6214:"5a578175aab923a979dc",6221:"56c4d15c823c019ddb39",6265:"b3553940c9159e24d8aa",6408:"e58aaf98d9306e8d9b77",6456:"b04732ea1491ac587015",6494:"7f264af8142cb9910c06",6625:"364cf21fe24d7e675de8",6631:"45bca887c7f2c0d84601",6639:"a1bd5bf1d51c681561a1",6747:"ae7a7ec28d22057d6d0d",6752:"912872ffa56a7243d664",6780:"3b96f58f66e0caa61b15",6884:"07642217627127113fb0",6918:"c8f3265e9286a784038b",6925:"665969c4af4481df0691",6949:"f50051a55eaa8dd5e780",6985:"8d289318ce5fe6dc7763",7051:"cff4509091dbd0706ebe",7078:"cddce4ed266fd9e0629e",7111:"4716f3208dc337521c10",7129:"0bc2d3617dda7143f094",7149:"d450e8145ad7e6fbd67f",7194:"098c1a8da1ddbbda98f6",7260:"6826612f0a41ab0fc35c",7271:"f7e796a37129a93179ee",7350:"aa555ff9e17c4029aedd",7391:"c63bd39c42093cc4130c",7413:"3a52b91975b98e6fe8e4",7550:"087936b2aa6ea51cd6bf",7555:"ea682716c26bc13db765",7648:"02c87d9b20f743b5cf16",7663:"6fabc58c7ddf7c2b076f",7807:"6adfcf6c0792dc9c9363",7871:"df6a9177c293c0c53e80",7987:"5d7c9d668ac98bd5bce1",8020:"71213c4f755723965a80",8056:"c06a1c8fb4a1f18cf217",8149:"9fb525d10e5c8ba95701",8167:"3edae41386acc976c9f8",8287:"7a7977ba76726177fb3c",8313:"9c1267d07e48b8d8f53f",8450:"757d38443ea38bd0165f",8537:"ae758430950906d90d11",8643:"3a92633d0497afb5344c",8882:"9838a8b1e0e6766b6408",8890:"6a6e7744cd3263ce2887",8904:"87e94e93ade13962a48f",9039:"19bbb3fc39665da2e3e6",9138:"f516266ddcf6ca8c7064",9327:"0c38440ca52f144413ac",9374:"6ef1056ef156ddb4caf1",9403:"61498701a4dae3f700c2",9465:"ca5284cff2560957cdd6",9498:"f43b3c60275506b2198a",9685:"f25fb7b89b7e831b726c",9754:"91018047180ff0d9e40b",9789:"458feb5c8c0263b0618b",9842:"581808dd4a8651b16779",9916:"0c2cb2d12479a20efce1"}[e]+".js",r.miniCssF=e=>e+"."+{6:"362fa6a7ab1f3e3b06c4",524:"ef662c4bc3e57dd91171",826:"2effba57f47544e58368",855:"56a5e53c97d91a9f96f7",898:"f909d7c1efc95f635922",956:"1e89775cfd644d656c56",1033:"5197f9f8b8500206d06c",1109:"b1ced88f4a839badfff1",1762:"7ff6b353c441db2276da",1803:"4653bb65d2b0d594d6af",2109:"4d5de3fbde1cd7dc5e9f",2191:"bb0aa12f5e562fd483f3",2260:"b98824e4829a1aa9b444",2486:"82c7dba4839761a57f28",2587:"1f1100dc01693edfe269",2639:"7b1d42eef7b89e0e96d3",2666:"fbb750fd312778403036",2676:"2d3cabbd39a3b0d6e9ea",2731:"ec19f123cabf8efd03a4",3066:"58a325f25b087530293d",3353:"860146c59230ab4bd938",3502:"c49903f7222870ff8aca",3610:"11b7ad14e26429fdfa5d",3717:"856421c70a4dff35762a",3780:"a289557f2e0bcabcc4ca",3842:"8cf6b523fd5a5b6fb022",3896:"96db838d3467bcf68051",3914:"d2b6c577f350629b6837",3939:"4d0187960a564ff5a557",3980:"b2ff45a2d8bb6a131d7c",4015:"1d0e3a62a59d173c81f3",4102:"4abd8542fa3aa3e7fd5d",4215:"d24836a292b1969ab4bb",4781:"cf1365a3bf51d9989978",4788:"3cff897925f7a8dbc837",4894:"99d4c2794da9feef3c70",4987:"ca5d16a7e990d39bfb0e",5145:"a2b224fd27ab2941c565",5163:"950dd1d584f76da1ed3b",5166:"a12c50ad6225ca6de843",5649:"b60ed09c5ea8c55827d4",5866:"f164dd2a584ab0f493cf",5940:"aedc1bdbd324e6042b17",5993:"4705829d0834140ee3f2",6025:"263b457b1a7f9ca139b2",6036:"3b493a9f0ab052e6447c",6106:"f01163745d787b60c86c",6214:"65b7dbf8be6cca5ac143",6221:"bc53670dfb8f982908a2",
6494:"4c212043f24336e170d5",6625:"0ed88fc3a989c98408cc",6639:"885b5577e3fb71ee2bea",6747:"c7d403ae692f88568278",6752:"207eb3cc75b3ed2c6754",6884:"bb7d30a7bbbe5af36556",6925:"a3a09d7303a96edb77cb",6949:"19355e81a60b640ea097",6985:"2cd225354e2fd236e8e9",7111:"b16b4eb739a7e8577559",7149:"12adbb19fdefe9b66b18",7194:"e04f69c8933166966874",7350:"00632eec360f0cf2d9a0",7391:"9c809fa91ed0c8f75bc0",7413:"f830ad1ad6ee6f9b1cb3",7555:"8c1e3939e7666b0f8c69",7807:"8577632fdab29ee53ddf",7871:"fff454908cba03863eb7",8056:"1f54f717d8e522c55c89",8149:"21f2b01074a4d082e268",8287:"2b6f71ec5c0064590ffd",8450:"f75ab24e1ecb22d29183",8904:"a302177fe7e3ccd50cb0",9138:"03b8fbcfabcae851949a",9327:"97be240031495a68333f",9403:"db9859ab09623682562c",9465:"fd61e82b3c912f2e9fad",9789:"cb5ad20bc727d3820b6c",9842:"ceaeabba258d065497c8",9916:"60c48148a54dba9504a0"}[e]+".css",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},f="tradingview:",r.l=(e,a,d,t)=>{if(c[e])c[e].push(a);else{var b,n;if(void 0!==d)for(var o=document.getElementsByTagName("script"),i=0;i<o.length;i++){var l=o[i];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==f+d){b=l;break}}b||(n=!0,(b=document.createElement("script")).charset="utf-8",b.timeout=120,r.nc&&b.setAttribute("nonce",r.nc),b.setAttribute("data-webpack",f+d),b.src=e,0!==b.src.indexOf(window.location.origin+"/")&&(b.crossOrigin="anonymous")),c[e]=[a];var s=(a,d)=>{b.onerror=b.onload=null,clearTimeout(u);var f=c[e];if(delete c[e],b.parentNode&&b.parentNode.removeChild(b),f&&f.forEach((e=>e(d))),a)return a(d)},u=setTimeout(s.bind(null,void 0,{type:"timeout",target:b}),12e4);b.onerror=s.bind(null,b.onerror),b.onload=s.bind(null,b.onload),n&&document.head.appendChild(b)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var a=r.g.document;if(!e&&a&&(a.currentScript&&(e=a.currentScript.src),!e)){var d=a.getElementsByTagName("script");d.length&&(e=d[d.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),r.g.location&&r.p.startsWith(r.g.location.origin)&&(r.p=r.p.slice(r.g.location.origin.length)),(()=>{const e=r.u;r.u=a=>e(a).replace("__LANG__",r.g.language)})(),(()=>{const e={ca_ES:(e=1)=>+(1!=e),cs:(e=1)=>+(1==e?0:e>=2&&e<=4?1:2),el:(e=1)=>+(1!=e),da_DK:(e=1)=>+(1!=e),en:(e=1)=>+(1!=e),et_EE:(e=1)=>+(1!=e),fa:(e=1)=>0,hu_HU:(e=1)=>0,id_ID:(e=1)=>0,it:(e=1)=>+(1!=e),ms_MY:(e=1)=>0, 6494:"4c212043f24336e170d5",6625:"0ed88fc3a989c98408cc",6639:"885b5577e3fb71ee2bea",6747:"c7d403ae692f88568278",6752:"207eb3cc75b3ed2c6754",6884:"bb7d30a7bbbe5af36556",6925:"a3a09d7303a96edb77cb",6949:"19355e81a60b640ea097",6985:"2cd225354e2fd236e8e9",7111:"b16b4eb739a7e8577559",7149:"12adbb19fdefe9b66b18",7194:"e04f69c8933166966874",7350:"00632eec360f0cf2d9a0",7391:"9c809fa91ed0c8f75bc0",7413:"f830ad1ad6ee6f9b1cb3",7555:"8c1e3939e7666b0f8c69",7807:"8577632fdab29ee53ddf",7871:"fff454908cba03863eb7",8056:"1f54f717d8e522c55c89",8149:"21f2b01074a4d082e268",8287:"2b6f71ec5c0064590ffd",8450:"f75ab24e1ecb22d29183",8904:"a302177fe7e3ccd50cb0",9138:"03b8fbcfabcae851949a",9327:"97be240031495a68333f",9403:"db9859ab09623682562c",9465:"fd61e82b3c912f2e9fad",9789:"cb5ad20bc727d3820b6c",9842:"ceaeabba258d065497c8",9916:"60c48148a54dba9504a0"}[e]+".css",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},t="tradingview:",r.l=(e,a,d,f)=>{if(c[e])c[e].push(a);else{var b,n;if(void 0!==d)for(var o=document.getElementsByTagName("script"),i=0;i<o.length;i++){var l=o[i];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==t+d){b=l;break}}b||(n=!0,(b=document.createElement("script")).charset="utf-8",b.timeout=120,r.nc&&b.setAttribute("nonce",r.nc),b.setAttribute("data-webpack",t+d),b.src=e,0!==b.src.indexOf(window.location.origin+"/")&&(b.crossOrigin="anonymous")),c[e]=[a];var s=(a,d)=>{b.onerror=b.onload=null,clearTimeout(u);var t=c[e];if(delete c[e],b.parentNode&&b.parentNode.removeChild(b),t&&t.forEach((e=>e(d))),a)return a(d)},u=setTimeout(s.bind(null,void 0,{type:"timeout",target:b}),12e4);b.onerror=s.bind(null,b.onerror),b.onload=s.bind(null,b.onload),n&&document.head.appendChild(b)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var a=r.g.document;if(!e&&a&&(a.currentScript&&(e=a.currentScript.src),!e)){var d=a.getElementsByTagName("script");d.length&&(e=d[d.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),r.g.location&&r.p.startsWith(r.g.location.origin)&&(r.p=r.p.slice(r.g.location.origin.length)),(()=>{const e=r.u;r.u=a=>e(a).replace("__LANG__",r.g.language)})(),(()=>{const e={ca_ES:(e=1)=>+(1!=e),cs:(e=1)=>+(1==e?0:e>=2&&e<=4?1:2),el:(e=1)=>+(1!=e),da_DK:(e=1)=>+(1!=e),en:(e=1)=>+(1!=e),et_EE:(e=1)=>+(1!=e),fa:(e=1)=>0,hu_HU:(e=1)=>0,id_ID:(e=1)=>0,it:(e=1)=>+(1!=e),ms_MY:(e=1)=>0,
no:(e=1)=>+(1!=e),nl_NL:(e=1)=>+(1!=e),ro:(e=1)=>+(1==e?0:e%100>19||e%100==0&&0!=e?2:1),sk_SK:(e=1)=>+(1==e?0:e>=2&&e<=4?1:2),sv:(e=1)=>+(1!=e),zh:(e=1)=>0,zh_TW:(e=1)=>0,de:(e=1)=>+(1!=e),es:(e=1)=>+(1!=e),fr:(e=1)=>+(e>1),he_IL:(e=1)=>+(1==e?0:2==e?1:e>10&&e%10==0?2:3),ko:(e=1)=>0,ja:(e=1)=>0,pl:(e=1)=>+(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),pt:(e=1)=>+(1!=e),tr:(e=1)=>+(1!=e),vi:(e=1)=>0,ar:(e=1)=>+(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5),ru:(e=1)=>+(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),th:(e=1)=>0};r.tf=(a,d={},c)=>{if(null===a){if(Array.isArray(c)){if(r.g.customTranslateFunction){const e=r.g.customTranslateFunction(c[0],d.plural?{...d,plural:c.length>2?c.slice(1):c[1]}:d,!0);if(null!==e)return e}return(c[e[r.g.language](d.count)]||c[0]).replace(/{(\w+)}/g,((e,a)=>void 0!==(d.replace||d)[a]?(d.replace||d)[a]:e))}return"object"==typeof c?r.tf(null,d,c[r.g.language||"en"]):r.tf(c,d)}if(c&&a){const e=`${a}${d.context?`_${d.context}`:""}`;if(c[e])return r.tf(null,d,c[e])}if("number"==typeof a)return a.toString();if("string"!=typeof a)return"";if(r.g.customTranslateFunction){const e=r.g.customTranslateFunction(a,d,!1);if(null!==e)return e}return(d.plural&&1!=+d.count?d.plural:a).replace(/{(\w+)}/g,((e,a)=>void 0!==(d.replace||d)[a]?(d.replace||d)[a]:e))}})(),r.p=r.g.WEBPACK_PUBLIC_PATH||r.p;var n=r.e,o=Object.create(null);function i(e,a){return n(e).catch((function(){return new Promise((function(d){var c=function(){self.removeEventListener("online",c,!1),!1===navigator.onLine?self.addEventListener("online",c,!1):d(a<2?i(e,a+1):n(e))};setTimeout(c,a*a*1e3)}))}))}r.e=function(e){if(!o[e]){o[e]=i(e,0);var a=function(){delete o[e]};o[e].then(a,a)}return o[e]},(()=>{if("undefined"!=typeof document){var e=e=>new Promise(((a,d)=>{var c=r.miniCssF(e),f=r.p+c;if(((e,a)=>{for(var d=document.getElementsByTagName("link"),c=0;c<d.length;c++){var f=(b=d[c]).getAttribute("data-href")||b.getAttribute("href");if("stylesheet"===b.rel&&(f===e||f===a))return b}var t=document.getElementsByTagName("style");for(c=0;c<t.length;c++){var b;if((f=(b=t[c]).getAttribute("data-href"))===e||f===a)return b}})(c,f))return a();((e,a,d,c,f)=>{var t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.onerror=t.onload=d=>{if(t.onerror=t.onload=null,"load"===d.type)c();else{var b=d&&("load"===d.type?"missing":d.type),r=d&&d.target&&d.target.href||a,n=new Error("Loading CSS chunk "+e+" failed.\n("+r+")");n.code="CSS_CHUNK_LOAD_FAILED",n.type=b,n.request=r,t.parentNode&&t.parentNode.removeChild(t),f(n)}},t.href=a,0!==t.href.indexOf(window.location.origin+"/")&&(t.crossOrigin="anonymous"),d?d.parentNode.insertBefore(t,d.nextSibling):document.head.appendChild(t)})(e,f,null,a,d)})),a={3666:0};r.f.miniCss=(d,c)=>{a[d]?c.push(a[d]):0!==a[d]&&{6:1,524:1,826:1,855:1,898:1,956:1,1033:1,1109:1,1762:1,1803:1,2109:1,2191:1,2260:1,2486:1,2587:1,2639:1,2666:1,2676:1,2731:1,3066:1,3353:1,3502:1,3610:1,3717:1,3780:1,3842:1,3896:1,3914:1,3939:1,3980:1,4015:1,4102:1,4215:1,4781:1, no:(e=1)=>+(1!=e),nl_NL:(e=1)=>+(1!=e),ro:(e=1)=>+(1==e?0:e%100>19||e%100==0&&0!=e?2:1),sk_SK:(e=1)=>+(1==e?0:e>=2&&e<=4?1:2),sv:(e=1)=>+(1!=e),zh:(e=1)=>0,zh_TW:(e=1)=>0,de:(e=1)=>+(1!=e),es:(e=1)=>+(1!=e),fr:(e=1)=>+(e>1),he_IL:(e=1)=>+(1==e?0:2==e?1:e>10&&e%10==0?2:3),ko:(e=1)=>0,ja:(e=1)=>0,pl:(e=1)=>+(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),pt:(e=1)=>+(1!=e),tr:(e=1)=>+(1!=e),vi:(e=1)=>0,ar:(e=1)=>+(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5),ru:(e=1)=>+(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),th:(e=1)=>0};r.tf=(a,d={},c)=>{if(null===a){if(Array.isArray(c)){if(r.g.customTranslateFunction){const e=r.g.customTranslateFunction(c[0],d.plural?{...d,plural:c.length>2?c.slice(1):c[1]}:d,!0);if(null!==e)return e}return(c[e[r.g.language](d.count)]||c[0]).replace(/{(\w+)}/g,((e,a)=>void 0!==(d.replace||d)[a]?(d.replace||d)[a]:e))}return"object"==typeof c?r.tf(null,d,c[r.g.language||"en"]):r.tf(c,d)}if(c&&a){const e=`${a}${d.context?`_${d.context}`:""}`;if(c[e])return r.tf(null,d,c[e])}if("number"==typeof a)return a.toString();if("string"!=typeof a)return"";if(r.g.customTranslateFunction){const e=r.g.customTranslateFunction(a,d,!1);if(null!==e)return e}return(d.plural&&1!=+d.count?d.plural:a).replace(/{(\w+)}/g,((e,a)=>void 0!==(d.replace||d)[a]?(d.replace||d)[a]:e))}})(),r.p=r.g.WEBPACK_PUBLIC_PATH||r.p;var n=r.e,o=Object.create(null);function i(e,a){return n(e).catch((function(){return new Promise((function(d){var c=function(){self.removeEventListener("online",c,!1),!1===navigator.onLine?self.addEventListener("online",c,!1):d(a<2?i(e,a+1):n(e))};setTimeout(c,a*a*1e3)}))}))}r.e=function(e){if(!o[e]){o[e]=i(e,0);var a=function(){delete o[e]};o[e].then(a,a)}return o[e]},(()=>{if("undefined"!=typeof document){var e=e=>new Promise(((a,d)=>{var c=r.miniCssF(e),t=r.p+c;if(((e,a)=>{for(var d=document.getElementsByTagName("link"),c=0;c<d.length;c++){var t=(b=d[c]).getAttribute("data-href")||b.getAttribute("href");if("stylesheet"===b.rel&&(t===e||t===a))return b}var f=document.getElementsByTagName("style");for(c=0;c<f.length;c++){var b;if((t=(b=f[c]).getAttribute("data-href"))===e||t===a)return b}})(c,t))return a();((e,a,d,c,t)=>{var f=document.createElement("link");f.rel="stylesheet",f.type="text/css",f.onerror=f.onload=d=>{if(f.onerror=f.onload=null,"load"===d.type)c();else{var b=d&&("load"===d.type?"missing":d.type),r=d&&d.target&&d.target.href||a,n=new Error("Loading CSS chunk "+e+" failed.\n("+r+")");n.code="CSS_CHUNK_LOAD_FAILED",n.type=b,n.request=r,f.parentNode&&f.parentNode.removeChild(f),t(n)}},f.href=a,0!==f.href.indexOf(window.location.origin+"/")&&(f.crossOrigin="anonymous"),d?d.parentNode.insertBefore(f,d.nextSibling):document.head.appendChild(f)})(e,t,null,a,d)})),a={3666:0};r.f.miniCss=(d,c)=>{a[d]?c.push(a[d]):0!==a[d]&&{6:1,524:1,826:1,855:1,898:1,956:1,1033:1,1109:1,1762:1,1803:1,2109:1,2191:1,2260:1,2486:1,2587:1,2639:1,2666:1,2676:1,2731:1,3066:1,3353:1,3502:1,3610:1,3717:1,3780:1,3842:1,3896:1,3914:1,3939:1,3980:1,4015:1,4102:1,4215:1,4781:1,
4788:1,4894:1,4987:1,5145:1,5163:1,5166:1,5649:1,5866:1,5940:1,5993:1,6025:1,6036:1,6106:1,6214:1,6221:1,6494:1,6625:1,6639:1,6747:1,6752:1,6884:1,6925:1,6949:1,6985:1,7111:1,7149:1,7194:1,7350:1,7391:1,7413:1,7555:1,7807:1,7871:1,8056:1,8149:1,8287:1,8450:1,8904:1,9138:1,9327:1,9403:1,9465:1,9789:1,9842:1,9916:1}[d]&&c.push(a[d]=e(d).then((()=>{a[d]=0}),(e=>{throw delete a[d],e})))}}})(),(()=>{var e={3666:0,6150:0};r.f.j=(a,d)=>{var c=r.o(e,a)?e[a]:void 0;if(0!==c)if(c)d.push(c[2]);else if(/^(1(033|109|762|803)|2(6(39|66|76)|109|191|260|486|587|731)|3(9(14|39|80)|(06|66|89)6|353|502|610|717|780|842)|4(78[18]|[02]15|102|894|987)|5(1(45|63|66)|24|649|866|940|993)|6(9(25|49|85)|[06]25|(21|49|88)4||036|106|150|221|639|747|752)|7(1(11|49|94)|350|391|413|555|807|871)|8(056|149|26|287|450|55|904|98)|9(138|327|403|465|56|789|842|916))$/.test(a))e[a]=0;else{var f=new Promise(((d,f)=>c=e[a]=[d,f]));d.push(c[2]=f);var t=r.p+r.u(a),b=new Error;r.l(t,(d=>{if(r.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var f=d&&("load"===d.type?"missing":d.type),t=d&&d.target&&d.target.src;b.message="Loading chunk "+a+" failed.\n("+f+": "+t+")",b.name="ChunkLoadError",b.type=f,b.request=t,c[1](b)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,d)=>{var c,f,[t,b,n]=d,o=0;if(t.some((a=>0!==e[a]))){for(c in b)r.o(b,c)&&(r.m[c]=b[c]);if(n)var i=n(r)}for(a&&a(d);o<t.length;o++)f=t[o],r.o(e,f)&&e[f]&&e[f][0](),e[f]=0;return r.O(i)},d=self.webpackChunktradingview=self.webpackChunktradingview||[];d.forEach(a.bind(null,0)),d.push=a.bind(null,d.push.bind(d))})(),(()=>{const{miniCssF:e}=r;r.miniCssF=a=>self.document&&"rtl"===self.document.dir?e(a).replace(/\.css$/,".rtl.css"):e(a)})()})(); 4788:1,4894:1,4987:1,5145:1,5163:1,5166:1,5649:1,5866:1,5940:1,5993:1,6025:1,6036:1,6106:1,6214:1,6221:1,6494:1,6625:1,6639:1,6747:1,6752:1,6884:1,6925:1,6949:1,6985:1,7111:1,7149:1,7194:1,7350:1,7391:1,7413:1,7555:1,7807:1,7871:1,8056:1,8149:1,8287:1,8450:1,8904:1,9138:1,9327:1,9403:1,9465:1,9789:1,9842:1,9916:1}[d]&&c.push(a[d]=e(d).then((()=>{a[d]=0}),(e=>{throw delete a[d],e})))}}})(),(()=>{var e={3666:0,6150:0};r.f.j=(a,d)=>{var c=r.o(e,a)?e[a]:void 0;if(0!==c)if(c)d.push(c[2]);else if(/^(1(033|109|762|803)|2(6(39|66|76)|109|191|260|486|587|731)|3(9(14|39|80)|(06|66|89)6|353|502|610|717|780|842)|4(78[18]|[02]15|102|894|987)|5(1(45|63|66)|24|649|866|940|993)|6(9(25|49|85)|[06]25|(21|49|88)4||036|106|150|221|639|747|752)|7(1(11|49|94)|350|391|413|555|807|871)|8(056|149|26|287|450|55|904|98)|9(138|327|403|465|56|789|842|916))$/.test(a))e[a]=0;else{var t=new Promise(((d,t)=>c=e[a]=[d,t]));d.push(c[2]=t);var f=r.p+r.u(a),b=new Error;r.l(f,(d=>{if(r.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var t=d&&("load"===d.type?"missing":d.type),f=d&&d.target&&d.target.src;b.message="Loading chunk "+a+" failed.\n("+t+": "+f+")",b.name="ChunkLoadError",b.type=t,b.request=f,c[1](b)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,d)=>{var c,t,[f,b,n]=d,o=0;if(f.some((a=>0!==e[a]))){for(c in b)r.o(b,c)&&(r.m[c]=b[c]);if(n)var i=n(r)}for(a&&a(d);o<f.length;o++)t=f[o],r.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return r.O(i)},d=self.webpackChunktradingview=self.webpackChunktradingview||[];d.forEach(a.bind(null,0)),d.push=a.bind(null,d.push.bind(d))})(),(()=>{const{miniCssF:e}=r;r.miniCssF=a=>self.document&&"rtl"===self.document.dir?e(a).replace(/\.css$/,".rtl.css"):e(a)})()})();

File diff suppressed because one or more lines are too long

View File

@@ -3783,7 +3783,7 @@ export interface ChartingLibraryWidgetOptions {
timeframe?: TimeframeOption; timeframe?: TimeframeOption;
/** /**
* Default time zone of the chart. The time on the timescale is displayed according to this time zone. * Default time zone of the chart. The time on the timescale is displayed according to this time zone.
* See the [list of supported time zones](https://www.tradingview.com/charting-library-docs/latest/ui_elements/timezones.md#supported-timezones) for available values. Set it to `exchange` to use the exchange time zone. Use the {@link ChartingLibraryWidgetOptions.overrides} section if you wish to override the default value. * See the [list of supported time zones](https://www.tradingview.com/charting-library-docs/latest/ui_elements/timezones.md#supported-time-zones) for available values. Set it to `exchange` to use the exchange time zone. Use the {@link ChartingLibraryWidgetOptions.overrides} section if you wish to override the default value.
* *
* ```javascript * ```javascript
* timezone: "America/New_York", * timezone: "America/New_York",
@@ -8619,7 +8619,7 @@ export interface IBrokerCommon {
/** /**
* Chart can have a sub-menu `Trading` in the context menu. This method should return an array of {@link ActionMetaInfo} elements, each of them representing one context menu item. * Chart can have a sub-menu `Trading` in the context menu. This method should return an array of {@link ActionMetaInfo} elements, each of them representing one context menu item.
* @param {TradeContext} context - context object passed by a browser * @param {TradeContext} context - context object passed by a browser
* @param {DefaultContextMenuActionsParams} options? - default options for the context menu action parameters * @param {DefaultContextMenuActionsParams} [options] - default options for the context menu action parameters
*/ */
chartContextMenuActions(context: TradeContext, options?: DefaultContextMenuActionsParams): Promise<ActionMetaInfo[]>; chartContextMenuActions(context: TradeContext, options?: DefaultContextMenuActionsParams): Promise<ActionMetaInfo[]>;
/** /**
@@ -8903,14 +8903,14 @@ export interface IBrokerConnectionAdapterHost {
/** /**
* Shows the order dialog * Shows the order dialog
* @param {T extends PreOrder} order - order to show in the dialog * @param {T extends PreOrder} order - order to show in the dialog
* @param {OrderTicketFocusControl} focus? - input control to focus on when dialog is opened * @param {OrderTicketFocusControl} [focus] - input control to focus on when dialog is opened
*/ */
showOrderDialog?<T extends PreOrder>(order: T, focus?: OrderTicketFocusControl): Promise<boolean>; showOrderDialog?<T extends PreOrder>(order: T, focus?: OrderTicketFocusControl): Promise<boolean>;
/** /**
* Shows notification message * Shows notification message
* @param {string} title - notification title * @param {string} title - notification title
* @param {string} text - notification content * @param {string} text - notification content
* @param {NotificationType} notificationType? - type of notification (default: NotificationType.Error) * @param {NotificationType} [notificationType] - type of notification (default: NotificationType.Error)
*/ */
showNotification(title: string, text: string, notificationType?: NotificationType): void; showNotification(title: string, text: string, notificationType?: NotificationType): void;
/** /**
@@ -8969,7 +8969,7 @@ export interface IBrokerConnectionAdapterHost {
* Displays a message dialog to a user. * Displays a message dialog to a user.
* @param {string} title - title of the message dialog * @param {string} title - title of the message dialog
* @param {string} text - message * @param {string} text - message
* @param {boolean} textHasHTML? - whether message text contains HTML * @param {boolean} [textHasHTML] - whether message text contains HTML
*/ */
showMessageDialog(title: string, text: string, textHasHTML?: boolean): void; showMessageDialog(title: string, text: string, textHasHTML?: boolean): void;
/** /**
@@ -9351,7 +9351,7 @@ export interface IChartWidgetApi {
*/ */
setChartType(type: SeriesType, callback?: () => void): void; setChartType(type: SeriesType, callback?: () => void): void;
/** /**
* Force the chart to re-request data. * Force the chart to re-request data, for example if there are [internet connection issues](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Datafeed-Issues.md#internet-connection-issues).
* Before calling this function the `onResetCacheNeededCallback` callback from {@link IDatafeedChartApi.subscribeBars} should be called. * Before calling this function the `onResetCacheNeededCallback` callback from {@link IDatafeedChartApi.subscribeBars} should be called.
* *
* **Example** * **Example**
@@ -9543,7 +9543,7 @@ export interface IChartWidgetApi {
* widget.activeChart().sendToBack([id]); * widget.activeChart().sendToBack([id]);
* ``` * ```
* *
* @param sources An array of source IDs. * @param entities An array of entity IDs.
*/ */
sendToBack(entities: readonly EntityId[]): void; sendToBack(entities: readonly EntityId[]): void;
/** /**
@@ -10417,15 +10417,23 @@ export interface IChartingLibraryWidget {
*/ */
getStudiesList(): string[]; getStudiesList(): string[];
/** /**
* Get an array of information about the inputs of a study. * Get an array of information about indicator inputs, including their names.
* You need to know an input name to refer to this property in the code.
* For example, when you change an input value using the [overrides](https://www.tradingview.com/charting-library-docs/latest/customization/overrides/Studies-Overrides.md).
* Consider the [Input property](https://www.tradingview.com/charting-library-docs/latest/customization/overrides/Studies-Overrides.md#input-property) section for more information.
* *
* @param studyName The name of a study. * @param studyName The name of a study.
*/ */
getStudyInputs(studyName: string): StudyInputInformation[]; getStudyInputs(studyName: string): StudyInputInformation[];
/** /**
* Get information about the styles of a study. * Get information about indicator properties.
* You can use this information to refer to the properties in the code.
* For example, when you change property values using the [overrides](https://www.tradingview.com/charting-library-docs/latest/customization/overrides/Studies-Overrides.md).
* *
* @param studyName The name of a study. * Note that `getStudyStyles` does not return actual property names but the indicator's [metadata](https://www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo/metainfo.md).
* Consider the [Property path](https://www.tradingview.com/charting-library-docs/latest/customization/overrides/Studies-Overrides.md#property-path) section for more information on how to refer to the properties.
*
* @param studyName The name of a indicator.
*/ */
getStudyStyles(studyName: string): StudyStyleInfo; getStudyStyles(studyName: string): StudyStyleInfo;
/** /**
@@ -10759,9 +10767,9 @@ export interface IContext {
* Load a new symbol for the custom indicator * Load a new symbol for the custom indicator
* @param {string} tickerid - Symbol identifier * @param {string} tickerid - Symbol identifier
* @param {string} period - period for the new symbol * @param {string} period - period for the new symbol
* @param {string} currencyCode? - Currency code * @param {string} [currencyCode] - Currency code
* @param {string} unitId? - Unit id * @param {string} [unitId] - Unit ID
* @param {string} unitId? - Subsession id * @param {string} [subsessionId] - Subsession ID
*/ */
new_sym(tickerid: string, period: string, currencyCode?: string, unitId?: string, subsessionId?: string): ISymbolInstrument; new_sym(tickerid: string, period: string, currencyCode?: string, unitId?: string, subsessionId?: string): ISymbolInstrument;
/** /**
@@ -10771,12 +10779,12 @@ export interface IContext {
select_sym(i: number): void; select_sym(i: number): void;
/** /**
* Creates an in-memory temporary storage with depth defined by the first call `new_var(value).get(n)` * Creates an in-memory temporary storage with depth defined by the first call `new_var(value).get(n)`
* @param {number} value? - variable's value * @param {number} [value] - variable's value
*/ */
new_var(value?: number): IPineSeries; new_var(value?: number): IPineSeries;
/** /**
* Creates an in-memory temporary storage with unlimited depth. * Creates an in-memory temporary storage with unlimited depth.
* @param {number} value? - variable's value * @param {number} [value] - variable's value
*/ */
new_unlimited_var(value?: number): IPineSeries; new_unlimited_var(value?: number): IPineSeries;
/** /**
@@ -11484,6 +11492,7 @@ export interface INewsApi {
refresh(): void; refresh(): void;
} }
export interface INonSeriesStudyBarsResult { export interface INonSeriesStudyBarsResult {
type: "non_series_bars";
/** /**
* Non series bars * Non series bars
*/ */
@@ -11875,7 +11884,7 @@ export interface IPineSeries {
* - s.get(1) returns second last, * - s.get(1) returns second last,
* - s.get(2) - third last * - s.get(2) - third last
* - and so on * - and so on
* @param {number} n? - index * @param {number} [n] - index
*/ */
get(n?: number): number; get(n?: number): number;
/** /**
@@ -12244,7 +12253,7 @@ export interface IPriceFormatter extends ISymbolValueFormatter {
/** /**
* Price Formatter * Price Formatter
* @param {number} price - price * @param {number} price - price
* @param {boolean} signPositive? - add plus sign to result string. * @param {boolean} [signPositive] - add plus sign to result string.
* @param {number} [tailSize] - add `tailSize` digits to fractional part of result string * @param {number} [tailSize] - add `tailSize` digits to fractional part of result string
* @param {boolean} [signNegative] - add minus sign to result string. * @param {boolean} [signNegative] - add minus sign to result string.
* @param {boolean} [useRtlFormat] - Use Right to left format * @param {boolean} [useRtlFormat] - Use Right to left format
@@ -12312,14 +12321,14 @@ export interface IPriceScaleApi {
currency(): CurrencyInfo | null; currency(): CurrencyInfo | null;
/** /**
* Sets a currency on the price scale. * Sets a currency on the price scale.
* @param {currency} string | null - currency supported by your backend (for example 'EUR', 'USD'). A null value will reset the currency to default. * @param {string|null} currency - currency supported by your backend (for example 'EUR', 'USD'). A null value will reset the currency to default.
*/ */
setCurrency(currency: string | null): void; setCurrency(currency: string | null): void;
/** Returns the current unit info set on the price scale if any or null if none is specified */ /** Returns the current unit info set on the price scale if any or null if none is specified */
unit(): UnitInfo | null; unit(): UnitInfo | null;
/** /**
* Sets a unit on the price scale. * Sets a unit on the price scale.
* @param {unit} string | null - unit supported by your backend (for example 'weight', 'energy'). A null value will reset the unit to default. * @param {string|null} unit - unit supported by your backend (for example 'weight', 'energy'). A null value will reset the unit to default.
*/ */
setUnit(unit: string | null): void; setUnit(unit: string | null): void;
} }
@@ -12331,11 +12340,12 @@ export interface IProjectionStudyResult {
/** last price displayed on price scale */ /** last price displayed on price scale */
price?: number; price?: number;
/** always projection */ /** always projection */
type?: "projection"; type: "projection";
/** box size is displayed in the legend */ /** box size is displayed in the legend */
boxSize?: number; boxSize?: number;
/** reversal amount is displayed in the legend */ /** reversal amount is displayed in the legend */
reversalAmount?: number; reversalAmount?: number;
projectionTime?: number;
} }
/** /**
* Allows you to select entities ([drawings](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Drawings) and [indicators](https://www.tradingview.com/charting-library-docs/latest/ui_elements/indicators/)) on the chart. Consider the following example: * Allows you to select entities ([drawings](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Drawings) and [indicators](https://www.tradingview.com/charting-library-docs/latest/ui_elements/indicators/)) on the chart. Consider the following example:
@@ -13041,7 +13051,7 @@ export interface IWatchedValue<T> extends IWatchedValueReadonly<T>, IObservableV
/** /**
* Set value for the watched value * Set value for the watched value
* @param {T} value - value to set * @param {T} value - value to set
* @param {boolean} forceUpdate? - force an update * @param {boolean} [forceUpdate] - force an update
*/ */
setValue(value: T, forceUpdate?: boolean): void; setValue(value: T, forceUpdate?: boolean): void;
/** @inheritDoc */ /** @inheritDoc */
@@ -18350,6 +18360,14 @@ export interface SortingParameters {
* Use these properties to customize indicator via {@link IChartWidgetApi.createStudy} and {@link IStudyApi.applyOverrides}. * Use these properties to customize indicator via {@link IChartWidgetApi.createStudy} and {@link IStudyApi.applyOverrides}.
*/ */
export interface SpreadIndicatorOverrides { export interface SpreadIndicatorOverrides {
/** Default value: `0` */
"negative fill.transparency": number;
/** Default value: `true` */
"negative fill.visible": boolean;
/** Default value: `0` */
"positive fill.transparency": number;
/** Default value: `true` */
"positive fill.visible": boolean;
/** Default value: `0` */ /** Default value: `0` */
"plot.linestyle": number; "plot.linestyle": number;
/** Default value: `2` */ /** Default value: `2` */
@@ -18364,6 +18382,20 @@ export interface SpreadIndicatorOverrides {
"plot.color": string; "plot.color": string;
/** Default value: `15` */ /** Default value: `15` */
"plot.display": number; "plot.display": number;
/** Default value: `0` */
"baseline.linestyle": number;
/** Default value: `2` */
"baseline.linewidth": number;
/** Default value: `line` */
"baseline.plottype": LineStudyPlotStyleName;
/** Default value: `false` */
"baseline.trackprice": boolean;
/** Default value: `0` */
"baseline.transparency": number;
/** Default value: `rgba(0, 0, 0, 0)` */
"baseline.color": string;
/** Default value: `0` */
"baseline.display": number;
[key: string]: StudyOverrideValueType; [key: string]: StudyOverrideValueType;
} }
/** /**
@@ -22771,6 +22803,14 @@ export interface StudyOverrides {
*/ */
"smoothed moving average.source": string; "smoothed moving average.source": string;
/** Default value: `0` */ /** Default value: `0` */
"spread.negative fill.transparency": number;
/** Default value: `true` */
"spread.negative fill.visible": boolean;
/** Default value: `0` */
"spread.positive fill.transparency": number;
/** Default value: `true` */
"spread.positive fill.visible": boolean;
/** Default value: `0` */
"spread.plot.linestyle": number; "spread.plot.linestyle": number;
/** Default value: `2` */ /** Default value: `2` */
"spread.plot.linewidth": number; "spread.plot.linewidth": number;
@@ -22784,6 +22824,20 @@ export interface StudyOverrides {
"spread.plot.color": string; "spread.plot.color": string;
/** Default value: `15` */ /** Default value: `15` */
"spread.plot.display": number; "spread.plot.display": number;
/** Default value: `0` */
"spread.baseline.linestyle": number;
/** Default value: `2` */
"spread.baseline.linewidth": number;
/** Default value: `line` */
"spread.baseline.plottype": LineStudyPlotStyleName;
/** Default value: `false` */
"spread.baseline.trackprice": boolean;
/** Default value: `0` */
"spread.baseline.transparency": number;
/** Default value: `rgba(0, 0, 0, 0)` */
"spread.baseline.color": string;
/** Default value: `0` */
"spread.baseline.display": number;
/** /**
* - Default value: `close` * - Default value: `close`
* - Input type: `text` * - Input type: `text`
@@ -27046,9 +27100,10 @@ export type Direction = "buy" | "sell";
*/ */
export type DrawingEventType = "click" | "move" | "remove" | "hide" | "show" | "create" | "properties_changed" | "points_changed"; export type DrawingEventType = "click" | "move" | "remove" | "hide" | "show" | "create" | "properties_changed" | "points_changed";
/** /**
* **Override properties for drawing tools.** * Override properties for drawings.
* Refer to the [Drawing Overrides](https://www.tradingview.com/charting-library-docs/latest/customization/overrides/Drawings-Overrides.md) article for information on how to customize drawings.
* *
* **The following constants are used within the default properties. You cannot use these names directly.** * The following constants are used within the default properties. You cannot use these names directly.
* *
* - LINESTYLE * - LINESTYLE
* - SOLID = 0 * - SOLID = 0
@@ -27150,17 +27205,19 @@ export type IProjectionBar = [
/** /**
* An array of bar values. * An array of bar values.
* *
* [time, open, high, low, close, volume, updatetime, isBarClosed] * [time, open, high, low, close, volume, updatetime, isBarClosed, emptyBars, emptyBarsPrice]
*/ */
export type ISeriesStudyResult = [ export type ISeriesStudyResult = [
number, time: number,
number, open: number,
number, high: number,
number, low: number,
number, close: number,
number, volume: number,
number | undefined, updatetime: number | undefined,
boolean | undefined isBarClosed: boolean | undefined,
emptyBars: number[] | undefined,
emptyBarsPrice: number | undefined
]; ];
/** /**
* Input field validator * Input field validator

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"private": true, "private": true,
"description": "CL v27.001 (internal id 3eb6c0e5 @ 2024-02-02T14:43:45.314Z)", "description": "CL v27.002 (internal id 18ee23e7 @ 2024-02-23T14:47:48.290Z)",
"type": "module", "type": "module",
"main": "charting_library.cjs.js", "main": "charting_library.cjs.js",
"module": "charting_library.esm.js", "module": "charting_library.esm.js",

View File

@@ -23,6 +23,6 @@
}, },
"homepage": "https://www.tradingview.com/charting-library-docs", "homepage": "https://www.tradingview.com/charting-library-docs",
"name": "charting_library", "name": "charting_library",
"version": "27.001", "version": "27.002",
"types": "charting_library.d.ts" "types": "charting_library.d.ts"
} }