- **Added support for paginated Symbol Search results.** Added the optional [`searchSymbolsPaginated`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IDatafeedChartApi#searchsymbolspaginated) method to the Datafeed API. When implemented, the library uses this method instead of [`searchSymbols`](https:/www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/required-methods#searchsymbols), loading Symbol Search results in "pages" rather than returning all results at once. For example, the first 50 results can be returned initially, and then more can be loaded on demand as the user scrolls down the list of symbols.
- **Added the `--tv-color-bar-mark-background-color` CSS variable.** This variable allows you to set a custom background color for tooltips shown for [bar marks](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Marks#marks-on-the-chart).
For more information on adjusting UI elements using CSS variables, see [CSS Color Themes](https:/www.tradingview.com/charting-library-docs/latest/customization/styles/CSS-Color-Themes).
- **Supported updating Overlay indicator bars that have a time value less than the two most recent main series times.** Ensured that real-time bars are plotted when an Overlay is "behind" the main series, specifically when the most recent Overlay bar time is less than `mainSeriesBars[mainSeriesBars.length - 2]`.
- **Reenable the Depth of Market (DOM) widget's dynamic mode by default.** The [DOM widget](https:/www.tradingview.com/charting-library-docs/latest/trading_terminal/depth-of-market) was made static starting with version 28. This change has been reversed so that the pre-28 dynamic mode is enabled by default. The static mode added in version 28 is still available by enabling the `static_dom` featureset. (Trading Platform only)
**Improvements**
- **VWAP indicator loads the exact amount of data to reach the target anchor.** Instead of showing an error when there isn’t enough data to calculate the VWAP, the indicator now loads the exact amount of data required to reach the target anchor.
- **Added `isAlwaysShownInLegend` property to input definitions in metainfo.** When set, this property keeps any [indicator inputs](https:/www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo/Custom-Studies-Inputs) (`StudySymbolInputInfo`) visible in the legend, even when other indicator inputs are hidden. Note that the [`always_show_study_symbol_input_values_in_legend`](https:/www.tradingview.com/charting-library-docs/latest/customization/Featuresets/#always_show_study_symbol_input_values_in_legend) featureset must be enabled for this property to take effect.
**Bug Fixes**
- **Fixed an issue where the floating toolbar three dots menu would not call the context menu APIs.**
- **Fixed inaccurate rounding in the Hull indicator calculation.**
- **Fixed an issue where the `onTick` event would not fire.**
- **Fixed an issue where custom indicators that return null values were failing to plot.**
- **Fixed an issue where the `getVisibleBarsRange` method returned the wrong user time.**
- **Fixed an issue where the Overlay indicator was failing to plot because of duplicate bar times.**
**Documentation**
- **New drag-to-export guide.** Check out a guide on how to [enable the drag-to-export feature](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#enable-drag-to-export-feature), including an interactive example.
It explains how users can drag the chart area to export data to external applications, such as pasting JSON into a text editor.
- **New troubleshooting section.** Added a section that explains possible causes and solutions for when [individual positions are not displayed on the chart](https:/www.tradingview.com/charting-library-docs/latest/trading_terminal/common-issues#individual-positions-are-not-displayed-on-the-chart).
---
## Version 30.1.0
*Date: Mon Nov 10 2025*
@@ -36,6 +76,25 @@
- **Fixed an issue where the Bollinger Bands indicator could be loaded inconsistently.** The result differed depending on whether it was added from the header dropdown or via the `createStudy` method.
- **Fixed an issue where `showOrderDialog` would use the default implementation instead of the one from `customUI`.** (Trading Platform only)
- **Fixed an issue where interacting with the DOM could cause errors in the console.** (Trading Platform only)
- **Fixed an issue where the Order Panel would not be shown on screens less than 493 pixels high.** (Trading Platform only)
**Documentation**
- **Updated navigation and structure.** Restructured and expanded documentation for better navigation and clarity:
- Created a new [Time and sessions](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/) section with an introductory article explaining how to correctly configure bar times, symbol sessions, and resolutions in the datafeed.
- Reorganized the [Tutorials](https://www.tradingview.com/charting-library-docs/latest/tutorials/) section into four dedicated categories: Tutorials, How-to guides, Framework integrations, and Interactive code examples.
- **Added new troubleshooting sections.** Each section explains possible causes and solutions for the corresponding issue.
- [Incorrect time display in Japanese-style charts](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Datafeed-Issues#japanese-charts-show-incorrect-time)
- [P&L showing 0 in bracket orders](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/common-issues#pl-in-bracket-orders-shows-0)
- **Other updates.** The following enhancements were made:
- Added an [interactive example](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Marks#example) showing how to implement marks on the chart or time scale.
- Expanded explanation and added an example for [enabling custom resolutions](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Resolution#enable-custom-resolutions).
- Exposed the `addPlusButton` [action ID](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#execute-action-by-id) that enables or disables the *Plus* button on the price scale for [quick trading](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Price-Scale#quick-trading).
- Clarified the behavior of the [`show_zoom_and_move_buttons_on_touch`](https://www.tradingview.com/charting-library-docs/latest/customization/Featuresets#show_zoom_and_move_buttons_on_touch) featureset on mobile devices.
- Documented a limitation for `long_positions` and `short_positions` drawing types where the [`text`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.CreateShapeOptions#text) property is auto-generated and must not be set manually.
- Clarified method descriptions for `mergeUp`, `mergeDown`, `unmergeUp`, and `unmergeDown` in both [`IStudyApi`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IStudyApi/) and [`ISeriesApi`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.ISeriesApi/) interfaces.
- Updated the [Connecting data](https://www.tradingview.com/charting-library-docs/latest/connecting_data/) article with clearer descriptions of available integration approaches and their appropriate use cases.
---
@@ -340,7 +399,6 @@ For more details, see the [Trading Overrides](https://www.tradingview.com/charti
- **New how-to guide.** Check out a new [guide](https://www.tradingview.com/charting-library-docs/latest/tutorials/how-to-guides/add-custom-button-to-top-toolbar) on how to add a custom button to the top toolbar.
- **Other updates.** The following enhancements were made:
- Added a new section that explains [multiple symbol resolving](https://www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/required-methods#multiple-symbol-resolving).
- Updated information on how to [change colors of the *Buy/Sell* buttons](https://www.tradingview.com/charting-library-docs/latest/customization/styles/CSS-Color-Themes#buysell-buttons-properties).
- Updated the [Toolbars](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Toolbars) article.
- Added a new [section](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#execute-action-by-id) that describes how to trigger specific actions, such as opening the *Chart settings* dialog, using the [`executeActionById`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#executeactionbyid) method.
- Added an [overview](https://www.tradingview.com/charting-library-docs/latest/getting_started/product-comparison) of other TradingView products.
this._legendView?.destroy(),this._floatingTooltipView?.destroy(),this._pineSourceCodeModel?.get()?.destroy(),this._visibleTimeRangeInputs?.destroy(),this._showPineVersionInStatusLine.destroy(),this._alertStateVersion?.destroy(),this._metaInfo.destroy(),this._studyName.destroy(),this._allOwnerSources.destroy(),this._sources.destroy(),this._symbolSource.destroy(),this._status.destroy(),this._compileActiveStatus.destroy(),this._compileErrorStatus.destroy(),this._plotOffsets.destroy(),this._serverPlotOffsets.destroy(),this._properties.destroy(),super.destroy()}setId(e){super.setId(e),this._properties.setNameInOwner((0,Wt.propertyPathForSource)(this))}properties(){returnthis._properties}propertiesPatched(){returnthis._propertiesPatched}isDraggable(){return!this._metaInfo.value().linkedToSeries}logs(){returnnull}logLevelMask(){conste=this._properties.childs().inputs.childs().__log_level.value();if(!(0,_.isNumber)(e)||e<0||e>7)thrownewError(`Value of log level is unexpected, current value is ${e}, but expected values from 0 to 7`);return{error:Boolean(1&e),warning:Boolean(2&e),info:Boolean(4&e)}}setLogLevelMask(e){constt=(Number(e.error)&&1)|(Number(e.warning)&&2)|(Number(e.info)&&4);this._properties.childs().inputs.childs().__log_level.setValue(t)}performance(){returnnewb.WatchedValue(null)}profilingEnabled(){return!!this._properties.childs().inputs.childs().__profile?.value()}enableProfiling(e){this._properties.childs().inputs.childs().__profile?.setValue(e)}onAboutToBeDestroyed(){returnthis._aboutToBeDestroyed}priceScale(e){returne?this._model.mainSeries().priceScale():super.priceScale()}lastValueData(e,t,s){consti={noData:!0},r=this.metaInfo().isPlotForceOverlay(e),n=r?this._model.mainSeries().priceScale():this.priceScale();if(this._model.timeScale().isEmpty()||null===n||n.isEmpty()||this.data().isEmpty())returni;consto=this._model.timeScale().visibleBarsStrictRange(),a=this.firstValue(!0,r);if(null===o||null===a)returni;if(!this._properties.childs().visible.value())returni;constl=this._properties.childs().styles,h=this._properties.childs().ohlcPlots;letc,u;if(l&&l.childs()[e]&&(c=l.childs()[e]),h&&h.childs()[e]&&(c=h.childs()[e]),!c||0===c.childs().display.value())returni;constd=this.metaInfo().plots;for(u=0;u<d.length;u++){constt=d[u];if(t.id===e||(0,L.isOhlcClosePlot)(t)&&t.target===e)break}constp=u+1,f=this.offset(e),m=this.nearestIndex(o.lastBar()-f,O.PlotRowSearchMode.NearestLeft,p);if(void0===m)returni;consty=this._lastNonEmptyPlotRow(p),g=null!==y&&o.contains(y.index),v=null!==y?y.value:null,S=t||g?v:this.data().valueAt(m);if(!S||!(0,_.isNumber)(S[p]))returni;constb=S[p],P=this._valuesProvider.getPlotColor(u,S),w=n.priceToCoordinate(b,a),I=this.plotFormatter(e).format(b),x={...n.getFormattedValues(b,a,void0,I),noData:!1,color:P,floatCoordinate:w,coordinate:w};returns&&(x.price=b),x}isFailed(){returnthis.status().type===xt.StudyStatusType.Error}isLoading(){returnthis.status().type===xt.StudyStatusType.Loading}isCompleted(){returnthis.status().type===xt.StudyStatusType.Completed}
},s.createElement("div",{className:Ce.buttonContent},null,s.createElement("span",null,S))):null:b?s.createElement("div",{className:c()(Ce.flagWrap,"apply-common-tooltip",!y&&Ce.withFlag),title:u.t(null,void0,r(57640)),onClick:x,"data-name":"sources-button"},y&&s.createElement(k.Icon,{className:Ce.icon,icon:O}),null,s.createElement("div",{className:c()(Ce.title)},S),s.createElement(we.ToolWidgetCaret,{className:Ce.caret,dropped:!1})):null}varLe=r(99605);functionRe(e){const{brokerButton:t=null}=e,{isSmallWidth:n,selectedFilterValues:o,setSelectedFilterValues:a,setSelectedIndex:l,isMobile:i,searchRef:d,symbolSearchContent:m}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),p=m.tabSelectFilters;returnh.isSeparateSymbolSearchTabs?s.createElement("div",{className:c()(Le.wrap,Le.small,Le.newStyles,i&&Le.mobile)},t&&s.createElement("div",{className:Le.brokerWrap},t),m.canChangeExchange&&s.createElement("div",{className:Le.filterItem},s.createElement(Ie,null)),p&&p.map((e=>{const{id:t,options:r,label:n}=e,c=r.find((e=>e.value===FILTER_DEFAULT_VALUE));if(!c)thrownewError("There must be default filter value in filter definition");constu=r.find((e=>e.value===o[m.currentSymbolType]?.[t]))||c;returns.createElement("div",{key:t,className:Le.filterItem},s.createElement(SymbolSearchSelectFilter,{selectedOption:u,defaultOption:c,options:r,onSelect:e=>{a(m.currentSymbolType,{[t]:e.value}),trackEvent("New SS",m.currentSymbolType,null===e.value?e.analyticsLabel:e.value),l(-1),d.current?.focus()},label:n,isMobile:i,"data-name":t}))}))):s.createElement("div",{className:c()(Le.wrap,n&&Le.small)},s.createElement("div",{className:Le.item},s.createElement("div",{className:Le.text},n?u.t(null,void0,r(74007)):u.t(null,void0,r(95481)))),s.createElement("div",{className:Le.item},!n&&s.createElement("div",{className:Le.text},u.t(null,void0,r(78734))),m.canChangeExchange&&s.createElement("div",{className:Le.exchange},s.createElement(Ie,null))))}varTe=r(24640),Ne=r(80903);functionBe(e){const{onTouchMove:t,listRef:r,className:n,listWrapRef:o,virtualListKey:a,items:l,getItemSize:i,hideFeed:u,canLoadMore:d,onLoadMoreSymbols:m}=e,{mode:p,isSmallWidth:g,handleListWidth:f}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),[v,b]=(0,s.useState)(null),y=(0,Se.useResizeObserver)((function([e]){b(e.contentRect.height),f(e.contentRect.width)})),S=(0,s.useCallback)((e=>{const{index:t,style:r}=e;returns.createElement("div",{style:r},l[t])}),[l]),x=(0,s.useCallback)((e=>(0,_.ensure)(l[e].key)),[l]),w="watchlist"===p&&null!==v;returns.createElement("div",{className:c()(Ne.wrap,w&&Ne.watchlist,u&&Ne.noFeed,u&&h.isSeparateSymbolSearchTabs&&Ne.newStyles,n),onTouchMove:t,ref:y},s.createElement("div",{ref:o,className:c()(Ne.scrollContainer,u&&Ne.noFeed)},w?s.createElement(ye.VariableSizeList,{key:a,ref:r,className:Ne.listContainer,width:"100%",height:(0,_.ensureNotNull)(v),itemCount:l.length,itemSize:i,children:S,itemKey:x,overscanCount:20,direction:(0,Te.isRtl)()?"rtl":"ltr"}):s.createElement(s.Fragment,null,s.createElement("div",{
;(0,h.getAllSymbolTypesValue)();consto=!1;leta;if(Se&&ge){a=(await(0,te.respectAbort)(j.current.signal,ge.accountMetainfo())).prefix}consts=d.enabled("show_spread_operators")?f(e)??a??r?.getRequestExchangeValue():l?.getRequestExchangeValue(),i=f(e)?void0:(r||l)?.getRequestCountryValue(),[c,u]=awaitPromise.all([Fe(j.current.signal,e,t,r,s,i,n),o&&!n?getRecent():Promise.resolve([])]),m=u.filter((e=>s?e.exchange?.toLowerCase()===s.toLowerCase():!i||e.country?.toLowerCase()===i.toLowerCase())),p=newSet(m.map((e=>`${e.exchange}_${e.symbol}`))),g=c.symbols.filter((e=>!p.has(`${e.exchange}_${e.symbol}`)));letv=function(e,t=window.ChartApiInstance.symbolsGrouping()){constr={},n=[];for(leto=0;o<e.length;++o){consta=e[o];if(a.prefix||Array.isArray(a.contracts))returne;constl=t[a.type];if(void0===l){n.push(a);continue}consts=l.exec(a.symbol);if(s){conste=s[1];lett;r.hasOwnProperty(e)?t=r[e]:(t=n.length,r[e]=t,n.push({type:a.type,symbol:e,exchange:a.exchange,description:a.description,full_name:a.exchange+":"+e,contracts:[]})),n[t].contracts?.push(a)}elsen.push(a)}returnn}([...m,...g]);if(n&&(v=[...S.renderSymbolSearchList,...v]),!v.length)returnx((r=>{constn=Boolean(l&&U.length>1&&!(0,h.exchangeSelectDisabled)(t)),o=H(t);return{...r,canChangeExchange:n,tabSelectFilters:o,token:e,symbolsRemaining:0,withFilters:Boolean(n||o?.length),currentSymbolType:t,currentSelectedSearchSource:l,currentTabAvailableSearchSources:U}})),Pe(),V("empty"),voidMe();Pe(),x((r=>{constn=Boolean(l&&U.length>1&&!(0,h.exchangeSelectDisabled)(t)),o=H(t);return{...r,canChangeExchange:n,tabSelectFilters:o,renderSymbolSearchList:v,token:e,symbolsRemaining:c.symbols_remaining,withFilters:Boolean(n||o?.length),currentSymbolType:t,currentSelectedSearchSource:l,currentTabAvailableSearchSources:U,symbolStartIndex:r.symbolStartIndex+c.symbols.length}})),V("good")}catch(e){(0,te.skipAbortError)(e)}}functionMe(){W&&(pe.current=setTimeout((()=>W()),1e3))}asyncfunctionFe(e,t,r,n,o,a,l){consts={serverHighlight:!1,text:d.enabled("show_spread_operators")?(0,m.shortName)(t):w.current?.value,exchange:o,country:a,type:r,lang:window.language||"",sortByCountry:void0,brokerId:ve,onlyTradable:Boolean(ve)&&Se,unhideSymbolSearchGroups:we,signal:e,start:l,filterQueryParams:O,overrideQueryParams:K,searchInitiationPoint:q},i=(0,ae.getSearchRequestDelay)();returnvoid0!==i&&await(0,te.delay)(e,i),G(s)}function_e(){Ue(),V("empty"),ie(""),k(!1),x((e=>({...e,symbolStartIndex:0}))),Pe()}functionAe(){"watchlist"===$.current&&(n("symbolSearch"),(0,le.trackEvent)("Watchlist","Mobile SS","Go to SS page"))}functionDe(e){switch((0,se.hashFromEvent)(e)){case37:case39:Re()}}functionPe(){he.current&&clearTimeout(he.current)}functionOe(){pe.current&&clearTimeout(pe.current)}functionUe(){j.current.abort(),j.current=newAbortController}}varAt=r(48199),Dt=r(97514),Pt=r(58442),Ot=r(1765);functionUt(e){const[t,r]=(0,s.useState)((()=>{const{defaultSearchSource:t,searchSources:r}=e,n=Ot.getValue("symboledit.exchangefilter","");returnr.find((e=>e.value()===n))||t}))
const{propType:t,properties:n,id:s,title:r="",solutionId:a}=e.definition,l=n[t],c=l.value()||"",u=e=>{l.setValue(e)};returno.createElement(b.CommonSection,{id:s,title:r,solutionId:a},o.createElement(y.CellWrap,null,o.createElement(w,{symbol:(0,i.ensureDefined)(c),onSymbolChanged:u})))}{const{study:t,value:n,input:{id:s,name:a},onChange:l,disabled:c,hasTooltip:u}=e,p=e=>{constn=(0,d.getInternalSymbolName)(e,t);l(n,s,a)};returno.createElement(w,{symbol:(0,i.ensureDefined)(n),onSymbolChanged:p,disabled:c,className:r()(u&&_.hasTooltip)})}}},1861:(e,t,n)=>{"use strict";n.d(t,{showSymbolSearchItemsDialog:()=>l});varo=n(50959),s=n(50655),r=n(51826),a=n(40336),i=n(87896);functionl(e){const{symbolTypeFilter:t,initialMode:n="symbolSearch",autofocus:l=!0,defaultValue:c,showSpreadActions:u,selectSearchOnInit:d,onSearchComplete:p,dialogTitle:h,placeholder:m,fullscreen:g,initialScreen:v,wrapper:f,dialog:b,contentItem:y,onClose:C,onOpen:x,footer:_,symbolTypes:w,searchInput:E,emptyState:S,hideMarkedListFlag:T,dialogWidth:N="auto",manager:I,shouldReturnFocus:k,onSymbolFiltersParamsChange:P,onEmptyResults:D,customSearchSymbols:B,enableOptionsChain:M,disableRecents:O,overrideQueryParams:R,hiddenFilterIds:L,showRecents:V,searchInitiationPoint:F,selectedSymbolSettingsKey:W,filterValuesSettingsKey:A}=e;if(r.dialogsOpenerManager.isOpened("SymbolSearch")||r.dialogsOpenerManager.isOpened("ChangeIntervalDialog"))return;constq=document.createElement("div"),z=o.createElement(s.SlotContext.Provider,{value:I??null},o.createElement(a.SymbolSearchItemsDialog,{symbolTypeFilter:t,onClose:U,initialMode:n,defaultValue:c,showSpreadActions:u,hideMarkedListFlag:T,selectSearchOnInit:d,onSearchComplete:p,dialogTitle:h,placeholder:m,fullscreen:g,initialScreen:v,wrapper:f,dialog:b,contentItem:y,footer:_,symbolTypes:w,searchInput:E,emptyState:S,autofocus:l,dialogWidth:N,shouldReturnFocus:k,onSymbolFiltersParamsChange:P,onEmptyResults:D,customSearchSymbols:B,enableOptionsChain:M,disableRecents:O,overrideQueryParams:R,hiddenFilterIds:L,showRecents:V,searchInitiationPoint:F,selectedSymbolSettingsKey:W,filterValuesSettingsKey:A})),H=(0,i.createReactRoot)(z,q);functionU(){H.unmount(),r.dialogsOpenerManager.setAsClosed("SymbolSearch"),C&&C()}returnr.dialogsOpenerManager.setAsOpened("SymbolSearch"),x&&x(),{close:U}}},73146:(e,t,n)=>{"use strict";n.d(t,{createAdapter:()=>a,doesStudyLikeAffectSave:()=>i});varo=n(26610),s=n(13896),r=n(2088);functiona(e){if((0,o.isLineTool)(e))return{isPine:()=>!1,isStandardPine:()=>!1,canOverrideMinTick:()=>!1,resolvedSymbolInfoBySymbol:()=>{thrownewTypeError("Only study is supported.")},symbolsResolved:()=>{thrownewTypeError("Only study is supported.")},parentSources:()=>{thrownewTypeError("Only study is supported.")},getAllChildren:()=>[],sourceId:()=>{thrownewTypeError("Only study is supported.")},inputs:()=>({}),parentSourceForInput:()=>{thrownewTypeError("Only study is supported.")}};if((0,r.isStudy)(e))returne;if("isInputsStudy"ine)returne;thrownewTypeError("Unsupported source type.")}functioni(e){
const{propType:t,properties:n,id:s,title:r="",solutionId:a}=e.definition,l=n[t],c=l.value()||"",u=e=>{l.setValue(e)};returno.createElement(b.CommonSection,{id:s,title:r,solutionId:a},o.createElement(y.CellWrap,null,o.createElement(w,{symbol:(0,i.ensureDefined)(c),onSymbolChanged:u})))}{const{study:t,value:n,input:{id:s,name:a},onChange:l,disabled:c,hasTooltip:u}=e,p=e=>{constn=(0,d.getInternalSymbolName)(e,t);l(n,s,a)};returno.createElement(w,{symbol:(0,i.ensureDefined)(n),onSymbolChanged:p,disabled:c,className:r()(u&&_.hasTooltip)})}}},1861:(e,t,n)=>{"use strict";n.d(t,{showSymbolSearchItemsDialog:()=>l});varo=n(50959),s=n(50655),r=n(51826),a=n(59071),i=n(87896);functionl(e){const{symbolTypeFilter:t,initialMode:n="symbolSearch",autofocus:l=!0,defaultValue:c,showSpreadActions:u,selectSearchOnInit:d,onSearchComplete:p,dialogTitle:h,placeholder:m,fullscreen:g,initialScreen:v,wrapper:f,dialog:b,contentItem:y,onClose:C,onOpen:x,footer:_,symbolTypes:w,searchInput:E,emptyState:S,hideMarkedListFlag:T,dialogWidth:N="auto",manager:I,shouldReturnFocus:k,onSymbolFiltersParamsChange:P,onEmptyResults:D,customSearchSymbols:B,enableOptionsChain:M,disableRecents:O,overrideQueryParams:R,hiddenFilterIds:L,showRecents:V,searchInitiationPoint:F,selectedSymbolSettingsKey:W,filterValuesSettingsKey:A}=e;if(r.dialogsOpenerManager.isOpened("SymbolSearch")||r.dialogsOpenerManager.isOpened("ChangeIntervalDialog"))return;constq=document.createElement("div"),z=o.createElement(s.SlotContext.Provider,{value:I??null},o.createElement(a.SymbolSearchItemsDialog,{symbolTypeFilter:t,onClose:U,initialMode:n,defaultValue:c,showSpreadActions:u,hideMarkedListFlag:T,selectSearchOnInit:d,onSearchComplete:p,dialogTitle:h,placeholder:m,fullscreen:g,initialScreen:v,wrapper:f,dialog:b,contentItem:y,footer:_,symbolTypes:w,searchInput:E,emptyState:S,autofocus:l,dialogWidth:N,shouldReturnFocus:k,onSymbolFiltersParamsChange:P,onEmptyResults:D,customSearchSymbols:B,enableOptionsChain:M,disableRecents:O,overrideQueryParams:R,hiddenFilterIds:L,showRecents:V,searchInitiationPoint:F,selectedSymbolSettingsKey:W,filterValuesSettingsKey:A})),H=(0,i.createReactRoot)(z,q);functionU(){H.unmount(),r.dialogsOpenerManager.setAsClosed("SymbolSearch"),C&&C()}returnr.dialogsOpenerManager.setAsOpened("SymbolSearch"),x&&x(),{close:U}}},73146:(e,t,n)=>{"use strict";n.d(t,{createAdapter:()=>a,doesStudyLikeAffectSave:()=>i});varo=n(26610),s=n(13896),r=n(2088);functiona(e){if((0,o.isLineTool)(e))return{isPine:()=>!1,isStandardPine:()=>!1,canOverrideMinTick:()=>!1,resolvedSymbolInfoBySymbol:()=>{thrownewTypeError("Only study is supported.")},symbolsResolved:()=>{thrownewTypeError("Only study is supported.")},parentSources:()=>{thrownewTypeError("Only study is supported.")},getAllChildren:()=>[],sourceId:()=>{thrownewTypeError("Only study is supported.")},inputs:()=>({}),parentSourceForInput:()=>{thrownewTypeError("Only study is supported.")}};if((0,r.isStudy)(e))returne;if("isInputsStudy"ine)returne;thrownewTypeError("Unsupported source type.")}functioni(e){
return(0,r.isStudy)(e)||!s.lineToolsDoNotAffectChartInvalidation}},45560:(e,t,n)=>{"use strict";n.d(t,{useDefinitionProperty:()=>r});varo=n(50959),s=n(71953);constr=e=>{constt="property"ine?e.property:void0,n="defaultValue"ine?e.defaultValue:e.property.value(),[r,a]=(0,o.useState)(t?t.value():n);(0,o.useEffect)((()=>{if(t){constn={};returna(t.value()),t.subscribe(n,(t=>{constn=t.value();e.handler&&e.handler(n),a(n)})),()=>{t.unsubscribeAll(n)}}return()=>{}}),[t]);return[r,e=>{if(void0!==t){constn=t.value();s.logger.logNormal(`Changing property value from "${n}" to "${e}"`),t.setValue(e)}}]}},78260:(e,t,n)=>{"use strict";n.d(t,{CellWrap:()=>i});varo=n(50959),s=n(97754),r=n.n(s),a=n(58123);functioni(e){returno.createElement("div",{className:r()(a.wrap,e.className)},e.children)}},53424:(e,t,n)=>{"use strict";n.d(t,{CheckableTitle:()=>c});varo=n(50959),s=n(15294),r=n(45560);functiona(e){const{property:t,...n}=e,[a,i]=(0,r.useDefinitionProperty)({property:t}),l="mixed"===a;returno.createElement(s.Checkbox,{...n,name:"toggle-enabled",checked:l||a,indeterminate:l,onChange:function(){i("mixed"===a||!a)}})}vari=n(78260),l=n(36730);functionc(e){const{property:t,disabled:n,title:s,className:r,name:c}=e,u=o.createElement("span",{className:l.title},s);returno.createElement(i.CellWrap,{className:r},t?o.createElement(a,{name:c,className:l.checkbox,property:t,disabled:n,label:u,labelAlignBaseline:!0}):u)}},31356:(e,t,n)=>{"use strict";n.d(t,{CommonSection:()=>a});varo=n(50959),s=(n(86240),n(33066)),r=n(53424);n(50921),n(42707),n(70724);functiona(e){const{id:t,offset:n,disabled:a,checked:i,title:l,children:c,solutionId:u,infoTooltip:d,dialogContent:p}=e;returno.createElement(s.PropertyTable.Row,null,o.createElement(s.PropertyTable.Cell,{placement:"first",verticalAlign:"adaptive",offset:n,"data-section-name":t,colSpan:Boolean(c)?void0:2,checkableTitle:!0},o.createElement(r.CheckableTitle,{name:`is-enabled-${t}`,title:l,disabled:a,property:i,dialogContent:p}),u&&!Boolean(c)&&!1,!1,d&&!Boolean(c)&&!1),Boolean(c)&&o.createElement(s.PropertyTable.Cell,{placement:"last","data-section-name":t},c,u&&!1,d&&!1))}},86067:(e,t,n)=>{"use strict";n.d(t,{GroupTitleSection:()=>l});varo=n(50959),s=n(33066),r=n(53424),a=n(97754),i=n(65032);functionl(e){returno.createElement(s.PropertyTable.Row,null,o.createElement(s.PropertyTable.Cell,{className:a(i.titleWrap,e.rowClassName),placement:"first",verticalAlign:"adaptive",colSpan:2,"data-section-name":e.name,checkableTitle:!0},o.createElement(r.CheckableTitle,{title:e.title,name:`is-enabled-${e.name}`,className:i.title})))}},71953:(e,t,n)=>{"use strict";n.d(t,{logger:()=>o});consto=(0,n(9343).getLogger)("Platform.GUI.PropertyDefinitionTrace")},16697:(e,t,n)=>{"use strict";n.d(t,{ColorPicker:()=>z});varo=n(50959),s=n(97754),r=n.n(s),a=n(11542),i=n(59369),l=n(82665),c=n(24377),u=n(50151),d=n(49483),p=n(20520),h=n(16396),m=n(6914),g=n(50238),v=n(93544),f=n(69825);constb=4;functiony(e){const{color:t,selected:r,onSelect:i,onSwatchRemove:l}=e,[c,y]=(0,o.useState)(!1),[C,x]=(0,
tabIndex:-1,"data-name":"sources-button"},s.createElement("div",{className:Ce.buttonContent},null,s.createElement("span",null,S))):null:b?s.createElement("div",{className:i()(Ce.flagWrap,"apply-common-tooltip",!y&&Ce.withFlag),title:u.t(null,void0,r(57640)),onClick:x,"data-name":"sources-button"},y&&s.createElement(k.Icon,{className:Ce.icon,icon:O}),null,s.createElement("div",{className:i()(Ce.title)},S),s.createElement(we.ToolWidgetCaret,{className:Ce.caret,dropped:!1})):null}varLe=r(99605);functionRe(e){const{brokerButton:t=null}=e,{isSmallWidth:n,selectedFilterValues:o,setSelectedFilterValues:a,setSelectedIndex:l,isMobile:c,searchRef:d,symbolSearchContent:m}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),p=m.tabSelectFilters;returnh.isSeparateSymbolSearchTabs?s.createElement("div",{className:i()(Le.wrap,Le.small,Le.newStyles,c&&Le.mobile)},t&&s.createElement("div",{className:Le.brokerWrap},t),m.canChangeExchange&&s.createElement("div",{className:Le.filterItem},s.createElement(Ie,null)),p&&p.map((e=>{const{id:t,options:r,label:n}=e,i=r.find((e=>e.value===FILTER_DEFAULT_VALUE));if(!i)thrownewError("There must be default filter value in filter definition");constu=r.find((e=>e.value===o[m.currentSymbolType]?.[t]))||i;returns.createElement("div",{key:t,className:Le.filterItem},s.createElement(SymbolSearchSelectFilter,{selectedOption:u,defaultOption:i,options:r,onSelect:e=>{a(m.currentSymbolType,{[t]:e.value}),trackEvent("New SS",m.currentSymbolType,null===e.value?e.analyticsLabel:e.value),l(-1),d.current?.focus()},label:n,isMobile:c,"data-name":t}))}))):s.createElement("div",{className:i()(Le.wrap,n&&Le.small)},s.createElement("div",{className:Le.item},s.createElement("div",{className:Le.text},n?u.t(null,void0,r(74007)):u.t(null,void0,r(95481)))),s.createElement("div",{className:Le.item},!n&&s.createElement("div",{className:Le.text},u.t(null,void0,r(78734))),m.canChangeExchange&&s.createElement("div",{className:Le.exchange},s.createElement(Ie,null))))}varTe=r(24640),Ne=r(50279),Be=r(39416);varMe=r(80903);functionFe(e){const{onTouchMove:t,listRef:r,className:n,listWrapRef:o,virtualListKey:a,items:l,getItemSize:c,hideFeed:u,canLoadMore:d,onLoadMoreSymbols:m}=e,{mode:p,isSmallWidth:g,handleListWidth:f}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),[v,b]=(0,s.useState)(null),y=(0,Se.useResizeObserver)((function([e]){b(e.contentRect.height),f(e.contentRect.width)})),S=(0,s.useCallback)((e=>{const{index:t,style:r}=e;returns.createElement("div",{style:r},l[t])}),[l]),x=(0,s.useCallback)((e=>(0,_.ensure)(l[e].key)),[l]),w="watchlist"===p&&null!==v,k=function(e,t={},r=[]){constn=(0,s.useRef)(null),o=(0,s.useRef)(e);o.current=e;const{ref:a=null,...l}=t,c=(0,s.useRef)(l);(0,Ne.default)(t,c.current)||(c.current=t);consti=(0,Be.useFunctionalRefObject)(a),u=(0,s.useCallback)((e=>{i(e),null!==n.current&&(n.current.disconnect(),null!==e&&n.current.observe(e))}),[i,n]);return(0,s.useEffect)((()=>(n.current=newIntersectionObserver(((e,t)=>o.current(e,t)),{...c.current,
root:c.current?.root?.current}),i.current&&u(i.current),()=>{n.current?.disconnect()})),[i,c.current,...r]),u}((e=>{constt=e.pop();void0!==t&&t.isIntersecting&&m&&m()}),{threshold:0,rootMargin:"0px 0px 20px 0px",root:o});returns.createElement("div",{className:i()(Me.wrap,w&&Me.watchlist,u&&Me.noFeed,u&&h.isSeparateSymbolSearchTabs&&Me.newStyles,n),onTouchMove:t,ref:y},s.createElement("div",{ref:o,className:i()(Me.scrollContainer,u&&Me.noFeed)},w?s.createElement(ye.VariableSizeList,{key:a,ref:r,className:Me.listContainer,width:"100%",height:(0,_.ensureNotNull)(v),itemCount:l.length,itemSize:c,children:S,itemKey:x,overscanCount:20,direction:(0,Te.isRtl)()?"rtl":"ltr"}):s.createElement(s.Fragment,null,s.createElement("div",{className:i()(Me.listContainer,g&&Me.multiLineItemsContainer)},!h.isSeparateSymbolSearchTabs&&s.createElement(Re,null),...l,d&&s.createElement("div",{key:`observer-${l.length}`,className:i()(Me.spinnerContainer,g&&Me.largeSpinner),ref:k},s.createElement(be.Spinner,{size:g?"small":"mini"}))))))}var_e=r(96967),Ae=r(47201),De=r(35020);varPe=r(95854),Oe=r(36966),Ue=r(7953),Qe=r(38528),Ve=r(66686);r(19954);constWe=s.createContext({children:{},setIsReady:()=>{}});varze=r(86866),Ke=r(67842);varHe,Ze,qe,$e=r(6916),Ge=r.n($e);functionje(e){const{className:t,count:r,compact:n=!0,size:o="xlarge",color:a="danger",sign:l,borderColor:c="none","aria-label":u,"aria-hidden":d,disabled:m,...h}=e,p=h;letg;g=!("xxsmall"===o||"xxxsmall"===o)&&r?n&&r>=100?"99+":l&&r>0?`+${r}`:r:"";constf=i()(t,Ge().counter,Ge()[o],Ge()[`color-${a}`],"none"!==c&&Ge()[`borderColor-${c}`],m&&Ge().disabled);returns.createElement("span",{...p,className:f,"aria-label":u,"aria-hidden":d},g)}functionJe({count:e,color:t="danger",size:r="xsmall",disabled:n}){returns.createElement(je,{"aria-label":"Tab counter",count:e,size:r,color:t,borderColor:"primary",disabled:n})}functionXe(e,t,r){const{id:n,items:o,activationType:a,orientation:l="horizontal",disabled:c,onActivate:i,isActive:u,overflowBehaviour:d,enableActiveStateStyles:m,tablistLabelId:h,tablistLabel:p,preventDefaultIfKeyboardActionHandled:g,size:f,stopPropagationIfKeyboardActionHandled:v,keyboardNavigationLoop:b,defaultKeyboardFocus:y,focusableItemAttributes:S}=t,x=(0,s.useMemo)((()=>function(e,t,r){returne.map((e=>{constn=e.counter;returnn?{...e,endUpperSlot:Je({count:n.count,color:n.color,size:r,disabled:t}),counter:void0}:e}))}(o,c,f)),[o,c,f]),w=(0,De.useMobileTouchState)(),k=function(e){constt=(0,E.useSafeMatchMedia)(C["media-mf-phone-landscape"],!0),r=(0,De.useMobileTouchState)();returne??(r||!t?"scroll":"collapse")}(d),I=(0,s.useRef)(!1),L=(0,s.useCallback)((e=>e.id),[]),R=m??!w,T=function(){const{setIsReady:e,children:t}=(0,s.useContext)(We),r=(0,s.useRef)((0,s.useId)());returnt[r.current]||(t[r.current]={isReady:!1}),(0,s.useCallback)((()=>{t[r.current].isReady=!0,e(Object.values(t).every((e=>e.isReady)))}),[t,e])}(),{visibleItems:N,hiddenItems:B,containerRefCallback:M,innerContainerRefCallback:F,moreButtonRef:_,setItemRef:A,itemsMeasurements:D}=(0,
country:a,type:r,lang:window.language||"",sortByCountry:void0,brokerId:ve,onlyTradable:Boolean(ve)&&Se,unhideSymbolSearchGroups:we,signal:e,start:l,filterQueryParams:O,overrideQueryParams:z,searchInitiationPoint:q},c=(0,ae.getSearchRequestDelay)();returnvoid0!==c&&await(0,te.delay)(e,c),$(s)}function_e(){Ue(),V("empty"),ce(""),k(!1),x((e=>({...e,symbolStartIndex:0}))),Pe()}functionAe(){"watchlist"===G.current&&(n("symbolSearch"),(0,le.trackEvent)("Watchlist","Mobile SS","Go to SS page"))}functionDe(e){switch((0,se.hashFromEvent)(e)){case37:case39:Re()}}functionPe(){he.current&&clearTimeout(he.current)}functionOe(){pe.current&&clearTimeout(pe.current)}functionUe(){j.current.abort(),j.current=newAbortController}}varPt=r(48199),Ot=r(97514),Ut=r(58442),Qt=r(1765);functionVt(e){const[t,r]=(0,s.useState)((()=>{const{defaultSearchSource:t,searchSources:r}=e,n=Qt.getValue("symboledit.exchangefilter","");returnr.find((e=>e.value()===n))||t}));return[t,(0,s.useCallback)((e=>{vart;r(e),t=e,Qt.setValue("symboledit.exchangefilter",t.value())}),[])]}functionWt(e){const{selectedSymbolSettingsKey:t="symboledit.filter"}=e,[r,n]=(0,s.useState)((()=>{if(1===e.types.length)returne.types[0].value;constr=Qt.getValue(t,(0,h.getAllSymbolTypesValue)());returne.types.find((e=>e.value===r))?r:(0,h.getAllSymbolTypesValue)()}));return[r,(0,s.useCallback)((e=>{n(e),function(e,t="symboledit.filter"){Qt.setValue(t,e)}(e,t)}),[t])]}varzt=r(46043),Kt=r(82708),Ht=r(88145),Zt=r(76460),qt=r(88716);const$t=!1,Gt=(0,h.getAvailableSearchSources)(),jt=(0,h.getDefaultSearchSource)(),Jt=d.enabled("uppercase_instrument_names");functionXt(e){const{onClose:t,symbolTypeFilter:n,initialMode:o,defaultValue:a="",showSpreadActions:l,hideMarkedListFlag:c,selectSearchOnInit:i=!0,onSearchComplete:m,dialogTitle:p=u.t(null,void0,r(51165)),placeholder:g,fullscreen:f,initialScreen:b,wrapper:w,dialog:k,contentItem:C,footer:E,searchInput:L,emptyState:R,autofocus:N,dialogWidth:M,onKeyDown:F,searchSourcesScreen:_,customSearchSymbols:A,isDisableFiltering:D,disableRecents:P,shouldReturnFocus:O,onSymbolFiltersParamsChange:U,onEmptyResults:Q,enableOptionsChain:V,overrideQueryParams:W,hiddenFilterIds:z,showRecents:K=!0,searchInitiationPoint:H="symbolSearch",selectedSymbolSettingsKey:Z,filterValuesSettingsKey:q}=e,$=(0,s.useMemo)((()=>{if(D)return[];constt=e.symbolTypes??(0,h.getAvailableSymbolTypes)();returnn?n(t):t}),[]),j=void0!==e.input,J=D?[]:Gt,[X,Y]=(0,s.useState)((()=>or(a,V)?"options":o)),[ee,te]=(0,s.useState)((()=>or(a,V))),[re,ae]=(0,s.useState)((()=>null)),le=(0,s.useRef)(function(e,t){constr=or(e,t);return(0,h.isOptionDefaultValue)(e)?r??e.value:e}(a,V)),[ce,ie]=Vt({searchSources:J,defaultSearchSource:jt}),[ue,de]=[],[me,he]=Wt({types:$,selectedSymbolSettingsKey:Z}),[pe,ge]=[{},()=>{}],[fe,ve]=(0,s.useState)(!1),[be,ye]=(0,s.useState)(-1),[Se,xe]=(0,s.useState)("noop"),we=h.isSeparateSymbolSearchTabs?ue?.[me]||jt:ce,ke=(0,s.useMemo)((()=>{if(!h.isSeparateSymbolSearchTabs)returnJ;returnJ.filter((e=>{constt=TAB_SOURCE_FILTER_MAP[me]
neww.TranslatedString("lock objects",r.t(null,void0,o(18942)))),H=neww.TranslatedString("unlock objects",r.t(null,void0,o(51198))),V=neww.TranslatedString("anchor objects",r.t(null,void0,o(63869))),B=neww.TranslatedString("unanchor objects",r.t(null,void0,o(99234))),z=neww.TranslatedString("change visibility at current interval and above",r.t(null,void0,o(45800))),q=neww.TranslatedString("change visibility at current interval and below",r.t(null,void0,o(75645))),G=neww.TranslatedString("change visibility at current interval",r.t(null,void0,o(84331))),$=neww.TranslatedString("change visibility at all intervals",r.t(null,void0,o(57916))),Y=(r.t(null,void0,o(66823)),(0,_.appendEllipsis)(r.t(null,void0,o(264))),r.t(null,void0,o(98334))),Z=r.t(null,void0,o(27298)),J=r.t(null,void0,o(3564)),K=r.t(null,void0,o(94559)),Q=r.t(null,void0,o(2165)),X=r.t(null,void0,o(16986)),ee=r.t(null,void0,o(12645)),te=r.t(null,void0,o(44579)),oe=r.t(null,void0,o(29436)),ne=r.t(null,void0,o(81054)),ie=r.t(null,void0,o(32538)),ae=r.t(null,void0,o(72046)),re=r.t(null,void0,o(90095)),le=r.t(null,void0,o(14115)),se=r.t(null,void0,o(33110)),ce=r.t(null,void0,o(28280)),de=r.t(null,void0,o(76150)),ue=r.t(null,void0,o(94210)),he=r.t(null,void0,o(60035)),pe=r.t(null,void0,o(10761)),ge=r.t(null,void0,o(11254)),Se=r.t(null,void0,o(35049)),me=r.t(null,void0,o(19271)),be=r.t(null,void0,o(15512)),ve=r.t(null,void0,o(46545)),_e=r.t(null,void0,o(52160)),we=r.t(null,void0,o(17293)),fe=r.t(null,void0,o(21973)),Ie=r.t(null,void0,o(55481)),Ae=r.t(null,void0,o(71179)),Te=r.t(null,void0,o(4077)),ye=r.t(null,void0,o(54853)),Ce=r.t(null,void0,o(20177)),We=r.t(null,void0,o(494)),Ne=r.t(null,void0,o(60668)),Pe=r.t(null,void0,o(58026)),Fe=r.t(null,void0,o(56982)),Ee=((0,_.appendEllipsis)(r.t(null,void0,o(35088))),(0,_.appendEllipsis)(r.t(null,void0,o(2439))),(0,_.appendEllipsis)(r.t(null,void0,o(32514)))),xe=(r.t(null,void0,o(78358)),(0,_.appendEllipsis)(r.t(null,void0,o(76266))),r.t(null,void0,o(49680))),Le=r.t(null,void0,o(12537)),Me=(r.t(null,void0,o(93553)),r.t(null,void0,o(74975))),ke=r.t(null,void0,o(99894)),De=r.t(null,void0,o(5837)),Oe=r.t(null,void0,o(24185)),Ue=(r.t(null,void0,o(37113)),r.t(null,void0,o(29449)),r.t(null,void0,o(50849)),r.t(null,void0,o(33158)),r.t(null,void0,o(81465)),r.t(null,void0,o(62986)),r.t(null,void0,o(55418))),je=r.t(null,void0,o(10261)),Re=r.t(null,void0,o(44020)),He=((0,_.appendEllipsis)(r.t(null,void0,o(32514))),r.t(null,void0,o(97878)),r.t(null,void0,o(39010))),Ve=r.t(null,void0,o(26090)),Be=(r.t(null,void0,o(95754)),r.t(null,void0,o(35679)),r.t(null,void0,o(9140)),r.t(null,void0,o(46607)),r.t(null,void0,o(39079)),(0,_.appendEllipsis)(r.t(null,void0,o(75594)))),ze=(0,_.appendEllipsis)(r.t(null,void0,o(88853))),qe=r.t(null,void0,o(35140)),Ge=r.t(null,void0,o(68422)),$e=r.t(null,void0,o(92957)),Ye=r.t(null,void0,o(58764));r.t(null,void0,o(10996)),r.t(null,void0,o(3061));asyncfunctionZe(e,t,o){returnnull}functionJe(e){
this._options.addClass&&(this._widget.className+=`${this._options.addClass}`),this._options["data-name"]&&(this._widget.dataset.name=this._options["data-name"]),this._options.layout&&"auto"!==this._options.layout&&(this._isVertical="vertical"===this._options.layout,this._updateLayoutType()),this._widget.addEventListener("click",this._preventClickUntilAnimation,!0)}destroy(){this.hide(!0),S._toolbars.splice(S._toolbars.indexOf(this),1),this._widget.removeEventListener("click",this._preventClickUntilAnimation,!0),document.body.contains(this._widget)&&document.body.removeChild(this._widget),null!==this._draggable&&this._draggable.destroy(),null!==this._sortable&&this._sortable.destroy(),this._widget.innerHTML="",this._responsiveResizeFunction=null}setResponsiveResizeFunc(t){this._responsiveResizeFunction=t}isVisible(){returnthis._visibility.value()}visibility(){returnthis._visibility.readonly()}isVertical(){returnthis._isVertical}show(t){this.isVisible()||(document.body.contains(this._widget)||(this._init(),document.body.appendChild(this._widget)),this._setHiddingTimeout(null),window.addEventListener("resize",this._windowResizeListener),this.raise(),this._visibility.setValue(!0),this._showTimeStamp=performance.now(),this._widget.classList.contains("i-hidden")?(this._widget.classList.remove("i-hidden"),setTimeout((()=>{this.isVisible()&&(t?.(),this._widget.classList.remove("i-closed"))}))):(t?.(),this._widget.classList.remove("i-closed")),this._onWindowResize())}hide(t=!1){if(!this.isVisible())return;conste=this._widget.classList.contains("i-closed");if(this._widget.classList.add("i-closed"),this._visibility.setValue(!1),t||e)this._setHiddingTimeout(null),this._widget.classList.add("i-hidden");else{constt=setTimeout((()=>{this._setHiddingTimeout(null),this._widget.classList.add("i-hidden")}),this.hideDuration());this._setHiddingTimeout(t)}window.removeEventListener("resize",this._windowResizeListener)}raise(){S._toolbars.length+S._startZIndex!==this._zIndex()&&(S._toolbars.splice(S._toolbars.indexOf(this),1),S._toolbars.push(this),S._updateAllZIndexes())}hideDuration(){return.75*r.dur}addWidget(t,e={}){consto=this.widgetsCount();if(void0===e.index&&(e.index=o),e.index<0||e.index>o)thrownewError(`Index must be in [0, ${o}]`);consti=document.createElement("div");i.className="tv-floating-toolbar__widget js-widget",i.appendChild(t);constn=e.index===o?null:this._content.childNodes.item(e.index);this._content.insertBefore(i,n),this._onWindowResize(),this._sortable?.updateList()}getReactWidgetContainer(){returnthis._reactWidgetsContainer}onWidgetsReordered(){returnthis._reorderedDelegate}onSortableStart(){returnthis._startSortableDelegate}removeWidget(t){conste=this._findWrapperForWidget(t);e&&(this._content.removeChild(e),this._onWindowResize(),this._sortable?.updateList())}widgetsCount(){returnthis._content.childNodes.length}showWidget(t){conste=this._findWrapperForWidget(t);e&&e.classList.remove("i-hidden")}hideWidget(t){conste=this._findWrapperForWidget(t);e&&e.classList.add("i-hidden")}removeWidgets(){
}))),Boolean(r.length)&&r.map(((o,n)=>{constr=t||e;returnr?o.showForSmallScreen?i.createElement(o.component,{...o.props,isSmallScreen:r,key:`${o.props.title}_${n}`,className:m()(K,c)}):null:i.createElement(o.component,{...o.props,key:`${o.props.title}_${n}`,className:m()(K,c)})}))),null!==o&&i.createElement(o.component,{...o.props,key:`${o.props.title}`,className:m()(K,c),isSmallScreen:t||e,isToolbarFixed:l})))):u();functionu(){returnnull===e?null:i.createElement(e.component,{...e.props,isToolbarFixed:l,isDrawingFinished:a,className:m()(K,c)})}}varj=o(51768),$=o(21618),G=o(34369);functionq(t){const{title:e,activeChartWidget:o,className:n}=t;returni.createElement($.ToolWidgetIconButton,{className:n,icon:G,title:e,onClick:asyncfunction(){(0,j.trackEvent)("GUI","Context action on drawings","Settings");constt=o.model().selection().lineDataSources(),e=t.length;1===e?awaito.showChartPropertiesForSource(t[0],void0,{onWidget:o.onWidget()}):e>1&&awaito.showChartPropertiesForSources({sources:t})},"data-name":"settings"})}varX=o(32473),Y=o(16465);functionJ(t){const{className:e,...o}=t;returni.createElement(X.ToolButton,{className:p(e,Y.button),tooltipPosition:"horizontal",...o})}varQ=o(65186),tt=o(91244);functionet(t){const{activeChartWidget:e,className:n}=t,s=e.model().selection().lineDataSources();if(0===s.length)returnnull;consta=s[0].properties().frozen,l=(0,f.useProperty)(a),c=l?{tooltip:r.t(null,void0,o(99894)),icon:Q}:{tooltip:r.t(null,void0,o(5837)),icon:tt};returni.createElement(J,{className:n,isActive:Boolean(l),onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Lock"),e.toggleLockSelectedObject()},"data-name":Boolean(l)?"unlock":"lock",...c})}varot=o(43576),it=o(31932),nt=o(84696);functionrt(t){const{activeChartWidget:e,className:n}=t,s=e.model().selection().lineDataSources(),a=s.find((t=>t.anchorable())),l=(0,f.useProperty)(a?.properties().anchored??newR.Property(!1)),c=(0,ot.usePromise)((async()=>{const{ActionsProvider:t}=await(0,it.actionsProviderModule)();returnnewt(e).actionForLineTools(s,"Chart.SelectedObject.ToggleAnchored")}),(t=>t?.destroy()),[e,l]);returnc?i.createElement(J,{className:n,isActive:Boolean(l),tooltip:r.t(null,void0,o(74089)),icon:nt.icons.get("Chart.AnchorLineTool"),onClick:()=>c.execute(),"data-name":"toggle-anchor"}):null}varst=o(93544);functionat(t){const{title:e,activeChartWidget:o,className:n}=t;returni.createElement($.ToolWidgetIconButton,{className:n,icon:st,title:e,"data-name":"remove",onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Remove"),o.removeSelectedSources()}})}varlt=o(49483),ct=o(53054);constht=lt.CheckMobile.any();functiondt(t){if(!ht)returnnull;const{activeChartWidget:e,className:n}=t,s=e.model().selection().lineDataSources();if(0===s.length)returnnull;consta=s[0];if(!a.snapTo45DegreesAvailable())returnnull;constl=(0,f.useProperty)((0,h.alignTo45Degrees)()),c=l?{tooltip:r.t(null,void0,o(31145)),icon:ct}:{tooltip:r.t(null,void0,o(83187)),icon:ct};returni.createElement(J,{className:n,
isActive:Boolean(l),onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Align to 45 degrees");constt=(0,h.alignTo45Degrees)().value();(0,h.alignTo45Degrees)().setValue(!t),t||e.model().alignToolTo45Degrees(a,(0,g.ensureNotNull)(a.ownerSource()))},"data-name":Boolean(l)?"disable-align-to-45-degrees":"enable-align-to-45-degrees",...c})}varut=o(98486);functionpt(t){const{title:e,activeChartWidget:o,className:n}=t;returni.createElement($.ToolWidgetIconButton,{className:n,icon:ut,title:e,"data-name":"cancel-drawing",onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Cancel Drawing"),o.resetDrawingState()}})}varmt=o(75774),gt=o(32563),vt=o(69451),_t=o(31269),ft=o(68335),wt=o(26709),yt=o(41706);asyncfunctionbt(t,e){const{createVisualOrderAction:i,createChangeIntervalsVisibilitiesAction:n,createActionToggleVisibilityDataSources:s,createSyncDrawingActions:a}=await(0,it.actionsProviderModule)(),l=[i(t,e),n(t,e)],c=function(t,e){consti=[],n=ft.isMacKeyboard?" +":"",s=e.filter((t=>t.cloneable()));s.length>0&&i.push(newyt.Action({actionId:"Chart.LineTool.Clone",options:{name:"clone",icon:o(36296),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" Drag",label:r.t(null,void0,o(12537)),onExecute:()=>{t.model().cloneLineTools(s,!1),(0,j.trackEvent)("GUI","Context action on drawings","Clone")}}}));consta=e.filter((t=>t.copiable()));if(a.length>0){conste={name:"copy",label:r.t(null,void0,o(49680)),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" C",onExecute:()=>{t.chartWidgetCollection().clipboard.uiRequestCopy(a)}};i.push(newyt.Action({actionId:"Chart.Clipboard.CopyLineTools",options:e,id:"Copy"}))}returni}(t,e);if(c.length&&l.push(newyt.Separator,...c),e.some((t=>t.isSynchronizable()))){consto=a(t,e);o.length&&l.push(newyt.Separator,...o)}if(1===e.length&&e[0].additionalActions){consto=awaite[0].additionalActions(t.model(),"FloatingToolbarButton");o.actions.length&&(l.push(newyt.Separator),l.push(...o.actions))}returnl.push(newyt.Separator,s(t,e)),l}varCt=o(44996);functionTt(t){const{title:e,activeChartWidget:o,isSmallScreen:n,className:r}=t,s=o.model(),a=s.selection().lineDataSources(),[l,c]=(0,i.useState)([]),h=(0,i.useRef)(null),d=(0,ot.usePromise)((async()=>{const{ActionsProvider:t}=await(0,it.actionsProviderModule)(),e=newt(o),i=a[0],n=s.paneForSource(i);returnn?e.contextMenuActionsForSources(a,n):[]}),void0,[o,a]),u=(0,i.useCallback)((async()=>{if(n)return;constt=awaitbt(o,a);c(xt(t))}),[n,o,a]),p=(0,i.useCallback)((t=>{if(!n||null===d)return;conste=xt(d);window.matchMedia(Z.DialogBreakpoints.TabletSmall).matches||!mt.isAnyMobile?_t.ContextMenuManager.showMenu(e,t,{mode:mt.isAnyMobile?"drawer":"menu","data-name":"more-menu"},{menuName:"LineToolFloatingToolbarMoreMenu"}):c(e)}),[n,d]);return(0,i.useEffect)((()=>{l.length&&h.current?.update()}),[l]),i.createElement(_.ToolWidgetMenu,{className:r,ref:h,arrow:!1,onOpen:u,onClick:p,title:e,content:i.createElement(v.Icon,{icon:Ct}),"data-name":"more",menuDataName:"more-menu",
title:o,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`,verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void0,content:i.createElement("div",{className:m()(Vt.buttonWrap,l&&Vt.small)},i.createElement(v.Icon,{icon:Ft}),!l&&"mixed"!==c&&i.createElement("div",{className:Vt.buttonLabel},`${c}px`))},Ht.map((t=>i.createElement(w.PopupMenuItem,{key:t,theme:Ot,label:`${t}px`,isActive:t===c,onClick:h,onClickArg:t}))));functionh(t){t&&e&&(r.beginUndoMacro(n),e.setValue(t,void0,{applyValue:(t,e)=>{r.setProperty(t,e,n)}}),r.endUndoMacro())}}functionKt(t){const{activeChartWidget:e,className:o,actionId:n}=t,r=e.model().selection().lineDataSources(),s=(0,ot.usePromise)((async()=>{const{ActionsProvider:t}=await(0,it.actionsProviderModule)();returnnewt(e).actionForLineTools(e.model().selection().lineDataSources(),n)}),(t=>t?.destroy()),[e,r]);if(!s)returnnull;const{label:a,icon:l}=s.options();returni.createElement(J,{className:o,tooltip:a,icon:l,onClick:()=>s.execute(),"data-name":`toggle-insert-cells-button-${n}`})}varUt=o(5880),jt=o.n(Ut),$t=o(21065),Gt=o.n($t),qt=o(48984),Xt=o.n(qt);constYt=news.TranslatedString("change line tool(s) font size",r.t(null,void0,o(37453))),Jt=news.TranslatedString("change line tool(s) line style",r.t(null,void0,o(13423))),Qt=news.TranslatedString("change line tool(s) line width",r.t(null,void0,o(81303))),te=news.TranslatedString("change line tool(s) color",r.t(null,void0,o(78655))),ee=news.TranslatedString("change line tool(s) background color",r.t(null,void0,o(50522))),oe=news.TranslatedString("change line tool(s) text color",r.t(null,void0,o(96142))),ie=news.TranslatedString("line tool(s) line style",r.t(null,{context:"line tool property name"},o(64974))),ne=r.t(null,void0,o(32514)),re=r.t(null,void0,o(99919)),se=r.t(null,void0,o(67410)),ae=r.t(null,void0,o(4543)),le=r.t(null,void0,o(37117)),ce=r.t(null,void0,o(92516)),he=r.t(null,void0,o(2573)),de=r.t(null,void0,o(53002)),ue=r.t(null,void0,o(75056)),pe=r.t(null,void0,o(11989)),me=r.t(null,void0,o(14097)),ge=r.t(null,void0,o(81956)),ve=r.t(null,void0,o(47370)),_e=r.t(null,void0,o(77753)),fe=r.t(null,void0,o(69715)),we=r.t(null,void0,o(28736)),ye=r.t(null,void0,o(65086)),be=r.t(null,void0,o(46193)),Ce=r.t(null,void0,o(7977)),Te=r.t(null,void0,o(8111)),xe=lt.CheckMobile.any()||lt.CheckMobile.isIPad();classSe{constructor(t){this._currentTool=null,this._updateVisibilityTimeout=null,this._lineWidthsProperty=null,this._lineColorsProperty=null,this._textColorsProperty=null,this._backgroundsProperty=null,this._highlighterWidthsProperty=null,this._floatingContainer=null,this._isDrawingFinished=!0,this._floatingToolbarRendered=!1,this._toolbarVisible=!1,this._propertiesVisible=!1,this._templatesButton=null,this._cancelButton=null,this._propertyButtons=[],this._commonButtons=[],
hotKey:(0,r.hotKeySerialize)({keys:[m,p,"H"],text:"{0} + {1} + {2}"})},lockAllDrawings:{iconActive:a.drawingToolsIcons.lockAllDrawingsActive},magnet:{hotKey:(0,r.hotKeySerialize)({keys:[m],text:"{0}"})},measure:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void0,o(92949))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};constw={};Object.entries(f).map((([t,e])=>{consto=s.lineToolsIcons[t]??a.drawingToolsIcons[t];(0,i.assert)(!!o,`Icon is not defined for drawing "${t}"`);constn=c.lineToolsLocalizedNames[t]??l[t];(0,i.assert)(!!n,`Localized name is not defined for drawing "${t}"`);return{...e,name:t,icon:o,localizedName:n,selectHotkey:d.lineToolsSelectHotkeys[t]}})).forEach((t=>{w[t.name]=t}))},44005:(t,e,o)=>{"use strict";o.d(e,{CollectibleColorPropertyDirectWrapper:()=>a,CollectibleColorPropertyUndoWrapper:()=>s});vari=o(50151),n=o(43337);classrextendsn.Property{constructor(t){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=t}destroy(){this._baseProperty.destroy(),super.destroy()}value(){constt=this._baseProperty.value();return"mixed"===t?"":t}visible(){returnthis._baseProperty.visible()}setValue(t){this._isProcess=!0,this._baseProperty.setValue(""===t?"mixed":t,void0,{applyValue:this._applyValue.bind(this)}),this._isProcess=!1,this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){consto=o=>{this._isProcess||e.call(t,this,"")},i={obj:t,method:e,callback:o};this._listenersMappers.push(i),this._baseProperty.subscribe(t,o)}unsubscribe(t,e){consto=(0,i.ensureDefined)(this._listenersMappers.find((o=>o.obj===t&&o.method===e))?.callback);this._baseProperty.unsubscribe(t,o)}unsubscribeAll(t){this._baseProperty.unsubscribeAll(t)}}classsextendsr{constructor(t,e,o){super(t),this._propertyApplier=e,this._undoText=o}_applyValue(t,e){this._propertyApplier.setProperty(t,e,this._undoText)}}classaextendsr{_applyValue(t,e){t.setValue(e)}}},66567:(t,e,o)=>{"use strict";o.d(e,{CollectiblePropertyUndoWrapper:()=>l});vari=o(50151),n=o(11542),r=o(95804),s=o(43337);consta=newr.TranslatedString("change {propertyName} property",n.t(null,void0,o(25167)));classlextendss.Property{constructor(t,e,o){super(),this._isProcess=!1,this._listenersMappers=[],this._valueApplier={applyValue:(t,e)=>{this._propertyApplier.setProperty(t,e,a)}},this._baseProperty=t,this._propertyApplier=o,this._propertyName=e}destroy(){this._baseProperty.destroy(),super.destroy()}value(){returnthis._baseProperty.value()}setValue(t,e){this._propertyApplier.beginUndoMacro(a.format({propertyName:this._propertyName})),this._isProcess=!0,this._baseProperty.setValue(t,void0,this._valueApplier),this._isProcess=!1,this._propertyApplier.endUndoMacro(),this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){consto=()=>{this._isProcess||e.call(t,this,"")};this._listenersMappers.push({obj:t,method:e,callback:o}),this._baseProperty.subscribe(t,o)}unsubscribe(t,e){consto=(0,
isActive:Boolean(l),onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Align to 45 degrees");constt=(0,h.alignTo45Degrees)().value();(0,h.alignTo45Degrees)().setValue(!t),t||e.model().alignToolTo45Degrees(a,(0,g.ensureNotNull)(a.ownerSource()))},"data-name":Boolean(l)?"disable-align-to-45-degrees":"enable-align-to-45-degrees",...c})}varut=o(98486);functionpt(t){const{title:e,activeChartWidget:o,className:n}=t;returni.createElement($.ToolWidgetIconButton,{className:n,icon:ut,title:e,"data-name":"cancel-drawing",onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Cancel Drawing"),o.resetDrawingState()}})}varmt=o(75774),gt=o(32563),vt=o(69451),_t=o(31269),ft=o(68335),wt=o(26709),yt=o(41706);asyncfunctionbt(t,e){const{createVisualOrderAction:i,createChangeIntervalsVisibilitiesAction:n,createActionToggleVisibilityDataSources:s,createSyncDrawingActions:a}=await(0,it.actionsProviderModule)(),l=[i(t,e),n(t,e)],c=function(t,e){consti=[],n=ft.isMacKeyboard?" +":"",s=e.filter((t=>t.cloneable()));s.length>0&&i.push(newyt.Action({actionId:"Chart.LineTool.Clone",options:{name:"clone",icon:o(36296),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" Drag",label:r.t(null,void0,o(12537)),onExecute:()=>{t.model().cloneLineTools(s,!1),(0,j.trackEvent)("GUI","Context action on drawings","Clone")}}}));consta=e.filter((t=>t.copiable()));if(a.length>0){conste={name:"copy",label:r.t(null,void0,o(49680)),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" C",onExecute:()=>{t.chartWidgetCollection().clipboard.uiRequestCopy(a)}};i.push(newyt.Action({actionId:"Chart.Clipboard.CopyLineTools",options:e,id:"Copy"}))}returni}(t,e);if(c.length&&l.push(newyt.Separator,...c),e.some((t=>t.isSynchronizable()))){consto=a(t,e);o.length&&l.push(newyt.Separator,...o)}if(1===e.length&&e[0].additionalActions){consto=awaite[0].additionalActions(t.model(),"FloatingToolbarButton");o.actions.length&&(l.push(newyt.Separator),l.push(...o.actions))}returnl.push(newyt.Separator,s(t,e)),l}varCt=o(44996);functionTt(t){returni.createElement(xt,{...t})}functionxt(t){const{title:e,activeChartWidget:o,isSmallScreen:n,className:r}=t,s=o.model(),a=s.selection().lineDataSources(),l=mt.isAnyMobile?(0,ot.usePromise)((async()=>{const{ActionsProvider:t}=await(0,it.actionsProviderModule)(),e=newt(o),i=a[0],n=s.paneForSource(i);returnn?e.contextMenuActionsForSources(a,n):[]}),void0,[o,a]):null,c=mt.isAnyMobile?null:(0,ot.usePromise)((()=>bt(o,a)),void0,[o,a]),h=(0,i.useCallback)((t=>{conste=mt.isAnyMobile?l:c;if(null===e)return;consto=St(e);_t.ContextMenuManager.showMenu(o,t,{mode:mt.isAnyMobile?"drawer":"menu","data-name":"more-menu"},{menuName:"LineToolFloatingToolbarMoreMenu"})}),[n,l,c]);returni.createElement(_.ToolWidgetMenu,{className:r,arrow:!1,onClick:h,title:e,content:i.createElement(v.Icon,{icon:Ct}),"data-name":"more",menuDataName:"more-menu",noMomentumBasedScroll:!0,closeOnEsc:!0},i.createElement(vt.ActionsTable,{parentIsOpened:!0,items:[]}))}functionSt(t){
verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void0,content:i.createElement("div",{className:m()(Ot.buttonWrap,l&&Ot.small)},i.createElement(v.Icon,{icon:Vt}),!l&&"mixed"!==c&&i.createElement("div",{className:Ot.buttonLabel},`${c}px`))},Zt.map((t=>i.createElement(w.PopupMenuItem,{key:t,theme:Ht,label:`${t}px`,isActive:t===c,onClick:h,onClickArg:t}))));functionh(t){t&&e&&(r.beginUndoMacro(n),e.setValue(t,void0,{applyValue:(t,e)=>{r.setProperty(t,e,n)}}),r.endUndoMacro())}}functionUt(t){const{activeChartWidget:e,className:o,actionId:n}=t,r=e.model().selection().lineDataSources(),s=(0,ot.usePromise)((async()=>{const{ActionsProvider:t}=await(0,it.actionsProviderModule)();returnnewt(e).actionForLineTools(e.model().selection().lineDataSources(),n)}),(t=>t?.destroy()),[e,r]);if(!s)returnnull;const{label:a,icon:l}=s.options();returni.createElement(J,{className:o,tooltip:a,icon:l,onClick:()=>s.execute(),"data-name":`toggle-insert-cells-button-${n}`})}varjt=o(5880),$t=o.n(jt),Gt=o(21065),qt=o.n(Gt),Xt=o(48984),Yt=o.n(Xt);constJt=news.TranslatedString("change line tool(s) font size",r.t(null,void0,o(37453))),Qt=news.TranslatedString("change line tool(s) line style",r.t(null,void0,o(13423))),te=news.TranslatedString("change line tool(s) line width",r.t(null,void0,o(81303))),ee=news.TranslatedString("change line tool(s) color",r.t(null,void0,o(78655))),oe=news.TranslatedString("change line tool(s) background color",r.t(null,void0,o(50522))),ie=news.TranslatedString("change line tool(s) text color",r.t(null,void0,o(96142))),ne=news.TranslatedString("line tool(s) line style",r.t(null,{context:"line tool property name"},o(64974))),re=r.t(null,void0,o(32514)),se=r.t(null,void0,o(99919)),ae=r.t(null,void0,o(67410)),le=r.t(null,void0,o(4543)),ce=r.t(null,void0,o(37117)),he=r.t(null,void0,o(92516)),de=r.t(null,void0,o(2573)),ue=r.t(null,void0,o(53002)),pe=r.t(null,void0,o(75056)),me=r.t(null,void0,o(11989)),ge=r.t(null,void0,o(14097)),ve=r.t(null,void0,o(81956)),_e=r.t(null,void0,o(47370)),fe=r.t(null,void0,o(77753)),we=r.t(null,void0,o(69715)),ye=r.t(null,void0,o(28736)),be=r.t(null,void0,o(65086)),Ce=r.t(null,void0,o(46193)),Te=r.t(null,void0,o(7977)),xe=r.t(null,void0,o(8111)),Se=lt.CheckMobile.any()||lt.CheckMobile.isIPad();classLe{constructor(t){this._currentTool=null,this._updateVisibilityTimeout=null,this._lineWidthsProperty=null,this._lineColorsProperty=null,this._textColorsProperty=null,this._backgroundsProperty=null,this._highlighterWidthsProperty=null,this._floatingContainer=null,this._isDrawingFinished=!0,this._floatingToolbarRendered=!1,this._toolbarVisible=!1,this._propertiesVisible=!1,this._templatesButton=null,this._cancelButton=null,this._propertyButtons=[],this._commonButtons=[],this._actionCommonButtons=[],this._toolExceptionCases=null,this._chartWidgetCollection=t,
iconActive:a.drawingToolsIcons.lockAllDrawingsActive},magnet:{hotKey:(0,r.hotKeySerialize)({keys:[m],text:"{0}"})},measure:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void0,o(92949))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};constw={};Object.entries(f).map((([t,e])=>{consto=s.lineToolsIcons[t]??a.drawingToolsIcons[t];(0,i.assert)(!!o,`Icon is not defined for drawing "${t}"`);constn=c.lineToolsLocalizedNames[t]??l[t];(0,i.assert)(!!n,`Localized name is not defined for drawing "${t}"`);return{...e,name:t,icon:o,localizedName:n,selectHotkey:d.lineToolsSelectHotkeys[t]}})).forEach((t=>{w[t.name]=t}))},44005:(t,e,o)=>{"use strict";o.d(e,{CollectibleColorPropertyDirectWrapper:()=>a,CollectibleColorPropertyUndoWrapper:()=>s});vari=o(50151),n=o(43337);classrextendsn.Property{constructor(t){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=t}destroy(){this._baseProperty.destroy(),super.destroy()}value(){constt=this._baseProperty.value();return"mixed"===t?"":t}visible(){returnthis._baseProperty.visible()}setValue(t){this._isProcess=!0,this._baseProperty.setValue(""===t?"mixed":t,void0,{applyValue:this._applyValue.bind(this)}),this._isProcess=!1,this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){consto=o=>{this._isProcess||e.call(t,this,"")},i={obj:t,method:e,callback:o};this._listenersMappers.push(i),this._baseProperty.subscribe(t,o)}unsubscribe(t,e){consto=(0,i.ensureDefined)(this._listenersMappers.find((o=>o.obj===t&&o.method===e))?.callback);this._baseProperty.unsubscribe(t,o)}unsubscribeAll(t){this._baseProperty.unsubscribeAll(t)}}classsextendsr{constructor(t,e,o){super(t),this._propertyApplier=e,this._undoText=o}_applyValue(t,e){this._propertyApplier.setProperty(t,e,this._undoText)}}classaextendsr{_applyValue(t,e){t.setValue(e)}}},66567:(t,e,o)=>{"use strict";o.d(e,{CollectiblePropertyUndoWrapper:()=>l});vari=o(50151),n=o(11542),r=o(95804),s=o(43337);consta=newr.TranslatedString("change {propertyName} property",n.t(null,void0,o(25167)));classlextendss.Property{constructor(t,e,o){super(),this._isProcess=!1,this._listenersMappers=[],this._valueApplier={applyValue:(t,e)=>{this._propertyApplier.setProperty(t,e,a)}},this._baseProperty=t,this._propertyApplier=o,this._propertyName=e}destroy(){this._baseProperty.destroy(),super.destroy()}value(){returnthis._baseProperty.value()}setValue(t,e){this._propertyApplier.beginUndoMacro(a.format({propertyName:this._propertyName})),this._isProcess=!0,this._baseProperty.setValue(t,void0,this._valueApplier),this._isProcess=!1,this._propertyApplier.endUndoMacro(),this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){consto=()=>{this._isProcess||e.call(t,this,"")};this._listenersMappers.push({obj:t,method:e,callback:o}),this._baseProperty.subscribe(t,o)}unsubscribe(t,e){consto=(0,i.ensureDefined)(this._listenersMappers.find((o=>o.obj===t&&o.method===e))?.callback);this._baseProperty.unsubscribe(t,o)}unsubscribeAll(t){
standardTheme:!1}).then((()=>{e.readOnly()||window.saver.saveChartSilently()}))}}))})),!(0,G.isDesktopApp)()||te("1.0.10")){const[,t]=j.getStdThemeNames();o.push(newV({id:"DarkColorTheme",category:"settingsActions",label:a.t(null,void0,n(25848)),checkable:!0,checked:j.getCurrentTheme().name===t,onExecute:()=>{!function(e){constt=(0,j.getCurrentTheme)().name===p.StdTheme.Dark?p.StdTheme.Light:p.StdTheme.Dark,o=e.chartModels().value().every((e=>null!==e.model().getThemeNameIfStdTheme())),s=()=>{(0,Y.loadTheme)(e,{themeName:t,standardTheme:!0}).then((()=>{e.readOnly()||window.saver.saveChartSilently()}))};if(o)s();else{conste=a.t(null,void0,n(78659)).format({name:(0,Q.capitalizeFirstLetter)(t)});(0,$.showConfirm)({text:e,onConfirm:({dialogClose:e})=>{s(),e()},onCancel:({dialogClose:e})=>{(0,g.setTheme)(t),(0,j.syncTheme)(),e()}})}}(e.chartWidgetCollection())}}))}returno};returnwindow.is_authenticated?j.getThemeNames().then(t):Promise.resolve(t())};varoe=n(78861),se=n(94322);n(78176);varie=n(7024),le=n(70173),ae=n(90995);const{DrawingSyncMode:re}=oe,ce={drawings:"ToggleHideAllDrawingTools",indicators:"ToggleHideAllIndicators",positions:"ToggleHideAllPositions",all:"ToggleHideAll"},he=newU.TranslatedString("stay in drawing mode",a.t(null,void0,n(4114))),de=newU.TranslatedString("sync drawings",a.t(null,void0,n(94521))),ue=a.t(null,void0,n(99901)),ve=a.t(null,void0,n(23391)),me=(a.t(null,void0,n(93027)),a.t(null,void0,n(3521)),a.t(null,void0,n(79451))),pe=a.t(null,void0,n(3519)),ge=a.t(null,void0,n(94593));varbe=n(84526),fe=n(92572),we=n(89324);classyeextendsV{constructor(e){super({label:a.t(null,void0,n(37189)),id:"InvertScale",category:"settingsActions",checkable:!0,onExecute:()=>{this._model.invertPriceScale(this._model.mainSeries().priceScale())},shortcutHint:(0,P.humanReadableHash)(P.Modifiers.Alt+73)}),this._model=e;(this._props=this._model.mainSeries().priceScale().properties().childs().isInverted).subscribe(this,(()=>{this._onUpdate.fire(this)}))}destroy(){super.destroy(),this._props.unsubscribeAll(this)}isChecked(){returnthis._model.mainSeries().priceScale().isInverted()}}classSeextendsV{constructor(e){super({label:a.t(null,void0,n(6919)),checkable:!0,id:"TogglePercantage",category:"settingsActions",onExecute:()=>{this.isChecked()?this._model.setPriceScaleRegularScaleMode(this._model.mainSeries().priceScale()):this._model.togglePriceScalePercentageScaleMode(this._model.mainSeries().priceScale())},shortcutHint:(0,P.humanReadableHash)(P.Modifiers.Alt+80),disabled:e.mainSeries().priceScale().isLockScale()||6===e.mainSeries().properties().childs().style.value(),checked:e.mainSeries().priceScale().isPercentage()}),this._model=e;(this._props=this._model.mainSeries().priceScale().properties().childs().percentage).subscribe(this,(()=>{this._onUpdate.fire(this)}))}destroy(){super.destroy(),this._props.unsubscribeAll(this)}isChecked(){returnthis._model.mainSeries().priceScale().isPercentage()}}classxeextendsV{constructor(e){super({label:a.t(null,void0,n(16170)),id:"ToggleLogScale",
min:-Number.MAX_SAFE_INTEGER,name:"Start time",type:"time"},{defval:"Standard Deviation",group:"Bands Settings",id:"Bands Calculation Mode",name:"Bands Calculation Mode",options:["Standard Deviation","Percentage"],tooltip:"Determines the units used to calculate the distance of the bands. When 'Percentage' is selected, a multiplier of 1 means 1%.",type:"text",display:15},{defval:!0,group:"Bands Settings",id:"calculate_stDev",inline:"band_1",name:" ",type:"bool",display:0},{defval:1,group:"Bands Settings",id:"bands_multiplier",inline:"band_1",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #1",step:.5,type:"float",display:15},{defval:!1,group:"Bands Settings",id:"calculate_stDev_2",inline:"band_2",name:" ",type:"bool",display:0},{defval:2,group:"Bands Settings",id:"bands_multiplier_2",inline:"band_2",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #2",step:.5,type:"float",display:15},{defval:!1,group:"Bands Settings",id:"calculate_stDev_3",inline:"band_3",name:" ",type:"bool",display:0},{defval:3,group:"Bands Settings",id:"bands_multiplier_3",inline:"band_3",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #3",step:.5,type:"float",display:15},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"},{id:"UpperBand",type:"line"},{id:"LowerBand",type:"line"},{id:"UpperBand_2",type:"line"},{id:"LowerBand_2",type:"line"},{id:"UpperBand_3",type:"line"},{id:"LowerBand_3",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"},LowerBand:{histogramBase:0,title:"Lower Band #1"},LowerBand_2:{histogramBase:0,title:"Lower Band #2"},LowerBand_3:{histogramBase:0,title:"Lower Band #3"},UpperBand:{histogramBase:0,title:"Upper Band #1"},UpperBand_2:{histogramBase:0,title:"Upper Band #2"},UpperBand_3:{histogramBase:0,title:"Upper Band #3"}},filledAreas:[{title:"Background #1",id:"Background_1",objAId:"UpperBand",objBId:"LowerBand",type:"plot_plot"}],area:[{name:"UpperBand",visible:!0},{name:"LowerBand",visible:!0}]};varo=i(50151),n=i(19979);constr={name:"Anchored VWAP",metainfo:s,constructor:class{constructor(){this._isNewSession=null,this._firstBarTime=0}init(e,t){this._firstBarTime=t(0),this._isNewSession=null}main(e,t,i){if(void0===i)return[NaN];(0,o.assert)(e.symbol.time===i.time);consts=i.time;if(s&&s<this._firstBarTime)return[NaN];constr=n.Std.volume(e),a=n.Std[t(8)](e),l=e.new_unlimited_var(),c=e.new_unlimited_var(),h=e.new_unlimited_var(),d=e.symbol.time;null!==d&&(null===this._isNewSession&&(this._isNewSession=n.Std.createNewSessionCheck(e)),this._isNewSession&&this._isNewSession(d)&&(this._resetHist(l),this._resetHist(c),this._resetHist(h))),l.set(n.Std.nz(l.get())+a*r),c.set(n.Std.nz(c.get())+r),h.set(n.Std.nz(h.get())+a*a*r);constu=l.get()/c.get(),_=h.get()/c.get()-Math.pow(u,2),p=Math.sqrt(Math.max(0,_)),m="Standard Deviation"===t(1)?p:.01*u,g=t(2),f=t(3),y=t(4),v=t(5),S=t(6),b=t(7);return[u,g?u+m*f:NaN,g?u-m*f:NaN,y?u+m*v:NaN,y?u-m*v:NaN,S?u+m*b:NaN,S?u-m*b:NaN]}_resetHist(e){e.reset_hist()}}}},95603:(e,t,i)=>{"use strict"
;i.d(t,{inactivityGapsStudyItem:()=>d});vars=i(47312),o=i(51101),n=i(51829),r=i(99955),a=i(37236),l=i(50151),c=i(19979);consth={historyCalculationMayChange:!0,_metainfoVersion:52,description:"Inactivity Gaps",id:"InactivityGaps@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,name:"InactivityGaps@tv-basicstudies",inputs:[{id:"display_session",name:"Gap Display Session",defval:"session",type:"text",display:0}],palettes:{},plots:[],defaults:{inputs:{display_session:"session"}},shortDescription:"Inactivity Gaps",format:{type:"inherit"},canExtendTimeScale:!0};constd={name:"InactivityGaps",metainfo:h,constructor:class{constructor(){this._lastRange=null,this._range={from:null,to:null}}init(e,t){consti=t(0);"string"!=typeofi&&c.Std.error(`Unexpected non-string value for ${h.inputs[0].name}`),this._displaySession=i,this._range={from:null,to:null},this._lastRange=null;constn=e.symbol.info;if(void0===n)return;constr="session"===this._displaySession?e.symbol.info?.session??"24x7":this._displaySession,a=s.SessionInfo.create(n.timezone,r,e.symbol.session.state().holidays,e.symbol.session.state().corrections);this._mainSeriesBarBuilder=(0,o.newBarBuilder)(e.symbol.period,e.symbol.session),this._extrapolationBarBuilder=(0,o.newBarBuilder)(e.symbol.period,a)}main(e,t){consti=e.symbol,s=c.Std.time(e);if("number"==typeofs&&isFinite(s)&&(null===this._range.from&&(this._range.from=s),this._range.to=s),i.isLastBar&&null!==(d=this._range)&&null!==d.from&&null!==d.to&&(o=this._range,h=this._lastRange,o?.from!==h?.from||o?.to!==h?.to)){this._lastRange={...this._range};constt=(0,r.extrapolateBarsFrontToTime)(this._extrapolationBarBuilder,this._range.from,this._range.to,1/0,!0).times;for(lets=0;s<t.length;s++)if(this._mainSeriesBarBuilder.moveTo(t[s]),i.isdwm()){consti=(0,a.get_cal_from_unix_timestamp_ms)((0,l.ensure)(e.symbol.timezone,"timezone"),t[s]);e.symbol.session.spec.includesDay(i)&&(t[s]=this._mainSeriesBarBuilder.startOfBar(0))}else{conste=this._mainSeriesBarBuilder.indexOfBar(t[s]);if(e!==n.SessionStage.PRE_SESSION&&e!==n.SessionStage.POST_SESSION){consti=this._mainSeriesBarBuilder.startOfBar(e);t[s]=i}}return{nonseries:!0,type:"study_gap",displaySession:this._displaySession,times:t}}varo,h,d;returnnull}}}},51052:(e,t,i)=>{"use strict";i.d(t,{overlayStudyItem:()=>n});vars=i(19979),o=i(37103);constn={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:"bool",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4},canExtendTimeScale:!0},constructor:class{constructor(){
this._extendTimeScaleFeatureEnabled=!1}init(e,t){this._context=e,this._extendTimeScaleFeatureEnabled=o.enabled("secondary_series_extend_time_scale"),this._context.new_sym(t(0),s.Std.period(this._context))}main(e,t){this._context=e;consti=!this._extendTimeScaleFeatureEnabled||!0!==t(1),o=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);constn=this._context.new_unlimited_var(this._context.symbol.time),r=this._context.new_unlimited_var(s.Std.open(this._context)),a=this._context.new_unlimited_var(s.Std.high(this._context)),l=this._context.new_unlimited_var(s.Std.low(this._context)),c=this._context.new_unlimited_var(s.Std.close(this._context));returni?(this._context.select_sym(0),[r.adopt(n,o,1),a.adopt(n,o,1),l.adopt(n,o,1),c.adopt(n,o,1)]):[r.get(0),a.get(0),l.get(0),c.get(0)]}}}},32503:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>p});vars,o,n=i(51101),r=i(50151),a=i(51829),l=i(46082),c=i(4622),h=i(19979);!function(e){e[e.TRADITIONAL=0]="TRADITIONAL",e[e.FIBONACCI=1]="FIBONACCI",e[e.WOODIE=2]="WOODIE",e[e.CLASSIC=3]="CLASSIC",e[e.DEMARK=4]="DEMARK",e[e.CAMARILLA=5]="CAMARILLA",e[e.FLOOR=6]="FLOOR"}(s||(s={})),function(e){e.AUTO="Auto",e.DAILY="Daily",e.WEEKLY="Weekly",e.MONTHLY="Monthly",e.YEARLY="Yearly"}(o||(o={}));classd{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}}classu{constructor(){this.pivots=[]}}function_(e,t){leti;switch(t){case"Auto":i=function(e){constt=l.Interval.parse(e.interval+e.resolution);switch(t.kind()){casel.ResolutionKind.Weeks:casel.ResolutionKind.Months:return"12M";casel.ResolutionKind.Days:return"1M";casel.ResolutionKind.Minutes:returnt.multiplier()>=1&&t.multiplier()<=15?"1D":"1W";casel.ResolutionKind.Seconds:casel.ResolutionKind.Ticks:return"1D"}thrownewError("Unexpected resolution type: "+e.resolution)}(e);break;case"Daily":i="1D";break;case"Weekly":i="1W";break;case"Monthly":i="1M";break;case"Yearly":i="12M";break;default:thrownewError("No such pivTimeFrame: "+t)}consts="D"===e.resolution&&"Daily"===t,o="W"===e.resolution&&("Daily"===t||"Weekly"===t),n="M"===e.resolution&&("Daily"===t||"Weekly"===t||"Monthly"===t);return(s||o||n||e.info&&(0,c.findSuitableResolutionToBuildFrom)(i,e.info).error)&&h.Std.error("You cannot see this pivot timeframe on this resolution"),i}constp={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0,symbol:""},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"},{defval:"",id:"symbol",name:"Other Symbol",type:"symbol",optional:!0}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._firstMainSeriesBarTime=NaN}init(e,t){this._isValidResolution=!1;consti=t(0),s=t(1),o=t(2),a=t(3);this._data=newu,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return0;case"Fibonacci":return1;case"Woodie":return2;case"Classic":return3;case"DeMark":return4;case"Camarilla":return5;case"Floor":return6;default:thrownewError("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=a,this._pivTimeFrame=o;constl=t(4);letc;c=""===l?e.new_sym(e.symbol.tickerid,_(e.symbol,this._pivTimeFrame)):e.new_sym(l,_(e.symbol,o)),this._isValidResolution=!0,(0,r.assert)(c.isdwm(),"a DWM resolution is required to use a multi-day bar builder"),this._barBuilder=(0,n.newBarBuilder)(c.period,e.symbol.session)}main(e,t,i){if(!this._isValidResolution)returnnull;if(e.is_main_symbol(i))returnisNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);consts=e.new_var(h.Std.open(e)),o=e.new_var(h.Std.high(e)),n=e.new_var(h.Std.low(e)),r=e.new_var(h.Std.close(e)),l=this._data,c=s.get(0),u=s.get(1),_=o.get(1),p=n.get(1),m=r.get(1),g=e.symbol.isLastBar;if(0===e.symbol.index||!e.symbol.isNewBar)returne.select_sym(0),null;this._barBuilder.moveTo(e.symbol.time);constf=function(e,t,i,s,o,n,r,a){constl=newd;letc=NaN;constu=i-s;switch(a){case0:c=(i+s+o)/3,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+(i-s),l.s2=c-(i-s),l.r3=2*c+(i-2*s),l.s3=2*c-(2*i-s),l.r4=3*c+(i-3*s),l.s4=3*c-(3*i-s),l.r5=4*c+(i-4*s),l.s5=4*c-(4*i-s);break;case1:c=(i+s+o)/3,l.p=c,l.r1=c+.382*u,l.s1=c-.382*u,l.r2=c+.618*u,l.s2=c-.618*u,l.r3=c+u,l.s3=c-u;break;case2:c=(i+s+2*e)/4,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+u,l.s2=c-u,l.r3=i+2*(c-s),l.s3=s-2*(i-c),l.r4=l.r3+u,l.s4=l.s3-u;break;case3:c=(i+s+o)/3,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+u,l.s2=c-u,l.r3=c+2*u,l.s3=c-2*u,l.r4=c+3*u,l.s4=c-3*u;break;case4:letn=NaN;n=h.Std.equal(t,o)?i+s+2*o:h.Std.greater(o,t)?2*i+s+o:2*s+i+o,c=n/4,l.p=c,l.r1=n/2-s,l.s1=n/2-i;break;case5:c=(i+s+o)/3,l.p=c,l.r1=o+1.1*u/12,l.s1=o-1.1*u/12,l.r2=o+1.1*u/6,l.s2=o-1.1*u/6,l.r3=o+1.1*u/4,l.s3=o-1.1*u/4,l.r4=o+1.1*u/2,l.s4=o-1.1*u/2;break;case6:c=(i+s+o)/3,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+(i-s),l.s2=c-(i-s),l.r3=c-l.s1+l.r2,l.s3=2*c-(2*i-s);break;default:thrownewError("Unknown kind")}returnl.startIndex__t=n,l.endIndex__t=r,l}(c,u,_,p,m,this._barBuilder.startOfBar(0),this._barBuilder.startOfBar(a.SessionStage.POST_SESSION),this._kindPP);returne.select_sym(0),this._showHistoricalPivots||(l.pivots=[]),l.pivots.push(f),l.pivots.length>this._historicalPivotsToKeep&&l.pivots.shift(),g?this._createResponse():null}_createResponse(){return0===this._data.pivots.length?null:{
nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){conste=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},52691:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});vars=i(70680);classoextendss.SpreadRatioBase{_doCalculation(e,t,i,s){returne*t/(i*s)}}constn={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:o}},57622:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});vars=i(19979);functiono(e,t,i){consto={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return0===e.length||(function(e,t){leti=0,s=0,o=0,n=0;for(lett=0;t<e.length;++t){constr=e[t],a=t+1;i+=a,s+=r,o+=a*a,n+=r*a}t.slope=(e.length*n-i*s)/(e.length*o-i*i),t.average=s/e.length,t.intercept=t.average-t.slope*i/e.length+t.slope}(e,o),function(e,t,i,o){letn=0,r=0,a=0,l=0,c=0,h=0,d=o.intercept;constu=e.length-1,_=o.intercept+o.slope*u/2;for(lets=0;s<=u;++s){letu=t[s]-d;u>n&&(n=u),u=d-i[s],u>r&&(r=u),u=e[s];constp=u-o.average,m=d-_;u-=d,a+=u*u,l+=p*p,c+=m*m,h+=p*m,d+=o.slope}o.stdDev=Math.sqrt(a/(0===u?1:u)),o.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),o.upDev=n,o.downDev=r}(e,t,i,o)),o}constn={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){consti=t(6),n=e.new_unlimited_var(s.Std.time(e)),r=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)returnnull;if(this._resultSent)returnnull
objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Positive fill",palette:"positivePalette",fillToIntersection:!0}]},24451:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});vars=i(70680);classoextendss.SpreadRatioBase{_doCalculation(e,t,i,s){returne*t-i*s}}constn={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:o}},60755:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>o});vars=i(19979);classo{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;consti=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)}}},96777:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>g});vars=i(50151),o=i(77914),n=i(46082),r=i(86811);classaextendsr.GraphicsObj{constructor(e,t,i,o,n,r){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(o,"rate"),this._firstBarTime=this._mixinJSONObject.createTimeField(n,"firstBarTime"),this._lastBarTime=this._mixinJSONObject.createTimeField(r,"lastBarTime")}isNaN(){returnsuper.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(){returnthis._priceLow.get()}priceHigh(){returnthis._priceHigh.get()}setPriceHigh(e){this._priceHigh.set(e)&&this._processObjUpdate()}rate(){returnthis._rate.get().slice()}setRate(e){this._rate.set(e)&&this._processObjUpdate()}rateAt(e){returnthis._rate.get()[e]}ratesSum(){lete=0;for(consttofthis._rate.get())!Number.isNaN(t)&&Number.isFinite(t)&&(e+=t);returne}firstBarTime(){returnthis._firstBarTime.get()}setFirstBarTime(e){this._firstBarTime.set(e)&&this._processObjUpdate()}lastBarTime(){returnthis._lastBarTime.get()}setLastBarTime(e){this._lastBarTime.set(e)&&this._processObjUpdate()}}varl,c,h=i(30376),d=i(19979);classu{constructor(e,t,i){this.index=e,this.offset=i,this.level=t}isNaN(){returnNumber.isNaN(this.level)}equals(e){returneinstanceofu&&(!this.isNaN()&&(!e.isNaN()&&(this.index===e.index&&this.offset===e.offset&&d.Std.equal(this.level,e.level))))}getLevel(){returnthis.level}getIndex(){returnthis.index}}class_extendsr.GraphicsObj{constructor(e,t){
consts=Math.abs(e-this._currentVAStart),r=Math.abs(e-this._currentVAEnd);s<r?(o=t,n=0):r<=s&&(o=i,n=1)}elseo=t,n=0;elseo=this._currentHists[this._currentVAEnd].ratesSum(),n=1}this._currentVAStart++,this._currentVAEnd--}_isVA(e){returne.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){lete=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()){consti=this._currentHistsGr.get(e);this._currentHistsGr.set(e,this._currentVAHistsGr.get(t)),this._currentVAHistsGr.set(t,i)}}for(;e<this._currentHistsGr.size();e++){constt=this._currentHistsGr.get(e);this._isVA(t)&&(this._currentHistsGr.remove(e),e--,this._currentVAHistsGr.add(t))}for(;t<this._currentVAHistsGr.size();t++){conste=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_(this)}_updateCurrentBox(){lete=this._minPrice,t=this._maxPrice;this._currentHists.length>0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());consti=[],o=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(newu(o,e)),i.push(newu(o,t)),i.push(newu(n,t)),i.push(newu(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(lete=0;e<this._currentHists.length;++e)this._currentHists[e].erase();this._currentHists=[],this._currentHistsGr.clear(),this._currentVAHistsGr.clear(),this._currentHistsMap.clear();for(lete=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,o,n){(0,s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");constr=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,c=e.isUp,h=(0,s.ensureNotNull)(this._rowsLayout);h.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,r,a);constu=h.rowWidth();if(!d.Std.greater(u,0))return;h.calculate()
;const_=h.getIndexLowVbP(),p=h.getIndexHighVbP(),m=h.getStartPrice();if(_===p){conste=_*u+m,t=(_+1)*u+m;this._updateResult({start:e,end:t},n*l,c,i,o)}else{lete=0;for(lett=_;t<=p;t++){consts=t*u+m,h=(t+1)*u+m,d=this._rowCoeff(s,h,r,a),_=d*l;e+=d,this._updateResult({start:s,end:h},n*_,c,i,o)}(0,s.assert)(d.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,o,n){constr=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)");constl=(0,s.ensureNotNull)(this._leftBoxTime),c=(0,s.ensureNotNull)(this._actualRightBoxTime);leth=n.get(e);if(void0===h)h=newa(this,e.start,e.end,r,l,c),n.set(e,h),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(h),g._addInOrder(h,o,0,o.length,((e,t)=>{leti=d.Std.compare(e.firstBarTime(),t.firstBarTime());return0!==i?i:(i=d.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:d.Std.compare(e.priceHigh(),t.priceHigh()))}));else{conste=[];for(lett=0;t<r.length;t++)e[t]=h.rateAt(t)+r[t];h.setRate(e)}}_rebuildOutData(){conste=this._currentHistsMap.size(),t=this._currentHists.length,i=this._currentHistsGr.size(),o=this._currentVAHistsGr.size();(0,s.assert)(e===t&&t===i+o,`Collections of HHistItems are out of sync ${e}${t}${i}${o}`),this._outPocLines.clear(),this._outPocLines.addAll(this._freezedPocs),d.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;constt=(0,s.ensureNotNull)(this._rowsLayout);0===t.type()?d.Std.error('Histogram is too large, please reduce "Row Size" input.'):((0,s.assert)(1===t.type(),`Unexpected rowsLayout type ${t.type()}`),d.Std.error('Histogram is too large, please increase "Row Size" input.'))}_createRates(e,t){if(1===this._numOfSubHists)return[t];if(2===this._numOfSubHists){consti=[0,0];returni[e?0:1]=t,i}return(0,s.assert)(!1,`Incorrect value of numOfSubHists = ${this._numOfSubHists}`),[]}_updateLastBarTimeInHistogram(e){constt=(0,s.ensureNotNull)(this._actualRightBoxTime);for(constiofe)i.setLastBarTime(t)}_rowCoeff(e,t,i,s){consto=s-i;return(t-e-Math.max(t-s,0)-Math.max(0,i-e))/o}static_addInOrder(e,t,i,s,n){if(i===s)returnvoidt.splice(i,0,e);constr=(0,o.toInt)((i+s)/2),a=t[r];n(e,a)<0?g._addInOrder(e,t,i,r,n):n(e,a)>0?g._addInOrder(e,t,r+1,s,n):t.splice(r,0,e)}}},13823:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>p,maxHHistItems:()=>u,numOfSubHists:()=>_});vars,o=i(37103),n=i(46082);!function(e){e[e.NumberOfRows=0]="NumberOfRows",e[e.TicksPerRow=1]="TicksPerRow"}(s||(s={}));classr{
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,o){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=o}getStartPrice(){returnthis._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){returnthis._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){returnthis._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){returnthis._type}}classaextendsr{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);conste=this.rowWidth();lett=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(){returnMath.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}classlextendsr{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);conste=this.rowWidth();lett=Math.floor(this._low/e);consti=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){returnthis._minTick*this._rowSize}}varc,h=i(19979),d=i(47132);functionu(){return6e3}function_(e){switch(e){case"Delta":case"Up/Down":return2;case"Total":return1;default:h.Std.error(`Invalid study argument value: ${e}`)}}!function(e){e.VolumeUpDown="Up/Down",e.VolumeTotal="Total",e.VolumeDelta="Delta",e.NumberOfRows="Number Of Rows",e.TicksPerRow="Ticks Per Row"}(c||(c={}));classp{findBasicResolutionForFromTo(e,t,i,s){constr=(0,d.getVolumeProfileResolutionForPeriod)(e.value(),t,i,s),a=n.Interval.parse(r);returno.enabled("charting_library_debug_mode")&&console.log(`${(newDate).toISOString()} Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&h.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?newa(t):newl(t)}}},74109:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});vars=i(50151),o=i(13823),n=i(4359),r=i(99481),a=i(46082),l=i(3186),c=i(45591),h=i(75719),d=i(30376),u=i(13421),_=i(60755),p=i(18330),m=i(96777);classgextendsm.VolumeByPriceExpr{constructor(e,t,i,s,o,n,r,a,l,c,h,d,u){super(e,t,i,n,r,a,!1,l,c,(()=>h),d,s,o,!1,u),this._firstBarTime=s,this._lastBarTime=o}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){constt=this._timeScale().get(e);returnthis._firstBarTime<=t&&t<this._lastBarTime}}varf=i(28056),y=i(19979);classvextendso.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._studyDataUpdate.setEraseCmds(this.popEraseCmds()),this._studyDataUpdate.update();conste=this._studyDataUpdate.getUpdate();e.json&&o.data.push({nonseries:!0,type:"study_graphics",data:e.json}),e.jsonUpdate&&o.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);constt=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(t&&t>=this._firstBarTime){conste=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}elseo.data.push([NaN,NaN,NaN])}returno}time(){returnthis._timeSeries}open(){returnthis._openSeries}high(){returnthis._highSeries}low(){returnthis._lowSeries}close(){returnthis._closeSeries}volume(){returnthis._volumeSeries}developingPoc(){returnthis._developingPocSeries}developingVAHigh(){returnthis._developingVAHighSeries}developingVALow(){returnthis._developingVALowSeries}}functionS(e){return{constructor:v,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["",""],direction:r.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:r.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"",visible:!0}},horizlines:{pocLines:{color:"",style:p.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"",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:"",linestyle:p.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"",linestyle:p.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"",linestyle:p.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:r.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:r.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}}}constb=S({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=S({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},28056:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});vars=i(50151),o=i(12217);classn{constructor(){this._histPos=-1,this._hist=newFloat64Array(2e3),this._times=newFloat64Array(2e3)}addHist(e){if(this._histPos>=0){constt=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}elsethis._histPos+=1;if(this._histPos===this._hist.length){conste=newFloat64Array(2*this._hist.length);e.set(this._hist),this._hist=e;constt=newFloat64Array(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);constt=this._histPos-e;returnthis._hist[t]}getLeftOrEqual(e){constt=(0,o.upperbound)(this._times,e,((e,t)=>e<t),0,this._histPos+1);return0===t?NaN:this._hist[t-1]}set(e){this._hist[this._histPos]=e}indexOf(e){thrownewError("Not implemented")}adopt(e,t,i){thrownewError("Method not implemented.")}}},53690:(e,t,i)=>{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>y});vars=i(50151),o=i(13823),n=i(99481),r=i(46082),a=i(3186),l=i(96777),c=i(30376);classhextendsl.VolumeByPriceExpr{constructor(e,t,i,s,o,n,r,a,l,h,d){super(e,t,i,n,newc.GraphicsList,r,!0,a,l,(()=>h),d,s,o,!1),this._firstBarTime=s,this._lastBarTime=o}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){constt=this._timeScale().get(e);returnthis._firstBarTime<=t&&t<this._lastBarTime}}vard=i(45591),u=i(75719),_=i(13421),p=i(60755),m=i(28056),g=i(19979);classfextendso.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(newu.EraseObj(e,t))}popEraseCmds(){conste=this._eraseCmds;returnthis._eraseCmds=[],e}init(e,t){this._studyDataUpdate=new_.JStudyDataUpdate(!0),this._hists=newa.GraphicsListColl,this._pocLines=newc.GraphicsList,this._valueAreaHists=newa.GraphicsListColl;consti=newd.StudyGraphicsData;i.getObjsContainer("hhists").push(newd.Container("histBars2",this._hists)),
conste=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}elseo.data.push([NaN,NaN,NaN])}returno}time(){returnthis._timeSeries}open(){returnthis._openSeries}high(){returnthis._highSeries}low(){returnthis._lowSeries}close(){returnthis._closeSeries}volume(){returnthis._volumeSeries}developingPoc(){returnthis._developingPocSeries}developingVAHigh(){returnthis._developingVAHighSeries}developingVALow(){returnthis._developingVALowSeries}}consty={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,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:["",""],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"",visible:!0},histBarsVA:{colors:["",""],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"",visible:!0}},horizlines:{pocLines:{color:"",style:0,visible:!0,width:2},vahLines:{color:"",style:0,visible:!1,width:2},valLines:{color:"",style:0,visible:!1,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:"",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"",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"}}}}},4659:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});classsextendsError{constructor(e,t){super(e),this.studyError=!0,this.title=t}}},
this._extendTimeScaleFeatureEnabled=!1}init(e,t){this._context=e,this._extendTimeScaleFeatureEnabled=o.enabled("secondary_series_extend_time_scale"),this._context.new_sym(t(0),s.Std.period(this._context))}main(e,t){this._context=e;consti=!this._extendTimeScaleFeatureEnabled||!0!==t(1),o=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);constn=this._context.new_unlimited_var(this._context.symbol.time),r=this._context.new_unlimited_var(s.Std.open(this._context)),a=this._context.new_unlimited_var(s.Std.high(this._context)),l=this._context.new_unlimited_var(s.Std.low(this._context)),c=this._context.new_unlimited_var(s.Std.close(this._context));if(i){this._context.select_sym(0);constt=n.adopt(n,o,1);if(s.Std.na(t))return[NaN,NaN,NaN,NaN];consti=n.indexOf(t),h=-1===i?NaN:r.get(i),d=-1===i?NaN:a.get(i),u=-1===i?NaN:l.get(i),_=-1===i?NaN:c.get(i);returnn.symbol.isBarUpdate&&t!==e.symbol.time?[{timeMs:t,value:NaN,offset:NaN},h,d,u,_]:[h,d,u,_]}return[r.get(0),a.get(0),l.get(0),c.get(0)]}}}},32503:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>p});vars,o,n=i(51101),r=i(50151),a=i(51829),l=i(46082),c=i(4622),h=i(19979);!function(e){e[e.TRADITIONAL=0]="TRADITIONAL",e[e.FIBONACCI=1]="FIBONACCI",e[e.WOODIE=2]="WOODIE",e[e.CLASSIC=3]="CLASSIC",e[e.DEMARK=4]="DEMARK",e[e.CAMARILLA=5]="CAMARILLA",e[e.FLOOR=6]="FLOOR"}(s||(s={})),function(e){e.AUTO="Auto",e.DAILY="Daily",e.WEEKLY="Weekly",e.MONTHLY="Monthly",e.YEARLY="Yearly"}(o||(o={}));classd{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}}classu{constructor(){this.pivots=[]}}function_(e,t){leti;switch(t){case"Auto":i=function(e){constt=l.Interval.parse(e.interval+e.resolution);switch(t.kind()){casel.ResolutionKind.Weeks:casel.ResolutionKind.Months:return"12M";casel.ResolutionKind.Days:return"1M";casel.ResolutionKind.Minutes:returnt.multiplier()>=1&&t.multiplier()<=15?"1D":"1W";casel.ResolutionKind.Seconds:casel.ResolutionKind.Ticks:return"1D"}thrownewError("Unexpected resolution type: "+e.resolution)}(e);break;case"Daily":i="1D";break;case"Weekly":i="1W";break;case"Monthly":i="1M";break;case"Yearly":i="12M";break;default:thrownewError("No such pivTimeFrame: "+t)}consts="D"===e.resolution&&"Daily"===t,o="W"===e.resolution&&("Daily"===t||"Weekly"===t),n="M"===e.resolution&&("Daily"===t||"Weekly"===t||"Monthly"===t);return(s||o||n||e.info&&(0,c.findSuitableResolutionToBuildFrom)(i,e.info).error)&&h.Std.error("You cannot see this pivot timeframe on this resolution"),i}constp={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0,symbol:""},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"},{defval:"",id:"symbol",name:"Other Symbol",type:"symbol",optional:!0}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._firstMainSeriesBarTime=NaN}init(e,t){this._isValidResolution=!1;consti=t(0),s=t(1),o=t(2),a=t(3);this._data=newu,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return0;case"Fibonacci":return1;case"Woodie":return2;case"Classic":return3;case"DeMark":return4;case"Camarilla":return5;case"Floor":return6;default:thrownewError("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=a,this._pivTimeFrame=o;constl=t(4);letc;c=""===l?e.new_sym(e.symbol.tickerid,_(e.symbol,this._pivTimeFrame)):e.new_sym(l,_(e.symbol,o)),this._isValidResolution=!0,(0,r.assert)(c.isdwm(),"a DWM resolution is required to use a multi-day bar builder"),this._barBuilder=(0,n.newBarBuilder)(c.period,e.symbol.session)}main(e,t,i){if(!this._isValidResolution)returnnull;if(e.is_main_symbol(i))returnisNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);consts=e.new_var(h.Std.open(e)),o=e.new_var(h.Std.high(e)),n=e.new_var(h.Std.low(e)),r=e.new_var(h.Std.close(e)),l=this._data,c=s.get(0),u=s.get(1),_=o.get(1),p=n.get(1),m=r.get(1),g=e.symbol.isLastBar;if(0===e.symbol.index||!e.symbol.isNewBar)returne.select_sym(0),null;this._barBuilder.moveTo(e.symbol.time);constf=function(e,t,i,s,o,n,r,a){constl=newd;letc=NaN;constu=i-s;switch(a){case0:c=(i+s+o)/3,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+(i-s),l.s2=c-(i-s),l.r3=2*c+(i-2*s),l.s3=2*c-(2*i-s),l.r4=3*c+(i-3*s),l.s4=3*c-(3*i-s),l.r5=4*c+(i-4*s),l.s5=4*c-(4*i-s);break;case1:c=(i+s+o)/3,l.p=c,l.r1=c+.382*u,l.s1=c-.382*u,l.r2=c+.618*u,l.s2=c-.618*u,l.r3=c+u,l.s3=c-u;break;case2:c=(i+s+2*e)/4,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+u,l.s2=c-u,l.r3=i+2*(c-s),l.s3=s-2*(i-c),l.r4=l.r3+u,l.s4=l.s3-u;break;case3:c=(i+s+o)/3,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+u,l.s2=c-u,l.r3=c+2*u,l.s3=c-2*u,l.r4=c+3*u,l.s4=c-3*u;break;case4:letn=NaN;n=h.Std.equal(t,o)?i+s+2*o:h.Std.greater(o,t)?2*i+s+o:2*s+i+o,c=n/4,l.p=c,l.r1=n/2-s,l.s1=n/2-i;break;case5:c=(i+s+o)/3,l.p=c,l.r1=o+1.1*u/12,l.s1=o-1.1*u/12,l.r2=o+1.1*u/6,l.s2=o-1.1*u/6,l.r3=o+1.1*u/4,l.s3=o-1.1*u/4,l.r4=o+1.1*u/2,l.s4=o-1.1*u/2;break;case6:c=(i+s+o)/3,l.p=c,l.r1=2*c-s,l.s1=2*c-i,l.r2=c+(i-s),l.s2=c-(i-s),l.r3=c-l.s1+l.r2,l.s3=2*c-(2*i-s);break;default:thrownewError("Unknown kind")}returnl.startIndex__t=n,l.endIndex__t=r,l}(c,u,_,p,m,this._barBuilder.startOfBar(0),this._barBuilder.startOfBar(a.SessionStage.POST_SESSION),this._kindPP);returne.select_sym(0),
this._showHistoricalPivots||(l.pivots=[]),l.pivots.push(f),l.pivots.length>this._historicalPivotsToKeep&&l.pivots.shift(),g?this._createResponse():null}_createResponse(){return0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){conste=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},52691:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});vars=i(70680);classoextendss.SpreadRatioBase{_doCalculation(e,t,i,s){returne*t/(i*s)}}constn={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:o}},57622:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});vars=i(19979);functiono(e,t,i){consto={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return0===e.length||(function(e,t){leti=0,s=0,o=0,n=0;for(lett=0;t<e.length;++t){constr=e[t],a=t+1;i+=a,s+=r,o+=a*a,n+=r*a}t.slope=(e.length*n-i*s)/(e.length*o-i*i),t.average=s/e.length,t.intercept=t.average-t.slope*i/e.length+t.slope}(e,o),function(e,t,i,o){letn=0,r=0,a=0,l=0,c=0,h=0,d=o.intercept;constu=e.length-1,_=o.intercept+o.slope*u/2;for(lets=0;s<=u;++s){letu=t[s]-d;u>n&&(n=u),u=d-i[s],u>r&&(r=u),u=e[s];constp=u-o.average,m=d-_;u-=d,a+=u*u,l+=p*p,c+=m*m,h+=p*m,d+=o.slope}o.stdDev=Math.sqrt(a/(0===u?1:u)),o.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),o.upDev=n,o.downDev=r}(e,t,i,o)),o}constn={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){
positivePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]}},p=[{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}]},24451:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});vars=i(70680);classoextendss.SpreadRatioBase{_doCalculation(e,t,i,s){returne*t-i*s}}constn={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:o}},60755:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>o});vars=i(19979);classo{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;consti=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)}}},96777:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>g});vars=i(50151),o=i(77914),n=i(46082),r=i(86811);classaextendsr.GraphicsObj{constructor(e,t,i,o,n,r){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(o,"rate"),this._firstBarTime=this._mixinJSONObject.createTimeField(n,"firstBarTime"),this._lastBarTime=this._mixinJSONObject.createTimeField(r,"lastBarTime")}isNaN(){returnsuper.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(){returnthis._priceLow.get()}priceHigh(){returnthis._priceHigh.get()}setPriceHigh(e){this._priceHigh.set(e)&&this._processObjUpdate()}rate(){returnthis._rate.get().slice()}setRate(e){this._rate.set(e)&&this._processObjUpdate()}rateAt(e){returnthis._rate.get()[e]}ratesSum(){lete=0;for(consttofthis._rate.get())!Number.isNaN(t)&&Number.isFinite(t)&&(e+=t);returne}firstBarTime(){returnthis._firstBarTime.get()}setFirstBarTime(e){this._firstBarTime.set(e)&&this._processObjUpdate()}lastBarTime(){returnthis._lastBarTime.get()}setLastBarTime(e){this._lastBarTime.set(e)&&this._processObjUpdate()}}varl,c,h=i(30376),d=i(19979);classu{constructor(e,t,i){this.index=e,this.offset=i,this.level=t}isNaN(){returnNumber.isNaN(this.level)}equals(e){
s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");constr=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,c=e.isUp,h=(0,s.ensureNotNull)(this._rowsLayout);h.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,r,a);constu=h.rowWidth();if(!d.Std.greater(u,0))return;h.calculate();const_=h.getIndexLowVbP(),p=h.getIndexHighVbP(),m=h.getStartPrice();if(_===p){conste=_*u+m,t=(_+1)*u+m;this._updateResult({start:e,end:t},n*l,c,i,o)}else{lete=0;for(lett=_;t<=p;t++){consts=t*u+m,h=(t+1)*u+m,d=this._rowCoeff(s,h,r,a),_=d*l;e+=d,this._updateResult({start:s,end:h},n*_,c,i,o)}(0,s.assert)(d.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,o,n){constr=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)");constl=(0,s.ensureNotNull)(this._leftBoxTime),c=(0,s.ensureNotNull)(this._actualRightBoxTime);leth=n.get(e);if(void0===h)h=newa(this,e.start,e.end,r,l,c),n.set(e,h),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(h),g._addInOrder(h,o,0,o.length,((e,t)=>{leti=d.Std.compare(e.firstBarTime(),t.firstBarTime());return0!==i?i:(i=d.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:d.Std.compare(e.priceHigh(),t.priceHigh()))}));else{conste=[];for(lett=0;t<r.length;t++)e[t]=h.rateAt(t)+r[t];h.setRate(e)}}_rebuildOutData(){conste=this._currentHistsMap.size(),t=this._currentHists.length,i=this._currentHistsGr.size(),o=this._currentVAHistsGr.size();(0,s.assert)(e===t&&t===i+o,`Collections of HHistItems are out of sync ${e}${t}${i}${o}`),this._outPocLines.clear(),this._outPocLines.addAll(this._freezedPocs),d.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;constt=(0,s.ensureNotNull)(this._rowsLayout);0===t.type()?d.Std.error('Histogram is too large, please reduce "Row Size" input.'):((0,s.assert)(1===t.type(),`Unexpected rowsLayout type ${t.type()}`),d.Std.error('Histogram is too large, please increase "Row Size" input.'))}_createRates(e,t){if(1===this._numOfSubHists)return[t];if(2===this._numOfSubHists){consti=[0,0];returni[e?0:1]=t,i}return(0,s.assert)(!1,`Incorrect value of numOfSubHists = ${this._numOfSubHists}`),[]}_updateLastBarTimeInHistogram(e){constt=(0,s.ensureNotNull)(this._actualRightBoxTime);for(constiofe)i.setLastBarTime(t)}_rowCoeff(e,t,i,s){consto=s-i;return(t-e-Math.max(t-s,0)-Math.max(0,i-e))/o}static_addInOrder(e,t,i,s,n){if(i===s)returnvoidt.splice(i,0,e);constr=(0,o.toInt)((i+s)/2),a=t[r]
;n(e,a)<0?g._addInOrder(e,t,i,r,n):n(e,a)>0?g._addInOrder(e,t,r+1,s,n):t.splice(r,0,e)}}},13823:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>p,maxHHistItems:()=>u,numOfSubHists:()=>_});vars,o=i(37103),n=i(46082);!function(e){e[e.NumberOfRows=0]="NumberOfRows",e[e.TicksPerRow=1]="TicksPerRow"}(s||(s={}));classr{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,o){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=o}getStartPrice(){returnthis._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){returnthis._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){returnthis._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){returnthis._type}}classaextendsr{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);conste=this.rowWidth();lett=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(){returnMath.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}classlextendsr{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);conste=this.rowWidth();lett=Math.floor(this._low/e);consti=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){returnthis._minTick*this._rowSize}}varc,h=i(19979),d=i(47132);functionu(){return6e3}function_(e){switch(e){case"Delta":case"Up/Down":return2;case"Total":return1;default:h.Std.error(`Invalid study argument value: ${e}`)}}!function(e){e.VolumeUpDown="Up/Down",e.VolumeTotal="Total",e.VolumeDelta="Delta",e.NumberOfRows="Number Of Rows",e.TicksPerRow="Ticks Per Row"}(c||(c={}));classp{findBasicResolutionForFromTo(e,t,i,s){constr=(0,d.getVolumeProfileResolutionForPeriod)(e.value(),t,i,s),a=n.Interval.parse(r);returno.enabled("charting_library_debug_mode")&&console.log(`${(newDate).toISOString()} Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&h.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?newa(t):newl(t)}}},74109:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});vars=i(50151),o=i(13823),n=i(4359),r=i(99481),a=i(46082),l=i(3186),c=i(45591),h=i(75719),d=i(30376),u=i(13421),_=i(60755),p=i(18330),m=i(96777);classgextendsm.VolumeByPriceExpr{constructor(e,t,i,s,o,n,r,a,l,c,h,d,u){super(e,t,i,n,r,a,!1,l,c,(()=>h),d,s,o,!1,u),this._firstBarTime=s,this._lastBarTime=o}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){constt=this._timeScale().get(e);returnthis._firstBarTime<=t&&t<this._lastBarTime}}varf=i(28056),y=i(19979)
;classvextendso.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(newh.EraseObj(e,t))}popEraseCmds(){conste=this._eraseCmds;returnthis._eraseCmds=[],e}init(e,t){this._studyDataUpdate=newu.JStudyDataUpdate(!0),this._hists=newl.GraphicsListColl,this._boxPolygons=newd.GraphicsList,this._pocLines=newd.GraphicsList,this._valueAreaHists=newl.GraphicsListColl;consti=newc.StudyGraphicsData;i.getObjsContainer("hhists").push(newc.Container("histBars2",this._hists)),i.getObjsContainer("hhists").push(newc.Container("histBarsVA",this._valueAreaHists)),i.getObjsContainer("horizlines").push(newc.Container("pocLines",this._pocLines)),i.getObjsContainer("polygons").push(newc.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);constn=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());constr=this._getRowsLayout(this._rowsLayout,this._rowSize);this._vbPCheckHaveVolumeExpr=new_.VbPCheckHaveVolumeExpr(this),this._volumeByPriceExpr=newg((0,o.numOfSubHists)(this._volume),e,this,this._firstBarTime,n,this._hists,this._boxPolygons,this._pocLines,this._valueAreaHists,this._vaVolumePercent,r,(0,o.maxHHistItems)(),this._lastBarTime),this._volumeByPriceExpr.setIdsGeneratorProxy(this),this._developingPocSeries=newf.VolumeProfileOutputSeries,this._developingVAHighSeries=newf.VolumeProfileOutputSeries,this._developingVALowSeries=newf.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();consto={type:"composite",data:[]};if(i&&i.period===this._basicResolution.value()&&(this._timeSeries.set(y.Std.time(e)),this._openSeries.set(y.Std.open(e)),this._highSeries.set(y.Std.high(e)),this._lowSeries.set(y.Std.low(e)),this._closeSeries.set(y.Std.close(e)),this._volumeSeries.set(y.Std.volume(e)),this._developingPocSeries.addHist(y.Std.time(e)),this._developingVAHighSeries.addHist(y.Std.time(e)),
this._developingVALowSeries.addHist(y.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();conste=this._studyDataUpdate.getUpdate();e.json&&o.data.push({nonseries:!0,type:"study_graphics",data:e.json}),e.jsonUpdate&&o.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);constt=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(t&&t>=this._firstBarTime){conste=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}elseo.data.push([NaN,NaN,NaN])}returno}time(){returnthis._timeSeries}open(){returnthis._openSeries}high(){returnthis._highSeries}low(){returnthis._lowSeries}close(){returnthis._closeSeries}volume(){returnthis._volumeSeries}developingPoc(){returnthis._developingPocSeries}developingVAHigh(){returnthis._developingVAHighSeries}developingVALow(){returnthis._developingVALowSeries}}functionS(e){return{constructor:v,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["",""],direction:r.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:r.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"",visible:!0}},horizlines:{pocLines:{color:"",style:p.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"",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:"",linestyle:p.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"",linestyle:p.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"",linestyle:p.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:r.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:r.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}}}constb=S({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=S({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},28056:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});vars=i(50151),o=i(12217);classn{constructor(){this._histPos=-1,this._hist=newFloat64Array(2e3),this._times=newFloat64Array(2e3)}addHist(e){if(this._histPos>=0){constt=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}elsethis._histPos+=1;if(this._histPos===this._hist.length){conste=newFloat64Array(2*this._hist.length);e.set(this._hist),this._hist=e;constt=newFloat64Array(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);constt=this._histPos-e;returnthis._hist[t]}getLeftOrEqual(e){constt=(0,o.upperbound)(this._times,e,((e,t)=>e<t),0,this._histPos+1);return0===t?NaN:this._hist[t-1]}set(e){this._hist[this._histPos]=e}indexOf(e){thrownewError("Not implemented")}adopt(e,t,i){thrownewError("Method not implemented.")}}},53690:(e,t,i)=>{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>y});vars=i(50151),o=i(13823),n=i(99481),r=i(46082),a=i(3186),l=i(96777),c=i(30376);classhextendsl.VolumeByPriceExpr{constructor(e,t,i,s,o,n,r,a,l,h,d){super(e,t,i,n,newc.GraphicsList,r,!0,a,l,(()=>h),d,s,o,!1),this._firstBarTime=s,this._lastBarTime=o}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){constt=this._timeScale().get(e);returnthis._firstBarTime<=t&&t<this._lastBarTime}}vard=i(45591),u=i(75719),_=i(13421),p=i(60755),m=i(28056),g=i(19979);classfextendso.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(newu.EraseObj(e,t))}popEraseCmds(){conste=this._eraseCmds;returnthis._eraseCmds=[],e}init(e,t){
data:e.jsonUpdate})}if(this._hasSecondarySymbol&&e.select_sym(0),i&&i.period===this._originalResolution.value()){(0,s.assert)(e.symbol.time===i.time);constt=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(t&&t>=this._firstBarTime){conste=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}elseo.data.push([NaN,NaN,NaN])}returno}time(){returnthis._timeSeries}open(){returnthis._openSeries}high(){returnthis._highSeries}low(){returnthis._lowSeries}close(){returnthis._closeSeries}volume(){returnthis._volumeSeries}developingPoc(){returnthis._developingPocSeries}developingVAHigh(){returnthis._developingVAHighSeries}developingVALow(){returnthis._developingVALowSeries}}consty={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,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:["",""],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"",visible:!0},histBarsVA:{colors:["",""],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"",visible:!0}},horizlines:{pocLines:{color:"",style:0,visible:!0,width:2},vahLines:{color:"",style:0,visible:!1,width:2},valLines:{color:"",style:0,visible:!1,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:"",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"",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"}}}}},4659:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});classsextendsError{constructor(e,t){super(e),this.studyError=!0,this.title=t}}},75719:(e,t,i)=>{"use strict";vars;i.d(t,{EraseAll:()=>n,EraseObj:()=>o,GraphicsCmds:()=>r}),function(e){e.One="one",e.All="all"}(s||(s={}));classo{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}classn{primitiveData(){return{action:"all"}}}classr{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())returnnull;constt={},i=this.create&&this.create.primitiveData(e);returnnull!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void0===t.create&&void0===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(){returnthis._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){thrownewError("Unsupported")}}},3186:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});classs{constructor(){this._stable=[],this._variable=null,this._owner=null}addStable(e){e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){constt=[];returnthis._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){returnthis._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(consttofthis._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(consttofthis._stable)if(!e(t))return!1;returnnull===this._variable||e(this._variable)}}},30376:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});vars=i(86811),o=i(31645);classn{constructor(){this._items=[],this._owner=null}primitivesData(e){constt=[];for(constiofthis._items)e.isIgnoredObj(i)||t.push(i.primitiveData());returnt}get(e){returnthis._items[e]}set(e,t){returnthis.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);consti=!0;returnthis._setCachedDataValid(!1),i}addAll(e){this.setOwner(e),this._items.push(...e._items);constt=!0;returnthis._setCachedDataValid(!1),t}remove(e){constt=this._items[e];returnthis._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){returnthis._items}size(){returnthis._items.length}add(e){e.setOwner(this),this._items.push(e);constt=!0;returnthis._setCachedDataValid(!1),t}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(consteofthis._items)e.markAsPosted()}isNaN(){
;vari=o.hl2(this._context),s=this._context.new_var(i),n=o.sma(s,5,this._context),r=this._context.new_var(i),a=o.sma(r,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=o.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),_=o.change(u);return[d,this.f_1(_)]}}},{name:"Balance of Power",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:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){returnthis._context=e,this._input=t,[this.f_0(o.close(this._context),o.open(this._context),o.high(this._context),o.low(this._context))]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:53,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:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1},inputs:{in_0:20,in_1:2,symbol:"",offset:0,maType:"SMA"}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"maType",name:"MA Type",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["maType"]}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){returne*t},this.f_1=function(e,t){returne+t},this.f_2=function(e,t){returne-t},this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;vari=this._context.new_var(o.time(this._context)),s=o.close(this._context),n=this._input(0),r=this._input(1),a=this._input(2),l=this._input(3),c=this._input(4)
;for(s=0;s<i;s++)n+=(o=e.get(s)-t)*o;returnn/(i-1)},this.standardHistVol=function(){vare=this._context.new_var(o.close(this._context)),t=this._context.new_var(o.log(e.get()/e.get(1)));return100*this.stdev(t,this.period,this._context)*o.sqrt(this.daysPerYear)},this.main=function(e,t){returnthis._context=e,this._input=t,[this.standardHistVol()]}}},{name:"Volatility Zero Trend Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Zero Trend Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Zero Trend Close-to-Close",description:"Volatility Zero Trend Close-to-Close",shortDescription:"Volatility Zero Trend Close-to-Close",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:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",min:0,max:1e4},{id:"daysPerYear",name:"Days Per Year",type:"integer"}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.volatliityZTCTC=function(){this._context.setMinimumAdditionalDepth(this._input(0)+1);for(vare=this._context.new_var(o.close(this._context)),t=this._context.new_var(e.symbol.time),i=Math.sqrt((t.get(0)-t.get(1))/864e5/this.daysPerYear),s=Math.log(o.close(this._context)/e.get(1)),n=this._context.new_var(s/i),r=this._context.new_var(Math.pow(n,2)),a=0,l=0;l<this.period;l++)a+=r.get(l);return100*Math.sqrt(a/this.period)},this.main=function(e,t){returnthis._context=e,this._input=t,[this.volatliityZTCTC()]}}},{name:"Volatility O-H-L-C",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility O-H-L-C@tv-basicstudies-1",scriptIdPart:"",name:"Volatility O-H-L-C",description:"Volatility O-H-L-C",shortDescription:"Volatility O-H-L-C",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:10,marketClosedPercentage:0,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"marketClosedPercentage",type:"float",name:"Market Closed Percentage",min:0,max:.999},{id:"daysPerYear",type:"integer",name:"Days Per Year"}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.marketClosedPercentage=this._input(1),this.daysPerYear=this._input(2),this.secondsPerYear=86400*this.daysPerYear},this.square=function(e){returne*e},this.volatilityOHLC=function(){
o.na(r.get(0))?(!e.symbol.isLastBar||e.symbol.isNewBar&&!Number.isNaN(e.symbol.projectionTime)||o.error("To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.","VWAP is waiting for more data"),[NaN]):[s.get(0)/n.get(0)]}}},{name:"VWMA",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:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;vari=o.close(this._context),s=this._input(0),n=this._context.new_var(i);return[o.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",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",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator",format:{precision:2,type:"percent"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;vari=this._input(0),s=this._input(1),n=o.volume(this._context),r=this._context.new_var(n),a=o.ema(r,i,this._context),l=this._context.new_var(n),c=o.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",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"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){
name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer",hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",
hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;vari=this._context.new_var(o.close(this._context)),s=this._input(0),n=this._input(1),r=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=o.ema(i,s,this._context),d=o.ema(i,n,this._context),u=o.ema(i,r,this._context),_=o.ema(i,a,this._context),p=o.ema(i,l,this._context),m=o.ema(i,c,this._context),g=this._input(6),f=this._input(7),y=this._input(8),v=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,_,p,m,o.ema(i,g,this._context),o.ema(i,f,this._context),o.ema(i,y,this._context),o.ema(i,v,this._context),o.ema(i,S,this._context),o.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,
this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==o.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||o.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==o.period(this._context)&&this._context.select_sym(1);consti=this._input(0),s=this._input(1),n=o.time(this._context),r=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(o[i](this._context)),l=this._context.new_unlimited_var(o[s](this._context));if(r.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)returnnull;constc=o.add_years_considering_dst(this._context.symbol.info.timezone,newDate(n),-1),h=r.indexOf(c.getTime()),d=-1===h?NaN:o.highest(a,h,this._context),u=-1===h?NaN:o.lowest(l,h,this._context);if(isNaN(d)||isNaN(u))return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{erase:[{action:"all"}]}}};return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:d,extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:u,extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},30342:(e,t,i)=>{"use strict";vars;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},81593:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});consts=i(34840)},48480:()=>{"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{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},32544:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>r,getQuoteSessionInstance:()=>n});vars=i(13607);consto={};functionn(e="full"){returno[e]||function(e="full",t){o[e]=t}(e,news(e)),o[e]}functionr(){for(consteino)if(o.hasOwnProperty(e)){constt=o[e];void0!==t&&t.destroy(),deleteo[e]}}},13607:(e,t,i)=>{"use strict";e=i.nmd(e);vars=i(20057).default,o=i(90484).default,n=i(67563).PriceFormatter;const{uniq:r}=i(53470);vara=i(4168);const{normalizeUpdateMode:l}=i(52706);varc=i(39527).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(30947);varu=i(48096).Delegate;const{getNewPeveCloseMode:_}=i(98422),{QuoteSession:p}=i(76220);functionm(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=newu,this.onDisconnect=newu,this._quoteApi=newp(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=o(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},
;if(this._waitingForFormatters[e])returnthis._waitingForFormatters[e];functions(e){vari=t&&!e.fractional?1:e.minmov;returnnewn({priceScale:e.pricescale,minMove:i,fractional:e.fractional,minMove2:e.minmove2})}varo=newPromise((function(t,o){if(i._formatterValuesCache[e])t(s(i._formatterValuesCache[e]));else{varn=a.guid();i.subscribe(n,[e],(function(r){"error"===r.status&&(i._waitingForFormatters[e]=null,o("Quotes snapshot is not received")),function(e){returne&&null!=e.pricescale&&null!=e.minmov}(r.values)&&(i._waitingForFormatters[e]=null,i._formatterValuesCache[e]=r.values,t(s(r.values)),i.unsubscribe(n,e))}))}}));returnthis._waitingForFormatters[e]=o,o},m.prototype.snapshot=function(e){vart=this;if(this._waitingForSnapshot[e])returnthis._waitingForSnapshot[e];vari=newPromise((function(i,s){if(t._snapshotValuesCache[e])i(t._snapshotValuesCache[e]);else{varo=a.guid();t.subscribe(o,[e],(function(n){"error"===n.status&&(t._waitingForSnapshot[e]=null,s("Quotes snapshot is not received"));varr=n.values;r&&r.minmov&&r.pricescale&&(t._waitingForSnapshot[e]=null,t._snapshotValuesCache[e]=r,i(r),t.unsubscribe(o,e))}))}}));returnthis._waitingForSnapshot[e]=i,i},window.TradingView=window.TradingView||{},window.TradingView.QuoteSessionMultiplexer=m,e&&e.exports&&(e.exports=m)},12178:(e,t,i)=>{"use strict";i.d(t,{getServerInterval:()=>o});vars=i(46082);functiono(e){returns.Interval.isRange(e)?"1":e}},45720:(e,t,i)=>{"use strict";functions(e,t,i){consts=e.get(t);returnvoid0!==s?s:(e.set(t,i),i)}functiono(e,t,i){consts=e.get(t);if(void0!==s)returns;consto=i();returne.set(t,o),o}functionn(e,t,i,n){returno(s(e,t,newMap),i,n)}functionr(e,t,i,o,n){constr=s(e,t,newMap),a=s(r,i,newMap);returns(a,o,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>r});classa{constructor(){this._map=newMap,this._size=0}size(){returnthis._size}clear(){this._map.clear(),this._size=0}}},12217:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>s.compareTwoCollectionsByIds,indexOf:()=>s.indexOf,intersect:()=>s.intersect,join:()=>s.join,lowerbound:()=>s.lowerbound,lowerboundExt:()=>s.lowerboundExt,lowerbound_int:()=>s.lowerbound_int,mapEntriesGenerator:()=>s.mapEntriesGenerator,moveAfter:()=>s.moveAfter,moveBefore:()=>s.moveBefore,moveToHead:()=>s.moveToHead,nestedMapGenerator:()=>s.nestedMapGenerator,removeItemFromArray:()=>s.removeItemFromArray,subtract:()=>s.subtract,sum:()=>s.sum,upperbound:()=>s.upperbound,upperbound_int:()=>s.upperbound_int});vars=i(16879)},69558:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LINESTYLE_DASHED:()=>n,LINESTYLE_DOTTED:()=>o,LINESTYLE_LARGE_DASHED:()=>r,LINESTYLE_SMALL_DASHED:()=>l,LINESTYLE_SOLID:()=>s,LINESTYLE_SPARSE_DOTTED:()=>a});consts=0,o=1,n=2,r=3,a=4,l=5},16659:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>r});vars,o=i(50151);functionn(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}!function(e){e[e.CapacityFactor=1.3]="CapacityFactor"}(s||(s={}));classr{constructor(e=0,t=1.3){this._cache=newMap,
boldHighlightStart:"<b>",boldHighlightEnd:"</b>"})}constr=newMap([["You cannot see this pivot timeframe on this resolution",s.t(null,void0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void0,i(69156))],["Runtime error",s.t(null,void0,i(60630))],["Access error",s.t(null,void0,i(77401))],["User-defined error",s.t(null,void0,i(8580))],["Compilation error",s.t(null,void0,i(12086))],["Metric error",s.t(null,void0,i(83111))],["There's no data for your selected period and chart timeframe.",s.t(null,void0,i(43716))],["The request took too long to process. Ensure you have a stable internet connection. If the issue persists, try decreasing the length of the requested time interval.",s.t(null,void0,i(99274))],["Unexpected error in Deep Backtesting mode. Contact support for more information.",s.t(null,void0,i(56815))],["check study unexpected error",s.t(null,void0,i(83524))],["To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.",s.t(null,void0,i(41446))],["VWAP is waiting for more data",s.t(null,void0,i(81030))],["The Bar Magnifier feature is only available to Premium users",s.t(null,void0,i(45328))],["The bar magnifier is only available to the Premium plan or higher.",s.t(null,void0,i(35601))]])},64971:(e,t,i)=>{"use strict";i.d(t,{getImage:()=>n});consts=newMap;functiono(e){e.crossOrigin="anonymous"}functionn(e,t,i=o){letn=s.get(e);returnvoid0===n&&(n=newPromise(((e,s)=>{consto=newImage;o.onload=()=>{e(o),o.onload=null,o.onerror=null},o.onerror=()=>{s(),o.onload=null,o.onerror=null},i(o),o.src=t})),s.set(e,n)),n}},38486:(e,t,i)=>{"use strict";functions(e){constt=Object.create(e);returnt.release=()=>{},t.ownership=()=>t,t}functiono(e){constt=e;returnt.release=()=>t.destroy(),t.ownership=()=>t,t}i.d(t,{ownership:()=>o,weakReference:()=>s})},95523:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>o});vars=i(37236);functiono(e,t=Date.now()){consti=(0,s.get_timezone)(e).offset_utc(t);leto="";constn=i/1e3/60/60;n%1&&(o=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));letr="";returnr=n>0?"+"+(n-n%1)+o:0===n?"":String(n-n%1+o),{offset:i,string:"UTC"+r}}},4148:(e,t,i)=>{"use strict";i.d(t,{clone:()=>s.clone,isNumber:()=>s.isNumber,isObject:()=>s.isObject});vars=i(87465)},59149:e=>{"use strict";vart=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{
d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],i=function(){vare=[{pattern:"(",ctor:n},{pattern:")",ctor:r},{pattern:"+",ctor:l},{pattern:"-",ctor:c},{pattern:"*",ctor:h},{pattern:"/",ctor:d},{pattern:"^",ctor:u},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,ctor:g},{pattern:/\./,ctor:v},{pattern:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&]*|'.+?'/,ctor:m},{pattern:/'[^']*/,ctor:y},{pattern:/[\0-\x20\s]+/,ctor:o}];functioni(e,t){vari=function(){};returni.prototype=t.prototype,e.prototype=newi,e}functions(){}functiono(e){this.value=e}functionn(){}functionr(){}functiona(){}functionl(){}functionc(){}functionh(){}functiond(){}functionu(){}s.prototype.toString=function(){returnthis.value},i(o,s),i(n,s),n.prototype.value="(",i(r,s),r.prototype.value=")",i(a,s),i(l,a),l.prototype.value="+",l.prototype.precedence=0,l.prototype.commutative=!0,i(c,a),c.prototype.value="-",c.prototype.precedence=0,c.prototype.commutative=!1,i(h,a),h.prototype.value="*",h.prototype.precedence=1,h.prototype.commutative=!0,i(d,a),d.prototype.value="/",d.prototype.precedence=1,d.prototype.commutative=!1,i(u,a),u.prototype.value="^",u.prototype.precedence=2,u.prototype.commutative=!1;var_=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,p=/[+\-/*]/;functionm(e){this.value=e}functiong(e){this.value=e}functionf(e){this.value=e}functiony(){m.apply(this,arguments)}functionv(){g.apply(this,arguments)}i(m,s),m.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){vare=p.test(this._ticker)?"'":"";returne+(this._exchange?this._exchange+":":"")+this._ticker+e}returnthis.value},m.prototype.parse=function(){vare=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},m.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(vare=function(e){returnt.some((function(t){returnt.t===e}))},i=2;i>=1;--i){vars=this._ticker.slice(0,i);if(e(s)){this._root=s,this._contract=this._ticker.slice(i);break}}},m.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))returnthis._exchange;null==e?deletethis._exchange:this._exchange=e+""},m.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))returnthis._ticker;null==e?deletethis._ticker:this._ticker=e+"",deletethis._root,deletethis._contract},m.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))returnthis._root;null==e?deletethis._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},m.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))returnthis._root;null==e?deletethis._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},i(g,s),g.prototype.toString=function(){
returnthis.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},g.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},f.prototype.toString=function(){returnthis.value},i(y,m),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)returnString("'")},i(v,g),v.prototype.isIncomplete=!0;varS=newRegExp(e.map((function(e){return"("+("string"==typeofe.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");functionb(t,i){vars,n=[];e:for(;s=S.exec(t);){for(varr=e.length;r--;)if(s[r+1]){if(e[r].ctor){vara=newe[r].ctor(s[r+1]);a._offset=s.index,n.push(a)}continuee}varl=newf(s[0]);l._offset=s.index,n.push(l)}if(i&&i.recover){varc;for(r=n.length;r--;){varh=n[r];if(hinstanceofg||hinstanceofm){if(void0!==c){vard=newm(""),u=n.splice(r,c-r+1,d);d.value=u.map((function(e){returne.value})).join("")}c=r}elsehinstanceofo||(c=void0)}}returnn}functionw(e){for(vart=[],i=0;i<e.length;i++)e[i]instanceofo||t.push(e[i]);returnt}functionC(e){e=w(e);for(vart,i=[],s=[],o=0;o<e.length;o++){varl=e[o];if(linstanceofa)s.length&&s[s.length-1].minPrecedence>l.precedence&&(s[s.length-1].minPrecedence=l.precedence);elseif(linstanceofn)s.push(t={minPrecedence:1/0,openBraceIndex:o});elseif(linstanceofr){varc=e[(t=s.pop()).openBraceIndex-1],h=e[o+1];hinstanceofa&&!(h.precedence<=t.minPrecedence)||!(!(cinstanceofa)||c.precedence<t.minPrecedence||c.precedence===t.minPrecedence&&c.commutative)||(i.unshift(t.openBraceIndex),i.push(o),s.length&&s[s.length-1].minPrecedence>t.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(o=i.length;o--;)e.splice(i[o],1);returne}functionT(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");return(e=b(e)).filter((function(e){returneinstanceofm})).map((function(e){returne.exchange()})).filter((function(e){returne}))}functionP(e){return1!==(e=T(e)).length?null:e[0]}functionx(e,t){return(e=T(e)).some((function(e){returnt.includes((e||"").toUpperCase())}))}functionM(e){returne.join("")}return{tokenize:b,validate:function(e){return{currentState:"var"}},factorOutBraces:C,normalizeTokens:function(e){for(vart=0;t<e.length;t++)e[t].parse&&e[t].parse();returne},flip:function(e){vart=function(e){for(vart,i=0,s=1,l=2,c=3,h=i,u=0,_=0;_<e.length;_++){varp=e[_];if(!(pinstanceofo))switch(h){casei:if(!(pinstanceofg&&1==+p.value))return!1;h=s;break;cases:if(!(h===s&&pinstanceofd))return!1;h=l,t=_+1;break;casel:if(pinstanceofn)h=c,u=1;elseif(pinstanceofa)return!1;break;casec:pinstanceofn?u++:pinstanceofr&&--u<=0&&(h=l)}}returne.slice(t)}(e);returnC(t||[newg("1"),newd,newn].concat(e).concat(newr))},hasBatsSymbols:function(e){returnx(e,["BATS"])},hasEodSymbols:function(e){return(e=P(e))&&-1!==e.toUpperCase().indexOf("_EOD")},hasChxjpySymbols:function(e){returnx(e,["CHXJPY"])},hasFreeDelaySymbols:function(e){
returnx(e,pro.getProductsByType(pro.PRODUCT_TYPES.exchange).map((function(e){returne.exchange.toUpperCase()+"_DLY"})))},getExchange:P,getExchanges:T,isExchange:function(e,t){return!!(e=P(e))&&e.substring(0,t.length)===t},SymbolToken:m,IncompleteSymbolToken:y,NumberToken:g,BinaryOperatorToken:a,OpenBraceToken:n,CloseBraceToken:r,ticker:function(e){returnnewm(e).ticker()},shortName:function(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");vart=C(w(b(e)));returnt.forEach((function(e){einstanceofm&&e.exchange(null)})),M(t)},normalize:function(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");returnM(C(w(b(e))))}}}();e.exports=i},95804:(e,t,i)=>{"use strict";i.d(t,{TranslatedString:()=>s});classs{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){returnthis._originalText}translatedText(){returnthis._translatedText}format(e){constt={},i={};for(constoofObject.keys(e)){constn=e[o];ninstanceofs?(t[o]=n.originalText(),i[o]=n.translatedText()):(t[o]=n.toString(),i[o]=n.toString())}consto=this._originalText.format(t),n=this._translatedText.format(i);returnnews(o,n)}}},9787:(e,t,i)=>{"use strict";i.d(t,{Version:()=>o});vars=i(50151);classo{constructor(e,t){this._major=e,this._minor=t}major(){returnthis._major}minor(){returnthis._minor}isZero(){return0===this._major&&0===this._minor}toString(){returnthis._major+"."+this._minor}compareTo(e){returnthis._major<e._major?-1:this._major>e._major?1:this._minor<e._minor?-1:this._minor>e._minor?1:0}isLess(e){returnthis.compareTo(e)<0}isLessOrEqual(e){returnthis.compareTo(e)<=0}isEqual(e){return0===this.compareTo(e)}isGreater(e){returnthis.compareTo(e)>0}isGreaterOrEqual(e){returnthis.compareTo(e)>=0}staticparse(e){if(einstanceofo)returnnewo(e.major(),e.minor());if("number"==typeofe)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),newo(e,0);if("string"==typeofe){constt=e.split(".");if(1===t.length){consti=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),newo(i,0)}if(2===t.length){consti=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);constn=parseInt(t[1],10);return(0,s.assert)(!isNaN(n),"Bad version string: "+e),newo(i,n)}thrownewError("Bad version string (one dot expected): "+e)}thrownewError("Bad version: "+e)}}o.ZERO=newo(0,0)},22613:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>s.WatchedValue});vars=i(52499)},62773:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>s.WatchedObject});vars=i(52499)},99247:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>r,initMouseClickAutoBlurHandler:()=>a});vars=i(81251),o=i(76460);constn="data-mouse-click-auto-blur";classr{constructor(){this._handler=e=>{document.activeElementinstanceofHTMLElement&&((0,o.isKeyboardClick)(e)||e.targetinstanceofElement&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)}
!t&&0===this._listeners.length&&this._onStopListening&&(this._onStopListening(),this._onStopListening=null)}destroy(){this._onStopListening&&(this._onStopListening(),this._onStopListening=null),super.destroy()}}!function(e){e.Normal="normal",e.Big="big"}(s||(s={}));classc{constructor(e){this.type="action",this._destroyed=!1,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:s,customActionOptions:n,customActionOptionsLoader:a,id:h=r.guid(),onStartListening:d}=e;(0,o.assert)(void0!==t,"actionId must be defined"),this.id=h,this._onUpdate=newl(d),this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=s??null,this._loadOptionsGetter&&(this._options.loading=!0),n&&(this._customAction=newc({actionId:t,options:n,optionsLoader:a,id:h}))}custom(){returnthis._customAction}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){returnthis._options.label||""}getSubItems(){returnthis._options.subItems||[]}isDisabled(){return!0===this._options.disabled}isActive(){return!0===this._options.active}isCheckable(){return!0===this._options.checkable}isChecked(){return!0===this._options.checked}isLoading(){return!0===this._options.loading}loadOptions(){returnthis._loadOptionsPromise?this._loadOptionsPromise:this._loadOptionsGetter?(this._loadOptionsPromise=this._loadOptionsGetter().then((e=>this.update({...e,loading:!1}))),this._loadOptionsPromise):null}getSize(){returnthis._options.size??"normal"}getPayload(){returnthis._options.payload}update(e){this._destroyed||(this._unbindShortcut(),e.hotkeyHash&&(this._options.shortcutHint=(0,n.humanReadableHash)(e.hotkeyHash)),this._options=Object.assign(this._options,e),this._bindShortcut(),this._onUpdate.fire(this))}onUpdate(){returnthis._onUpdate}getState(){returnthis.loadOptions(),{actionId:this._options.actionId,label:this.getLabel(),styledLabel:this._options.styledLabel,disabled:this.isDisabled(),active:this.isActive(),subItems:this.getSubItems(),checkable:this.isCheckable(),checked:this.isChecked(),loading:this.isLoading(),size:this.getSize(),doNotCloseOnClick:this._options.doNotCloseOnClick||!1,shortcutHint:this._options.shortcutHint,hint:this._options.hint,icon:this._options.icon,iconId:this._options.iconId,iconChecked:this._options.iconChecked,toolbox:this._options.toolbox,showToolboxOnHover:this._options.showToolboxOnHover||!1,statName:this._options.statName,name:this._options.name,invisibleHotkey:this._options.invisibleHotkey,noInteractive:this._options.noInteractive,jsxLabel:"jsxLabel"inthis._options?this._options.jsxLabel:void0,isRepeatAccepted:this._options.isRepeatAccepted}}destroy(){this._destroyed=!0,this._onUpdate.destroy(),this._unbindShortcut(),this._options.onDestroy?.(),this._customAction?.destroy()}options(){returnthis._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;conste="string"==typeofthis._options.label?this._options.label:this._options.name
traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer",hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{
id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;vari=this._context.new_var(o.close(this._context)),s=this._input(0),n=this._input(1),r=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=o.ema(i,s,this._context),d=o.ema(i,n,this._context),u=o.ema(i,r,this._context),_=o.ema(i,a,this._context),p=o.ema(i,l,this._context),m=o.ema(i,c,this._context),g=this._input(6),f=this._input(7),y=this._input(8),v=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,_,p,m,o.ema(i,g,this._context),o.ema(i,f,this._context),o.ema(i,y,this._context),o.ema(i,v,this._context),o.ema(i,S,this._context),o.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==o.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){
this._symbolSupports1DResolution||o.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==o.period(this._context)&&this._context.select_sym(1);consti=this._input(0),s=this._input(1),n=o.time(this._context),r=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(o[i](this._context)),l=this._context.new_unlimited_var(o[s](this._context));if(r.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)returnnull;constc=o.add_years_considering_dst(this._context.symbol.info.timezone,newDate(n),-1),h=r.indexOf(c.getTime()),d=-1===h?NaN:o.highest(a,h,this._context),u=-1===h?NaN:o.lowest(l,h,this._context);if(isNaN(d)||isNaN(u))return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{erase:[{action:"all"}]}}};return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:d,extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:u,extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},30342:(e,t,i)=>{"use strict";vars;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},81593:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});consts=i(34840)},48480:()=>{"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{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},32544:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>r,getQuoteSessionInstance:()=>n});vars=i(13607);consto={};functionn(e="full"){returno[e]||function(e="full",t){o[e]=t}(e,news(e)),o[e]}functionr(){for(consteino)if(o.hasOwnProperty(e)){constt=o[e];void0!==t&&t.destroy(),deleteo[e]}}},13607:(e,t,i)=>{"use strict";e=i.nmd(e);vars=i(20057).default,o=i(90484).default,n=i(67563).PriceFormatter;const{uniq:r}=i(53470);vara=i(4168);const{normalizeUpdateMode:l}=i(52706);varc=i(39527).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(30947);varu=i(48096).Delegate;const{getNewPeveCloseMode:_}=i(98422),{QuoteSession:p}=i(76220);functionm(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=newu,this.onDisconnect=newu,this._quoteApi=newp(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=o(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}m.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},m.prototype.typeFields={},
if(i._formatterValuesCache[e])t(s(i._formatterValuesCache[e]));else{varn=a.guid();i.subscribe(n,[e],(function(r){"error"===r.status&&(i._waitingForFormatters[e]=null,o("Quotes snapshot is not received")),function(e){returne&&null!=e.pricescale&&null!=e.minmov}(r.values)&&(i._waitingForFormatters[e]=null,i._formatterValuesCache[e]=r.values,t(s(r.values)),i.unsubscribe(n,e))}))}}));returnthis._waitingForFormatters[e]=o,o},m.prototype.snapshot=function(e){vart=this;if(this._waitingForSnapshot[e])returnthis._waitingForSnapshot[e];vari=newPromise((function(i,s){if(t._snapshotValuesCache[e])i(t._snapshotValuesCache[e]);else{varo=a.guid();t.subscribe(o,[e],(function(n){"error"===n.status&&(t._waitingForSnapshot[e]=null,s("Quotes snapshot is not received"));varr=n.values;r&&r.minmov&&r.pricescale&&(t._waitingForSnapshot[e]=null,t._snapshotValuesCache[e]=r,i(r),t.unsubscribe(o,e))}))}}));returnthis._waitingForSnapshot[e]=i,i},window.TradingView=window.TradingView||{},window.TradingView.QuoteSessionMultiplexer=m,e&&e.exports&&(e.exports=m)},12178:(e,t,i)=>{"use strict";i.d(t,{getServerInterval:()=>o});vars=i(46082);functiono(e){returns.Interval.isRange(e)?"1":e}},45720:(e,t,i)=>{"use strict";functions(e,t,i){consts=e.get(t);returnvoid0!==s?s:(e.set(t,i),i)}functiono(e,t,i){consts=e.get(t);if(void0!==s)returns;consto=i();returne.set(t,o),o}functionn(e,t,i,n){returno(s(e,t,newMap),i,n)}functionr(e,t,i,o,n){constr=s(e,t,newMap),a=s(r,i,newMap);returns(a,o,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>r});classa{constructor(){this._map=newMap,this._size=0}size(){returnthis._size}clear(){this._map.clear(),this._size=0}}},12217:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>s.compareTwoCollectionsByIds,indexOf:()=>s.indexOf,intersect:()=>s.intersect,join:()=>s.join,lowerbound:()=>s.lowerbound,lowerboundExt:()=>s.lowerboundExt,lowerbound_int:()=>s.lowerbound_int,mapEntriesGenerator:()=>s.mapEntriesGenerator,moveAfter:()=>s.moveAfter,moveBefore:()=>s.moveBefore,moveToHead:()=>s.moveToHead,nestedMapGenerator:()=>s.nestedMapGenerator,removeItemFromArray:()=>s.removeItemFromArray,subtract:()=>s.subtract,sum:()=>s.sum,upperbound:()=>s.upperbound,upperbound_int:()=>s.upperbound_int});vars=i(16879)},69558:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LINESTYLE_DASHED:()=>n,LINESTYLE_DOTTED:()=>o,LINESTYLE_LARGE_DASHED:()=>r,LINESTYLE_SMALL_DASHED:()=>l,LINESTYLE_SOLID:()=>s,LINESTYLE_SPARSE_DOTTED:()=>a});consts=0,o=1,n=2,r=3,a=4,l=5},16659:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>r});vars,o=i(50151);functionn(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}!function(e){e[e.CapacityFactor=1.3]="CapacityFactor"}(s||(s={}));classr{constructor(e=0,t=1.3){this._cache=newMap,this._lastItem=null,this._firstItem=null,this._size=e,this._sizeLimited=e>0,this._capacityFactor=t}set(e,t){consti={key:e,value:t,prevItem:this._lastItem,nextItem:null};null!==this._lastItem&&(this._lastItem.nextItem=i);consts=this._cache.get(e)
constr=newMap([["You cannot see this pivot timeframe on this resolution",s.t(null,void0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void0,i(69156))],["Runtime error",s.t(null,void0,i(60630))],["Access error",s.t(null,void0,i(77401))],["User-defined error",s.t(null,void0,i(8580))],["Compilation error",s.t(null,void0,i(12086))],["Metric error",s.t(null,void0,i(83111))],["There's no data for your selected period and chart timeframe.",s.t(null,void0,i(43716))],["The request took too long to process. Ensure you have a stable internet connection. If the issue persists, try decreasing the length of the requested time interval.",s.t(null,void0,i(99274))],["Unexpected error in Deep Backtesting mode. Contact support for more information.",s.t(null,void0,i(56815))],["check study unexpected error",s.t(null,void0,i(83524))],["To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.",s.t(null,void0,i(41446))],["VWAP is waiting for more data",s.t(null,void0,i(81030))],["The Bar Magnifier feature is only available to Premium users",s.t(null,void0,i(45328))],["The bar magnifier is only available to the Premium plan or higher.",s.t(null,void0,i(35601))]])},64971:(e,t,i)=>{"use strict";i.d(t,{getImage:()=>n});consts=newMap;functiono(e){e.crossOrigin="anonymous"}functionn(e,t,i=o){letn=s.get(e);returnvoid0===n&&(n=newPromise(((e,s)=>{consto=newImage;o.onload=()=>{e(o),o.onload=null,o.onerror=null},o.onerror=()=>{s(),o.onload=null,o.onerror=null},i(o),o.src=t})),s.set(e,n)),n}},38486:(e,t,i)=>{"use strict";functions(e){constt=Object.create(e);returnt.release=()=>{},t.ownership=()=>t,t}functiono(e){constt=e;returnt.release=()=>t.destroy(),t.ownership=()=>t,t}i.d(t,{ownership:()=>o,weakReference:()=>s})},95523:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>o});vars=i(37236);functiono(e,t=Date.now()){consti=(0,s.get_timezone)(e).offset_utc(t);leto="";constn=i/1e3/60/60;n%1&&(o=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));letr="";returnr=n>0?"+"+(n-n%1)+o:0===n?"":String(n-n%1+o),{offset:i,string:"UTC"+r}}},4148:(e,t,i)=>{"use strict";i.d(t,{clone:()=>s.clone,isNumber:()=>s.isNumber,isObject:()=>s.isObject});vars=i(87465)},59149:e=>{"use strict";vart=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{
d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],i=function(){vare=[{pattern:"(",ctor:n},{pattern:")",ctor:r},{pattern:"+",ctor:l},{pattern:"-",ctor:c},{pattern:"*",ctor:h},{pattern:"/",ctor:d},{pattern:"^",ctor:u},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,ctor:g},{pattern:/\./,ctor:v},{pattern:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&]*|'.+?'/,ctor:m},{pattern:/'[^']*/,ctor:y},{pattern:/[\0-\x20\s]+/,ctor:o}];functioni(e,t){vari=function(){};returni.prototype=t.prototype,e.prototype=newi,e}functions(){}functiono(e){this.value=e}functionn(){}functionr(){}functiona(){}functionl(){}functionc(){}functionh(){}functiond(){}functionu(){}s.prototype.toString=function(){returnthis.value},i(o,s),i(n,s),n.prototype.value="(",i(r,s),r.prototype.value=")",i(a,s),i(l,a),l.prototype.value="+",l.prototype.precedence=0,l.prototype.commutative=!0,i(c,a),c.prototype.value="-",c.prototype.precedence=0,c.prototype.commutative=!1,i(h,a),h.prototype.value="*",h.prototype.precedence=1,h.prototype.commutative=!0,i(d,a),d.prototype.value="/",d.prototype.precedence=1,d.prototype.commutative=!1,i(u,a),u.prototype.value="^",u.prototype.precedence=2,u.prototype.commutative=!1;var_=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,p=/[+\-/*]/;functionm(e){this.value=e}functiong(e){this.value=e}functionf(e){this.value=e}functiony(){m.apply(this,arguments)}functionv(){g.apply(this,arguments)}i(m,s),m.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){vare=p.test(this._ticker)?"'":"";returne+(this._exchange?this._exchange+":":"")+this._ticker+e}returnthis.value},m.prototype.parse=function(){vare=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},m.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(vare=function(e){returnt.some((function(t){returnt.t===e}))},i=2;i>=1;--i){vars=this._ticker.slice(0,i);if(e(s)){this._root=s,this._contract=this._ticker.slice(i);break}}},m.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))returnthis._exchange;null==e?deletethis._exchange:this._exchange=e+""},m.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))returnthis._ticker;null==e?deletethis._ticker:this._ticker=e+"",deletethis._root,deletethis._contract},m.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))returnthis._root;null==e?deletethis._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},m.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))returnthis._root;null==e?deletethis._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},i(g,s),g.prototype.toString=function(){returnthis.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},
g.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},f.prototype.toString=function(){returnthis.value},i(y,m),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)returnString("'")},i(v,g),v.prototype.isIncomplete=!0;varS=newRegExp(e.map((function(e){return"("+("string"==typeofe.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");functionb(t,i){vars,n=[];e:for(;s=S.exec(t);){for(varr=e.length;r--;)if(s[r+1]){if(e[r].ctor){vara=newe[r].ctor(s[r+1]);a._offset=s.index,n.push(a)}continuee}varl=newf(s[0]);l._offset=s.index,n.push(l)}if(i&&i.recover){varc;for(r=n.length;r--;){varh=n[r];if(hinstanceofg||hinstanceofm){if(void0!==c){vard=newm(""),u=n.splice(r,c-r+1,d);d.value=u.map((function(e){returne.value})).join("")}c=r}elsehinstanceofo||(c=void0)}}returnn}functionw(e){for(vart=[],i=0;i<e.length;i++)e[i]instanceofo||t.push(e[i]);returnt}functionC(e){e=w(e);for(vart,i=[],s=[],o=0;o<e.length;o++){varl=e[o];if(linstanceofa)s.length&&s[s.length-1].minPrecedence>l.precedence&&(s[s.length-1].minPrecedence=l.precedence);elseif(linstanceofn)s.push(t={minPrecedence:1/0,openBraceIndex:o});elseif(linstanceofr){varc=e[(t=s.pop()).openBraceIndex-1],h=e[o+1];hinstanceofa&&!(h.precedence<=t.minPrecedence)||!(!(cinstanceofa)||c.precedence<t.minPrecedence||c.precedence===t.minPrecedence&&c.commutative)||(i.unshift(t.openBraceIndex),i.push(o),s.length&&s[s.length-1].minPrecedence>t.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(o=i.length;o--;)e.splice(i[o],1);returne}functionT(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");return(e=b(e)).filter((function(e){returneinstanceofm})).map((function(e){returne.exchange()})).filter((function(e){returne}))}functionP(e){return1!==(e=T(e)).length?null:e[0]}functionx(e,t){return(e=T(e)).some((function(e){returnt.includes((e||"").toUpperCase())}))}functionM(e){returne.join("")}return{tokenize:b,validate:function(e){return{currentState:"var"}},factorOutBraces:C,normalizeTokens:function(e){for(vart=0;t<e.length;t++)e[t].parse&&e[t].parse();returne},flip:function(e){vart=function(e){for(vart,i=0,s=1,l=2,c=3,h=i,u=0,_=0;_<e.length;_++){varp=e[_];if(!(pinstanceofo))switch(h){casei:if(!(pinstanceofg&&1==+p.value))return!1;h=s;break;cases:if(!(h===s&&pinstanceofd))return!1;h=l,t=_+1;break;casel:if(pinstanceofn)h=c,u=1;elseif(pinstanceofa)return!1;break;casec:pinstanceofn?u++:pinstanceofr&&--u<=0&&(h=l)}}returne.slice(t)}(e);returnC(t||[newg("1"),newd,newn].concat(e).concat(newr))},hasBatsSymbols:function(e){returnx(e,["BATS"])},hasEodSymbols:function(e){return(e=P(e))&&-1!==e.toUpperCase().indexOf("_EOD")},hasChxjpySymbols:function(e){returnx(e,["CHXJPY"])},hasFreeDelaySymbols:function(e){returnx(e,pro.getProductsByType(pro.PRODUCT_TYPES.exchange).map((function(e){
returne.exchange.toUpperCase()+"_DLY"})))},getExchange:P,getExchanges:T,isExchange:function(e,t){return!!(e=P(e))&&e.substring(0,t.length)===t},SymbolToken:m,IncompleteSymbolToken:y,NumberToken:g,BinaryOperatorToken:a,OpenBraceToken:n,CloseBraceToken:r,ticker:function(e){returnnewm(e).ticker()},shortName:function(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");vart=C(w(b(e)));returnt.forEach((function(e){einstanceofm&&e.exchange(null)})),M(t)},normalize:function(e){if("string"!=typeofe)thrownewTypeError("expression must be a string");returnM(C(w(b(e))))}}}();e.exports=i},95804:(e,t,i)=>{"use strict";i.d(t,{TranslatedString:()=>s});classs{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){returnthis._originalText}translatedText(){returnthis._translatedText}format(e){constt={},i={};for(constoofObject.keys(e)){constn=e[o];ninstanceofs?(t[o]=n.originalText(),i[o]=n.translatedText()):(t[o]=n.toString(),i[o]=n.toString())}consto=this._originalText.format(t),n=this._translatedText.format(i);returnnews(o,n)}}},9787:(e,t,i)=>{"use strict";i.d(t,{Version:()=>o});vars=i(50151);classo{constructor(e,t){this._major=e,this._minor=t}major(){returnthis._major}minor(){returnthis._minor}isZero(){return0===this._major&&0===this._minor}toString(){returnthis._major+"."+this._minor}compareTo(e){returnthis._major<e._major?-1:this._major>e._major?1:this._minor<e._minor?-1:this._minor>e._minor?1:0}isLess(e){returnthis.compareTo(e)<0}isLessOrEqual(e){returnthis.compareTo(e)<=0}isEqual(e){return0===this.compareTo(e)}isGreater(e){returnthis.compareTo(e)>0}isGreaterOrEqual(e){returnthis.compareTo(e)>=0}staticparse(e){if(einstanceofo)returnnewo(e.major(),e.minor());if("number"==typeofe)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),newo(e,0);if("string"==typeofe){constt=e.split(".");if(1===t.length){consti=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),newo(i,0)}if(2===t.length){consti=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);constn=parseInt(t[1],10);return(0,s.assert)(!isNaN(n),"Bad version string: "+e),newo(i,n)}thrownewError("Bad version string (one dot expected): "+e)}thrownewError("Bad version: "+e)}}o.ZERO=newo(0,0)},22613:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>s.WatchedValue});vars=i(52499)},62773:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>s.WatchedObject});vars=i(52499)},99247:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>r,initMouseClickAutoBlurHandler:()=>a});vars=i(81251),o=i(76460);constn="data-mouse-click-auto-blur";classr{constructor(){this._handler=e=>{document.activeElementinstanceofHTMLElement&&((0,o.isKeyboardClick)(e)||e.targetinstanceofElement&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)}staticattributes(e=!0){returne?{[n]:!0}:{}}}consta=(0,s.default)((()=>newr))},
this._onStopListening=null)}destroy(){this._onStopListening&&(this._onStopListening(),this._onStopListening=null),super.destroy()}}!function(e){e.Normal="normal",e.Big="big"}(s||(s={}));classc{constructor(e){this.type="action",this._destroyed=!1,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:s,customActionOptions:n,customActionOptionsLoader:a,id:h=r.guid(),onStartListening:d}=e;(0,o.assert)(void0!==t,"actionId must be defined"),this.id=h,this._onUpdate=newl(d),this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=s??null,this._loadOptionsGetter&&(this._options.loading=!0),n&&(this._customAction=newc({actionId:t,options:n,optionsLoader:a,id:h}))}custom(){returnthis._customAction}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){returnthis._options.label||""}getSubItems(){returnthis._options.subItems||[]}isDisabled(){return!0===this._options.disabled}isActive(){return!0===this._options.active}isCheckable(){return!0===this._options.checkable}isChecked(){return!0===this._options.checked}isLoading(){return!0===this._options.loading}loadOptions(){returnthis._loadOptionsPromise?this._loadOptionsPromise:this._loadOptionsGetter?(this._loadOptionsPromise=this._loadOptionsGetter().then((e=>this.update({...e,loading:!1}))),this._loadOptionsPromise):null}getSize(){returnthis._options.size??"normal"}getPayload(){returnthis._options.payload}update(e){this._destroyed||(this._unbindShortcut(),e.hotkeyHash&&(this._options.shortcutHint=(0,n.humanReadableHash)(e.hotkeyHash)),this._options=Object.assign(this._options,e),this._bindShortcut(),this._onUpdate.fire(this))}onUpdate(){returnthis._onUpdate}getState(){returnthis.loadOptions(),{actionId:this._options.actionId,label:this.getLabel(),styledLabel:this._options.styledLabel,disabled:this.isDisabled(),active:this.isActive(),subItems:this.getSubItems(),checkable:this.isCheckable(),checked:this.isChecked(),loading:this.isLoading(),size:this.getSize(),doNotCloseOnClick:this._options.doNotCloseOnClick||!1,shortcutHint:this._options.shortcutHint,hint:this._options.hint,icon:this._options.icon,iconId:this._options.iconId,iconChecked:this._options.iconChecked,toolbox:this._options.toolbox,showToolboxOnHover:this._options.showToolboxOnHover||!1,statName:this._options.statName,name:this._options.name,invisibleHotkey:this._options.invisibleHotkey,noInteractive:this._options.noInteractive,jsxLabel:"jsxLabel"inthis._options?this._options.jsxLabel:void0,isRepeatAccepted:this._options.isRepeatAccepted}}destroy(){this._destroyed=!0,this._onUpdate.destroy(),this._unbindShortcut(),this._options.onDestroy?.(),this._customAction?.destroy()}options(){returnthis._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;conste="string"==typeofthis._options.label?this._options.label:this._options.name;this._hotkeyAction=this._options.hotkeyGroup.add({hotkey:this._options.hotkeyHash,
;consta=newn.SessionInfo("Etc/UTC","0000-0000:1234567");varl=i(37103);functionc(){return!l.enabled("disable_resolution_rebuild")}consth=function(e,t,i){if(!e||!o.Interval.isDWM(t))returnnull;constl=newn.SessionInfo(i.timezone,i.session,i.session_holidays,i.corrections),c=(0,r.newBarBuilder)(t,l,a);return{timeToSessionStart:e=>c.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{constt=(0,s.utc_to_cal)(l.timezone,e),i=l.spec.correctTradingDay(t);return(0,s.set_hms)(i,0,0,0,0,(0,s.get_timezone)("Etc/UTC")),i.getTime()}}}.bind(null,c()),d=function(e,t,i){if(!e)returne=>e;consts=newn.SessionInfo(i.timezone,i.session,i.session_holidays,i.corrections),o=(0,r.newBarBuilder)(t,s,s,!1);returne=>o.alignTimeIfPossible(e)}.bind(null,c())},17776:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>o});vars=i(52746);functiono(e,t){switch(e){case12:return(0,s.barFunction)("low","low","close");case2:case18:case20:case14:case15:case3:case10:case13:return(0,s.barFunction)(t??"close");default:return(0,s.barFunction)("close","open")}}},28001:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>o});vars=i(50151);classo{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){returnthis._firstBar}lastBar(){returnthis._lastBar}count(){returnthis._lastBar-this._firstBar+1}contains(e){returnthis._firstBar<=e&&e<=this._lastBar}unite(e){returnnull===e?this:newo(Math.min(this._firstBar,e.firstBar()),Math.max(this._lastBar,e.lastBar()))}equals(e){returnthis._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}staticcompare(e,t){returnnull===e||null===t?e===t:e.equals(t)}}},54370:(e,t,i)=>{"use strict";i.d(t,{allChartStyles:()=>o});vars=i(37103);functiono(){returnfunction(){conste=[0,1,9,13,2,14,15,3,16,10];returns.enabled("chart_style_hilo")&&e.push(12),e.push(21),e}().concat((s.enabled("japanese_chart_styles"),[8]))}},32853:(e,t,i)=>{"use strict";vars=i(49251).makeFont,o=i(49251).parseFont,n=i(9343).getLogger;const{drawPoly:r}=i(58221);vara=n("Model.ChartTradingUtils"),l={_fontHeightCache:{},_parsedColorCache:{},_parseColor:function(e){if(this._parsedColorCache[e])returnthis._parsedColorCache[e];vart=document.createElement("div");t.style.color=e;vari=t.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||t.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)$/i),s={r:i[1],g:i[2],b:i[3],a:i[4]||"1"};returnthis._parsedColorCache[e]=s,s},getColorFromProperties:function(e,t){vari=1-t.value()/100,s=this._parseColor(e.value());return"rgba("+s.r+","+s.g+","+s.b+","+i+")"},setColorToProperties:function(e,t,i){vars=this._parseColor(e);t.setValue("rgb("+s.r+","+s.g+","+s.b+")");varo=100*(1-s.a);i.setValue(Math.max(0,Math.min(o,100)))},getFontFromProperties:function(e,t,i,o){returns(t.value(),e.value(),o.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,n){varr=o(e);null!==r?(r.family.length>0&&t.setValue(r.family),
(0,j.showConfirm)({text:ce.format({name:e.name}),onConfirm:({dialogClose:t})=>newPromise((s=>{z.backend.invalidateStudyTemplatesList(),z.backend.removeStudyTemplate(e.id).then((()=>{this.refreshStudyTemplateList((()=>{consto=this.list();this._list.setValue(o.filter((t=>t!==e))),this._recentStudyTemplatesService&&this._recentStudyTemplatesService.remove(e.id),s(),t(),i?.()}))}))}))},t)}),{source:"Study templates delete"})}}varde=i(29803),ue=i(26010),_e=i(35727);classpe{constructor(e,t){this._visibility=newO.WatchedValue(!1),this._dialogPromise=null,this._dialog=null,this._chartWidgetCollection=e,this._options=t}visible(){returnthis._visibility.readonly()}show(e,t,i){consts=Array.isArray(e)?e:[],o=Array.isArray(e)?void0:e;null===this._dialog&&this._requestDialog(s??[],t,i,o),this._dialog?.open(s??[],this._options?.indicatorsPreloader?.getIndicatorPromises(),t,i,o)}hide(){this._dialog?.hide()}getDialog(){returnthis._dialog}resetAllPages(){this._dialog?.resetAllStudies()}_requestDialog(e,t,s,o){if(null===this._dialogPromise){letn;n=Promise.all([i.e(2346),i.e(8185),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(2537),i.e(1697),i.e(7833),i.e(8260),i.e(509),i.e(7463),i.e(3853),i.e(2227),i.e(9418),i.e(6864),i.e(6456)]).then(i.bind(i,86682)).then((e=>newe.IndicatorsLibraryContainer(this._chartWidgetCollection,this._options))),this._dialogPromise=n.then((i=>{this._dialog=i,this._dialog.visible().subscribe((e=>{this._visibility.setValue(e)})),this._dialog.open(e,this._options?.indicatorsPreloader?.getIndicatorPromises(),t,s,o)}))}returnthis._dialogPromise}}varme=i(88723),ge=i(39527),fe=i(4226),ye=i(18712),ve=i(23714),Se=i(61786),be=i(97363),we=i(3190),Ce=i(37236),Te=i(87453),Pe=i(10845);constxe=/^Etc\/GMT([+-])(\d{1,2}):?(\d\d)?$/,Me=newMap;functionIe(e){if(Me.has(e))returnMe.get(e);constt=xe.test(e);returnMe.set(e,t),t}constAe=newMap;functionLe(e){if(Ae.has(e))returnAe.get(e);constt=function(e){constt=e.match(xe);if(!t)return0;consti="+"===t[1]?-1:1;return60*(60*parseInt(t[2],10)+parseInt(t[3]||"0",10))*i}(e),i={time:[1924992e3+t],offset:[t]};returnAe.set(e,i),i}letke=null;constEe=newMap;classDe{constructor(){this._customTimezones=newMap}addTimezones(e){e.forEach((e=>{const{id:t,...i}=e;this._addTimezone(t,i)})),this.updateChartTimezones()}listTimezoneIds(){return[...this._customTimezones.keys()]}listTimezones(){return[...this._customTimezones.entries()].map((([e,t])=>({id:e,...t})))}getTimezoneInfo(e){if(!this.timezoneIsAvailable(e))thrownewError("Provided timezone alias is not within the list of supported timezones.");return(0,n.ensure)(this._customTimezones.get(e))}getAllTimezoneInfo(){returnthis.listTimezones()}getAliasTimezone(e){returnthis.getTimezoneInfo(e).alias}timezoneIsAvailable(e){returnthis._customTimezones.has(e)}updateChartTimezones(){(0,Pe.updateAvailableTimezones)(this.getAllTimezoneInfo())}getTimezoneData(e){if(Ee.has(e))returnEe.get(e);lett=null;if(Ie(e))t=Le(e);elseif(this.timezoneIsAvailable(e)){consti=this.getAliasTimezone(e);Te.tzData[i]&&(t=Te.tzData[i]),
!t&&Ie(i)&&(t=Le(i))}returnt&&Ee.set(e,t),t}staticinstance(){returnnull===ke&&(ke=newDe),ke}_addTimezone(e,t){try{if((0,n.ensure)(e,"Custom timezone ID"),(0,n.ensure)(t.alias,"Custom timezone alias"),(0,n.ensure)(t.title,"Custom timezone title"),(0,Pe.timezoneIsAvailable)(e)&&!this.timezoneIsAvailable(e))thrownewError("Custom timezone id already exists.");if(!(0,Pe.timezoneIsSupported)(t.alias)&&!Ie(t.alias))thrownewError("Custom timezone alias is not a supported timezone.");if(e.length<1)thrownewError("Custom timezone id is empty");if(t.title.length<1)thrownewError("Custom timezone title is empty");this._customTimezones.set(e,t)}catch(e){console.warn(`Unable to add custom timezone. ${e}`)}}}(0,Ce.setCustomTimezones)(De);varBe=i(91106);letVe=null;varRe=i(46082);classNe{constructor(e){this._alive=newO.WatchedValue,this._container=newO.WatchedValue,this._width=newO.WatchedValue,this._height=newO.WatchedValue,this._fullscreen=newO.WatchedValue,this._detachable=newO.WatchedValue,this._fullscreenable=newO.WatchedValue,this._visible=newO.WatchedValue,this._availWidth=newO.WatchedValue,this._availHeight=newO.WatchedValue,this._owner=newO.WatchedValue,this._ownersStack=[],this.owner=this._owner.readonly(),this._bridge={alive:this._alive.readonly(),container:this._container.readonly(),width:this._width.readonly(),height:this._height.readonly(),fullscreen:this._fullscreen.readonly(),detachable:this._detachable.readonly(),fullscreenable:this._fullscreenable.readonly(),visible:this._visible.readonly(),availWidth:this._availWidth.readonly(),availHeight:this._availHeight.readonly(),remove:()=>{conste=this._owner.value();e&&e.remove&&e.remove()},negotiateWidth:e=>{constt=this._owner.value();t&&t.negotiateWidth&&t.negotiateWidth(e)},negotiateHeight:e=>{constt=this._owner.value();t&&t.negotiateHeight&&t.negotiateHeight(e)},requestFullscreen:()=>{conste=this._owner.value();e&&e.requestFullscreen&&e.requestFullscreen()},exitFullscreen:()=>{conste=this._owner.value();e&&e.exitFullscreen&&e.exitFullscreen()},detach:e=>{constt=this._owner.value();t&&t.detach&&t.detach(e)},attach:()=>{conste=this._owner.value();e&&e.attach&&e.attach()}},e&&this.pushOwner(e)}destroy(){for(consteofthis._ownersStack)this._unsubscribeOwner(e)}bridge(){returnthis._bridge}pushOwner(e){if(!e.alive.value())return;for(consteofthis._ownersStack)this._unsubscribeOwner(e);constt={owner:e};this._ownersStack.push(t),this._subscribeOwner(t)}_subscribeOwner(e){constt=e.owner;if(e.deathWatcher||(this._alive.setValue(!0),e.deathWatcher=t.alive.spawn(),e.deathWatcher.subscribe((t=>{t||this._deadHandler(e)}))),this._owner.setValue(t),!e.subscriptions){consti=e.subscriptions=[];this._visible.setValue(!1);consts=(e,t)=>{if(e){consts=e.spawn();i.push(s),s.subscribe((e=>{t.setValue(e)}),{callWithLast:!0})}elset.deleteValue()};s(t.container,this._container),s(t.width,this._width),s(t.height,this._height),s(t.fullscreen,this._fullscreen),s(t.detachable,this._detachable),s(t.fullscreenable,this._fullscreenable),
s(t.availWidth,this._availWidth),s(t.availHeight,this._availHeight),s(t.visible,this._visible)}}_unsubscribeOwner(e,t){if(e.subscriptions){for(consttofe.subscriptions)t.unsubscribe();e.subscriptions=null}t&&e.deathWatcher&&(e.deathWatcher.unsubscribe(),e.deathWatcher=null)}_deadHandler(e){constt=this._ownersStack.indexOf(e);(0,n.assert)(-1!==t,"sanitized owner should be in stack");for(lete=this._ownersStack.length-1;e>=t;e--)this._unsubscribeOwner(this._ownersStack[e],!0);this._ownersStack.length=t,t>0?this._subscribeOwner(this._ownersStack[t-1]):(this._alive.setValue(!1),this._owner.deleteValue())}}classOe{constructor(e){this._document=e,this.isFullscreen=newO.WatchedValue;constt=()=>{conste=["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"];for(lett=0;t<e.length;t++){consti=e[t];if(iinthis._document){this.isFullscreen.setValue(!!this._document[i]);break}}};t();for(constiof["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"])e.addEventListener(i,t,!1)}enter(){conste=this._document.documentElement;for(consttof["requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen"])if("function"==typeofe[t]){e[t]();break}this.isFullscreen.setValue(!0)}exit(){conste=this._document;for(consttof["exitFullscreen","mozCancelFullScreen","mozExitFullscreen","webkitExitFullscreen","msExitFullscreen"])if("function"==typeofe[t]){e[t]();break}this.isFullscreen.setValue(!1)}}classFe{constructor(e){lett;this.isVisible=newO.WatchedValue(!0);leti=null;for(constsof["","moz","ms","webkit"]){consto=s?`${s}Hidden`:"hidden";if(oine){t=`${s}visibilitychange`,i=()=>{this.isVisible.setValue(!e[o])},i(),e.addEventListener(t,i,!1);break}}this.destroy=()=>{i&&(e.removeEventListener(t,i,!1),i=null)}}}varWe,He=i(84015),ze=i(49483);!function(e){e.Quirks="quirks",e.Visual="visual"}(We||(We={}));functionUe(e,t){leti=0;for(const{min:s,max:o}oft){if(e<s||o<s)continue;constt=Math.min(e,o);if(i=Math.max(i,t),e===i)break}returni}functionje(e){constt=[];if(void0===e)return[];Array.isArray(e)||(e=[e]);for(constiofe){lete,s;isFinite(i)?e=s=Number(i):(e=+i.min,s=+i.max),(e<0||isNaN(e))&&(e=0),isNaN(s)&&(s=1/0),e<=s&&s>0&&t.push({min:e,max:s})}returnt.sort(((e,t)=>e.min-t.min||e.max-t.max)),t}functionGe(e,t){if(e.length!==t.length)return!1;for(leti=e.length;i--;){if(e[i].min!==t[i].min)return!1;if(e[i].max!==t[i].max)return!1}return!0}constqe=l.enabled("no_min_chart_width");var$e;!function(e){e[e.MinChartHeight=300]="MinChartHeight",e[e.MinChartWidth=300]="MinChartWidth",e[e.DefaultOffset=4]="DefaultOffset",e[e.ThinOffset=1]="ThinOffset",e[e.TopToolbarMargin=0]="TopToolbarMargin"}($e||($e={}));constKe=l.enabled("bypass_chart_height_check");functionYe(e){constt=l.enabled("side_toolbar_in_fullscreen_mode"),i=l.enabled("header_in_fullscreen_mode");return"center"===e||"left"===e&&t||"top"===e&&i}varZe=i(32544),Xe=i(60709),Je=i(16216),Qe=(i(7304),
i(16738)),et=i(83873),tt=i(87465),it=i(69109),st=i(72270);constot=(0,ne.getLogger)("Common.UndoStack");classnt{constructor(){this._commands=[],this._onChange=newae.Delegate}onChange(){returnthis._onChange}isEmpty(){return0===this._commands.length}size(){returnthis._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(einstanceofst.UndoCommand))thrownewTypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())returnvoidot.logDebug("pop: undo stack is empty");conste=this._commands.pop();returnthis._onChange.fire(e),e}head(){if(!this.isEmpty())returnthis._commands[this._commands.length-1]}}classrtextendsst.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return0===this._subcommands.length}redo(e){for(lett=0;t<this._subcommands.length;t++)this._subcommands[t].redo(e)}undo(e){for(lett=this._subcommands.length-1;t>=0;t--)this._subcommands[t].undo(e)}commands(){returnthis._subcommands}affectsState(){returnthis._subcommands.some((e=>e.affectsState()))}}classatextendsst.UndoCommand{constructor(e,t,i,s,o=!0){super(s,void0,o),this._setter=e,this._oldValue=t,this._newValue=i}redo(){this._setter(this._newValue)}undo(){this._setter(this._oldValue)}}classltextendsat{constructor(e,t,i,s,o=!0){super((e=>this._vwState.setValue(e)),t,i,s,o),this._vwState=e}}constct=(0,ne.getLogger)("Common.UndoHistory");varht=i(87296),dt=i(95804),ut=i(3354);const_t=newdt.TranslatedString("change chart layout to {title}",a.t(null,void0,i(68846)));classptextendsst.UndoCommand{constructor(e,t){super(_t.format({title:ut.layouts[t].title})),this._chartWidgetCollection=e,this._newLayoutType=t,this._oldLayoutType=e.layout.value()}redo(){this._chartWidgetCollection.setLayout(this._newLayoutType)}undo(){this._chartWidgetCollection.setLayout(this._oldLayoutType)}}varmt=i(78861),gt=i(68335),ft=i(48943),yt=i(62773);functionvt(e){constt={};return{promise:newPromise(((i,s)=>{e.subscribe(t,i,!0)})),destroy:()=>{e.unsubscribeAll(t)}}}varSt=i(26867),bt=i(82095),wt=i(29447);classCtextendsX.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){constt=this._chartWidgetCollection,s=t.activeChartWidget.value();returns.generalPropertiesDefinitions().then((o=>Promise.all([i.e(7871),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(8894),i.e(5743),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(1979),i.e(4495),i.e(9487),i.e(445),i.e(846),i.e(7827),i.e(9323),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(844),i.e(9590),i.e(4678),i.e(159),i.e(9965),i.e(9742),i.e(6043),i.e(1488),i.e(509),i.e(3014),i.e(4422),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(2475),i.e(769),i.e(9928),i.e(8604),i.e(5893),i.e(624),i.e(7078)]).then(i.bind(i,56080)).then((i=>{
constn=newi.GeneralChartPropertiesDialogRenderer({chartWidgetCollection:t,propertyPages:o,activePageId:this._activePageId,model:s.model()});returnthis._dialog?.hide(),this._dialog?.visible().unsubscribe(this._subscribe),this._dialog=n,n.visible().subscribe(this._subscribe),n.show(e),this._activePageId=void0,n}))))}hide(){this._dialog?.hide()}isVisible(){returnthis.visible().value()}focusOnText(){}setActivePage(e){this._activePageId=e}}classTtextendsX.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){this._load().then((t=>{this._dialog?.hide(),this._dialog?.visible().unsubscribe(this._subscribe),this._dialog=t,t.visible().subscribe(this._subscribe),t.show(e),ee.emit("compare_add")}))}hide(){this._dialog?.hide()}_load(){returnPromise.all([Promise.all([i.e(4040),i.e(7271)]).then(i.bind(i,43900)),Promise.all([i.e(8955),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(3359),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(445),i.e(846),i.e(6956),i.e(9002),i.e(2227),i.e(4931),i.e(9418),i.e(3179),i.e(4426),i.e(2475),i.e(731)]).then(i.bind(i,14283))]).then((([e,t])=>{consti=newe.CompareModel(this._chartWidgetCollection);returnt.getCompareDialogRenderer(i)}))}}varPt=i(12217),xt=i(95059);constMt=()=>i.e(4389).then(i.bind(i,67090));functionIt(e,t={}){returnMt().then((i=>i.copyToClipboardImageOfChart(e,t)))}functionAt(e,t={}){returnMt().then((i=>i.getImageOfChartSilently(e,t)))}varLt=i(11946);functionkt(e){constt=e.querySelector("#chart-aria-description");if(null!==t)returnt;consti=e.createElement("div");returni.id="chart-aria-description",i.tabIndex=-1,i.role="alert",i.ariaLive="assertive",e.body.appendChild(i),i}functionEt(e,t){consti={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:t?"2-digit":void0,minute:t?"2-digit":void0,hour12:!0};returnnewDate(1e3*e).toLocaleString(void0,i)}classDt{constructor(){this._ariaElement=null,this._customProvider=null,this._lastDescription=null,this._locale="en"}createElement(e){this._ariaElement=kt(e)}setCustomProvider(e){this._customProvider=e}setLocale(e){this._locale=e}asyncupdateChartDescription(e,t,i){consts=function(e){constt=ut.layouts[e];returnt?.count??1}(i),o=awaitthis._buildChartContext(e,t,s);if(null===o)return;if(this._customProvider){conste=awaitthis._customProvider(o);if(null!==e)returnvoidthis._setChartDescription(e)}if("en"!==this._locale)return;constn=function(e){constt=function(e){if(!l.enabled("aria_detailed_chart_descriptions")||!e.visibleData)return"";lett;try{t=function(e){lett=e.schema.findIndex((e=>"userTime"===e.type));t<0&&(t=e.schema.findIndex((e=>"time"===e.type)));if(t<0)thrownewError("Exported Data should contain `time`.");consti=Bt(e,(e=>"value"===e.type&&"series"===e.sourceType&&"close"===e.plotTitle),-1);if(i<0)thrownewError("Exported Data should contain `close`.")
i(16738)),et=i(83873),tt=i(87465),it=i(69109),st=i(72270);constot=(0,ne.getLogger)("Common.UndoStack");classnt{constructor(){this._commands=[],this._onChange=newae.Delegate}onChange(){returnthis._onChange}isEmpty(){return0===this._commands.length}size(){returnthis._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(einstanceofst.UndoCommand))thrownewTypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())returnvoidot.logDebug("pop: undo stack is empty");conste=this._commands.pop();returnthis._onChange.fire(e),e}head(){if(!this.isEmpty())returnthis._commands[this._commands.length-1]}}classrtextendsst.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return0===this._subcommands.length}redo(e){for(lett=0;t<this._subcommands.length;t++)this._subcommands[t].redo(e)}undo(e){for(lett=this._subcommands.length-1;t>=0;t--)this._subcommands[t].undo(e)}commands(){returnthis._subcommands}affectsState(){returnthis._subcommands.some((e=>e.affectsState()))}}classatextendsst.UndoCommand{constructor(e,t,i,s,o=!0){super(s,void0,o),this._setter=e,this._oldValue=t,this._newValue=i}redo(){this._setter(this._newValue)}undo(){this._setter(this._oldValue)}}classltextendsat{constructor(e,t,i,s,o=!0){super((e=>this._vwState.setValue(e)),t,i,s,o),this._vwState=e}}constct=(0,ne.getLogger)("Common.UndoHistory");varht=i(87296),dt=i(95804),ut=i(3354);const_t=newdt.TranslatedString("change chart layout to {title}",a.t(null,void0,i(68846)));classptextendsst.UndoCommand{constructor(e,t){super(_t.format({title:ut.layouts[t].title})),this._chartWidgetCollection=e,this._newLayoutType=t,this._oldLayoutType=e.layout.value()}redo(){this._chartWidgetCollection.setLayout(this._newLayoutType)}undo(){this._chartWidgetCollection.setLayout(this._oldLayoutType)}}varmt=i(78861),gt=i(68335),ft=i(48943),yt=i(62773);functionvt(e){constt={};return{promise:newPromise(((i,s)=>{e.subscribe(t,i,!0)})),destroy:()=>{e.unsubscribeAll(t)}}}varSt=i(26867),bt=i(82095),wt=i(29447);classCtextendsX.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){constt=this._chartWidgetCollection,s=t.activeChartWidget.value();returns.generalPropertiesDefinitions().then((o=>Promise.all([i.e(7871),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(8894),i.e(5743),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(1979),i.e(4495),i.e(9487),i.e(445),i.e(846),i.e(7827),i.e(9323),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(844),i.e(9590),i.e(4678),i.e(159),i.e(9965),i.e(9742),i.e(6043),i.e(1488),i.e(509),i.e(3014),i.e(4422),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(9026),i.e(769),i.e(9928),i.e(8604),i.e(5893),i.e(624),i.e(7078)]).then(i.bind(i,56080)).then((i=>{
constn=newi.GeneralChartPropertiesDialogRenderer({chartWidgetCollection:t,propertyPages:o,activePageId:this._activePageId,model:s.model()});returnthis._dialog?.hide(),this._dialog?.visible().unsubscribe(this._subscribe),this._dialog=n,n.visible().subscribe(this._subscribe),n.show(e),this._activePageId=void0,n}))))}hide(){this._dialog?.hide()}isVisible(){returnthis.visible().value()}focusOnText(){}setActivePage(e){this._activePageId=e}}classTtextendsX.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){this._load().then((t=>{this._dialog?.hide(),this._dialog?.visible().unsubscribe(this._subscribe),this._dialog=t,t.visible().subscribe(this._subscribe),t.show(e),ee.emit("compare_add")}))}hide(){this._dialog?.hide()}_load(){returnPromise.all([Promise.all([i.e(4040),i.e(7271)]).then(i.bind(i,43900)),Promise.all([i.e(8955),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(3359),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(445),i.e(846),i.e(6956),i.e(9002),i.e(2227),i.e(4931),i.e(9418),i.e(3179),i.e(4426),i.e(9026),i.e(731)]).then(i.bind(i,14283))]).then((([e,t])=>{consti=newe.CompareModel(this._chartWidgetCollection);returnt.getCompareDialogRenderer(i)}))}}varPt=i(12217),xt=i(95059);constMt=()=>i.e(4389).then(i.bind(i,67090));functionIt(e,t={}){returnMt().then((i=>i.copyToClipboardImageOfChart(e,t)))}functionAt(e,t={}){returnMt().then((i=>i.getImageOfChartSilently(e,t)))}varLt=i(11946);functionkt(e){constt=e.querySelector("#chart-aria-description");if(null!==t)returnt;consti=e.createElement("div");returni.id="chart-aria-description",i.tabIndex=-1,i.role="alert",i.ariaLive="assertive",e.body.appendChild(i),i}functionEt(e,t){consti={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:t?"2-digit":void0,minute:t?"2-digit":void0,hour12:!0};returnnewDate(1e3*e).toLocaleString(void0,i)}classDt{constructor(){this._ariaElement=null,this._customProvider=null,this._lastDescription=null,this._locale="en"}createElement(e){this._ariaElement=kt(e)}setCustomProvider(e){this._customProvider=e}setLocale(e){this._locale=e}asyncupdateChartDescription(e,t,i){consts=function(e){constt=ut.layouts[e];returnt?.count??1}(i),o=awaitthis._buildChartContext(e,t,s);if(null===o)return;if(this._customProvider){conste=awaitthis._customProvider(o);if(null!==e)returnvoidthis._setChartDescription(e)}if("en"!==this._locale)return;constn=function(e){constt=function(e){if(!l.enabled("aria_detailed_chart_descriptions")||!e.visibleData)return"";lett;try{t=function(e){lett=e.schema.findIndex((e=>"userTime"===e.type));t<0&&(t=e.schema.findIndex((e=>"time"===e.type)));if(t<0)thrownewError("Exported Data should contain `time`.");consti=Bt(e,(e=>"value"===e.type&&"series"===e.sourceType&&"close"===e.plotTitle),-1);if(i<0)thrownewError("Exported Data should contain `close`.")
;consts=Bt(e,(e=>"value"===e.type&&"series"===e.sourceType&&"low"===e.plotTitle),i),o=Bt(e,(e=>"value"===e.type&&"series"===e.sourceType&&"high"===e.plotTitle),i),n=Bt(e,(e=>"value"===e.type&&"series"===e.sourceType&&"open"===e.plotTitle),i),r=e.data.map((e=>({time:e[t],open:e[n],high:e[o],low:e[s],close:e[i]}))),a={start:r[0],close:r[r.length-1],low:r[0],high:r[0]};for(consteofr)e.high>a.high.high&&(a.high=e),e.low<a.low.low&&(a.low=e);returna}(e.visibleData)}catch(e){returneinstanceofError&&console.warn("Unable to generate chart description. "+e.message),""}consti=`The first price is ${e.priceFormatter.format(t.start.open)} at ${Et(t.start.time)}.`,s=`The last price is ${e.priceFormatter.format(t.close.close)} at ${Et(t.close.time)}.`,o=t.close.close-t.start.open,n=o/t.start.open*100,r=`The actual change in price was ${e.priceFormatter.format(o)}, corresponding to a percentage change of ${n.toFixed(2)}%.`;leta="";t.low.time!==t.start.time&&t.low.time!==t.close.time&&(a+=`The lowest price was ${e.priceFormatter.format(t.low.low)} at ${Et(t.low.time)}.`);t.high.time!==t.start.time&&t.high.time!==t.close.time&&(a+=` The highest price was ${e.priceFormatter.format(t.high.high)} at ${Et(t.high.time)}.`);return`${i}${s}${r}${a}`.trim()}(e),i=function(e){constt=e.description??e.symbol,i=e.chartTypeName,s=function(e){if(e.chartCount<=1)return"";return`Chart ${e.chartIndex+1} of ${e.chartCount}. `}(e);return`${s}${i} chart of ${t}`}(e);return`${i}. ${t}`}(o);this._setChartDescription(n)}staticgetInstance(){returnnull===this._instance&&(this._instance=newDt),this._instance}async_getExportData(e,t){return(awaitPromise.all([i.e(2578),i.e(9498)]).then(i.bind(i,99207))).exportData(e,t)}async_getData(e,t,i){consts=e.model().model();returnawaitthis._getExportData(s,{from:t,to:i,includeTime:!0,includeUserTime:!0})}_setChartDescription(e){if(!this._ariaElement)return;lett=e;e===this._lastDescription&&(t+="."),this._ariaElement.textContent=t,this._lastDescription=t}async_buildChartContext(e,t,i){consts=e.model().mainSeries().properties().childs().style.value(),o=s,n=(0,xt.getTranslatedChartStyleName)(s),r=e.model().mainSeries().symbolInfo(),a=e.model().timeScale(),c=a.visibleBarsStrictRange();if(!c)returnnull;consth=c.firstBar(),d=Math.min(c.lastBar(),a.baseIndex()),u=a.indexToTimePoint(h),_=a.indexToTimePoint(d);if(!u||!_)returnnull;letp;l.enabled("aria_detailed_chart_descriptions")&&(p=awaitthis._getData(e,u,_));constm=e.model().mainSeries().interval(),g=Re.Interval.parse(m).isIntraday();return{chartType:o,chartTypeName:n,symbol:e.model().mainSeries().symbol(),description:r?.description,symbolInfo:r,exchange:r?.exchange,ticker:r?.ticker,visibleData:p,visibleRange:{from:u,to:_},chartCount:i,chartIndex:t,priceFormatter:e.model().mainSeries().formatter(),interval:m,isIntraday:g}}}functionBt(e,t,i){consts=e.schema.findIndex(t);returns>=0?s:i}Dt._instance=null;varVt=i(10555),Rt=i(58978),Nt=i(24377),Ot=i(50279),Ft=i(27714),Wt=i(62153);classHt{constructor(e,t){this._isDestroyed=!1,
this._lollipopTooltipRenderer=null,this._activeLollipop=e,this._cardType=t,this._activeLollipop.subscribe((e=>{null===e&&this._destroyTooltip()}))}destroy(){this._destroyTooltip(),this._activeLollipop.release(),this._isDestroyed=!0}tryToHideTooltipByClickOutside(e,t,i){if(!this._isClickInsideTooltip(i)){if(void0!==i){consts=t(e,i);if(null!==s&&(0,Ot.default)(s,this._activeLollipop.value()))return}this._activeLollipop.setValue(null)}}asyncshowTooltip(e,t,s,o,r){consta=s();if(null===a||0===a.length)return;const{showLollipopTooltip:l}=awaitPromise.all([i.e(1681),i.e(1171),i.e(6032),i.e(2641),i.e(2227),i.e(3179),i.e(9039)]).then(i.bind(i,92892)),c=awaito();this._isDestroyed||((0,n.assert)(null===this._lollipopTooltipRenderer,"Lollipop tooltip renderer should be null before creating a new one"),this._lollipopTooltipRenderer=l({items:a,position:t,customCloseSubscriptions:r.customCloseSubscriptions,onClose:()=>r.onClose(e),onClickOutside:t=>r.onClickOutside(e,t),onSizeChanged:r.onSizeChanged,showScrollFades:!0,cardType:this._cardType,theme:c}))}_isClickInsideTooltip(e){returnnull!==this._lollipopTooltipRenderer&&void0!==e&&this._lollipopTooltipRenderer.isClickInside(e)}_destroyTooltip(){this._lollipopTooltipRenderer?.hide(),this._lollipopTooltipRenderer=null}}varzt,Ut=i(2383),jt=i(94602),Gt=i(6453),qt=i(69558),$t=i(58221),Kt=i(33350),Yt=i(4539);!function(e){e[e.SizeDelta=1]="SizeDelta"}(zt||(zt={}));classZt{constructor(e,t,i){this._data=e,this._hittest=t,this._textWidthCache=i}draw(e,t){const{horizontalPixelRatio:i,verticalPixelRatio:s}=t,o=this._data.centerPoint,n=Math.round(o.x*i),r=Math.round(o.y*s),a=Math.max(1,Math.floor(i))%2/2,l=Math.max(1,Math.floor(s))%2/2,c=newVt.Point(n+a,r-l);this._drawLollipop(e,c,t),this._drawLabel(e,c,t)}hitTest(e){constt=(0,Yt.interactionTolerance)().esd,i=this._data.centerPoint.y-this._data.style.lollipop.height/2-t,s=this._data.centerPoint.x-this._data.style.lollipop.width/2-t,o=(0,Vt.box)(newVt.Point(s,i),newVt.Point(s+this._data.style.lollipop.width+2*t,i+this._data.style.lollipop.height+2*t));return(0,Gt.pointInBox)(e,o)?this._hittest:null}_drawLollipop(e,t,i){consts=this._data.style,{horizontalPixelRatio:o}=i,n=this._fillRadius(o);s.lollipop.fillCircle&&s.lollipop.backgroundColor&&this._drawFilledCircle(e,t,n,s.lollipop.backgroundColor);constr=Math.round(s.lollipop.lineWidth*o),a=n-Math.round(1*o+r/2);this._drawBorderLine(e,t,r,a),s.lollipop.fillCircle&&s.lollipop.fillStyle&&this._drawFilledCircle(e,t,a,s.lollipop.fillStyle)}_drawLabel(e,t,i){consts=this._data.style.lollipop.text,o=s.label;if(""===o)return;const{horizontalPixelRatio:n,verticalPixelRatio:r}=i;e.textAlign="center",e.textBaseline="middle",e.fillStyle=s.strokeStyle,e.font=s.font;consta=this._textWidthCache.yMidCorrection(e,o);e.translate(t.x,t.y+((s.deltaY||0)+a)*r),(0,Kt.drawScaled)(e,n,r,(()=>{e.fillText(o,0,0)}))}_fillRadius(e){constt=this._data.style,i=Math.max(1,Math.floor(e));lets=Math.round(t.lollipop.width*e);returns%2!=i%2&&(s+=1),s/2}_drawBorderLine(e,t,i,s){consto=this._data.style
returnthis._collapsed.value()}setCollapsed(e){this._collapsed.setValue(e)}collapsed(){returnthis._collapsed.readonly()}isJustClonedChart(){return!!(this._options||{}).justCloned}removeAllDrawingTools(){!!this.model().model().allLineTools().find((e=>e.isLocked?.()))?(0,cg.confirmRemovingLockedLineTools)(cg.DeleteLockedLineToolReason.RemoveAll).then((e=>{this.model().removeAllDrawingTools(e)})):this.model().removeAllDrawingTools(!0)}removeAllStudies(){this.model().removeAllStudies()}removeAllStudiesDrawingTools(){!!this.model().model().allLineTools().find((e=>e.isLocked?.()))?(0,cg.confirmRemovingLockedLineTools)(cg.DeleteLockedLineToolReason.RemoveAll).then((e=>{this.model().removeAllStudiesAndDrawingTools(e)})):this.model().removeAllStudiesAndDrawingTools(!0)}removeSelectedSources(){this.removeDataSources(this.model().selection().dataSources())}removeDataSources(e){constt=this.model(),i=e.filter((e=>e!==t.mainSeries()&&e!==t.lineBeingCreated()&&e.isUserDeletable()));if(0===i.length)return;lets=null;(0,Ws.isStudy)(i[0])&&((0,n.assert)(1===i.length,"Cannot remove several studies (no multi select for studies)"),s=i[0]);i.find((e=>e.hasAlert().value()));consto=!!i.find((e=>(0,zs.isLineTool)(e)&&e.isLocked?.()));if(s&&s.hasChildren()){conste=s.getAllChildren().map((e=>e.name(!0)));(0,fs.showDeleteStudyTreeConfirm)(e,(()=>{t.removeSelectedSources()}))}elseo?(0,cg.showDeleteLockedLineToolsConfirm)(cg.DeleteLockedLineToolReason.RemoveSelected,(e=>{e||t.selectionMacro((e=>{i.filter((e=>(0,zs.isLineTool)(e)&&e.isLocked?.())).forEach((t=>{e.removeSourceFromSelection(t)}))})),t.removeSelectedSources()})):t.removeSelectedSources()}getSymbol(e){if(!this._model)returnthis._setSymbolIntervalContentOverrides.symbol||window.DEFAULT_SYMBOL;if(!e)returnthis._symbolWV.value();constt=this._model.mainSeries().properties().childs();returnt.shortName&&t.shortName.value()?t.shortName?.value()??"":t.symbol?.value()??""}setSymbol(e){this._model?(this._symbolWV.setValue(e),this._model.setSymbol(this._model.mainSeries(),e)):(this._mainSeriesProperties.merge({symbol:e}),this._symbolWV.setValue(e),this._setSymbolIntervalContentOverrides.symbol=e)}setResolution(e){this._model?(this._resolutionWV.setValue(e),this._model.setResolution(this._model.mainSeries(),e)):(this._mainSeriesProperties.merge({interval:e}),this._resolutionWV.setValue(e),this._setSymbolIntervalContentOverrides.interval=e)}getResolution(){returnthis._resolutionWV.value()}symbolWV(){returnthis._symbolWV.readonly()}symbolInfoWV(){returnthis._symbolInfoWV}resolutionWV(){returnthis._resolutionWV.readonly()}loadRange(e){if(this._model){this.screen.show();this._model.loadRange(e)||this.screen.hide()}}asyncshowGeneralChartProperties(e,t){if(!l.enabled("show_chart_property_page"))returnPromise.resolve(null);consts=awaitthis._showChartProperties(this.model().mainSeries(),e,{doNotCloseOnBgClick:!0,onResetToDefault:async()=>{this.model().restorePreferences()
returnnull!==this._timeAxisWidget?this._timeAxisWidget.size.height:0}withModel(e,t){null!==this._model?t.call(e):this.modelCreated().subscribe(e,t,!0)}hasModel(){returnnull!==this._model}onRedraw(){returnthis._redraw}copyLineToOtherCharts(){conste=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources().filter((e=>e.isSynchronizable()));e.model().copyToOtherCharts(t,!0)}toggleLockSelectedObject(){conste=this.model();e.selection().lineDataSources().forEach((t=>{consti=t.properties().frozen.value();e.setProperty(t.properties().frozen,!i,(i?Sg:bg).format({title:newdt.TranslatedString(t.name(),t.title(pa.TitleDisplayTarget.StatusLine))}),Wr.lineToolsDoNotAffectChartInvalidation)}))}hideDataSources(e){if(e.length){constt=e.map((e=>e.properties().visible)),i=e.map((()=>!1));this.model().setProperties(t,i,vg.format({title:newdt.TranslatedString(e[0].name(),e[0].title(pa.TitleDisplayTarget.StatusLine))}))}}hideSelectedObject(){this.hideDataSources(this.model().selection().dataSources().filter((e=>!0)))}unlinkSelectedLine(){conste=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources();e.unlinkLines(t)}paneWidgetsWV(){returnthis._paneWidgets}paneWidgets(){returnthis._paneWidgets.value()}paneWidgetSeparators(e){constt=this.paneWidgets().indexOf(e),i={};returnthis._paneSeparators.forEach((e=>{e.topPaneIndex()===t&&(i.separatorBelow=e),e.bottomPaneIndex()===t&&(i.separatorAbove=e)})),i}activePaneWidget(){returnthis._activePaneWidget.readonly()}paneByState(e){returnthis._paneWidgets.value().find((t=>t.hasState()&&t.state()===e))??null}paneByCanvas(e){returnthis._paneWidgets.value().find((t=>t.hasCanvas(e)))??null}timeAxisByCanvas(e){returnthis._timeAxisWidget?.hasCanvas(e)?this._timeAxisWidget:null}selectPointMode(){return(0,n.ensureNotNull)(this._model).model().selectPointMode()}cancelRequestSelectPoint(){conste=(0,n.ensureNotNull)(this._model).model();e.cancelRequestSelectPoint(),e.setReplayStatus(e.isInReplay().value()?3:0),e.clearCurrentPosition()}requestSelectPoint(e,t){consti=(0,n.ensureNotNull)(this._model);returne.selectPointMode===mt.SelectPointMode.Replay&&i.model().setReplayStatus(1),newPromise(((s,o)=>{constn=()=>!!this.isVisible()||(o("Chartwidget must be visible"),this.cancelRequestSelectPoint(),!1);if(!n())return;(0,mt.resetToCursor)(!0),i.lineBeingCreated()&&i.cancelCreatingLine();letr=!1;consta={};i.model().onPointSelected().subscribe(a,((e,t)=>{r=!0,this._isVisible.unsubscribe(n),this._hideHint(),s({point:e,pane:t})}),!0),i.model().requestSelectPoint(e),this.startTrackingMode(),void0!==t&&this._showEventHint(t),this._isVisible.subscribe(n),this.selectPointMode().subscribe((()=>{setTimeout((()=>{r||(this.selectPointMode().value()===mt.SelectPointMode.None&&this._hideHint(),i.model().onPointSelected().unsubscribeAll(a),this._isVisible.unsubscribe(n),o("cancelled"))}))}),{once:!0})}))}showReplayOrderConfirmationDialog(){returnthis.model().isInReplay().value(),Promise.resolve()}showSourceProperties(e,t){e===this.model().mainSeries()&&(t=Ns.TabNames.symbol),
null!==c&&c(),r=null}}classAf{constructor(e,t,i){this.handler=e,this.customId=t,this.singleShot=i}}functionLf(e,t){return`${e}__${t}`}functionkf(e){for(consttofObject.keys(e)){consti=e[t];if((0,tt.isObject)(i))thrownewError(`Study with non-simple inputs cannot be created: ${t}=${JSON.stringify(i)}`)}returne}classEf{constructor(e,t,i,s){this.sessionid="",this._chartApiMessagerProvider=e,this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._metadataRequestNextNumber=1,this._studyMetaInfoCache=i,this.studiesAccessController=s,this._connected=!1,this._enabled=!1,this._studyEngine=t,this._callbacks={},this._serverTimeOffset=0,this._studyEngine.on("configuration_received",(()=>{this._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",((...e)=>{constt=e[0];if(!Array.isArray(t)||t.length<6)return;consti={time:t.value[0]/1e3,open:t.value[1],high:t.value[2],low:t.value[3],close:t.value[4],volume:t.value[5]};this._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={},this._studySpecs=newMap,this._isNonCountedStudy=()=>!0,this.defaultResolutions=this.defaultResolutions.bind(this)}destroy(){this._studyEngine.destroy(),this._studyEngine=null}purgeCache(){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache()}resetCache(){this._studyEngine.resetCache()}defaultResolutions(){returnthis._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]}availableCurrencies(){conste=this._studyEngine.supportedCurrencies().map((e=>"string"==typeofe?{id:e,code:e}:e));returnPromise.resolve(e)}availableUnits(){returnPromise.resolve(this._studyEngine.supportedUnits())}asyncavailablePriceSources(e){returnawaitthis._studyEngine.supportedPriceSources(e)??[]}supportedSymbolsTypes(){returnthis._studyEngine.supportedSymbolsTypes()??[]}symbolsGrouping(){conste={};for(const[t,i]ofObject.entries(this._studyEngine.symbolsGrouping()))e[t]=iinstanceofRegExp?i:newRegExp(i);returne}start(){this._enabled=!0,this._fireEvent("start_enabled")}unsubscribe(e,t){consti=this._callbacks[e];i&&i.splice(i.indexOf(t),1)}on(e,t){returnthis._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}chartCreateSession(e,t){returnthis._studyEngine.chartCreateSession(e),!1}chartDeleteSession(e){returnthis._studyEngine.chartDeleteSession(e),!1}createSession(e,t){this._chartApiMessagerProvider.createChartApiMessager(e,this),this._sessions[e]=t,this._notificationHandlers[e]={},this.connected()&&t.onMessage({method:"connected",params:[]})}removeSession(e){deletethis._sessions[e],deletethis._notificationHandlers[e],this._studyEngine.stopSources(e)}connected(){returnthis._connected}connect(){this._enabled?this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]})):this.on("start_enabled",(()=>{this.connect()}))}disconnect(){this._connected=!1,this._notifySessions({method:"disconnected",params:[]}),this.purgeCache(),this.studyCounter=0}
switchTimezone(e,t){returnthis._studyEngine.switchTimezone(e,t),!1}receiveLocalResponse(e){this._dispatchNotification(e),this._fireEvent("message_"+e.method,void0,!0)}getMarks(e,t,i,s,o){constn=s;this._studyEngine.getMarks(e,t,i,n,o)}getTimescaleMarks(e,t,i,s,o){constn=s;this._studyEngine.getTimescaleMarks(e,t,i,n,o)}resolveSymbol(e,t,i,s){returnthis._notificationHandlers[e][t]=newAf(s,t),this._studyEngine.resolveSymbol(e,t,i),!1}requestFirstBarTime(e,t,i,s){thrownewError("Method not implemented.")}createSeries(e,t,i,s,o,n,r,a){this._notificationHandlers[e][t]=newAf((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t);constl={countBack:n||300};returnnull!==r&&"time-range"===r.type&&(l.to=1e3*r.to,l.from=1e3*r.from),this._studyEngine.createSeries(e,t,i,s,o,l),!1}removeSeries(e,t){returndeletethis._notificationHandlers[e][t],this._studyEngine.removeSeries(e,t),!1}setVisibleTimeRange(e,t,i,s,o,r,a,l,c,h){letd=s,u=!0!==(a=a||{}).applyDefaultRightMargin&&void0===a.percentRightMargin&&void0!==o?o:null;const_=(0,Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,t)),(0,n.ensureNotNull)(this._studyEngine.getSeriesSymbolInfo(e,t)));null!==_&&(d=_.timeToSessionStart(1e3*d)/1e3,null!==u&&(u=_.timeToSessionStart(1e3*u)/1e3));constp=()=>{consts=this._studyEngine.sessionTimeScale(e);if(null===s)returnvoid(h&&h(newError("Session time scale is not available")));consto=s.indexOfTime(1e3*d);let_;if(null===u)_=s.lastSessionBarIndex();else{conste=s.indexOfTime(1e3*u);_=e&&e.index}if(null===o||null===_)returnvoid(h&&h(newError("Bars are not available")));letp=o.index;if(o.timeMs<1e3*d&&(p+=1),!1===r){conste=(0,n.ensureNotNull)(s.firstSessionBarIndex());p<e&&(p=e)}p>_?h&&h(newError("Invalid visible range")):(this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesTimeframeUpdate(t,i,p,_,a,c),l&&setTimeout(l,0))};if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*s))returnvoidp();constm=this._chartApiMessagerProvider.getChartApiMessager(e).beforeSeriesCompleted,g=this._chartApiMessagerProvider.getChartApiMessager(e).seriesError;functionf(e,s){e===t&&s===i&&(m.unsubscribe(null,f),g.unsubscribe(null,y),p())}functiony(e,s){e===t&&s===i&&m.unsubscribe(null,f)}void0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=window.setTimeout((()=>{deletethis._setVisibleRangeTimeout[e],m.subscribe(null,f,!0),g.subscribe(null,y,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*s)}),0)}modifySeries(e,t,i,s,o,n,r,a){returnthis._notificationHandlers[e][t]=newAf((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t),this._studyEngine.modifySeries(e,t,s,o,i,n),!1}requestMoreData(e,t,i,s){consto="number"==typeoft?t:i;returnthis._studyEngine.extendSeriesRange(e,o),!1}allStudiesMetadata(){returnthis._studyMetaInfoCache.studiesMetadata()}requestMetadata(){returnnewPromise((e=>{constt=this.studiesAccessController.getEnabledTools();e({
method:"studies_metadata",params:["metadata_"+this._metadataRequestNextNumber++,{errors:[],hash:"",metainfo:t,migrations:[]}]})}))}setIsNonCountedStudyFn(e){this._isNonCountedStudy=e}canCreateStudy(e,t,i){returnthis._isNonCountedStudy(t.id)||this.studyCounter<210?{success:!0}:{success:!1,reason:"general",limitValue:210}}getStudyCounter(e){returnthis.studyCounter}getFundamentalCounter(e){return0}createStudy(e,t,i,s,o,n,r,a){if(!this.canCreateStudy(e,a).success){conste=newError("Exceeded the limit of studies");throwe.cause="TooManyStudies",e}returnthis._notificationHandlers[e][t]=newAf(r,t),this._studySpecs.set(Lf(e,t),a),this._studyEngine.createStudy(e,t,s,i,o,kf(n)),this._isNonCountedStudy(a.id)||this.studyCounter++,!0}removeStudy(e,t){if(this._notificationHandlers[e][t]){deletethis._notificationHandlers[e][t];consti=Lf(e,t),s=(0,n.ensureDefined)(this._studySpecs.get(i));this._studySpecs.delete(i),this._studyEngine.removeStudy(e,t),this._isNonCountedStudy(s.id)||this.studyCounter--}return!1}modifyStudy(e,t,i,s,o,n){returnthis._notificationHandlers[e][t]=newAf(o,t),this._studyEngine.modifyStudy(e,t,i,kf(s)),!1}notifyStudy(e,t,i,s){thrownewError("Method not implemented.")}createPointset(e,t,i,s,o,n,r){returnthis._notificationHandlers[e][t]=newAf(r,t),this._studyEngine.createPointset(e,t,s,o,n),!1}modifyPointset(e,t,i,s,o){thrownewError("Method not implemented.")}removePointset(e,t){returnthis._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t),!1}requestMoreTickmarks(e,t,i,s){returnthis._studyEngine.requestMoreTickmarks(e,i),!1}setFutureTickmarksMode(e,t){thrownewError("Method not implemented.")}serverTime(){returnthis._studyEngine.serverTime()}quoteCreateSession(e){returnthis._studyEngine.quoteCreateSession(e),!1}quoteDeleteSession(e){returnthis._studyEngine.quoteDeleteSession(e),!1}quoteAddSymbols(e,t){return-1!==t.indexOf(void0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((e=>!!e))),this._studyEngine.quoteAddSymbols(e,t),!1}quoteRemoveSymbols(e,t){returnthis._studyEngine.quoteRemoveSymbols(e,t),!1}quoteFastSymbols(e,t){returnthis._studyEngine.quoteFastSymbols(e,t),!1}quoteSetFields(e,t){returnthis._studyEngine.quoteSetFields(e,t),!1}quoteHibernateAll(e){returnthis._studyEngine.quoteHibernateAll(e),!1}searchSymbols(e,t,i,s,o){this._studyEngine.searchSymbols(e,t,i,s,o)}depthCreateSession(e){this._studyEngine.depthCreateSession(e)}depthDeleteSession(e){this._studyEngine.depthDeleteSession(e)}depthSetSymbol(e,t){this._studyEngine.depthSetSymbol(e,t)}depthClearSymbol(e){}depthSetScale(e,t){}_applyTimeFrame(e,t,i,s,o){letr,a,l={},c=!0;if("period-back"===o.type){constt=this._studyEngine.getSeriesLastBarTime(e,i);if(null===t)return;a=t/1e3;consts=Re.Interval.parse(o.value),h=(0,n.ensureNotNull)(this._studyEngine.getSeriesSymbolInfo(e,i));r=(0,Td.alignPeriodsBackForVisibleRange)(h.session,h.session_holidays,h.corrections,s.letter(),s.multiplier(),1,t)/1e3;constd=(0,Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,i)),h)
xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},circle:{name:"LineToolCircle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},path:{name:"LineToolPath"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"},emoji:{name:"LineToolEmoji"},sticker:{name:"LineToolSticker"},regression_trend:{name:"LineToolRegressionTrend"},fixed_range_volume_profile:{name:"LineToolFixedRangeVolumeProfile"}};constFf=newae.Delegate;varWf=i(44862),Hf=i(51829);functionzf(e,t,i){if(i.isDays())returnt;if(e.moveTo(1e3*t),i.isIntraday()){consti=e.indexOfBar(1e3*t);if(i<0)thrownewError(`${t} is out of the instrument session `);returne.endOfBar(i)/1e3}returne.startOfBar(Hf.SessionStage.LASTBAR_SESSION)/1e3}classUf{constructor(e){this._timeScale=e}coordinateToTime(e){constt=this._timeScale.coordinateToIndex(e);returnthis._timeScale.indexToTimePoint(t)}barSpacingChanged(){returnthis._timeScale.barSpacingChanged()}rightOffsetChanged(){returnthis._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){returnthis._timeScale.barSpacing()}rightOffset(){returnthis._timeScale.rightOffset()}width(){returnthis._timeScale.width()}defaultRightOffset(){returnthis._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){returnthis._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){returnthis._timeScale.usePercentageRightOffset().spawn()}isEmpty(){returnthis._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){returnthis._timeScale.points().size()}leftVisibleBarUTCTime(){conste=this._timeScale.visibleBarsStrictRange()?.firstBar()??null;returnnull===e?null:this._timeScale.indexToTimePoint(e)}}
constjf=newdt.TranslatedString("change timezone",a.t(null,void0,i(20137)));classGf{constructor(e){this._onTimezoneChanged=newae.Delegate,this._chartWidget=e,this._timezoneProperty=e.properties().childs().timezone,this._timezoneProperty.subscribe(this,(e=>{this._onTimezoneChanged.fire(e.value())})),e.onAboutToBeDestroyed().subscribe(this,(()=>{this._timezoneProperty.unsubscribeAll(this)}),!0)}availableTimezones(){returnPe.availableTimezones}getTimezone(){conste=this._timezoneProperty.value();return(0,n.ensureDefined)(this.availableTimezones().find((t=>t.id===e)))}setTimezone(e,t){(0,n.assert)((0,Pe.timezoneIsAvailable)(e),`Incorrect timezone: ${e}`),t?.disableUndo?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,jf)}onTimezoneChanged(){returnthis._onTimezoneChanged}}classqf{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){conste=this._priceScale.properties().childs();returne.percentage.value()?2:e.indexedTo100.value()?3:e.log.value()?1:0}setMode(e){this._priceScale.setMode({percentage:2===e,log:1===e,indexedTo100:3===e})}isInverted(){returnthis._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){returnthis._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){returnthis._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){returnthis._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){returnthis._priceScale.hasMainSeries()}getStudies(){returnthis._priceScale.getStudies().map((e=>e.id()))}currency(){conste=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);returnnull===t?null:{readOnly:t.readOnly,selectedCurrency:t.selectedCurrency,originalCurrencies:Array.from(t.originalCurrencies),currencies:e.getItems().filter((e=>!t.baseCurrencies.has(e))),symbols:Array.from(t.symbols)}}setCurrency(e){constt=this.currency()?.currencies;t&&e&&!t.includes(e)?console.warn("The provided currency is not supported by your datafeed!"):this._chartUndoModel.setPriceScaleCurrency(this._priceScale,e)}unit(){conste=this._chartModel.availableUnits(),t=this._priceScale.unit(e);returnnull===t?null:{readOnly:0===t.availableGroups.size,selectedUnit:t.selectedUnit,originalUnits:Array.from(t.originalUnits),availableGroups:Array.from(t.availableGroups),symbols:Array.from(t.symbols)}}setUnit(e){!e||this._chartModel.availableUnits().unitGroupById(e)?this._chartUndoModel.setPriceScaleUnit(this._priceScale,e):console.warn("The provided unit is not supported by your datafeed!")}coordinateToPrice(e){constt=this._priceScale.mainSource()?.firstValue();returnnull==t?null:this._priceScale.coordinateToPrice(e,t)}measureUnitId(){conste=this._priceScale.measureUnitId(this._chartModel.availableUnits());returnnull===e?null:{selectedMeasureUnitId:e.selectedMeasureUnitId}}}function$f(e){
return{id:e.id(),name:(t=e.toolname,Object.keys(Of).find((e=>Of[e].name===t))||null)};vart}functionKf(e){return{id:e.id(),name:e.metaInfo().description}}constYf=newdt.TranslatedString("change pane height",a.t(null,void0,i(14691)));classZfextendsst.UndoCommand{constructor(e,t,i){super(Yf),this._model=e,this._paneIndex=t,this._paneHeight=i,this._prevStretchFactors=this._model.panes().map((e=>e.stretchFactor()))}redo(){this._model.changePanesHeight(this._paneIndex,this._paneHeight)}undo(){conste=this._model.panes();for(lett=0;t<e.length;++t)e[t].setStretchFactor((0,n.ensureDefined)(this._prevStretchFactors[t]));this._model.fullUpdate()}}classXf{constructor(e,t){this._priceScales=newWeakMap,this._pane=e,this._chartWidget=t}hasMainSeries(){returnthis._pane.containsMainSeries()}getLeftPriceScales(){returnthis._pane.leftPriceScales().map(this._getPriceScaleApi,this)}getRightPriceScales(){returnthis._pane.rightPriceScales().map(this._getPriceScaleApi,this)}getMainSourcePriceScale(){conste=this._pane.mainDataSource();if(null===e)returnnull;constt=e.priceScale();returnnull===t||this._pane.isOverlay(e)?null:this._getPriceScaleApi(t)}getPriceScaleById(e){constt=this._pane.getPriceScaleById(e);returnnull===t?null:this._getPriceScaleApi(t)}setMaximized(e){this._pane.maximized().value()!==e&&this._chartWidget.model().toggleMaximizedPane(this._pane)}isMaximized(){returnthis._pane.maximized().value()}legendLoaded(){conste=this._chartWidget.paneByState(this._pane);returnBoolean(e&&e.statusWidget())}getAllEntities(){conste=this._pane.model();returnthis._pane.sourcesByGroup().allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){returnt===e.mainSeries()?function(e){return{id:e.id(),name:"Main Series"}}(e.mainSeries()):(0,Ws.isStudy)(t)?Kf(t):(0,zs.isLineTool)(t)?$f(t):null}(e,t))).filter(tt.notNull).filter((e=>null!==e.name))}getHeight(){returnthis._pane.height()}setHeight(e){constt=this._chartWidget.model().model(),i=t.panes();(0,n.assert)(i.length>1,"Unable to change pane's height if there is only one pane");consts=i.indexOf(this._pane);(0,n.assert)(-1!==s,"Invalid pane index");consto=newZf(t,s,e);this._chartWidget.model().undoHistory().pushUndoCommand(o)}moveTo(e){constt=this.paneIndex();t!==e&&((0,n.assert)(e>=0&&e<this._chartWidget.paneWidgets().length,"Invalid pane index"),this._chartWidget.model().movePane(t,e))}paneIndex(){returnthis._chartWidget.model().model().panes().indexOf(this._pane)}collapse(){if(1===this._chartWidget.model().panes().length)thrownewError("Cannot collapse a single pane!");if(this._pane.collapsed().value())thrownewError("Cannot collapse current pane!");this._chartWidget.model().toggleCollapsedPane(this._pane)}restore(){if(1===this._chartWidget.paneWidgets().length)thrownewError("Cannot restore a single pane!");if(!this._pane.collapsed().value())thrownewError("Cannot restore current pane!");this._chartWidget.model().toggleCollapsedPane(this._pane)}isCollapsed(){returnthis._pane.collapsed().value()}_getPriceScaleApi(e){
lett=this._priceScales.get(e);returnvoid0===t&&(t=newqf(this._chartWidget.model(),e),this._priceScales.set(e,t)),t}}varJf=i(3618);functionQf(e){returnvoid0===e.inputs?[]:e.inputs.map((e=>({...e,id:e.id,localizedName:void0!==e.name?(0,Jf.getTranslatedInputTitle)(e.name):""})))}functioney(e){constt={};if(e.defaults){consti=(0,Al.default)(e.defaults);t.defaults=i}returnvoid0!==e.plots&&(t.plots=(0,Al.default)(e.plots)),void0!==e.styles&&(t.styles=(0,Al.default)(e.styles)),void0!==e.bands&&(t.bands=(0,Al.default)(e.bands)),void0!==e.filledAreas&&(t.filledAreas=(0,Al.default)(e.filledAreas)),void0!==e.palettes&&(t.palettes=(0,Al.default)(e.palettes)),t}varty=i(82130);classiy{constructor(e,t){this._onStudyCompleted=newae.Delegate,this._onStudyError=newae.Delegate,this._isStudyDestroyed=!1,this._study=e,this._chartWidget=t,this._undoModel=this._chartWidget.model(),this._model=this._undoModel.model(),this._study.onAboutToBeDestroyed().subscribe(this,(()=>{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this),this._isStudyDestroyed=!0})),this._study.onStatusChanged().subscribe(this,(e=>{switch(e.type){casegh.StudyStatusType.Completed:this._onStudyCompleted.fire();break;casegh.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){returnthis._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){returnQf(this._study.metaInfo())}getInputValues(){conste=this._study.inputs({symbolsForChartApi:!1,asObject:!0});returnObject.keys(e).map((t=>{consti=e[t];return{id:t,value:(0,tt.isObject)(i)?i.v:i}}))}getStyleInfo(){returney(this._study.metaInfo())}getStyleValues(){const{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}=this._study.properties().state();return{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}}setInputValues(e){constt=this.getInputValues();for(constiofe){void0!==t.find((e=>e.id===i.id))?this._study.properties().childs().inputs.childs()[i.id].setValue(i.value):console.warn(`There is no such input: "${i.id}"`)}}mergeUp(){this._model.isMergeUpAvailableForSource(this._study)&&newla(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&newca(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&newna(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&newoa(this._model,this._study,null).redo()}paneIndex(){returnthis._model.panes().indexOf(this._model.paneForSource(this._study))}onDataLoaded(){returnthis._onStudyCompleted}onStudyError(){returnthis._onStudyError}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._study)&&this._undoModel.mergeSourceUp(this._study)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._study)&&this._undoModel.mergeSourceDown(this._study)}unmergeUpWithUndo(){
this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceUp(this._study)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceDown(this._study)}priceScale(){returnnewqf(this._undoModel,(0,n.ensureNotNull)(this._study.priceScale()))}symbolSource(){conste=(0,n.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){returnthis._study.currency()}changePriceScale(e){constt=(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())),i=(0,n.ensureNotNull)(this._model.paneForSource(this._study));switch(e){case"no-scale":(0,n.assert)(i.actionNoScaleIsEnabled(this._study),"Unable to leave a pane without any non-overlay price scale"),newTl(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,n.assert)(i===t,"Study should be on the main pane"),newPl(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":newTl(this._model,this._study,i,"left",null).redo();break;case"new-right":newTl(this._model,this._study,i,"right",null).redo();break;default:consts=this._model.dataSourceForId(e);if(null===s)thrownewError(`There is no study with entityId='${e}'`);consto=i===this._model.paneForSource(s);(0,n.assert)(o,"Both studies should be on the same pane");constr=(0,n.ensureNotNull)(s.priceScale()),a=kr(this._study,r,this._model),l=ih(this._study,r,this._model);newPl(this._model,this._study,i,r,null).redo(),null!==a&&newbl(this._model,r,a,null).redo(),null!==l&&newwl(this._model,r,l,null).redo()}}isVisible(){returnthis._study.properties().childs().visible.value()}setVisible(e){this._study.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._study])}sendToBack(){this._model.sendToBack([this._study])}applyOverrides(e){(0,Wf.applyOverridesToStudy)(this._study,e)}hasPlots(){returnthis._study.metaInfo().plots.length>0}dataLength(){if(this._study.status().type!==gh.StudyStatusType.Completed)return0;returnthis._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){conste=this._study.status();returne.type===gh.StudyStatusType.Undefined||e.type===gh.StudyStatusType.Loading}hasError(){returnthis._study.status().type===gh.StudyStatusType.Error}hasPendingUnresolvedSymbols(){returnthis._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,ty.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){returnthis._study.graphicsViewsReady()}properties(){returnthis._study.properties()}setProperties(e){this._study.properties().mergeAndFire(e)}asyncapplyToEntireLayout(){const{ActionsProvider:e}=await(0,Go.actionsProviderModule)();if(this._isStudyDestroyed)return;constt=newe(this._chartWidget),i=(awaitt.contextMenuActionsForSources([this._study],(0,n.ensureNotNull)(this._chartWidget.model().paneForSource(this._study)))).find((e=>"applyStudyToEntireLayout"===e.id));i&&i.execute()}status(){return{
...this._study.status()}}title(){returnthis._study.title(pa.TitleDisplayTarget.StatusLine)}symbolsResolved(){returnthis._study.symbolsResolved()}study(){returnthis._study}}constsy=newMap([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);functionoy(e){constt=sy.get(e.toolname);if(void0!==t)returnt;consti=e.pointsCount();return-1===i?e.points().length:i}functionny(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}constry=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];classay{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){returnthis._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){returnthis._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){returnthis._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){returnthis._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(e,t){returnthis._source.properties().state(ry,e,t)}setProperties(e,t){(0,yi.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,yi.allowSavingDefaults)(!1)}getPoints(){lete=this._source.points();constt=oy(this._source);returne.length>t&&((0,n.assert)(ny(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;constt=oy(this._source);if(t!==e.length)thrownewError(`Wrong points count. Required: ${t}, provided: ${e.length}`);consti=this._pointsConverter.apiPointsToDataSource(e);this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource())),this._model.changeLinePoints(this._source,i),this._model.endChangingLinetool(!0),this._source.createServerPoints()}getAnchoredPosition(){returnthis._source.positionPercents()}setAnchoredPosition(e){constt=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void0===t||null===i||null===s)return;consto={logical:s,screen:t},n=newMap;n.set(i,e),this._model.startMovingSources([this._source],o,null,newMap),this._model.moveSources(o,n),this._model.endMovingSources(!0)}ownerSourceId(){return(0,n.ensureNotNull)(this._source.ownerSource()).id()}changePoint(e,t){if(this._source.isFixed())return;consti=this._pointsConverter.apiPointsToDataSource([e])[0];this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource()),{...i},t),this._model.changeLinePoint({...i}),this._model.endChangingLinetool(!1),this._source.createServerPoints()}isHidden(){
null!==c&&c(),r=null}}classAf{constructor(e,t,i){this.handler=e,this.customId=t,this.singleShot=i}}functionLf(e,t){return`${e}__${t}`}functionkf(e){for(consttofObject.keys(e)){consti=e[t];if((0,tt.isObject)(i))thrownewError(`Study with non-simple inputs cannot be created: ${t}=${JSON.stringify(i)}`)}returne}classEf{constructor(e,t,i,s){this.sessionid="",this._chartApiMessagerProvider=e,this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._metadataRequestNextNumber=1,this._studyMetaInfoCache=i,this.studiesAccessController=s,this._connected=!1,this._enabled=!1,this._studyEngine=t,this._callbacks={},this._serverTimeOffset=0,this._studyEngine.on("configuration_received",(()=>{this._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",((...e)=>{constt=e[0];if(!Array.isArray(t?.value)||t.value.length<6)return;consti={time:t.value[0]/1e3,open:t.value[1],high:t.value[2],low:t.value[3],close:t.value[4],volume:t.value[5]};this._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={},this._studySpecs=newMap,this._isNonCountedStudy=()=>!0,this.defaultResolutions=this.defaultResolutions.bind(this)}destroy(){this._studyEngine.destroy(),this._studyEngine=null}purgeCache(){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache()}resetCache(){this._studyEngine.resetCache()}defaultResolutions(){returnthis._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]}availableCurrencies(){conste=this._studyEngine.supportedCurrencies().map((e=>"string"==typeofe?{id:e,code:e}:e));returnPromise.resolve(e)}availableUnits(){returnPromise.resolve(this._studyEngine.supportedUnits())}asyncavailablePriceSources(e){returnawaitthis._studyEngine.supportedPriceSources(e)??[]}supportedSymbolsTypes(){returnthis._studyEngine.supportedSymbolsTypes()??[]}symbolsGrouping(){conste={};for(const[t,i]ofObject.entries(this._studyEngine.symbolsGrouping()))e[t]=iinstanceofRegExp?i:newRegExp(i);returne}start(){this._enabled=!0,this._fireEvent("start_enabled")}unsubscribe(e,t){consti=this._callbacks[e];i&&i.splice(i.indexOf(t),1)}on(e,t){returnthis._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}chartCreateSession(e,t){returnthis._studyEngine.chartCreateSession(e),!1}chartDeleteSession(e){returnthis._studyEngine.chartDeleteSession(e),!1}createSession(e,t){this._chartApiMessagerProvider.createChartApiMessager(e,this),this._sessions[e]=t,this._notificationHandlers[e]={},this.connected()&&t.onMessage({method:"connected",params:[]})}removeSession(e){deletethis._sessions[e],deletethis._notificationHandlers[e],this._studyEngine.stopSources(e)}connected(){returnthis._connected}connect(){this._enabled?this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]})):this.on("start_enabled",(()=>{this.connect()}))}disconnect(){this._connected=!1,this._notifySessions({method:"disconnected",params:[]}),this.purgeCache(),this.studyCounter=0
}switchTimezone(e,t){returnthis._studyEngine.switchTimezone(e,t),!1}receiveLocalResponse(e){this._dispatchNotification(e),this._fireEvent("message_"+e.method,void0,!0)}getMarks(e,t,i,s,o){constn=s;this._studyEngine.getMarks(e,t,i,n,o)}getTimescaleMarks(e,t,i,s,o){constn=s;this._studyEngine.getTimescaleMarks(e,t,i,n,o)}resolveSymbol(e,t,i,s){returnthis._notificationHandlers[e][t]=newAf(s,t),this._studyEngine.resolveSymbol(e,t,i),!1}requestFirstBarTime(e,t,i,s){thrownewError("Method not implemented.")}createSeries(e,t,i,s,o,n,r,a){this._notificationHandlers[e][t]=newAf((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t);constl={countBack:n||300};returnnull!==r&&"time-range"===r.type&&(l.to=1e3*r.to,l.from=1e3*r.from),this._studyEngine.createSeries(e,t,i,s,o,l),!1}removeSeries(e,t){returndeletethis._notificationHandlers[e][t],this._studyEngine.removeSeries(e,t),!1}setVisibleTimeRange(e,t,i,s,o,r,a,l,c,h){letd=s,u=!0!==(a=a||{}).applyDefaultRightMargin&&void0===a.percentRightMargin&&void0!==o?o:null;const_=(0,Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,t)),(0,n.ensureNotNull)(this._studyEngine.getSeriesSymbolInfo(e,t)));null!==_&&(d=_.timeToSessionStart(1e3*d)/1e3,null!==u&&(u=_.timeToSessionStart(1e3*u)/1e3));constp=()=>{consts=this._studyEngine.sessionTimeScale(e);if(null===s)returnvoid(h&&h(newError("Session time scale is not available")));consto=s.indexOfTime(1e3*d);let_;if(null===u)_=s.lastSessionBarIndex();else{conste=s.indexOfTime(1e3*u);_=e&&e.index}if(null===o||null===_)returnvoid(h&&h(newError("Bars are not available")));letp=o.index;if(o.timeMs<1e3*d&&(p+=1),!1===r){conste=(0,n.ensureNotNull)(s.firstSessionBarIndex());p<e&&(p=e)}p>_?h&&h(newError("Invalid visible range")):(this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesTimeframeUpdate(t,i,p,_,a,c),l&&setTimeout(l,0))};if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*s))returnvoidp();constm=this._chartApiMessagerProvider.getChartApiMessager(e).beforeSeriesCompleted,g=this._chartApiMessagerProvider.getChartApiMessager(e).seriesError;functionf(e,s){e===t&&s===i&&(m.unsubscribe(null,f),g.unsubscribe(null,y),p())}functiony(e,s){e===t&&s===i&&m.unsubscribe(null,f)}void0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=window.setTimeout((()=>{deletethis._setVisibleRangeTimeout[e],m.subscribe(null,f,!0),g.subscribe(null,y,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*s)}),0)}modifySeries(e,t,i,s,o,n,r,a){returnthis._notificationHandlers[e][t]=newAf((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t),this._studyEngine.modifySeries(e,t,s,o,i,n),!1}requestMoreData(e,t,i,s){consto="number"==typeoft?t:i;returnthis._studyEngine.extendSeriesRange(e,o),!1}allStudiesMetadata(){returnthis._studyMetaInfoCache.studiesMetadata()}requestMetadata(){returnnewPromise((e=>{constt=this.studiesAccessController.getEnabledTools();e({
method:"studies_metadata",params:["metadata_"+this._metadataRequestNextNumber++,{errors:[],hash:"",metainfo:t,migrations:[]}]})}))}setIsNonCountedStudyFn(e){this._isNonCountedStudy=e}canCreateStudy(e,t,i){returnthis._isNonCountedStudy(t.id)||this.studyCounter<210?{success:!0}:{success:!1,reason:"general",limitValue:210}}getStudyCounter(e){returnthis.studyCounter}getFundamentalCounter(e){return0}createStudy(e,t,i,s,o,n,r,a){if(!this.canCreateStudy(e,a).success){conste=newError("Exceeded the limit of studies");throwe.cause="TooManyStudies",e}returnthis._notificationHandlers[e][t]=newAf(r,t),this._studySpecs.set(Lf(e,t),a),this._studyEngine.createStudy(e,t,s,i,o,kf(n)),this._isNonCountedStudy(a.id)||this.studyCounter++,!0}removeStudy(e,t){if(this._notificationHandlers[e][t]){deletethis._notificationHandlers[e][t];consti=Lf(e,t),s=(0,n.ensureDefined)(this._studySpecs.get(i));this._studySpecs.delete(i),this._studyEngine.removeStudy(e,t),this._isNonCountedStudy(s.id)||this.studyCounter--}return!1}modifyStudy(e,t,i,s,o,n){returnthis._notificationHandlers[e][t]=newAf(o,t),this._studyEngine.modifyStudy(e,t,i,kf(s)),!1}notifyStudy(e,t,i,s){thrownewError("Method not implemented.")}createPointset(e,t,i,s,o,n,r){returnthis._notificationHandlers[e][t]=newAf(r,t),this._studyEngine.createPointset(e,t,s,o,n),!1}modifyPointset(e,t,i,s,o){thrownewError("Method not implemented.")}removePointset(e,t){returnthis._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t),!1}requestMoreTickmarks(e,t,i,s){returnthis._studyEngine.requestMoreTickmarks(e,i),!1}setFutureTickmarksMode(e,t){thrownewError("Method not implemented.")}serverTime(){returnthis._studyEngine.serverTime()}quoteCreateSession(e){returnthis._studyEngine.quoteCreateSession(e),!1}quoteDeleteSession(e){returnthis._studyEngine.quoteDeleteSession(e),!1}quoteAddSymbols(e,t){return-1!==t.indexOf(void0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((e=>!!e))),this._studyEngine.quoteAddSymbols(e,t),!1}quoteRemoveSymbols(e,t){returnthis._studyEngine.quoteRemoveSymbols(e,t),!1}quoteFastSymbols(e,t){returnthis._studyEngine.quoteFastSymbols(e,t),!1}quoteSetFields(e,t){returnthis._studyEngine.quoteSetFields(e,t),!1}quoteHibernateAll(e){returnthis._studyEngine.quoteHibernateAll(e),!1}searchSymbols(e,t,i,s,o){this._studyEngine.searchSymbols(e,t,i,s,o)}searchSymbolsPaginated(e,t){this._studyEngine.searchSymbolsPaginated(e,t)}depthCreateSession(e){this._studyEngine.depthCreateSession(e)}depthDeleteSession(e){this._studyEngine.depthDeleteSession(e)}depthSetSymbol(e,t){this._studyEngine.depthSetSymbol(e,t)}depthClearSymbol(e){}depthSetScale(e,t){}_applyTimeFrame(e,t,i,s,o){letr,a,l={},c=!0;if("period-back"===o.type){constt=this._studyEngine.getSeriesLastBarTime(e,i);if(null===t)return;a=t/1e3;consts=Re.Interval.parse(o.value),h=(0,n.ensureNotNull)(this._studyEngine.getSeriesSymbolInfo(e,i));r=(0,Td.alignPeriodsBackForVisibleRange)(h.session,h.session_holidays,h.corrections,s.letter(),s.multiplier(),1,t)/1e3;constd=(0,
fib_channel:{name:"LineToolFibChannel"},xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},circle:{name:"LineToolCircle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},path:{name:"LineToolPath"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"},emoji:{name:"LineToolEmoji"},sticker:{name:"LineToolSticker"},regression_trend:{name:"LineToolRegressionTrend"},fixed_range_volume_profile:{name:"LineToolFixedRangeVolumeProfile"}};constFf=newae.Delegate;varWf=i(44862),Hf=i(51829);functionzf(e,t,i){if(i.isDays())returnt;if(e.moveTo(1e3*t),i.isIntraday()){consti=e.indexOfBar(1e3*t);if(i<0)thrownewError(`${t} is out of the instrument session `);returne.endOfBar(i)/1e3}returne.startOfBar(Hf.SessionStage.LASTBAR_SESSION)/1e3}classUf{constructor(e){this._timeScale=e}coordinateToTime(e){constt=this._timeScale.coordinateToIndex(e);returnthis._timeScale.indexToTimePoint(t)}barSpacingChanged(){returnthis._timeScale.barSpacingChanged()}rightOffsetChanged(){returnthis._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){returnthis._timeScale.barSpacing()}rightOffset(){returnthis._timeScale.rightOffset()}width(){returnthis._timeScale.width()}defaultRightOffset(){returnthis._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){returnthis._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){returnthis._timeScale.usePercentageRightOffset().spawn()}isEmpty(){returnthis._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){returnthis._timeScale.points().size()}leftVisibleBarUTCTime(){conste=this._timeScale.visibleBarsStrictRange()?.firstBar()??null
;returnnull===e?null:this._timeScale.indexToTimePoint(e)}}constjf=newdt.TranslatedString("change timezone",a.t(null,void0,i(20137)));classGf{constructor(e){this._onTimezoneChanged=newae.Delegate,this._chartWidget=e,this._timezoneProperty=e.properties().childs().timezone,this._timezoneProperty.subscribe(this,(e=>{this._onTimezoneChanged.fire(e.value())})),e.onAboutToBeDestroyed().subscribe(this,(()=>{this._timezoneProperty.unsubscribeAll(this)}),!0)}availableTimezones(){returnPe.availableTimezones}getTimezone(){conste=this._timezoneProperty.value();return(0,n.ensureDefined)(this.availableTimezones().find((t=>t.id===e)))}setTimezone(e,t){(0,n.assert)((0,Pe.timezoneIsAvailable)(e),`Incorrect timezone: ${e}`),t?.disableUndo?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,jf)}onTimezoneChanged(){returnthis._onTimezoneChanged}}classqf{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){conste=this._priceScale.properties().childs();returne.percentage.value()?2:e.indexedTo100.value()?3:e.log.value()?1:0}setMode(e){this._priceScale.setMode({percentage:2===e,log:1===e,indexedTo100:3===e})}isInverted(){returnthis._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){returnthis._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){returnthis._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){returnthis._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){returnthis._priceScale.hasMainSeries()}getStudies(){returnthis._priceScale.getStudies().map((e=>e.id()))}currency(){conste=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);returnnull===t?null:{readOnly:t.readOnly,selectedCurrency:t.selectedCurrency,originalCurrencies:Array.from(t.originalCurrencies),currencies:e.getItems().filter((e=>!t.baseCurrencies.has(e))),symbols:Array.from(t.symbols)}}setCurrency(e){constt=this.currency()?.currencies;t&&e&&!t.includes(e)?console.warn("The provided currency is not supported by your datafeed!"):this._chartUndoModel.setPriceScaleCurrency(this._priceScale,e)}unit(){conste=this._chartModel.availableUnits(),t=this._priceScale.unit(e);returnnull===t?null:{readOnly:0===t.availableGroups.size,selectedUnit:t.selectedUnit,originalUnits:Array.from(t.originalUnits),availableGroups:Array.from(t.availableGroups),symbols:Array.from(t.symbols)}}setUnit(e){!e||this._chartModel.availableUnits().unitGroupById(e)?this._chartUndoModel.setPriceScaleUnit(this._priceScale,e):console.warn("The provided unit is not supported by your datafeed!")}coordinateToPrice(e){constt=this._priceScale.mainSource()?.firstValue();returnnull==t?null:this._priceScale.coordinateToPrice(e,t)}measureUnitId(){conste=this._priceScale.measureUnitId(this._chartModel.availableUnits());returnnull===e?null:{
selectedMeasureUnitId:e.selectedMeasureUnitId}}}function$f(e){return{id:e.id(),name:(t=e.toolname,Object.keys(Of).find((e=>Of[e].name===t))||null)};vart}functionKf(e){return{id:e.id(),name:e.metaInfo().description}}constYf=newdt.TranslatedString("change pane height",a.t(null,void0,i(14691)));classZfextendsst.UndoCommand{constructor(e,t,i){super(Yf),this._model=e,this._paneIndex=t,this._paneHeight=i,this._prevStretchFactors=this._model.panes().map((e=>e.stretchFactor()))}redo(){this._model.changePanesHeight(this._paneIndex,this._paneHeight)}undo(){conste=this._model.panes();for(lett=0;t<e.length;++t)e[t].setStretchFactor((0,n.ensureDefined)(this._prevStretchFactors[t]));this._model.fullUpdate()}}classXf{constructor(e,t){this._priceScales=newWeakMap,this._pane=e,this._chartWidget=t}hasMainSeries(){returnthis._pane.containsMainSeries()}getLeftPriceScales(){returnthis._pane.leftPriceScales().map(this._getPriceScaleApi,this)}getRightPriceScales(){returnthis._pane.rightPriceScales().map(this._getPriceScaleApi,this)}getMainSourcePriceScale(){conste=this._pane.mainDataSource();if(null===e)returnnull;constt=e.priceScale();returnnull===t||this._pane.isOverlay(e)?null:this._getPriceScaleApi(t)}getPriceScaleById(e){constt=this._pane.getPriceScaleById(e);returnnull===t?null:this._getPriceScaleApi(t)}setMaximized(e){this._pane.maximized().value()!==e&&this._chartWidget.model().toggleMaximizedPane(this._pane)}isMaximized(){returnthis._pane.maximized().value()}legendLoaded(){conste=this._chartWidget.paneByState(this._pane);returnBoolean(e&&e.statusWidget())}getAllEntities(){conste=this._pane.model();returnthis._pane.sourcesByGroup().allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){returnt===e.mainSeries()?function(e){return{id:e.id(),name:"Main Series"}}(e.mainSeries()):(0,Ws.isStudy)(t)?Kf(t):(0,zs.isLineTool)(t)?$f(t):null}(e,t))).filter(tt.notNull).filter((e=>null!==e.name))}getHeight(){returnthis._pane.height()}setHeight(e){constt=this._chartWidget.model().model(),i=t.panes();(0,n.assert)(i.length>1,"Unable to change pane's height if there is only one pane");consts=i.indexOf(this._pane);(0,n.assert)(-1!==s,"Invalid pane index");consto=newZf(t,s,e);this._chartWidget.model().undoHistory().pushUndoCommand(o)}moveTo(e){constt=this.paneIndex();t!==e&&((0,n.assert)(e>=0&&e<this._chartWidget.paneWidgets().length,"Invalid pane index"),this._chartWidget.model().movePane(t,e))}paneIndex(){returnthis._chartWidget.model().model().panes().indexOf(this._pane)}collapse(){if(1===this._chartWidget.model().panes().length)thrownewError("Cannot collapse a single pane!");if(this._pane.collapsed().value())thrownewError("Cannot collapse current pane!");this._chartWidget.model().toggleCollapsedPane(this._pane)}restore(){if(1===this._chartWidget.paneWidgets().length)thrownewError("Cannot restore a single pane!");if(!this._pane.collapsed().value())thrownewError("Cannot restore current pane!");this._chartWidget.model().toggleCollapsedPane(this._pane)}isCollapsed(){
returnthis._pane.collapsed().value()}_getPriceScaleApi(e){lett=this._priceScales.get(e);returnvoid0===t&&(t=newqf(this._chartWidget.model(),e),this._priceScales.set(e,t)),t}}varJf=i(3618);functionQf(e){returnvoid0===e.inputs?[]:e.inputs.map((e=>({...e,id:e.id,localizedName:void0!==e.name?(0,Jf.getTranslatedInputTitle)(e.name):""})))}functioney(e){constt={};if(e.defaults){consti=(0,Al.default)(e.defaults);t.defaults=i}returnvoid0!==e.plots&&(t.plots=(0,Al.default)(e.plots)),void0!==e.styles&&(t.styles=(0,Al.default)(e.styles)),void0!==e.bands&&(t.bands=(0,Al.default)(e.bands)),void0!==e.filledAreas&&(t.filledAreas=(0,Al.default)(e.filledAreas)),void0!==e.palettes&&(t.palettes=(0,Al.default)(e.palettes)),t}varty=i(82130);classiy{constructor(e,t){this._onStudyCompleted=newae.Delegate,this._onStudyError=newae.Delegate,this._isStudyDestroyed=!1,this._study=e,this._chartWidget=t,this._undoModel=this._chartWidget.model(),this._model=this._undoModel.model(),this._study.onAboutToBeDestroyed().subscribe(this,(()=>{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this),this._isStudyDestroyed=!0})),this._study.onStatusChanged().subscribe(this,(e=>{switch(e.type){casegh.StudyStatusType.Completed:this._onStudyCompleted.fire();break;casegh.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){returnthis._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){returnQf(this._study.metaInfo())}getInputValues(){conste=this._study.inputs({symbolsForChartApi:!1,asObject:!0});returnObject.keys(e).map((t=>{consti=e[t];return{id:t,value:(0,tt.isObject)(i)?i.v:i}}))}getStyleInfo(){returney(this._study.metaInfo())}getStyleValues(){const{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}=this._study.properties().state();return{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}}setInputValues(e){constt=this.getInputValues();for(constiofe){void0!==t.find((e=>e.id===i.id))?this._study.properties().childs().inputs.childs()[i.id].setValue(i.value):console.warn(`There is no such input: "${i.id}"`)}}mergeUp(){this._model.isMergeUpAvailableForSource(this._study)&&newla(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&newca(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&newna(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&newoa(this._model,this._study,null).redo()}paneIndex(){returnthis._model.panes().indexOf(this._model.paneForSource(this._study))}onDataLoaded(){returnthis._onStudyCompleted}onStudyError(){returnthis._onStudyError}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._study)&&this._undoModel.mergeSourceUp(this._study)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._study)&&this._undoModel.mergeSourceDown(this._study)}
unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceUp(this._study)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceDown(this._study)}priceScale(){returnnewqf(this._undoModel,(0,n.ensureNotNull)(this._study.priceScale()))}symbolSource(){conste=(0,n.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){returnthis._study.currency()}changePriceScale(e){constt=(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())),i=(0,n.ensureNotNull)(this._model.paneForSource(this._study));switch(e){case"no-scale":(0,n.assert)(i.actionNoScaleIsEnabled(this._study),"Unable to leave a pane without any non-overlay price scale"),newTl(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,n.assert)(i===t,"Study should be on the main pane"),newPl(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":newTl(this._model,this._study,i,"left",null).redo();break;case"new-right":newTl(this._model,this._study,i,"right",null).redo();break;default:consts=this._model.dataSourceForId(e);if(null===s)thrownewError(`There is no study with entityId='${e}'`);consto=i===this._model.paneForSource(s);(0,n.assert)(o,"Both studies should be on the same pane");constr=(0,n.ensureNotNull)(s.priceScale()),a=kr(this._study,r,this._model),l=ih(this._study,r,this._model);newPl(this._model,this._study,i,r,null).redo(),null!==a&&newbl(this._model,r,a,null).redo(),null!==l&&newwl(this._model,r,l,null).redo()}}isVisible(){returnthis._study.properties().childs().visible.value()}setVisible(e){this._study.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._study])}sendToBack(){this._model.sendToBack([this._study])}applyOverrides(e){(0,Wf.applyOverridesToStudy)(this._study,e)}hasPlots(){returnthis._study.metaInfo().plots.length>0}dataLength(){if(this._study.status().type!==gh.StudyStatusType.Completed)return0;returnthis._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){conste=this._study.status();returne.type===gh.StudyStatusType.Undefined||e.type===gh.StudyStatusType.Loading}hasError(){returnthis._study.status().type===gh.StudyStatusType.Error}hasPendingUnresolvedSymbols(){returnthis._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,ty.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){returnthis._study.graphicsViewsReady()}properties(){returnthis._study.properties()}setProperties(e){this._study.properties().mergeAndFire(e)}asyncapplyToEntireLayout(){const{ActionsProvider:e}=await(0,Go.actionsProviderModule)();if(this._isStudyDestroyed)return;constt=newe(this._chartWidget),i=(awaitt.contextMenuActionsForSources([this._study],(0,n.ensureNotNull)(this._chartWidget.model().paneForSource(this._study)))).find((e=>"applyStudyToEntireLayout"===e.id));i&&i.execute()}status(){
return{...this._study.status()}}title(){returnthis._study.title(pa.TitleDisplayTarget.StatusLine)}symbolsResolved(){returnthis._study.symbolsResolved()}study(){returnthis._study}}constsy=newMap([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);functionoy(e){constt=sy.get(e.toolname);if(void0!==t)returnt;consti=e.pointsCount();return-1===i?e.points().length:i}functionny(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}constry=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];classay{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){returnthis._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){returnthis._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){returnthis._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){returnthis._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(e,t){returnthis._source.properties().state(ry,e,t)}setProperties(e,t){(0,yi.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,yi.allowSavingDefaults)(!1)}getPoints(){lete=this._source.points();constt=oy(this._source);returne.length>t&&((0,n.assert)(ny(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;constt=oy(this._source);if(t!==e.length)thrownewError(`Wrong points count. Required: ${t}, provided: ${e.length}`);consti=this._pointsConverter.apiPointsToDataSource(e);this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource())),this._model.changeLinePoints(this._source,i),this._model.endChangingLinetool(!0),this._source.createServerPoints()}getAnchoredPosition(){returnthis._source.positionPercents()}setAnchoredPosition(e){constt=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void0===t||null===i||null===s)return;consto={logical:s,screen:t},n=newMap;n.set(i,e),this._model.startMovingSources([this._source],o,null,newMap),this._model.moveSources(o,n),this._model.endMovingSources(!0)}ownerSourceId(){return(0,n.ensureNotNull)(this._source.ownerSource()).id()}changePoint(e,t){if(this._source.isFixed())return;consti=this._pointsConverter.apiPointsToDataSource([e])[0];this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource()),{...i},t),this._model.changeLinePoint({...i}),this._model.endChangingLinetool(!1),this._source.createServerPoints()}isHidden(){
returnthis._source.isSourceHidden()}getRawPoints(){returnthis._source.points()}getNormalizedPoints(){returnthis._source.normalizedPoints()}setRawPoint(e,t){this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource()),{...t},e),this._model.changeLinePoint({...t}),this._model.endChangingLinetool(!1)}move(e,t){this._model.startMovingSources([this._source],{logical:e,screen:(0,n.ensureNotNull)(this._source.pointToScreenPoint(e))},null,newMap),this._model.moveSources({logical:t,screen:(0,n.ensureNotNull)(this._source.pointToScreenPoint(t))},newMap),this._model.endMovingSources(!1)}dataAndViewsReady(){returnthis._source.dataAndViewsReady()}zorder(){returnthis._source.zorder()}symbol(){returnthis._source.properties().symbol.value()}currency(){returnthis._source.properties().currencyId.value()}unit(){returnthis._source.properties().unitId.value()}share(e){this._undoModel.shareLineTools([this._source],e)}setVisible(e,t=!1){this._undoModel.setProperty(this._source.properties().visible,e,null,t)}sharingMode(){returnthis._source.sharingMode().value()}lineDataSource(){returnthis._source}template(){returnthis._source.template()}}classly{constructor(e,t){this._series=e,this._undoModel=t,this._model=t.model()}isUserEditEnabled(){returnthis._series.userEditEnabled()}setUserEditEnabled(e){this._series.setUserEditEnabled(e)}mergeUp(){this._model.isMergeUpAvailableForSource(this._series)&&newla(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&newca(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&newna(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&newoa(this._model,this._series,null).redo()}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._series)&&this._undoModel.mergeSourceUp(this._series)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._series)&&this._undoModel.mergeSourceDown(this._series)}unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._series)&&this._undoModel.unmergeSourceUp(this._series)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._series)&&this._undoModel.unmergeSourceDown(this._series)}detachToRight(){newTl(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){newTl(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){newTl(this._model,this._series,this._pane(),"overlay",null).redo()}changePriceScale(e){constt=(0,n.ensureNotNull)(this._model.paneForSource(this._series));switch(e){case"new-left":newTl(this._model,this._series,t,"left",null).redo();break;case"new-right":newTl(this._model,this._series,t,"right",null).redo();break;case"no-scale":(0,n.assert)(t.actionNoScaleIsEnabled(this._series),"Unable to leave a pane without any non-overlay price scale"),newTl(this._model,this._series,t,"overlay",null).redo();break;default:consti=this._model.dataSourceForId(e)
;if(null===i)thrownewError(`There is no study with entityId='${e}'`);consts=this._model.paneForSource(i)===t;(0,n.assert)(s,"Study should be on the main pane");consto=(0,n.ensureNotNull)(i.priceScale());newPl(this._model,this._series,t,o,null).redo()}}isVisible(){returnthis._series.properties().childs().visible.value()}setVisible(e){this._series.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._series])}sendToBack(){this._model.sendToBack([this._series])}entityId(){returnthis._series.id()}chartStyleProperties(e,t){returnt?this._series.properties().childs()[cy(e)].state():this._series.properties().childs()[cy(e)].state(["inputs","inputsInfo"])}setChartStyleProperties(e,t){this._series.properties().childs()[cy(e)].mergeAndFire(t)}barsCount(){returnthis._series.bars().size()}endOfData(){returnthis._series.endOfData()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}series(){returnthis._series}isLoading(){returnthis._series.isLoading()}isInReplay(){returnthis._series.isInReplay()}data(){returnthis._series.data()}priceScale(){returnnewqf(this._undoModel,this._series.priceScale())}seriesErrorMessage(){returnthis._series.seriesErrorMessage()}compositeStatusVW(){returnthis._series.compositeStatusVW()}properties(){returnthis._series.properties()}_pane(){return(0,n.ensureNotNull)(this._model.paneForSource(this._series))}}functioncy(e){switch(e){case0:return"barStyle";case1:return"candleStyle";case2:return"lineStyle";case14:return"lineWithMarkersStyle";case15:return"steplineStyle";case3:return"areaStyle";case16:return"hlcAreaStyle";case4:return"renkoStyle";case5:return"kagiStyle";case6:return"pnfStyle";case7:return"pbStyle";case8:return"haStyle";case9:return"hollowCandleStyle";case10:return"baselineStyle";case11:return"rangeStyle";case12:return"hiloStyle";case13:return"columnStyle";case17:return"volFootprintStyle";case18:return"tpoStyle";case19:return"volCandlesStyle";case20:return"svpStyle";case21:return"hlcBarsStyle";default:(0,n.ensureNever)(e)}thrownewError(`unsupported chart style: ${e}`)}varhy=i(32112);functiondy(e,t){const{symbolChanged:i,currencyChanged:s,unitChanged:o,styleChangeRequiresRestart:n}=e.compareSymbolParams(t);return!(i||s||o||n)}functionuy(e,t){e.isLoading()&&!e.isFailed()||t(e.isFailed());consti=e.seriesSource().symbolInstanceId(),s=e.dataEvents(),o=e.symbolParams(),n=()=>{s.completed().unsubscribe(null,r),(dy(e,o)||e.seriesSource().symbolInstanceId()===i)&&t(!1)},r=()=>{s.error().unsubscribe(null,n),(dy(e,o)||e.seriesSource().symbolInstanceId()===i)&&t(!0)};s.completed().subscribe(null,n,!0),s.error().subscribe(null,r,!0)}class_y{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){returnthis._controller.createGroupFromSelection().id}removeGroup(e){constt=(0,n.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){returnthis._controller.groups().map((e=>e.id))}shapesInGroup(e){constt=(0,
n.ensureDefined)(this._groupById(e));return(0,vi.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){consti=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._model.dataSourceForId(t));(0,n.assert)((0,zs.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,s)}addShapeToGroup(e,t){consti=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._model.dataSourceForId(t));(0,n.assert)((0,zs.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,s)}availableZOrderOperations(e){constt=(0,n.ensureDefined)(this._groupById(e));returnthis._controller.availableZOrderOperations(t)}bringToFront(e){constt=(0,n.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){constt=(0,n.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){constt=(0,n.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){constt=(0,n.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){consti=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,s)}insertBefore(e,t){consti=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,s)}groupVisibility(e){return(0,n.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){consti=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,n.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){consti=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,n.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){consti=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){constt=e.map((e=>(0,n.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,zs.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){returnthis._controller.groups().find((t=>t.id===e))}}varpy=i(18041);constmy=newdt.TranslatedString("change price to bar ratio",a.t(null,void0,i(2509))),gy=newdt.TranslatedString("toggle lock scale",a.t(null,void0,i(49695)));functionfy(e,t){returnt.map((t=>(0,n.ensureNotNull)(e.dataSourceForId(t))))}classyy{constructor(e,t){this._visibleBarsChanged=newae.Delegate,this._crosshairMoved=newae.Delegate,this._dataSourceHovered=newae.Delegate,this._ranges=null,this._zoomUndoStackIsNotEmpty=null,this._panes=newWeakMap,this._studies=newWeakMap,this._lineDataSources=newWeakMap,this._selectionApi=null,this._lollipopSourcesApi=null,this._prevVisibleRange=null,this._prevHoveredSourceId=null,this._onSymbolChangedDelegate=newae.Delegate,this._chartWidget=e,this._activateChart=t,this._timezoneApi=newGf(e),this._chartWidget.withModel(this,(()=>{
}),o)}))}asyncsetSymbol(e,t){(0,tt.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s,initiatorName:o="chart api"}=t||{};if(e===this.symbol()||this._chartWidget.hasModel()&&this._chartWidget.model().mainSeries().symbolSameAsResolved(e))returni?.(),!0;s||this._activateChart();constn=this._chartWidget.chartWidgetCollection(),r=awaitn.setSymbol(e,void0,this._chartWidget);returnr&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}asyncsetResolution(e,t){(0,tt.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s,initiatorName:o="Chart api"}=t||{},n=Re.Interval.normalize(e);if(null===n||n===this.resolution())returni?.(),!0;s||this._activateChart();constr=awaitthis._chartWidget.chartWidgetCollection().setResolution(n,void0,this._chartWidget);returnr&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}asyncsetChartType(e,t){if(this._chartWidget.model().mainSeries().properties().childs().style.value()===e)returnt?.(),!0;consti=this._chartWidget.chartWidgetCollection().setChartStyleToWidget(e,this._chartWidget);returnuy(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){returnthis._chartWidget.getCheckableActionState(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}getBarsMarksSources(){returnthis._chartWidget.model().barsMarksSources()}getAllShapes(){returnthis._chartWidget.model().model().allLineTools().map($f).filter((e=>null!==e.name))}getAllStudies(){returnthis._chartWidget.model().model().allStudies(!0).map(Kf)}getStudyTemplateSnapshot(e,t,i){return(0,py.getStudyTemplateSaveData)(e,this._chartWidget.model().model(),t,i)}getStudyTemplateDescString(){conste=(0,py.getStudyTemplateMetaInfo)(this._chartWidget.model().model());return(0,py.getStudyTemplateDescString)(e.indicators)}asyncapplyStudyTemplateByRecord(e){if(!e)return;const{name:t,id:i,is_default:s}=e,o=e=>this._chartWidget.model().applyStudyTemplate(JSON.parse(e.content),t);s?awaitz.backend.getStandardStudyTemplateById(i,o):awaitz.backend.getStudyTemplateById(i).then(o)}chartTemplate(){returnthis._chartWidget.model().model().template()}applyChartTempalte(e){this._chartWidget.chartWidgetCollection().applyTheme(e)}getAllPanesHeight(){conste=this._chartWidget.model().model().panes();if(this._chartWidget.hasMaximizedPane()){lett=0,i=0;e.forEach((e=>{t+=e.height(),i+=e.stretchFactor()}));consts=i/t;returne.map((e=>Math.round(e.stretchFactor()/s*100)/100))}returne.map((e=>e.height()))}setAllPanesHeight(e){constt=this._chartWidget.model().model(),i=t.panes();(0,n.assert)(i.length===e.length,"There`s a mismatch between the number of heights you provided and the number of panes.");consts=i.reduce(((e,t)=>e+t.stretchFactor()),0)/e.reduce(((e,t)=>e+t));e.forEach(((e,t)=>{consto=e*s;i[t].setStretchFactor(o)})),t.fullUpdate()}maximizeChart(){
this._chartWidget.requestFullscreen()}isMaximized(){returnthis._chartWidget.inFullscreen()}restoreChart(){this._chartWidget.exitFullscreen()}restoreChartPreferences(){this._chartWidget.model().restorePreferences()}availableZOrderOperations(e){constt=fy(this._chartWidget.model().model(),e);returnthis._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){constt=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){constt=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}bringForward(e){constt=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){constt=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}insertAfter(e,t){consti=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertAfter(s,o)}insertBefore(e,t){consti=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertBefore(s,o)}sessions(){returnthis._chartWidget.model().model().sessions()?.get()??null}chartModel(){returnthis._chartWidget.model().model()}chartUndoModel(){returnthis._chartWidget.model()}chartWidget(){returnthis._chartWidget}getTimeScaleLogicalRange(){returnthis._chartWidget.model().timeScale().logicalRange()}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");consti=this._chartWidget.model().model().dataSourceForId(e);if(!i)return;consts=i.properties();s&&s.visible&&s.visible.setValue(t)}asynccreateStudy(e,t,i,s,o,n){if("function"==typeofo)returnconsole.warn('"createStudy" does not take "callback" parameter anymore'),Promise.resolve(null);if(n=n||{},"string"!=typeofe)returnthis._createStudy(e);e=e.toLowerCase();constr=await(0,os.studyMetaInfoRepository)().findAllJavaStudies(),a=ns.StudyMetaInfo.findStudyMetaInfoByDescription(r,e);if(n.checkLimit){conste=this._chartWidget.model().canCreateStudy({id:a.id});if(!e.success)return(0,wr.showTooManyStudiesNotice)(e.limitValue),Promise.resolve(null)}constl=(n.disableUndo?this._chartWidget.model().model():this._chartWidget.model()).createStudyInserter({type:"java",studyId:a.id},[]);if(l.setForceOverlay(!!t),n.priceScale&&l.setPreferredPriceScale(function(e){switch(e){case"no-scale":return"overlay";case"as-series":return"as-series";case"new-left":return"left";case"new-right":return"right";default:thrownewError(`The pricescale "${e}" is invalid, the only valid options are "no-scale", "as-series", "new-left" and "new-right".`)}}(n.priceScale)),n.allowChangeCurrency&&l.setAllowChangeCurrency(!0),n.allowChangeUnit&&l.setAllowChangeUnit(!0),Array.isArray(s)){console.warn("Passing study inputs as an ordered array is now deprecated. Please use an object where keys correspond to the inputs of your study instead.");conste={};for(lett=0;t<a.inputs.length;++t)e[a.inputs[t].id]=s[t];s=e}returnl.insert((()=>Promise.resolve({inputs:s||{},parentSources:[]
}))).then((e=>(o&&(0,Wf.applyOverridesToStudy)(e,o),i&&e.setUserEditEnabled(!1),e.id())))}waitForStudyCreated(e){returnthis._chartWidget.model().model().waitForStudy(e)}compileFailedStudies(){returnthis._chartWidget.model().model().studiesWV().value().filter((e=>e.isPine()&&e.hasCompileError()))}getStudyById(e){constt=this._chartWidget.model().model().getStudyById(e);if(null===t)thrownewError("There is no such study");returnthis._getStudyApi(t)}getSeries(){conste=this._chartWidget.model(),t=e.mainSeries();returnnewly(t,e)}createShape(e,t){returnthis._createMultipointShape(this._convertUserPointsToDataSource([e]),t)}asynccreateMultipointShape(e,t){returnthis._createMultipointShape(this._convertUserPointsToDataSource(e),t)}getShapeById(e){constt=this._chartWidget.model().model().getLineToolById(e);if(null===t)thrownewError("There is no such shape");returnthis._getLineDataSourceApi(t)}removeEntity(e,t){consti=this._chartWidget.model().model().dataSourceForId(e);i?t&&t.disableUndo?$r(this._chartWidget.model().model(),[i]):this._chartWidget.model().removeSource(i,!0,!0):console.warn(`Can't find a source with id: ${e}`)}removeEntityWithUndo(e){constt=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.model().removeSource(t,!1)}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}selection(){returnnull===this._selectionApi&&(this._selectionApi=newhy.SelectionApi(this._chartWidget.model().model())),this._selectionApi}showPropertiesDialog(e){constt=this._chartWidget.model().model().dataSourceForId(e);if(null===t)thrownewError(`Study or shape ${e} does not exist`);this._chartWidget.showChartPropertiesForSource(t)}createStudyTemplate(e){returnthis._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}drawOnAllCharts(e){(0,mt.drawOnAllCharts)().setValue(e)}createOrderLine(){thrownewError("createOrderLine is only available on Trading Platform")}createPositionLine(){thrownewError("createPositionLine is only available on Trading Platform")}createExecutionShape(){thrownewError("createExecutionShape is only available on Trading Platform")}symbol(){returnthis._chartWidget.symbolWV().value()}symbolExt(){conste=this._chartWidget.model().mainSeries().symbolInfo();if(null===e)returnnull;constt=((e,t)=>{consti={};returnt.forEach((t=>{void0!==e[t]&&(i[t]=e[t])})),i
})(e,["name","base_name","ticker","description","long_description","type","session","session_display","session_holidays","corrections","exchange","exchange","listed_exchange","timezone","format","pricescale","minmov","fractional","minmove2","variable_tick_size","has_intraday","supported_resolutions","intraday_multipliers","has_seconds","has_ticks","seconds_multipliers","has_daily","daily_multipliers","has_weekly_and_monthly","weekly_multipliers","monthly_multipliers","has_empty_bars","visible_plots_set","volume_precision","data_status","delay","expired","expiration_date","sector","industry","currency_code","original_currency_code","unit_id","original_unit_id","unit_conversion_types","subsession_id","subsessions","price_source_id","price_sources","logo_urls","exchange_logo","pro_name","library_custom_fields"]);returnt.pro_name=e.pro_name,t}resolution(){returnthis._chartWidget.model().mainSeries().interval()}marketStatus(){returnthis._chartWidget.model().mainSeries().marketStatusModel().currentSession().spawn()}getVisibleRange(){conste={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)returne;consts=i.firstBar(),o=i.lastBar(),r=this._convertIndexToPublicTime(o);if(null===r)returne;consta=Math.max((0,n.ensureNotNull)(t.points().range().value()).firstIndex,s);returne.from=(0,n.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=r,e}getVisibleBarsRange(){conste=this._chartWidget.model().timeScale(),t=e.visibleBarsStrictRange();if(null===t)returnnull;consti=this._convertIndexToPublicTime(t.firstBar()),s=t.lastBar()-Math.max(0,Math.ceil(e.rightOffset())),o=this._convertIndexToPublicTime(s);returnnull===i||null===o?null:{from:i,to:o}}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())returnnull;returnthis._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}scrollPosition(){returnconsole.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){returnconsole.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}priceFormatter(){returnthis._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){returnthis._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){returnthis._chartWidget.getTimezone()}getTimezoneApi(){returnthis._timezoneApi}getPanes(){returnthis._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){if(!l.enabled("charting_library_export_chart_data"))returnPromise.reject("Data export is not supported");constt={...e};returnvoid0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),
Promise.all([i.e(2578),i.e(9498)]).then(i.bind(i,99207)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}setDragExportEnabled(e){l.enabled("chart_drag_export")?this._chartWidget.model().model().setDragExportEnabled(e):console.error("feature is not enabled")}canZoomOut(){return!this._chartWidget.model().zoomStack().isEmpty()}canZoomOutWV(){if(!this._zoomUndoStackIsNotEmpty){conste=newO.WatchedValue(!1);this._zoomUndoStackIsNotEmpty=e.spawn(),this._chartWidget.withModel(this,(()=>{constt=this._chartWidget.model().zoomStack();t.onChange().subscribe(this,(()=>e.setValue(!t.isEmpty())))}))}returnthis._zoomUndoStackIsNotEmpty.readonly()}zoomOut(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}shapesGroupController(){returnnew_y(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){returnthis._chartWidget.selectPointMode().value()!==mt.SelectPointMode.None}requestSelectBar(){returnthis.isSelectBarRequested()?Promise.reject("already requested"):newPromise(((e,t)=>{this._chartWidget.requestSelectPoint({pointType:"time"}).then((t=>{e(this._convertTimeToPublic((0,n.ensureDefined)(t.point.time)))})).catch((()=>{t("cancelled")}))}))}cancelSelectBar(){this.isSelectBarRequested()&&this._chartWidget.cancelRequestSelectPoint()}barTimeToEndOfPeriod(e){constt=this._prepareEndOfPeriodArgs();returnzf(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){constt=this._prepareEndOfPeriodArgs();returnfunction(e,t,i){if(i.isDays())returnt;consts=1e3*t-1;if(e.moveTo(s),i.isIntraday()){consti=e.indexOfBar(s);if(i<0)thrownewError(`${t} is out of the instrument session `);returne.startOfBar(i)/1e3}returne.startOfBar(0)/1e3}(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){consti=()=>newError(`Cannot create "${t.shape}" shape`),s=t.shape;if(Nf(s)&&!0!==Of[s].isAnchored)throwconsole.warn(`${s} is not an anchored shape. It can be created using createShape or createMultipointShape`),i();consto=this._chartWidget.model().model(),n=o.mainSeries();if(o.timeScale().isEmpty())throwi();constr=void0!==t.ownerStudyId?o.dataSourceForId(t.ownerStudyId):n,a=this._convertPositionPercentToDataSource(e,r);if(null===a)throwi();returnthis._createMultipointShape([a],t)}properties(){returnthis._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){returnthis._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){returnthis._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){returnthis._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){constt=this._chartWidget.model(),i=t.model().dataSourceForId(e);returnt.cloneLineTools([i],!1)[0]}shareLineTools(e,t){
consti=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}getLollipopSourcesApi(){thrownewError("getLollipopSourcesApi is not supported")}clickAtLatestUpdatesLollipop(){thrownewError("clickAtLatestUpdatesLollipop is not supported")}linkingGroupIndex(){returnthis._apiLinkingGroupIndex.spawn()}loadingScreenActive(){returnthis._chartWidget.screen.isShown()}symbolResolvingActive(){for(consteofthis._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){returnthis._chartWidget.hasModel()}disableAllUtilitySources(){0}chartProto(){returnkg.prototype}ranges(){thrownewError("not implemented")}getTimeScale(){returnnewUf(this._chartWidget.model().timeScale())}asyncloadChartTemplate(e){await(0,Vf.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}asyncsyncTime(e){if(this._chartWidget.hasModel()){constt=this._chartWidget.model().model(),i=t.mainSeries().syncModel();if(i)returnt.syncTimeWithModel(i.syncSourceTarget(),e)}}syncDateRange(e,t){this._chartWidget.hasModel()&&this._chartWidget.model().model().gotoTimeRange(e,t)}getLineToolsState(e=1,t,i){this._canUseLineToolsSynchronizer("getLineToolsState");consts=i??!0,o=(0,n.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,s);returndeleteo.clientId,o}asyncapplyLineToolsState(e){this._canUseLineToolsSynchronizer("applyLineToolsState"),await(0,n.ensureNotNull)(this.lineToolsSynchronizer()).applyDTO(e)}reloadLineToolsFromServer(){this._canUseLineToolsSynchronizer("reloadLineToolsFromServer"),(0,n.ensureNotNull)(this.lineToolsSynchronizer()).reloadAllLineTools()}studyMetaIntoRepository(){return(0,os.studyMetaInfoRepository)()}replayStatus(){returnthis._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){returnthis._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s,o){returnthis._chartWidget.model().insertStudyWithoutCheck(newns.StudyMetaInfo(e,o),t,i,s)}copyEntityToClipboard(e){constt=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([t])}pasteFromClipboard(){this._chartWidget.chartWidgetCollection().clipboard.uiRequestPaste()}inactivityGaps(){returnthis._chartWidget.model().model().inactivityGaps()}setInactivityGapsSession(e){this._chartWidget.model().model().setInactivityGapsSession(e)}_destroy(){this._zoomUndoStackIsNotEmpty?.destroy(),this._chartWidget.hasModel()&&(this._chartWidget.model().crosshairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged),this._chartWidget.model().zoomStack().onChange().unsubscribeAll(this)),this._chartWidget.modelCreated().unsubscribeAll(this),this._widgetLinkingGroupIndex.destroy()}async_createTradingPrimitive(e){constt=this._chartWidget.model(),i=t.model(),s=(0,
n.ensureNotNull)(i.paneForSource(i.mainSeries()));await(0,xo.ensureLineToolLoaded)(e);consto={pane:s,point:(()=>{conste=(0,n.ensureNotNull)(t.mainSeries().bars().last());return{index:e.index,price:e.value[4],interval:i.mainSeries().interval()}})(),linetool:e,actionSource:"API"};returni.createLineTool(o).adapter()}_createStudy(e){returnPromise.reject("Pine Script® and java studies are not supported")}_convertTimeToPublic(e){returnthis._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){returnnull===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_convertPositionPercentToDataSource(e,t){consti=this._chartWidget.model().timeScale(),s=t.priceScale(),o=t.firstValue();if(null==o||!isFinite(o)||null===s)returnnull;constn=i.coordinateToIndex(e.x*i.width());return{price:s.coordinateToPrice(e.y*s.height(),o),index:n}}_convertUserPointsToDataSource(e){constt=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),o=i.data();if(t.timeScale().isEmpty())returnnull;constr=e.map((e=>e.time||0)),a=this._alignPoints(r),l=(e,t,r)=>{consta=s.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,n.ensureNotNull)(s.valueAt(a)),h=(0,n.ensureNotNull)(s.range().value());if(e>c&&a===h.lastIndex){constt=(0,n.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}elseif(e<c&&a===h.firstIndex){constt=(0,n.ensureNotNull)(i.syncModel()).distance(e,c);t.success&&(l.index=l.index-t.result)}if((0,tt.isNumber)(t))l.price=t;else{lete=r?["open","high","low","close"].indexOf(r)+1:1;e<=0&&(e=1),l.price=(0,n.ensure)((0,n.ensureNotNull)(o.valueAt(a))[e])}returnl},c=[];for(lett=0;t<e.length;t++){consti=e[t];c.push(l(a[t],i.price,i.channel))}returnc}async_createMultipointShape(e,t){consti=()=>newError(`Cannot create "${s.shape}" shape`),s=Object.assign({},{filled:!0},t),o=Of[s.shape]||Of.flag;constr=this._chartWidget.model().model(),a=r.mainSeries();if(r.timeScale().isEmpty())throwi();constl=void0!==s.ownerStudyId?r.dataSourceForId(s.ownerStudyId)??a:a,c=r.paneForSource(l);if(null===e||null===c)throwi();if(o.onlySelectable)thrownewError(`Cannot create "${s.shape}" shape`);if("LineToolIcon"===o.name){conste=s;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!s.hasOwnProperty("icon"))thrownewError("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}await(0,xo.ensureLineToolLoaded)(o.name);consth=(0,zs.createLineToolProperties)(r.backgroundTheme().spawnOwnership(),o.name,!r.readOnly());if((0,zs.prepareLineToolPropertiesByOwnerSource)(h,l),s.overrides)for(consteins.overrides)h.hasChild(e)?(0,n.ensureDefined)(h.child(e)).mergeAndFire(s.overrides[e]):ny(o.name)&&-1!==["profitLevel","stopLevel"].indexOf(e)&&h.addProperty(e,s.overrides[e]);letd;void0!==h.hasChild("text")&&s.text&&(0,n.ensureDefined)(h.child("text")).setValue(s.text),h.hasChild("filled")&&s.filled&&(0,n.ensureDefined)(h.child("filled")).setValue(!0),
d=s.disableUndo?this._chartWidget.model().model():this._chartWidget.model();constu=d.createLineTool({pane:c,point:e[0],linetool:o.name,properties:h,ownerSource:l,actionSource:"API"});if(null===u)throwh.destroy(),i();if(u.properties()!==h&&h.destroy(),ny(o.name)){if(e.length>2)thrownewError(`Wrong points count for ${s.shape}. Required 1 or 2`);2===e.length&&(u.startChanging(1,e[1]),u.setPoint(1,e[1]),u.endChanging(!0,!1))}else{constt=u.pointsCount();if(t!==e.length&&-1!==t)thrownewError(`Wrong points count for ${s.shape}. Required ${t}`);consti=newTo.EnvironmentState(void0,!0),n=(0,Lt.isLineDrawnWithPressedButton)(o.name);for(lett=1;t<e.length&&this._chartWidget.model().lineBeingCreated();t++)u.setLastPoint(e[t]),d.continueCreatingLine(e[t],i,t<e.length-1||n);(0,Lt.isLineToolFinishRequiredWhenCreatedByApi)(o.name)&&(u.finish(),d.finishLineTool(u),d.continueCreatingLine(e[e.length-1],i,!1))}if(s.lock&&u.setUserEditEnabled(!1),s.disableSelection&&u.setSelectionEnabled(!1),s.disableSave&&(void0===u.customization&&(u.customization={}),u.customization.disableSave=!0),s.hasOwnProperty("showInObjectsTree")&&(void0===u.customization&&(u.customization={}),u.customization.showInObjectsTree=s.showInObjectsTree),s.zOrder){conste=this._chartWidget.model().availableZOrderOperations([u]);"top"===s.zOrder&&e.bringToFrontEnabled?d.bringToFront([u]):"bottom"===s.zOrder&&e.sendToBackEnabled&&d.sendToBack([u])}returnu.id()}_convertTimeFromPublic(e){returnthis._getTimeConverter().convertPublicTimeToInternalTime(e)}_getTimeConverter(){conste=this._chartWidget.model().mainSeries();return(0,On.getChartWidgetApiTimeConverter)(e.interval(),(0,n.ensureNotNull)(e.symbolInfo(),"main series symbol info"),this._chartWidget.model().model())}_onHoveredSourceChanged(e){constt=null!==e&&(0,An.isPriceDataSource)(e)?e.id():null,i=this._prevHoveredSourceId;this._prevHoveredSourceId=t,t!==i&&this._dataSourceHovered.fire(t)}_onCrosshairMoved(e){constt=this.chartModel().crosshairSource().pane;if(null===t)return;consti=this._chartWidget.offsetInDocument(t),s=this.chartModel().timeScale(),o=t.mainDataSource()?.priceScale(),n=s.indexToUserTime(e.index),r=this._convertIndexToPublicTime(e.index),a=s.indexToCoordinate(e.index),l=o?.priceToCoordinate(e.price,t.mainDataSource()?.firstValue()||0);if(void0===a||void0===l||null===n||null===r)return;constc={price:e.price,time:r,userTime:n.getTime()/1e3,entityValues:{},offsetX:a+i.left,offsetY:l+i.top},h=this.chartModel().priceDataSources(),d=(0,wi.sourceChangeEvent)(this._chartWidget.model().crosshairSource().id());for(lete=0;e<h.length;e++){constt=h[e],i=t.dataWindowView();if(null===i)continue;i.update(d);consts=t===this.chartModel().hoveredSource(),o=i.items().filter((e=>e.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));c.entityValues[t.id()]={isHovered:s,values:o,title:i.header()}}this._crosshairMoved.fire(c)}_makeSubscriptionFromDelegate(e){return{subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}
_prepareEndOfPeriodArgs(){conste=this._chartWidget.model().model(),t=e.timezone(),i=(0,n.ensureNotNull)(e.mainSeries().symbolInfo()),s=e.mainSeries().interval(),o=newCd.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,Td.newBarBuilder)(s,o,o),intervalObj:Re.Interval.parse(s)}}_getPaneApi(e){lett=this._panes.get(e);returnvoid0===t&&(t=newXf(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){lett=this._studies.get(e);returnvoid0===t&&(t=newiy(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){lett=this._lineDataSources.get(e);returnvoid0===t&&(t=neway(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{constt=(0,n.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();returne.map((e=>{consts=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){constt=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),o=i.symbolInfo();if(t.timeScale().isEmpty()||!Re.Interval.isDWM(s)||null===o)returne;constn=(0,Jd.createDwmAligner)(s,o);returnnull===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){conste=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)returnvoide.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);consti=this.getVisibleRange();null!==this._prevVisibleRange&&(0,tt.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!l.enabled("saveload_separate_drawings_storage"))thrownewError(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}_onSymbolChanged(e){vart;this._onSymbolChangedDelegate.fire({name:(t=e).name,base_name:t.base_name,ticker:t.ticker,description:t.description,long_description:t.long_description,type:t.type,session:t.session,session_display:t.session_display,session_holidays:t.session_holidays,corrections:t.corrections,exchange:t.exchange,listed_exchange:t.listed_exchange,timezone:t.timezone,format:t.format,pricescale:t.pricescale,minmov:t.minmov,fractional:t.fractional,minmove2:t.minmove2,variable_tick_size:t.variable_tick_size,has_intraday:t.has_intraday,supported_resolutions:t.supported_resolutions,intraday_multipliers:t.intraday_multipliers,has_seconds:t.has_seconds,has_ticks:t["is-tickbars-available"],seconds_multipliers:t.seconds_multipliers,build_seconds_from_ticks:t.build_seconds_from_ticks,has_daily:t.has_daily,daily_multipliers:t.daily_multipliers,has_weekly_and_monthly:t.has_weekly_and_monthly,weekly_multipliers:t.weekly_multipliers,monthly_multipliers:t.monthly_multipliers,has_empty_bars:t.has_empty_bars,visible_plots_set:t.visible_plots_set,volume_precision:t.volume_precision,data_status:t.data_status,
this._timeSync=d.trackTime.spawn(),this._chartWidgetCollection.activeChartWidget.subscribe((()=>this._onActiveChartChanged()),{callWithLast:!0}),ee.subscribe("toggle_currency_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_currency_menu",...e)}),this),ee.subscribe("toggle_unit_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_unit_menu",...e)}),this)}destroy(){this._supportedChartStylesSpawn.destroy(),this._intervalsService?.destroy(),this._themesApi?.destroy(),this._widgebarApi?.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._drawOnAllCharts.destroy(),this._pineEditorApi?.destroy(),this._isDestroyed=!0,this._magnetEnabledWV?.destroy(),this._magnetModeWV?.destroy(),this._magnetSnapsToIndicatorsWV?.destroy(),ee.unsubscribeAll("toggle_currency_menu_inner",this),ee.unsubscribeAll("toggle_unit_menu_inner",this)}themes(){returnnull===this._themesApi&&(this._themesApi=newRf({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:this._saveChartService?.getSaveAsController()??null,ChartLayoutRename:this._saveChartService?.getRenameController()??null,ChartLayoutCreate:this._saveChartService?.getCreateController()??null,ChartLayoutLoad:this._loadChartService,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){ee.subscribe(e,t,void0)}unsubscribe(e,t){ee.unsubscribe(e,t,void0)}onActiveChartChanged(){returnthis._activeChartWidgetChangedDelegate}webview(){returnby(),this._webview}connect(){by()}disconnect(){by()}onConnectionStatusChanged(e){by()}isConnected(){by()}supportTicketData(){returnthis._supportTicketData}setPublishChartOptions(e){by()}publishChart(e){by()}studyTemplatesDrawerApi(){by()}fontIconsSettingsDrawer(){by()}intervalsService(){by()}alertService(){by()}asyncalerts(){by()}supportedChartTypes(){returnthis._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,mt.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,mt.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){returnthis._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,mt.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,mt.drawOnAllChartsMode)().setValue(e)}currencies(){returnthis._chartApiInstance?.availableCurrencies()??Promise.reject()}units(){returnthis._chartApiInstance?.availableUnits()??Promise.reject()}disableTrackingEvents(){(0,re.disableTrackingEvents)()}getSaveChartService(){returnthis._saveChartService}symbolSync(){returnthis._symbolSync}intervalSync(){returnthis._intervalSync}dateRangeSync(){returnthis._dateRangeSync}
crosshairSync(){returnthis._crosshairSync}timeSync(){returnthis._timeSync}setSymbolSearchUI(e){by()}chart(e=0){if(e<0||e>=this.chartsCount())throwError("Incorrect index: "+e);returnthis._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}*charts(){for(lete=0;e<this.chartsCount();e++)yieldthis.chart(e)}activeChart(){returnthis._getChartWidgetApi(this._activeChartWidget())}activeChartRangesState(){returnthis._activeChartRangeState}setActiveChart(e){if(e>=0&&e<this.chartsCount()){constt=this._chartWidgetCollection.getAll()[e];t&&(this._activeChartWidget().inFullscreen()?t.requestFullscreen():this._chartWidgetCollection.activeChartWidget.setValue(t))}}asyncreplayApi(){by()}asyncbacktestingStrategyApi(){if(by(),null===this._chartApiInstance)thrownewError("backtesting api isn't available");if(null===this._backtestingStrategyApi){awaitPromise.all(this._chartWidgetCollection.getAll().map(waitForModel));const{facade:e}=awaitgetBacktestingStrategyFacadeInstance(this._chartWidgetCollection);this._backtestingStrategyApi=e}returnthis._backtestingStrategyApi}pineEditorApi(){by()}activeChartIndex(){returnthis._chartIndex(this._activeChartWidget())}chartsCount(){returnut.layouts[this.layout()].count}layout(){returnthis._chartWidgetCollection.layout.value()}layoutName(){returnthis._chartWidgetCollection.metaInfo.name.value()}layoutNameWatchedValue(){returnthis._chartWidgetCollection.metaInfo.name.readonly()}asynclayoutSettingsDrawer(){by()}setLayout(e,t){t?.withUndo?this._chartWidgetCollection.setChartLayoutWithUndo(e):this._chartWidgetCollection.setLayout(e)}resetLayoutSizes(e){thrownewError("Unsupported. This API is only applicable to the Trading Edition of the library")}setLayoutSizes(e,t){thrownewError("Unsupported. This API is only applicable to the Trading Edition of the library")}unloadUnusedCharts(){thrownewError("Unsupported. This API is only applicable to the Trading Edition of the library")}moveActiveChart(e){this._chartWidgetCollection.moveActiveChartWithUndo(e)}asyncopenPublicationViewPopup(e){0}asyncclosePublicationViewPopup(){0}undoRedoState(){returnthis._chartWidgetCollection.undoHistory.state()}clearUndoHistory(){returnthis._chartWidgetCollection.undoHistory.clearStack()}undo(){this._chartWidgetCollection.undoHistory.undo()}redo(){this._chartWidgetCollection.undoHistory.redo()}asyncselectLineTool(e,t,i){if(!Nf(e))return;consts=Of[e].name;if("icon"===e){conste=t?.icon;void0!==e&&mt.iconTool.setValue(e)}if(await(0,zs.initLineTool)(s),"emoji"===e){conste=t?.emoji;void0!==e&&mt.emojiTool.setValue(e)}if("sticker"===e){conste=t?.sticker;void0!==e&&mt.stickerTool.setValue(e)}mt.tool.setValue(s),(0,wn.trackDrawingToolSelected)(s,i)}favoriteDrawingsToolbar(){returni.e(5551).then(i.bind(i,46973)).then((e=>(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=newe.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){returnthis._sharingChartService}watchlist(){by()}setWatchlistApiPromise(e){by()}news(){by()}setNewsApiPromise(e){by()}widgetbar(){by()}
setWidgetbarApiPromise(e){by()}getChartStorage(){returngetChartStorage()}setDebugMode(e){l.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?l.setEnabled(e,t):lu.addPlusButtonProperty.setValue(t)}magnetEnabled(){returnnull===this._magnetEnabledWV&&(this._magnetEnabledWV=wy((0,mt.properties)().childs().magnet)),this._magnetEnabledWV}magnetMode(){returnnull===this._magnetModeWV&&(this._magnetModeWV=wy((0,mt.properties)().childs().magnetMode)),this._magnetModeWV}magnetSnapsToIndicators(){returnnull===this._magnetSnapsToIndicatorsWV&&(this._magnetSnapsToIndicatorsWV=wy((0,mt.properties)().childs().magnetSnapsToIndicators)),this._magnetSnapsToIndicatorsWV}flushBufferedData(){Ff.fire()}chartWidgetCollectionState(e){returnthis._chartWidgetCollection.state(e)}chartWidgetCollectionSeriesStatuses(){returnthis._chartWidgetCollection.chartSeriesStatuses()}watermark(){{conste=P_.getInstance();if(!e.ready())thrownewError("Watermark API is not initialised yet.");returne}}setContextMenuOptions(e){Cy.setContextMenuOptions(e)}changeSymbol(e,t,i,s="API"){de.linking.setIntervalAndLogInitiator((0,n.ensureNotNull)(Re.Interval.normalize(t)),s),de.linking.setSymbolAndLogInitiator(e,s),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}closePopupsAndDialogs(){Io.ContextMenuManager.hideAll(),ee.emit(vy.CLOSE_POPUPS_AND_DIALOGS_COMMAND)}startFullscreen(){returnthis._chartWidgetCollection.startFullscreen()}exitFullscreen(){returnthis._chartWidgetCollection.exitFullscreen()}getFavoriteChartStylesService(){by()}getFavoriteIntervalsService(){by()}getFavoriteCurrencyUnitConversionApi(){by()}getIntervals(){lete=[];constt=(0,ht.getCustomResolutions)();returnnull!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),(0,ht.mergeResolutions)(e,t)}getLinetoolsFavoritesStore(){by()}getSavedCharts(e){z.backend.getCharts().then(e)}getStudiesList(){return(0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata().filter((e=>!e.is_hidden_study)).map((e=>e.description))}getStudyInputs(e){returnQf(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getStudyStyles(e){returney(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getSymbolInterval(e){constt={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};returne?.(t),t}hasChartChanges(){returnthis._chartWidgetCollection.hasChanges()}asyncloadChart(e){{this._chartApiInstance?.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name));constt=awaitthis._chartWidgetCollection.loadContent(e.json);this._chartWidgetCollection.unloadUnusedCharts(),this._chartApiInstance?.connect(),de.linking.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),ee.emit("chart_loaded"),
t.contentMigrated&&ee.emit("chart_migrated")}}asyncloadChartFromServer(e){await(this._loadChartService?.loadChart(e,!1))}asyncloadLayoutFromServerByLayoutId(e,t,i){await(this._loadChartService?.loadChartByUrl(e,!!t,i))}layoutId(){returnthis._chartWidgetCollection.metaInfo.uid.value()}asynccreateNewLayout(e){by()}lockAllDrawingTools(){returnnull===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=newO.WatchedValue((0,mt.lockDrawings)().value()),this._lockDrawingsWatchedValue.subscribe((e=>{(0,mt.lockDrawings)().setValue(e)})),(0,mt.lockDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._lockDrawingsWatchedValue).setValue((0,mt.lockDrawings)().value())}))),this._lockDrawingsWatchedValue}hideAllDrawingTools(){returnnull===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=newO.WatchedValue((0,mt.hideAllDrawings)().value()),this._hideDrawingsWatchedValue.subscribe((e=>{(0,mt.hideAllDrawings)().setValue(e)})),(0,mt.hideAllDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideDrawingsWatchedValue).setValue((0,mt.hideAllDrawings)().value())}))),this._hideDrawingsWatchedValue}hideAllIndicators(){returnnull===this._hideIndicatorsWatchedValue&&(this._hideIndicatorsWatchedValue=newO.WatchedValue((0,mt.hideAllIndicators)().value()),this._hideIndicatorsWatchedValue.subscribe((e=>{(0,mt.hideAllIndicators)().setValue(e)})),(0,mt.hideAllIndicators)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideIndicatorsWatchedValue).setValue((0,mt.hideAllIndicators)().value())}))),this._hideIndicatorsWatchedValue}logs(){return{getLogHistory:ne.getLogHistory,enable:window.lon,disable:window.loff}}mainSeriesPriceFormatter(){returnthis._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()}onContextMenu(e){ee.subscribe("onContextMenu",(t=>{t.callback(e(t.unixtime,t.price))}),void0)}onGrayedObjectClicked(e){ee.subscribe("onGrayedObjectClicked",e,void0)}removeChartFromServer(e,t){z.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;consti=this._saveChartService.saveToJSON(t);returne&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}selectedLineTool(){conste=Object.keys(Of),t=mt.tool.value();for(leti=0;i<e.length;++i)if(Of[e[i]].name===t)returne[i];thrownewError("Unknown tool")}autosave(){if(!this._saveChartService)thrownewError("Saving service is not available");returnthis._saveChartService.autoSaveEnabled()}setForceFullscreenMode(){by()}setMultichartMode(){by()}setDateRangeLinkingEnabled(e){this._chartWidgetCollection.lock.dateRange.setValue(e)}studyMetaIntoRepository(){return(0,os.studyMetaInfoRepository)()}deferredStudiesReady(){returnvh.ready()}hasPendingStudiesModuleLoading(){return(0,Ws.hasPendingStudiesModuleLoading)()}hasPendingLineToolsModuleLoading(){returnhasPendingLineToolsModuleLoading()}shouldBeSaved(){return!this._chartWidgetCollection.readOnly()&&(this._saveChartService?.hasChanges()||!1)}setIntervalLinkingEnabled(e){
this._chartWidgetCollection.lock.interval.setValue(e)}setTimeFrame(e){this._chartWidgetCollection.setTimeFrame(e)}showConfirmDialog(e){lett=e.callback;consti=e=>{t&&(t(e),t=null)};(0,j.showConfirm)({title:e.title,text:e.body||"",onClose:()=>{i(!1)},onConfirm:e=>{i(!0),e.dialogClose()}})}showLoadChartDialog(){this._loadChartService?.showLoadDialog()}persistentLogger(){returnnull}showNoticeDialog(e){(0,j.showWarning)({title:e.title,text:e.body||"",onClose:e.callback})}showSupportDialog(){by()}showSaveAsChartDialog(){conste=this._saveChartService;e&&window.runOrSignIn((()=>{e.saveChartAs()}),{source:"Save as chart dialogue"})}showRenameChartDialog(){by()}saveChartOrShowTitleDialog(e,t,i){by()}showCreateAlertDialog(){by()}createGoProDialog(e){by()}setUserInfo(e){by()}openMobileChartPicker(){by()}closeMobileChartPicker(){by()}takeClientScreenshot(e){returnthis._chartWidgetCollection.clientSnapshot(e)}takeScreenshot(){returnthis._chartWidgetCollection.takeScreenshot()}trading(){by()}waitTrading(){by()}viewMode(){by()}viewModeWatchedValue(){by()}asyncdummyBrokerController(){returnPromise.reject("Not implemented")}pineLibApi(){returnby(),{saveNew,saveNext,requestBuiltinScripts}}resetCache(){(0,r.getChartingLibraryGlobalContext)().ChartApiInstance.resetCache()}getSymbolAliasService(){thrownewError("not supported")}staticsetContextMenuOptions(e){void0!==e.items_processor&&Io.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void0!==e.renderer_factory&&Io.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){lett=this._chartWidgets.get(e);returnvoid0===t&&(t=newyy(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){returnthis._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){returnthis._chartWidgetCollection.activeChartWidget.value()}_toggleUnitConversionMenu(e,t,i,s,o){if(t)returnvoidee.emit(e,t,-1,-1,"");constr=this._chartWidgetCollection.getAll(),a=r.findIndex((e=>e.model().model().id()===i));if(-1===a)return;constl=(0,n.ensureDefined)(r[a]).paneWidgets().findIndex((e=>e.state().id()===s));-1!==l&&ee.emit(e,t,a,l,o)}_onBeforeActiveChartChanged(){0}_onActiveChartChanged(){this._onBeforeActiveChartChanged(),this._activeChartWidgetWV.setValue(this.activeChart()),this._activeChartWidgetChangedDelegate.fire(),this._onAfterActiveChartChanged()}_onAfterActiveChartChanged(){this._updateActiveChartRangeState()}_updateActiveChartRangeState(){0}}i(4783),i(45);varTy=i(78136),Py=i(19979);constxy={ar_AE:"ar",de_DE:"de",en:"www",es:"es",ca_ES:"es",fa_IR:"www",fr:"fr",he_IL:"il",id:"id",in:"in",it:"it",ja:"jp",kr:"kr",ms_MY:"my",pl:"pl",br:"br",ru:"ru",sv_SE:"se",th_TH:"th",tr:"tr",uk:"uk",vi_VN:"vn",zh_CN:"cn",zh_TW:"tw"};functionMy(e){returnxy[e]||"www"}varIy=i(33065),Ay=i(70893),Ly=i(50946);i(59449);constky={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-cold-gray-900"],
onTimescaleCompleted(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})}onSeriesTimeframeUpdate(e,t,i,s,o,n){constr={method:"series_timeframe",params:[this._session,e,t,i,s,n||null,!0,o]};this._server.receiveLocalResponse(r)}onPointsetDataUpdate(e,t,i){this.onDataUpdate(e,t,i,null)}onDataUpdate(e,t,i,s){consto={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(o)}onQuotesData(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})}onDepthData(e){this._server.receiveLocalResponse({method:"dd",params:e})}onDepthUpdate(e){this._server.receiveLocalResponse({method:"dpu",params:e})}onClearData(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})}_prepareDataUpdateObjects(e){constt={};returne.forEach((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}}classSv{constructor(){this._instances=newMap}createChartApiMessager(e,t){consti=newvv(t,e);returnthis._instances.set(e,i),i}getChartApiMessager(e){return(0,n.ensureDefined)(this._instances.get(e),`ChartapiMessager instance for session ${e}`)}}constbv={blue:"#2962ff",gray:"#787B86",green:"#4CAF50",olive:"#808000",teal:"#00897B",new:(e,t)=>(0,Ro.applyTransparency)(e,t)},wv={hline:{style_dashed:qt.LINESTYLE_DASHED,style_dotted:qt.LINESTYLE_DOTTED,style_solid:qt.LINESTYLE_SOLID}},Cv={line:"line"};classTv{get(e){returnNaN}set(e){}indexOf(e){returnNaN}adopt(e,t,i){returnNaN}}varPv=i(60911);classxv{constructor(e,t){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>this._ctx.symbol.isLastBar},this.input={bool:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("boolean"==typeofe,"Study input value should be a boolean"),e},int:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("number"==typeofe,"Study input value should be a number"),e},source:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)((e=>{switch(e){case"open":case"high":case"low":case"close":case"hl2":case"hlc3":case"ohlc4":return!0;default:return!1}})(e),"Study input value should be a series source"),this._ctx.new_var(Py.Std[e](this._ctx))},string:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeofe,"Study input value should be a string"),e},symbol:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeofe,"Study input value should be a symbol string"),e}},this.request={security:(e,t)=>{consti=this._symbolIndexByTickerId.get(e);this._addedTickerIds.has(e)||this._ctx.new_sym(e,Py.Std.period(this._ctx)),(0,n.assert)(void0!==i,`Unknown tickerId ${e}`);consts=this._ctx.new_unlimited_var(Py.Std.time(this._ctx));this._ctx.select_sym(i)
display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"integer"}),e),source:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"source"}),newTv),string:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,options:i?.options,type:"text"}),e),symbol:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"symbol"}),e)},this.math={max:e=>(0,Hd.isNumber)(e)?0:newTv,min:e=>(0,Hd.isNumber)(e)?0:newTv,negative:e=>(0,Hd.isNumber)(e)?0:newTv},this.ta={change:e=>newTv,correlation:(e,t,i)=>newTv,cum:e=>newTv,ema:()=>newTv,rma:()=>newTv,sma:()=>newTv,vwap:()=>[newTv,newTv,newTv],wma:()=>newTv},this.request={security:e=>(this._tickers.push(e),newTv)},this.runtime={error:e=>{thrownewError(e)}},this.ticker={modify:()=>""},this.timeframe={change:()=>!1,isDWM:()=>!1},this._bands=[],this._defaults={},this._filledAreas=[],this._format={type:"inherit"},this._inputs=[],this._overlay=!1,this._plots=[],this._shortTitle="",this._styles={},this._tickers=[],this._title="",this._version=1}getStudyName(){returnthis._title}getStudyMetainfo(){vare,t;return{_metainfoVersion:53,bands:this._bands,defaults:this._defaults,description:this._title,filledAreas:this._filledAreas,format:this._format,id:(e=this._title,t=this._version,`${e}@tv-basicstudies-${t}`),inputs:this._inputs,is_price_study:this._overlay,palettes:{},plots:this._plots,shortDescription:this._shortTitle,styles:this._styles}}getTickers(){returnthis._tickers}open(){returnnewTv}high(){returnnewTv}low(){returnnewTv}close(){returnnewTv}volume(){returnnewTv}year(){return0}na(e){return!1}series(e){returnnewTv}fill(e,t,i){consts=this._getNextFillId(),o=this._plots.some((t=>t.id===e.id)),n=this._plots.some((e=>e.id===t.id)),r=this._bands.some((t=>t.id===e.id)),a=this._bands.some((e=>e.id===t.id)),l=o&&n;l||r&&a||this.runtime.error(`Could not find pair of plots or pair of hlines with ids ${e.id}${t.id}`);constc=l?"plot_plot":"hline_hline";this._filledAreas.push({fillgaps:!1,id:s,isHidden:!1,objAId:e.id,objBId:t.id,title:i?.title??(l?"Plots Background":"Hlines Background"),type:c}),void0===this._defaults.filledAreasStyle&&(this._defaults.filledAreasStyle={}),this._defaults.filledAreasStyle[s]=(e=>{if((e=>void0===e?.color)(e))return{bottomColor:e?.bottomColor,fillType:"gradient",topColor:e?.topColor,visible:"all"===e?.display};return{fillType:void0,color:e?.color??"TODO",visible:"all"===e?.display}})(i)}hline(e,t){consti=this._getNextBandId();this._bands.push({id:i,isHidden:!1,name:t?.title??"Level"}),void0===this._defaults.bands&&(this._defaults.bands=[]);consts={color:t?.color??"#808080",linestyle:t?.linestyle??wv.hline.style_dashed,linewidth:t?.linewidth??1,value:e,visible:"none"!==t?.display,name:""};returnthis._defaults.bands.push(s),{id:i}}
this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){returnthis.info}isLastBarClosed(){returnthis.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){constt=this.bars[e];if(void0===t)thrownewError(`BarSet has no value at index ${e}`);returnt}count(){returnthis.bars.length}emptyBarCount(){returnthis._emptyBarCount}add(e,t,i){void0===i&&(i=!1);consts=e,o=this.bars,n=o.length,r=s.time,a=0===n?NaN:o[n-1].time;0===n||a<r?(o.push(s),i&&(this._emptyBarCount+=1,this._lastBarIsEmpty=!0)):a===r?(i!==this._lastBarIsEmpty&&(this._emptyBarCount+=i?1:-1,this._lastBarIsEmpty=i),o[n-1]=s):console.error("time order violation, prev: "+newDate(a).toUTCString()+", cur: "+newDate(r).toUTCString()),this.isBarClosed=!!t}}functionqv(e,t){returne.ticker+(e.currency_code?"_#_"+e.currency_code:"")+(e.unit_id?"_#_"+e.unit_id:"")+(e.subsession_id?"_#_"+e.subsession_id:"")+"_#_"+t}function$v(e){returnnewDate(e).toISOString()}!function(e){e.ThreadKeySeparator="_#_"}(Fv||(Fv={})),function(e){e[e.MaxEmptyResponsesInARow=50]="MaxEmptyResponsesInARow",e[e.ResetCacheTimePeriod=1e4]="ResetCacheTimePeriod"}(Fv||(Fv={}));classKv{constructor(e,t,i,s,o,n){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._emptyResponsesCount=0,this._firstDataRequest=!0,this._datafeed=e,this._symbolInfo=t,this._interval=Re.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=o,this._serverTimeOffsetGetter=s,this._resetCacheTimePeriod=void0===n?1e4:n,this._sessionSpec=newjv.SessionsSpec(t.timezone,t.session,t.session_holidays,t.corrections),this._updateDatesFromExpirationDate()}destroy(){0!==this._subscribers.length&&this._logWarning("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),deletethis._datafeed,this._destroyed=!0}addSubscription(e,t,i){consts=this._getNextSubscriptionId();this._pendingSubscribers.push({key:s,range:e,onHistoryCallback:t,onErrorCallback:i}),Re.Interval.isDWM(this._resolution)&&void0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&this._logWarning(`Internal error: invalid date for DWM resolution ${$v(e.to)}, expected time without a time part`),this._clearResetCacheTimeout();returnsetTimeout((()=>{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){constt=this._pendingSubscribers.find((t=>t.key===e));if(t)returnvoidthis._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);consti=this._subscribers.find((t=>t.key===e));if(i)returnthis._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=window.setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)))
;this._logWarning("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}resetCache(){this._unsubscribeRealtime();conste=this._leftDate;this._purgeCache(),null===e||l.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})}_logMessage(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logWarning(e){console.warn(`${this._logMessagePrefix()}${e}`)}_logError(e){console.error(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){conste=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(newDate).toISOString()} 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(){void0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){returnnull===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){constt=void0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void0!==e.to&&t<=(0,n.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};consti=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,Pt.lowerbound)(this._cache.bars,i,((e,t)=>e.time<t));returne.countBack<s?{countBack:0,to:0!==e.countBack&&s<=this._cache.bars.length?this._dealignTime(this._cache.bars[s-e.countBack].time):t}:{countBack:e.countBack-s,to:this._dealignTime(this._cache.bars[0].time)}}_processPendingSubscribers(){conste=this._pendingSubscribers;if(!e.length)return;if(this._requesting)returnvoidthis._logMessage("Processing is skipped due active request");if(this._logMessage(`Processing pending subscribers, count=${e.length}`),this._errorMessage){constt=this._errorMessage;returnthis._logMessage(`Return error: ${t}`),this._pendingSubscribers=[],voide.forEach((e=>{e.onErrorCallback(t)}))}lett=this._normalizeRange(e[0].range);for(constiofe.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 ${$v(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=>{constt=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){constt={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};returnthis._subscribers.push(t),t}_isSymbolExpired(){
returnthis._symbolInfo.expired||void0!==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=>{consti=t.barset;if(null===i)thrownewError("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),qv(this._symbolInfo,this._resolution),this.resetCache.bind(this)),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(qv(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){consti=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(),$v(s.bars[0].time),$v(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){constt=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,Pt.lowerbound)(this._cache.bars,t,((e,t)=>e.time<t)),s=newGv(this._symbolInfo,this._cache.bars.slice(Math.max(0,i-e.countBack)));return0!==s.bars.length?s.firstLoadedTimeMs=this._dealignTime(s.bars[0].time):0!==this._cache.bars.length?s.firstLoadedTimeMs=this._dealignTime(this._cache.bars[this._cache.bars.length-1].time):s.firstLoadedTimeMs=this._dealignTime((0,n.ensureNotNull)(this._leftDate)),s}_ensureRequestedTo(e){lett;if(this._requesting&&this._logMessage("Internal error: trying to call getBars while the previous request is active",!0),null!==this._leftDate)t=this._leftDate;else{conste=this._now();if(null===this._dwmAligner)t=e;else{leti=this._sessionSpec.alignToNearestSessionStart(newDate(e),1).getTime();if(i<e){conste=this._sessionSpec.alignToNearestSessionEnd(newDate(i),1).getTime();i=this._sessionSpec.alignToNearestSessionStart(newDate(e+1e3),1).getTime()}t=this._dealignTime(i)}}consti=(0,Td.alignPeriodsBackForDataRequest)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.countBack,Math.min(e.to,t,this._nextTime??1/0));lets=e.countBack;if(e.to<t){s+=(0,Td.getPeriodsBetweenDates)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.to,t)}if(null!==this._leftDate&&this._leftDate<i)returnvoidthis._processPendingSubscribers();consto=this._firstDataRequest||(this._isSymbolExpired()?0===this._cache.bars.length:null===this._leftDate);this._firstDataRequest=!1,
this._requesting=!0,this._nextTime=null,this._leftDate=i;constn=`[${$v(i)} ... ${$v(t)}, ${s} bars]`;this._logMessage(`Requesting data: ${n}`);letr=!1;consta=i/1e3,l=t/1e3;this._datafeed.getBars(this._symbolInfo,this._resolution,{from:this._interval.isTicks()?a:Math.floor(a),to:this._interval.isTicks()?l:Math.floor(l),countBack:s,firstDataRequest:o},((e,t)=>{if(!this._destroyed)if(r)this._logMessage("getBars callback is already called before",!0);else{if(r=!0,e.length>0){constt=` [${$v(e[0].time)} ... ${$v(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${n}`)}elsethis._logMessage(`Receiving bars: barset is empty, requested range: ${n}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(r?this._logMessage("getBars callback is already called before",!0):(r=!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($v(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?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._logMessage("EOD received"),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?this._logWarning("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&this._setEndOfData()}_getNextSubscriptionId(){returnthis._nextSubscriptionId++}_checkBars(e,t=!1){if(l.enabled("charting_library_debug_mode"))for(leti=1;i<e.length;i++){if(e[i].time<=e[i-1].time){lets=`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"),this._logError(s)}consts=this._getExpectedBarPropertyNames();s.some((t=>"number"!=typeofe[i][t]||!isFinite(e[i][t])))&&this._logError(`Wrong bars values: all ${s.join(", ")} properties should be numbers`)}}_getExpectedBarPropertyNames(){switch(this._symbolInfo.visible_plots_set){case"c":return["close","time"];case"hlc":return["high","low","close","time"];default:return["high","low","open","close","time"]}}_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)returnthis._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){constt=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)returnthis._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}returnthis._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){constt=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):this._logError(`putToCacheNewBar: time violation, previous bar time: ${$v(s)} should be less or equal to new time: ${$v(i)}`)}_alignBarsTime(e){if(this._dwmAligner)for(consttofe)t.time=this._dwmAligner.timeToSessionStart(t.time)}_now(){returnDate.now()+1e3*this._serverTimeOffsetGetter()+6e4}}classYv{constructor(e,t,i){this._threads={},this._datafeed=e,this._serverTimeOffsetGetter=t,this._resetCacheTimePeriod=i}destroy(){this._forEachThread(((e,t)=>t.destroy())),this._threads={},deletethis._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}resetCache(){this._forEachThread(((e,t)=>t.resetCache()))}subscribe(e,t,i,s,o){constn=qv(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));returnn+'"'+this._threads[n].addSubscription(i,s,o)}unsubscribe(e){constt=e.split('"');if(2!==t.length)returnvoidthis._logWarning("Wrong guid format");consti=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):this._logWarning("Data thread doesnt exist: "+e)}_createThread(e,t){returnnewKv(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,Jd.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}_logWarning(e){console.warn(`${(newDate).toISOString()} FEED: ${e}`)}}classZv{constructor(){this._listeners=[]}listenersCount(){returnthis._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){constt=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;consti=this._listeners.indexOf(t[0]);deletethis._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";constt=this._listeners,i=t.length;for(lets=0;s<i;s++){consti=t[s];i&&i.onErrorCallback&&i.onErrorCallback(e)}}fire(e,t){t||(this._barset=e);consti=this._listeners,s=i.length;for(lett=0;t<s;t++){consts=i[t];s&&s.dataListener(e)}}}varXv=i(30342)
;classJv{constructor(e,t,i,s,o,n,r){this.periodBase="",this._shouldAlignDwmBarsToMainSeries=l.enabled("align_dwm_bars_to_main_series"),this._canExtendTimeScale=l.enabled("secondary_series_extend_time_scale");consta=(0,Pv.decodeExtendedSymbol)(e),c="string"==typeofa.symbol?a:a.symbol;if((0,Pv.isStudySymbol)(c))thrownewError(`Unexpected nested study symbol: ${e}`);consth="string"==typeofa.symbol?a.symbol:a.symbol.symbol;this.ticker=h,this.currencyCode=i||c["currency-id"],this.unitId=s||c["unit-id"],this.subsessionId=r||c.session;constd=c["currency-id"]!==this.currencyCode||c["unit-id"]!==this.unitId;c["currency-id"]=this.currencyCode,c["unit-id"]=this.unitId,d&&(e=(0,Pv.encodeExtendedSymbolOrGetSimpleSymbolString)(a)),this.tickerid=e;constu=Re.Interval.parse(t);this.resolution=u.letter(),this.interval=u.multiplier(),this.period=u.value(),this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN,this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.minTick=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.isFirstBar=!1,this.isLastBar=!1,this.session=newCd.SessionInfo("Etc/UTC","24x7"),this.regularSubsession=null,this.preMarketSubsession=null,this.postMarketSubsession=null,this.script=o,this.projectionTime=NaN,this.isAdditionalDepthAllowed=!(0,Pv.isStudySymbol)(a)||a.type.includes("BarSetHeikenAshi"),n&&this.set_symbolinfo(n)}set_symbolinfo(e){if(e||console.error("WARN: symbolinfo isn't defined for "+this.tickerid),this.info=e,this.minTick=e.minmov/e.pricescale,this.currencyCode=e.currency_code,this.unitId=e.unit_id,this.subsessionId=e.subsession_id,this.timezone=(0,Ce.get_timezone)(e.timezone),this.utcTimezone=(0,Ce.get_timezone)("Etc/UTC"),this.session.init(e.timezone,e.session,e.session_holidays,e.corrections),void0!==e.subsessions){constt=e.subsessions.find((e=>e.id===Xv.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===Xv.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===Xv.SubsessionId.PostMarket));void0!==t&&(this.regularSubsession=newjv.SessionsSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void0!==i&&(this.preMarketSubsession=newjv.SessionsSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void0!==s&&(this.postMarketSubsession=newjv.SessionsSpec(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=(0,Td.newBarBuilder)(this.period,e,t)}bartime(){conste=this.time;if(!this.isdwm()||isNaN(e))returne;constt=(0,n.ensureDefined)(this.timezone,"symbol instrument timezone");leti=(0,Ce.utc_to_cal)(t,e);returni=this.session.spec.correctTradingDay(i),(0,Ce.cal_to_utc)(t,i)}lastbar(e){if(isNaN(e.time))return;lett=e.time;if(this.dwm_aligner){conste=(0,Ce.get_cal_from_unix_timestamp_ms)(this.dwm_aligner.sessionSrc().timezone,t);!this._shouldAlignDwmBarsToMainSeries||this.dwm_aligner.sessionTgt().spec.includesDay(e)?(this.dwm_aligner.moveTo(t),
t=this.dwm_aligner.startOfBar(0)):this._canExtendTimeScale&&this.utcTimezone&&((0,Ce.set_hms)(e,0,0,0,0,this.utcTimezone),t=(0,Ce.cal_to_utc)(this.utcTimezone,e))}consti=this.time!==t;i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=(0,Hd.isNumber)(e.volume)&&e.volume>=0?e.volume:NaN,this.updatetime=e.updatetime||NaN,this.isNewBar=i,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.projectionTime=e.projectionTime||NaN,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}classQv{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){returnthis.get(0)}get(e=0){returnisNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=Py.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){lete=Py.Std.na(this.mindepth)?Py.Std.max_series_default_size:Py.Std.max(this.mindepth+1,1);e=Math.round(e);constt=newArray(e);for(leti=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(){null!==this._hist&&(this._hist=null,this.add_hist())}adopt(e,t,i){this._hist||(this.mindepth=NaN);consts=t.get();leto=e.indexOf(s);if(0!==i){consti=t.get(1);if(!Py.Std.na(i)){o=o===e.indexOf(i)?-1:o}}returno<0?NaN:this._get(o)}indexOf(e){if(!this._hist)returnthis.mindepth=NaN,-1;if(Py.Std.na(e))return-1;constt=this._hist.length,i=this.symbol.index+1,s=Math.min(t,i),o=(0,Pt.upperbound_int)(this._hist,e,0,s);return0===o?-1:s-o}_get(e){if(null===this._hist)returnNaN;lett=this._histPos-e;returnt<0&&(t+=this._hist.length),this._hist[t]}}classeSextendsQv{add_hist(){if(this._hist||(this._hist=newFloat64Array(2e3),this._histPos=-1),this._histPos=this._histPos+1,this._histPos===this._hist.length){conste=newFloat64Array(2*this._hist.length);e.set(this._hist),this._hist=e}this._hist[this._histPos]=this.original}}classtS{constructor(e){this.minimumAdditionalDepth=null,this._vars=[],this._varsIndex=0,this._ctx=[],this._ctxIndex=0,this.symbol=e}new_sym(e,t,i,s,o){returnthis.symbol.script.add_sym(e,t,i,s,o,void0)}select_sym(e){constt=this.symbol.script.get_sym(e);null==t&&Py.Std.error(`Attempted to select symbol at index ${e} but there is no such symbol`),this.symbol=t}is_main_symbol(e){returnvoid0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){constt=this._vars;t.length<=this._varsIndex&&t.push(newQv(this.symbol));consti=t[this._varsIndex++]
}),r=s[0],a=(t,s,o)=>{i.push(e.datafeed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,o,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))},l=(t,i)=>{"series"===(i.nonseries?"nonseries":"series")?this.update(t,i):i.lastBar?(this._nonseriesUpdate=i,i.lastBar.isLastBar=!0,"projection"===i.type&&(i.lastBar.projectionTime=i.lastBar.time),this._symbols[0].lastbar(i.lastBar),this._nonseriesUpdate=null):e.nonseriesOut(s[0],i)},c=()=>o;a(r,c,(e=>{!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&(e=>{functioni(i,s){leto=(0,Jd.createTimeToBarTimeAligner)(i,s)(e);constr=(0,Jd.createDwmAligner)(i,s);returnnull!==r&&(o=r.timeToExchangeTradingDay(o)),{to:o,countBack:(0,n.ensureNotNull)(t,"script runner script").maxAdditionalDepth()}}for(lete=1;e<s.length;e++){constt=s[e],o=t.period;Re.Interval.isEqual(o,r.period)||a(t,i.bind(null,o),l.bind(null,e))}})(e.firstLoadedTimeMs),l(0,e)}));for(lete=1;e<s.length;e++){constt=s[e];Re.Interval.isEqual(t.period,r.period)&&a(t,c,l.bind(null,e))}this._subscription=i}stop(){conste=this._subscription;if(e||this._script){if(null!==e)for(lett=0;t<e?.length;t++)this.host.datafeed.unsubscribe(e[t]);this._subscription=null,this._script?.stop(),this._script=null,this._symbols=null,this.isStarted=!1}elseconsole.warn("Recurring script engine stop happened.")}update(e,t){if(!t)returnvoidconsole.error("Unexpected barset = null");consti=this._symbols[e];if(this._isRecalculated){conste=t.bar(t.count()-1);e.isBarClosed=t.isLastBarClosed(),e.isLastBar=!0,i.lastbar(e)}elsethis._barsets[e]||(this._barsets[e]=t,i.set_symbolinfo(t.symbolinfo()),this.recalc())}recalc(){conste=this._symbols;for(lett=0;t<e.length;t++)if(!this._barsets[t])return;try{for(lett=e.length-1;t>=0;t--){consti=e[t],s=this._barsets[t],o=s.count();for(let e=0;e<o;e++){constt=s.bar(e);t.isLastBar=e===o-1,t.isBarClosed=!t.isLastBar||s.isLastBarClosed(),i.lastbar(t)}}this._isRecalculated=!0;constt=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(!(einstanceofkv.StudyError))throwe;this.host.onErrorCallback(e.message,e.title)}}}classnS{constructor(e){this.runner=newoS(e)}stop(){this.runner.stop()}isStarted(){returnthis.runner.isStarted}}classrS{constructor(e,t,i,s,o,n,r,a,l,c,h){this.listeners=t,this._isRecalculated=!1,this._symbolInfo=a,this.engine=newnS({datafeed:e,tickerid:i,currencyCode:s,unitId:o,subsessionId:h,period:n,body:r,sessionId:c,symbolInfo:a,dataRange:l,forceAlignBars:!1,enableDwmAligning:!1,input:()=>{thrownewError("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=newGv(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){consti=Object.assign({},t);i.nonseries=!0,i.data=t.bars,deletei.bars,i.barsetSize=this._barset?this._barset.count():0,i.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,this.listeners.fire(i,!0)}_out(e,t){consti=t[0];if(isNaN(i))return;consts={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},o=t[7];this._barset||(this._barset=newGv((0,n.ensureDefined)(e.info,"bar builder item output symbol info")));constr=t[8],a=t[9];if(rinstanceofArray&&a)for(lete=0;e<r.length;e++){constt=r[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(s,o),this._barset.isBarClosed=!!o,this._isRecalculated&&this.listeners.fire(this._barset)}}classaS{main(e){constt=e.new_var(Py.Std.open(e)),i=e.new_var(Py.Std.close(e)),s=t.get(1),o=i.get(1),n=Py.Std.ohlc4(e),r=Py.Std.na(t.get(1))?(Py.Std.open(e)+Py.Std.close(e))/2:(s+o)/2;t.set(r),i.set(n);consta=Py.Std.max(Py.Std.high(e),Py.Std.max(r,n)),l=Py.Std.min(Py.Std.low(e),Py.Std.min(r,n)),c=Py.Std.volume(e),h=e.symbol;return[h.time,r,a,l,n,c,h.updatetime,h.isBarClosed,void0,void0]}}varlS=i(4622);classcS{constructor(e,t,i,s,o,n,r,a){this.listeners=e,this._host=n,this._host.resolve(t,i,(e=>{o&&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)}}varhS=i(99955);classdS{constructor(e,t){this._period=e,this._generateEmptyBars=!!t}init(e){this._bb=(0,Td.newBarBuilder)(this._period,e.symbol.session,null),this._bbEmptyBars=this._generateEmptyBars?(0,Td.newBarBuilder)(this._period,e.symbol.session,null):void0,e.setMinimumAdditionalDepth(0)}main(e){constt=(0,n.ensureDefined)(this._bb,"bar builder study bar builder"),i=e.symbol.time,s=t.alignTime(i),o=e.new_var(s),r=Py.Std.na(s),a=o.get(1),l=Py.Std.na(a)?1:Py.Std.neq(s,a),c=e.new_var(),h=e.new_var(),d=e.new_var(),u=e.new_var(),_=c.get(1),p=h.get(1),m=d.get(1),g=u.get(1),f=r?NaN:l?Py.Std.open(e):_,y=r?NaN:l?Py.Std.high(e):Py.Std.max(Py.Std.high(e),p),v=r?NaN:l?Py.Std.low(e):Py.Std.min(Py.Std.low(e),m),S=r?NaN:Py.Std.close(e),b=r?NaN:l?Py.Std.volume(e):Py.Std.volume(e)+g,w=r?NaN:i,C=e.symbol.isBarClosed&&t.isLastBar(0,i),T=this._generateEmptyBars&&l?this._extrapolate(a,s):void0,P=e.new_var(Py.Std.close(e)).get(1),x=TinstanceofArray?P:NaN;returnc.set(f),h.set(y),d.set(v),u.set(b),[s,f,y,v,S,b,w,C,T,x]}_extrapolate(e,t){returnisNaN(e)||isNaN(t)?void0:(0,hS.extrapolateBarsFrontToTime)((0,n.ensureDefined)(this._bbEmptyBars,"bar builder study empty bar builder"),e,t,Number.MAX_SAFE_INTEGER,!0).times}}
constuS=e=>{console.error(e),Py.Std.error(e)},_S=Re.Interval.parse("1M").inMilliseconds(0);classpS{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,o,n,r,a,l,c,h){constd=l(r),u=((e,t,i,s,o,n,r,a,l)=>n+e+s+(t||"")+(i||"")+(l||"")+(o.has_empty_bars?"_":"")+"_"+r.countBack+"_"+r.to+"_"+Boolean(a))(e,t,i,s,r,a,d,c,h);let_=this._getCache(u);return_||(_=this._createItem(e,t,i,s,r,d,a,c,h),this._putCache(u,_)),_.listeners.addListener(o,n),{key:u,listener:o}}unsubscribe(e){constt=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){conste=[],t=e=>!!this._cache[e];for(constiinthis._cache)if(t(i)){0===(0,n.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(lett=0;t<e.length;t++){consti=e[t],s=(0,n.ensureNotNull)(this._cache[i],`unused datafeed cache item ${i}`);this._cache[i]=null,s.stop()}this.removeUnused()}}_getCache(e){returnthis._cache[e]}_putCache(e,t){this._cache[e]=t}_rebuildFrom(e,t){consti=(0,lS.findSuitableResolutionToBuildFrom)(e,t);if(i.error)throwuS(i.errorMessage),newError(i.errorMessage);returni.resolution}_createItem(e,t,i,s,o,n,r,a,l){constc=newZv,h=(0,Pv.decodeExtendedSymbol)(e),d="string"!=typeofh.symbol?h.symbol:h;t=d["currency-id"]||t,i=d["unit-id"]||i;constu=d.symbol,_=d.session&&d.session!==Xv.SubsessionId.Extended;if((l=d.session||l)===Xv.SubsessionId.Regular&&(l=void0),"type"inh){conste=Object.assign({},o);returno.has_empty_bars&&(e.has_empty_bars=!1),newrS(this,c,u,t,i,s,function(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))returnnewaS;constt=`unknown builder type: ${e.type}`;throwconsole.error(t),newError(t)}(h),e,n,r,l)}a&&!(0,Jd.isAlignmentEnabled)()&&uS("Internal error: rebuilding is requested but it is disabled."),!a&&o.has_empty_bars&&uS('Misconfiguration error: attempt to request data for symbol with "has_empty_bars" flag, but "disable_resolution_rebuild" featureset is enabled');constp=this._rebuildFrom(s,o);if(!Re.Interval.isTicks(s)&&(!Re.Interval.isEqual(s,p)||a)){(0,Jd.isAlignmentEnabled)()||uS('Misconfiguration error: remove "disable_resolution_rebuild" featureset or provide '+s+" data by yourself");consta=o.has_empty_bars,h=Object.assign({},o);o.has_empty_bars&&(h.has_empty_bars=!1);constd=Math.ceil((m=Re.Interval.parse(s),g=Re.Interval.parse(p),m.kind()===g.kind()?m.multiplier()/g.multiplier():(m.isMonths()?m.multiplier()*_S:m.inMilliseconds())/(g.isMonths()?g.multiplier()*_S:g.inMilliseconds())));returnn=Object.assign({},n,{countBack:n.countBack*d}),newrS(this,c,e,t,i,p,newdS(s,a),h,n,r,l)}varm,g;returnnewcS(c,u,{currency:t,unit:i,session:l},s,!!_,this._host,o,n)}}functionmS(e,t,i){return(0,tt.isArray)(e)?function(e,t,i){returne.map((e=>{consts=mS(e,t,i),o=t(s);returnvoid0!==o?o:s}))}(e,t,i):(0,tt.isObject)(e)&&((0,tt.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){consts={};returnObject.keys(e).forEach((o=>{constn=mS(e[o],t,i),r=t(n);s[o]=void0!==r?r:n})),s}(e,t,i):e}functiongS(e,t,i){consts=mS(e,t,i),o=t(s)
;returnvoid0!==o?o:s}varfS,yS=i(92211);functionvS(e,t){returne.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit",e[e.ExtendedExtrapolateLimit=45e4]="ExtendedExtrapolateLimit"}(fS||(fS={}));classSS{constructor(e,t,i){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=Re.Interval.parse(t),this._extrapolateLimit=i??(l.enabled("extended_extrapolation_limit")?45e4:2e5),this._session=newCd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),this._barBuilder=(0,Td.newBarBuilder)(t,this._session,null)}destroy(){this.clear()}interval(){returnthis._interval}barBuilder(){returnthis._barBuilder}symbolInfo(){returnthis._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){returnthis._barsTimes.length}futureBars(){returnthis._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)returnvoidthis.setBarsTimes(e,t);consti=e[0],s=this._barsTimes[this._barsTimes.length-1],o=i>s?this._barsTimes.length:(0,Pt.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,n.assert)(-1!==this._projectionFirstIndex,"something went wrong"),s!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){consti=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)returnthis._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)));consti=this.indexOfTime(e);if(null===i)returnnull;consts=this.timeOfBarIndex(i.index+t,0);returnnull===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);lett=(0,Pt.lowerbound_int)(this._historyBarsCache,e)
t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:e<this._projectionFirstIndex}}_calculateBarPattern(e,t,i){consts=this.interval(),o=s.multiplier(),n=s.isDWM(),r=[];leta,l=e;a=s.isSeconds()?1e3:s.isMinutes()?6e4:s.isDays()?864e5:s.isWeeks()?6048e5:s.isMonths()?2592e6:864e5;letc=0;for(;(null===i||c<i)&&(null===t||l<t);){conste=l+o*a;lett=e;if(n){this._barBuilder.moveTo(e);consti=newDate(e),s=this._session.spec,o=s?.correctTradingDay(i);o&&(t=o.getTime())}else{this._barBuilder.moveTo(e);consti=this._barBuilder.indexOfBar(e);t=this._barBuilder.startOfBar(i)}if(r.includes(t)){conste=l+o*a;if(r.includes(e))break;r.push(e),l=e}elser.push(t),l=t;if(r.length>this._extrapolateLimit)break;c++}returnr}_extendFutureCacheFromRight(e){constt=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;consti=e(t,this._futureBarsCache.length)||[];return0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){constt=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;consti=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,n.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;constt=(0,hS.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,n.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;constt=(0,hS.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||vS(this._futureBarsCache,this._extrapolateLimit))&&(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{consts=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t,o=e-i;returnthis._calculateBarPattern(s,null,o)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times)))}_ensureExtrapolatedToHistoryBar(e){this._historyBarsCache.length>=e||vS(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){
if(e>this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)returnnull;constt=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)returnnull;consts=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}lett=(0,Pt.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs<t));returnthis._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(){returnthis._minFutureBarsCount}firstFutureBarIndex(){returnthis._sortedTimePoints.length}firstSessionBarIndex(){return0===this._sortedTimePoints.length?null:0}lastSessionBarIndex(){return0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}tickMarks(e=0){constt=this.firstFutureBarIndex();(0,n.assert)(e<=t,"tickmarks cannot be filtered in the future");consti=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);consts=[];for(lett=e;t<this._sortedTimePoints.length;++t)s.push(IS(this._sortedTimePoints[t],t));consto=i.map(((e,i)=>IS(e,i+t)));returns.concat(o)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,Ce.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;lett=-1,i=(0,Pt.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMs<t));for(constsofe){conste=Math.round(1e3*s.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,n.assert)(i!==t,"data must have unique times"),t=i,s.index=i}(0,n.assert)(i<this._sortedTimePoints.length,"data must be within a data range")}convertTimesToIndexes(e,t=!1){if(0===e.length)return[];leti=-1,s=(0,Pt.lowerbound)(this._sortedTimePoints,e[0],((e,t)=>e.timeMs<t));returne.map(((e,o,r)=>{for(;s<this._sortedTimePoints.length&&this._sortedTimePoints[s].timeMs<e;)s+=1;if(0===s&&e<this._sortedTimePoints[0].timeMs)returnFh.INVALID_TIME_POINT_INDEX;if(s>=this._sortedTimePoints.length){constt=this.indexOfTime(e);if(null===t)returnFh.INVALID_TIME_POINT_INDEX;s=t.timeMs!==e?t.index+1:t.index}return(!t||o>0&&e<=r[o-1])&&(0,n.assert)(s>i,"data must have unique sorted times"),i=s,s}))}firstSeriesBarTime(){return0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceStudyBarsTimesTail(e,t){returnthis._replaceInstanceBarsTimesTail(e,t)}replaceBarsTimesTail(e,t){returnthis._replaceInstanceBarsTimesTail(e,t)}setSeriesBarsTimes(e,t){returnthis._setBarsTimes(e,t)}setStudyBarsTimes(e,t,i){
constkS=newMap([["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]]]),ES=newMap([["horizlines",(e,t)=>{consti=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{consti=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{consti=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{consti=e;for(consteofi.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{consti=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);classDS{main(e){return[Py.Std.open(e),Py.Std.high(e),Py.Std.low(e),Py.Std.close(e),Py.Std.volume(e),Py.Std.updatetime(e),void0,void0,void0,void0]}}constBS=(0,ne.getLogger)("ChartApi.PointsetsManager");classVS{constructor(){this._pointsetsDataBySymbol=newMap}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,o){letn=this._pointsetsDataBySymbol.get(t);void0===n&&(n=newMap,this._pointsetsDataBySymbol.set(t,n));constr=[];for(consttofs){const[s,n,a]=t;if("number"!=typeofs||Number.isNaN(s)){BS.logWarn(`Pointset time is invalid: id=${e}, ${s} of type ${typeofs}`);continue}constl=o(a||i);r.push({point:t,extrapolation:l.extrapolateTimeWithOffsetToTime(1e3*s,n)})}s.length===r.length&&n.set(e,{resolution:i,points:r})}removePointset(e){constt=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(consteoft)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){consti=this._pointsetsDataBySymbol.get(e);void0!==i&&i.forEach(((e,i)=>{if(Re.Interval.isEqual(e.resolution,t))for(consttofe.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){consto=newMap,n=this._pointsetsDataBySymbol.get(e);returnvoid0!==n&&n.forEach(((e,n)=>{constr=this._refreshPointsetData(e,t,i,s);null!==r&&o.set(n,r)})),o}_refreshPointsetData(e,t,i,s){if(Re.Interval.isEqual(e.resolution,t))for(lets=0;s<e.points.length;++s){consto=e.points[s];if(null!==o.extrapolation&&o.extrapolation.exact)continue;const[n,r,a]=o.point,l=i(a||t);o.extrapolation=l.extrapolateTimeWithOffsetToTime(1e3*n,r)}consto=[];for(leti=0;i<e.points.length;++i){constn=e.points[i];if(null===n.extrapolation)returnnull;constr=s.indexOfTime(n.extrapolation.timeMs);if(null===r)returnBS.logWarn(`Cannot get index of time: time=${n.extrapolation.timeMs}, ${e.resolution} -> ${t}`),null;o.push({index:i,value:[r.index,r.timeMs/1e3]})}returno}}constRS=-5e6,NS="pre_post_market_sessions",OS=l.enabled(NS),FS=l.enabled("pay_attention_to_ticker_not_symbol");classWS{constructor(e,t,i,s){this._chartApiMessagerProvider=t,this._marketStatusWatcherProvider=i,this._studyLibrary=s,this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},
this._timeScales[e].setTimezone(t);consti=this._timeScales[e].tickMarks();null!==i&&this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(0,i)}on(e,t){returnthis._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}supportedResolutions(){returnthis._datafeedConfiguration.supported_resolutions}supportedCurrencies(){returnthis._datafeedConfiguration.currency_codes||[]}supportedUnits(){returnthis._datafeedConfiguration.units||{}}supportedPriceSources(e){returnnewPromise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(JS(e).price_sources)}),(e=>{i(e)}))}))}supportedSymbolsTypes(){returnthis._datafeedConfiguration.symbols_types||[]}symbolsGrouping(){returnthis._datafeedConfiguration.symbols_grouping||{futures:/$a/}}getMarks(e,t,i,s,o){constr={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks&&(this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,n.ensure)(e.full_name),o,newDate(1e3*t).toUTCString(),newDate(1e3*i).toUTCString())),this._externalDatafeed.getMarks(JS(e),t,i,(t=>{consti=t.map((e=>(e.time=Number(e.time),e)));this._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(i)));consta=(0,Jd.createDwmAligner)(o,e),c=l.enabled("two_character_bar_marks_labels"),h=i.map((e=>{constt=e;returnt.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,t.direction=(0,et.default)(e.color)?r[e.color]:r.red,t.onClicked=()=>{ee.emit("onMarkClick",e.id)},t.label=e.label?c?e.label.slice(0,2):e.label[0]:"",t}));s(h)}),o))}getTimescaleMarks(e,t,i,s,o){this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks&&(this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,n.ensure)(e.full_name),o,newDate(1e3*t).toUTCString(),newDate(1e3*i).toUTCString())),this._externalDatafeed.getTimescaleMarks(JS(e),t,i,(t=>{this._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(t)));consti=(0,Jd.createDwmAligner)(o,e),r=t.map((e=>{constt=e;returnt.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,t}));s(r)}),o))}getSeriesLastBarTime(e,t){consti=this._getSeriesData(e,t);returnnull===i||0===i.length?null:i[i.length-1].timeMs}getSeriesInterval(e,t){consti=this._studiesCache[e][t];returni?i.resolution:null}onSessionSeriesError(e){this.stopSources(e);constt=this._mainSeriesRecord(e);null!==t&&(t.error=!0),this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}stopSources(e){for(consttofthis._getStudiesCacheSessionKeys(e)){consti=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}}getSeriesSymbolInfo(e,t){consti=this._studiesCache[e][t];returni?i.symbolInfo:null}modifySeries(e,t,i,s,o,r){consta=this._mainSeriesRecord(e);if(null===a||a.guid!==t){
if(null!==a&&a.error)returnthis._studiesCache[e][t].symbolId=i,this._studiesCache[e][t].resolution=s,void(this._studiesCache[e][t].turnaround=o);this._stopSourcesTree(e,t),this.createSeries(e,t,o,i,s,{countBack:0},!0);for(constiofthis._getStudiesCacheSessionKeys(e)){consts=this._studiesCache[e][i];if(s&&"study"===s.type&&s.parentId===t){this._studiesNonSeriesTimes[e][i]=null;constt=this._studiesCache[e][s.parentId];this._createStudy(t.symbolId,t.resolution,s.studyObject,e,i,s.turnaround,s.parentId,(0,n.ensure)(s.inputs))}}}elsethis._modifyMainSeries(e,i,s,o,r)}createStudy(e,t,i,s,o,n){constr=this._studiesCache[e][i],a=this._studyLibrary.findStudyObject(o);if(null===a)return$S("Study does not exist: "+o),voidthis._chartApiMessagerProvider.getChartApiMessager(e).onStudyError(t,s,"unknown study name");constl=newa.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(r.symbolId,r.resolution,l,e,t,s,i,n)}modifyStudy(e,t,i,s){consto=this._studiesCache[e][t];if(!o)throwError("This should never happen");constn=this._studiesCache[e][o.parentId];o.inputs=s,o.turnaround=i,o.engine&&(o.engine.stop(),this._pineDatafeed.removeUnused()),this._studiesNonSeriesTimes[e][t]=null,this._createStudy(n.symbolId,n.resolution,o.studyObject,e,t,i,o.parentId,s)}sessionTimeScale(e){returnthis._timeScales[e]||null}isTimeScaleExtendedTo(e,t){consti=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(i.resolution)&&null!=i.symbolInfo){conste=(0,Jd.createDwmAligner)(i.resolution,i.symbolInfo);null!==e&&(t=e.timeToSessionStart(t))}consts=this._timeScales[e].indexOfTime(t);returnnull!==s&&s.index>=0}ensureExtendedTo(e,t,i){if(!this._studiesCache[t][e])throwError("This should never happen");setTimeout((()=>{this._recreateSourcesForDataRange(t,{to:i})}),0)}extendSeriesRange(e,t){leti=this._timeScales[e].firstSeriesBarTime();if(null===i)returnvoidthis._logMessage("Nothing to extend - there is no points on time scale");consts=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(s.resolution)&&null!=s.symbolInfo){conste=(0,Jd.createDwmAligner)(s.resolution,s.symbolInfo);null!==e&&(i=e.timeToExchangeTradingDay(i))}consto=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s.symbolId))),r=this._barsCoefficients(o,s.resolution),a=r.barsCoefficient||1;if(!r.barsCoefficient){consti=this._getSeriesData(e,s.guid);null!==i&&(r.expectedBarsCount=i.length+t)}setTimeout((()=>{this._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}seriesTurnaround(e,t){returnthis._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround}createSeries(e,t,i,s,o,r,a){this._setEndOfData(e,t,i,!1);constc=newDS;this._studiesCache[e]=this._studiesCache[e]||{};consth=this._getSeriesData(e,t),d=this._studiesCache[e][t],u=this._seriesCount(e),_=this._mainSeriesRecord(e),p=function(e){let{dataRange:t}=e
;const{oldStudyRecord:i,resolution:s,symbolId:o,seriesCount:r,oldData:a,mainSeriesRecord:l,timeScales:c,session:h}=e;if(!i||Re.Interval.isEqual(i.resolution,s)&&i.symbolId===o)void0!==t.countBack&&null!==a&&0!==a.length&&(t.to=a[0].timeMs),i&&null!=i.firstLoadedTimeMs?t.to=void0!==t.to?Math.min(i.firstLoadedTimeMs,t.to):i.firstLoadedTimeMs:i||0===r||null!==l&&(null!=l.firstLoadedTimeMs?(t.to=l.firstLoadedTimeMs,t.countBack=0):t=Object.assign({},l.dataRange));elseif(1===r)t=Object.assign({},i.initialDatarange);else{conste=c[h].firstSeriesBarTime();(void0===t.to||null!==e&&e<t.to)&&(t.to=(0,n.ensureNotNull)(e),t.countBack=0)}void0===t.countBack&&(t.countBack=0);void0===t.to&&0===t.countBack&&(t.countBack=100);returnt}({dataRange:r,oldStudyRecord:d,resolution:o,symbolId:s,seriesCount:u,oldData:h,mainSeriesRecord:_,timeScales:this._timeScales,session:e});if(this._studiesCache[e][t]={symbolId:s,resolution:o,studyObject:c,guid:t,type:"series",turnaround:i,dataRange:p,initialDatarange:d&&d.initialDatarange||Object.assign({},p),firstLoadedTimeMs:null,symbolInfo:null,isMain:d&&d.isMain||0===u,completed:!1},null!==_&&_.guid!==t&&_.error)return;this._updateMainTsBuilder(e),this._updateTimeScaleState(e),this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesLoading(t,i);constm=(s,n,r)=>{consta=[];if(void0!==r){conste=(r.data||[]).reduce(((e,t)=>Math.max(e,t[0]||0)),-1);if(null!=r.projectionTime)for(lett=0;t<=e;++t)a.push(r.projectionTime+t)}letl=null,c=null;consth=s?this._getSymbolExtrapolator(e,s,o):null;if(void0!==n){consti=n.map((e=>e.timeMs)).concat(a);null!==h&&h.replaceBarsTimesTail(i,n.length),c=this._timeScales[e].replaceBarsTimesTail(t,i),l=n}else{consti=this._getSeriesData(e,t)||[],s=i.map((e=>e.timeMs)).concat(a);null!==h&&h.setBarsTimes(s,i.length),c=this._timeScales[e].setSeriesBarsTimes(t,s),l=i}if(this._applyTimeScaleUpdate(e,c),0===l.length&&void0===r)return;this._timeScales[e].fillIndexesInRows(l);constd=void0!==r?this._prepareSeriesNonSeriesData(e,t,r):null;this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,l,d)},g=s=>{consto=this._studiesCache[e][t];o.completed=!0,this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesError(t,i,s),l.enabled("clear_bars_on_series_error")&&(o.isMain?this.onSessionSeriesError(e):this._clearSeriesData(e,t))};this._computeStudy(e,c,s,o,t,[],p,jS(e,t),(function(){return-1/0}),{onDataReadyCallback:(r,l,c,h)=>{constd=this._studiesCache[e][t];if(!d)throwError("This should never happen");if(d.symbolInfo=c,d.firstLoadedTimeMs=h.firstLoadedTimeMs,d.completed=!0,this._updateMainTsBuilder(e),a&&this._pointsetsManagers[e].invalidatePointsetsForSymbol(c.full_name,o),0!==r.length){consti=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s))),a=this._barsCoefficients(i,o);a.expectedBarsCount&&a.barsCount&&(a.barsCoefficient=Math.min(Math.max(a.barsCoefficient||1,Math.floor(a.expectedBarsCount/(r.length-a.barsCount)+.5)),100)),a.barsCount=r.length,this._clearSeriesData(e,t)}else!h.endOfData&&d.isMain&&setTimeout((()=>{
this._studiesCache[e]&&this._recreateSourcesForDataRange(e,{countBack:10})}),0);m(c),h.endOfData&&(this._logMessage("Series has no more data on server: {0}".format(c.full_name)),this._setEndOfData(e,t,i)),0===r.length&&this._clearSeriesData(e,t),this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesCompleted(t,i,c.data_status),this._updateTimeScaleState(e)},onRealtimeCallback:(s,n,r,a,l)=>{m(l,s),this._timeScales[e].fillIndexesInRows(s);constc=s[s.length-1];if(n){if(!this._studiesCache[e][t])throwError("This should never happen");this._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c)))}elsethis._logMessage("Last bar update: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c))),this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,s,null);this._fireEvent("realtime_tick",s[s.length-1],!0)},onSymbolErrorCallback:e=>{this._logMessage("Series symbol resolve error: "+e),g(e||"resolve error")},onErrorCallback:e=>{this._logMessage("Series error: "+e),g(e)},onNonSeriesDataUpdate:(s,o)=>{if("projection"!==s.type)thrownewError("unexpected non-series data type for series "+s.type);constr=this._getSeriesData(e,t);if(null!==r)m((0,n.ensure)(o.info),0===r.length?void0:[r[r.length-1]],s);else{consto=this._prepareSeriesNonSeriesData(e,t,s);this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,[],o)}}})}removeStudy(e,t){if(this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),this._pineDatafeed.removeUnused()),this._studyCanExtendTimeScale(e,t)){this._timeScales[e].setCompleted(!1);consti=this._timeScales[e].setStudyBarsTimes(t,[],!0);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}deletethis._studiesCache[e][t],deletethis._studiesNonSeriesTimes[e][t]}removeSeries(e,t){this._stopSourcesTree(e,t),deletethis._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);consti=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}requestMoreTickmarks(e,t){consti=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);consts=i.firstFutureBarIndex(),o=i.tickMarks(s);this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(s,o)}chartCreateSession(e){this._pointsetsManagers[e]=newVS,this._timeScales[e]=newAS,this._studiesNonSeriesTimes[e]={}}chartDeleteSession(e){this._pointsetsManagers[e].destroy(),deletethis._pointsetsManagers[e],this._timeScales[e].destroy(),deletethis._timeScales[e],deletethis._studiesNonSeriesTimes[e]}removePointset(e,t){this._pointsetsManagers[e].removePointset(t)}asynccreatePointset(e,t,i,s,o){constn=this._resolvePromisesBySymbolId.get(US(e,i));if(void0===n)return;letr;try{r=(awaitn).symbolInfo}catch(e){return}this._pointsetsManagers[e].createPointset(t,r.full_name,s,o,((t=s)=>this._getSymbolExtrapolator(e,r,t))),
last_price:s?t.v.lp:void0,change_percent:s?t.v.chp:void0,current_session:s?t.v.cs:o&&o.marketStatus(),pricescale:i.pricescale,minmov:i.minmov,minmove2:i.minmove2||0,fractional:i.fractional||!1}};XS(i.logo_urls,i.exchange_logo,n.values),(o&&s?t.v.cs:void0)&&o.stop(),this._chartApiMessagerProvider.getChartApiMessager(e).onQuotesData([e,n])},o=n=>{n.forEach((r=>{consta=r.n;if(i[a]?.size>0){constt=[...i[a]].map((e=>({...r,n:e})));if(l.enabled("charting_library_debug_mode")){constt=void0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for symbol ${a}${t}: ${JSON.stringify(n)}`)}setTimeout((()=>o(t)),0)}if(void0!==t[r.n]&&null!==t[r.n])s(r,t[r.n]);elseif(l.enabled("charting_library_debug_mode")){constt=void0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for unexpected symbol ${a}${t}: ${JSON.stringify(n)}`)}}))},r=asynce=>{try{const[s,o]=KS(e),r=awaitnewPromise(((e,t)=>{this._resolveSymbolByName(s,o,e,t)})),a=(0,n.ensure)(r.ticker);returnt[a]=t[e]=JS(r),a===e?a:(void0===i[a]&&(i[a]=newSet),a!==e&&i[a].add(e),a)}catch{returnnull}},a=asynce=>[...newSet((awaitPromise.all([...newSet(e)].map(r))).filter((e=>null!==e)))];if(this._externalDatafeed.getQuotes&&!l.enabled("charting_library")){const[t,i]=awaitPromise.all([a(this._quotesInfo[e].symbols),a(this._quotesInfo[e].fastSymbols)]),s={};if(l.enabled("charting_library_debug_mode")){conste=WS.debugGetQuotesRequestId++;this._logMessage(`QUOTES Requesting data for symbols ${JSON.stringify(t)} with request ID ${e}`);for(constioft){constt=1e4;s[i]=window.setTimeout((()=>{this._logMessage(`QUOTES Timeout after waiting ${t/1e3} seconds for data symbol ${i} with request ID ${e}`)}),t)}}this._externalDatafeed.getQuotes(t,(n=>{if(l.enabled("charting_library_debug_mode"))for(consteofn)void0!==s[e.n]&&clearTimeout(s[e.n]),delete s[e.n];this._quotesInfo[e]&&0!==this._quotesInfo[e].symbols.length&&(o(n),this._quotesInfo[e].listenerGUID=e,l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Subscribing listenerGUID ${this._quotesInfo[e].listenerGUID} to data for symbols ${JSON.stringify(t)} and fast symbols ${JSON.stringify(i)}`),this._externalDatafeed.subscribeQuotes(t,i,o,this._quotesInfo[e].listenerGUID))}),(e=>{this._logMessage(`QUOTES Error getting data for symbols ${JSON.stringify(t)}: ${e}`)}))}else!this._externalDatafeed.getQuotes&&l.enabled("trading_terminal")&&setTimeout((()=>{o(this._quotesInfo[e].symbols.map((e=>({n:e,s:"ok",v:{}}))))}));this._createMarketStatusWatchers(e,this._quotesInfo[e].symbols)}_createMarketStatusWatchers(e,t){void0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(leti=0;i<t.length;i+=1){consts=t[i];if(void0===this._marketStatusWatchers[e][s]){const[t,i]=KS(s);this._marketStatusWatchers[e][s]=this._marketStatusWatcherProvider.createMarketStatusWatcher(((o,n,r,a)=>this._resolveSymbolByName(t,i,r,(o=>{
$S(`Error resolving for market status watcher ${qS(t,i.currency,i.unit,i.session)}:\n${o}`),this.quoteRemoveSymbols(e,[s]),a(o)}))),e,s,this._chartApiMessagerProvider)}}}_filteredSymbols(e){constt=[];returne.forEach((e=>{einstanceofObject||t.indexOf(e)<0&&t.push(e)})),t}_refreshPointsets(e){e.forEach((e=>{constt=this._studiesCache[e];if(null==t)return;leti=null;for(const eofObject.keys(t)){consts=t[e];if("series"===s.type){i=s;break}}if(null===i||null==i.symbolInfo)return;consts=i.symbolInfo;this._pointsetsManagers[e].getUpdatesForSymbol(i.symbolInfo.full_name,i.resolution,((t=i.resolution)=>this._getSymbolExtrapolator(e,s,t)),this._timeScales[e]).forEach(((t,i)=>{this._chartApiMessagerProvider.getChartApiMessager(e).onPointsetDataUpdate(i,null,t)}))}))}_recreateSourcesForDataRange(e,t){consti=[];for(constsofthis._getStudiesCacheSessionKeys(e)){consto=this._studiesCache[e][s];if(o&&"series"===o.type&&!this._isEndOfData(e,s,o.turnaround)&&(this._stopSourcesTree(e,s),i.push(s)),o&&"study"===o.type&&this._studyCanExtendTimeScale(e,s)&&!this._isEndOfData(e,s,o.turnaround)){consti=this._studiesCache[e][(0,n.ensure)(o.parentId)];o.dataRange=t,this._createStudy(i.symbolId,i.resolution,o.studyObject,e,s,o.turnaround,(0,n.ensure)(o.parentId),(0,n.ensure)(o.inputs))}}i.forEach((i=>{this._startSourcesTree(e,i,Object.assign({},t))}));for(consttofthis._getStudiesCacheSessionKeys(e)){consti=this._studiesCache[e][t];"series"===i.type&&this._isEndOfData(e,t,i.turnaround)&&this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesCompleted(t,i.turnaround,(0,n.ensure)(i.engine).runner.host.symbolInfo.data_status)}this._updateTimeScaleState(e)}_startSourcesTree(e,t,i){consts=this._studiesCache[e][t];this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0);for(constiofthis._getStudiesCacheSessionKeys(e)){consto=this._studiesCache[e][i];o&&"study"===o.type&&o.parentId===t&&this._createStudy(s.symbolId,s.resolution,o.studyObject,e,i,o.turnaround,o.parentId,(0,n.ensure)(o.inputs))}}_clearSeriesData(e,t){consti={};i[t]={turnaround:this._studiesCache[e][t].turnaround};for(constsofthis._getStudiesCacheSessionKeys(e)){consto=this._studiesCache[e][s];"study"===o.type&&this._studyCanExtendTimeScale(e,s)||("study"!==o.type||o.parentId!==t||this._studyCanExtendTimeScale(e,s)||(i[s]={turnaround:o.turnaround}))}this._chartApiMessagerProvider.getChartApiMessager(e).onClearData(i)}_prepareSeriesNonSeriesData(e,t,i){consts=i.data[i.data.length-1],o=this._getSeriesData(e,t),r=null===o?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:r.map(((e,t)=>({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(r.map((e=>{constt=e[0]||0;returnt<0?(0,n.ensure)(o)[(0,n.ensure)(o).length+t].timeMs:i.projectionTime+t})))}}_seriesCount(e){lett=0;for(constiofthis._getStudiesCacheSessionKeys(e)){"series"===this._studiesCache[e][i].type&&(t+=1)}returnt}
_modifyMainSeries(e,t,i,s,o){this.stopSources(e);constr=this._mainSeriesRecord(e);leta=!1;for(constnofthis._getStudiesCacheSessionKeys(e)){constc=this._studiesCache[e][n];if(c&&"series"===c.type)if((0,Wv.default)(r)||c.guid!==r.guid)this.createSeries(e,c.guid,c.turnaround,c.symbolId,i,{countBack:0},!0);else{a=r.symbolId!==t||r.resolution!==i;constn=ZS(o),c={countBack:n||0};l.enabled("request_only_visible_range_on_reset")&&n&&(deletethis._objectsDataCache[jS(e,r.guid)],deletethis._studiesCache[e][r.guid]),this.createSeries(e,r.guid,s,t,i,c,!0)}}for(consttofthis._getStudiesCacheSessionKeys(e)){consti=this._studiesCache[e][t];if(i&&"study"===i.type){this._studiesNonSeriesTimes[e][t]=null;consts=this._studiesCache[e][(0,n.ensure)(i.parentId)];this._createStudy(s.symbolId,s.resolution,i.studyObject,e,t,i.turnaround,i.parentId,(0,n.ensure)(i.inputs))}}a&&this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}_mainSeriesRecord(e){lett=null,i=null;for(constsofthis._getStudiesCacheSessionKeys(e)){consto=this._studiesCache[e][s];if("series"===o.type&&(null===t&&(t=o),o.isMain)){i=o;break}}returnnull===i&&(i=t),null!==i&&(i.isMain=!0),i}_stopSourcesTree(e,t){for(constiofthis._getStudiesCacheSessionKeys(e)){consts=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))}this._pineDatafeed.removeUnused()}_getSeriesData(e,t){returnthis._objectsDataCache[jS(e,t)]||null}_resolveSymbolImpl(e,t,i){vars;(0,Pv.isEncodedExtendedSymbol)(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(newDate).toISOString()}${s}`));const[o,n]=KS(e);this._resolveSymbolByName(o,n,t,i)}_getSymbolExtrapolator(e,t,i){consts=(0,n.ensure)(Re.Interval.normalize(i)),o=function(e,t,i){consts=void0!==t.subsession_id?","+t.subsession_id:"";returne+","+t.full_name+","+i+s}(e,t,s);letr=this._symbolExtrapolators[o];returnvoid0===r&&(r=newSS(t,s),this._symbolExtrapolators[o]=r),r}_barsCoefficients(e,t){consti=(0,Pv.decodeExtendedSymbol)(e);if(!("type"ini)||void0===i.type)return{};consts=e+t;returnthis._barsCoefficientsCache[s]||(this._barsCoefficientsCache[s]={}),this._barsCoefficientsCache[s]}_studyCanExtendTimeScale(e,t){consti=this._studiesCache[e][t]?.metainfo;returnvoid0!==i&&(l.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||l.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id||l.enabled("inactivity_gaps")&&"InactivityGaps@tv-basicstudies-1"===i.id)}_stopQuotesSubscription(e){this._quotesInfo[e].listenerGUID&&(l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Unsubscribe listenerGUID=${this._quotesInfo[e].listenerGUID}`),this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void0),this._removeMarketStatusWatchers(e)}_removeMarketStatusWatchers(e){Object.keys(this._marketStatusWatchers[e]||{}).forEach((t=>{this._marketStatusWatchers[e][t].stop()
})),this._marketStatusWatchers[e]={}}_logMessage(e){l.enabled("charting_library_debug_mode")&&console.log(`${(newDate).toISOString()}${e}`)}_resolveSymbolByName(e,t,i,s){leto;constn=t&&t.currency,r=t&&t.unit,a=t&&t.session,l=GS(e,n,r,a);(0,Wv.default)(this._resolveRequests[l])?(o=this._resolveSymbolInternal(e,n||void0,r||void0,a||void0),this._resolveRequests[l]=o,o.then((t=>{this._resolveRequests[GS(e,t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,yS.extractSymbolNameFromSymbolInfo)(t,null),t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,yS.extractSymbolNameFromSymbolInfo)(t,null),n,r,a)]=o})).catch((()=>{}))):o=this._resolveRequests[l],o.then(i).catch(s)}_resolveSymbolInternal(e,t,i,s){returnnewPromise(((o,n)=>{constr=qS(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(r));leta=!0;this._externalDatafeed.resolveSymbol(e,(e=>{a&&$S("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),this._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(r,JSON.stringify(e)));constt=function(e,t){if(e.ticker||(e.ticker=e.symbol||e.name),e.full_name=t.shouldUseTickerNotSymbol?e.ticker:`${e.exchange}:${e.name}`,e.pro_name=e.full_name,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),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),void0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions){constt=[];for(constiofe.supported_resolutions){conste=Re.Interval.parse(i);e.isValid()&&!e.isRange()&&t.push(e.value())}e.supported_resolutions=t}if(e.price_sources||(e.price_sources=[]),e["is-tickbars-available"]=!!e.has_ticks,deletee.has_ticks,!0===t.shouldUseSubsessions&&Array.isArray(e.subsessions))for(lett=0;t<e.subsessions.length;t++){consti=e.subsessions[t];switch(i.id){caseXv.SubsessionId.Regular:caseXv.SubsessionId.Extended:i.private=!1;break;caseXv.SubsessionId.PreMarket:caseXv.SubsessionId.PostMarket:i.private=!0}}returne.build_seconds_from_ticks=!1,e}(e,{shouldUseSubsessions:OS,shouldUseTickerNotSymbol:FS});!function(e){constt=e.ticker??e.name??("symbol"ine?e.symbol:void0)??"unknown symbol";functioni(e){$S(`SymbolInfo validation for ${t}: `+e)}"string"==typeofe.ticker&&0!==e.ticker.length||!FS||i('ticker must be a non-empty string when the "pay_attention_to_ticker_not_symbol" featureset is enabled');void0!==e.exchange&&0!==e.exchange.length||i("exchange must be provided to the symbol information");e.has_empty_bars&&!(0,
Jd.isAlignmentEnabled)()&&i('both has_empty_bars field and featureset "disable_resolution_rebuild" are enabled and may cause data issues (see #3329)');(void0===e.minmov||e.minmov<=0)&&i("minmov must be positive");(void0===e.pricescale||e.pricescale<=0)&&i("pricescale must be positive");void0!==e.name&&0!==e.name.length||i("name must be non-empty string");void0!==e.session&&0!==e.session.length||i("session must be non-empty string");"holidays"ine&&i("field holidays is deprecated, use session_holidays instead");"has_no_volume"ine&&i("field has_no_volume is deprecated, use visible_plots_set instead");void0===e.timezone||0===e.timezone.length?i("timezone must be non-empty string"):"exchange"!==e.timezone&&(0,Pe.timezoneIsAvailable)(e.timezone)||"UTC"!==e.timezone&&i('unsupported timezone "{0}"'.format(e.timezone));if(void0!==e.intraday_multipliers){constt=e.intraday_multipliers;if(Array.isArray(t))for(lete=0;e<t.length;++e)"string"!=typeoft[e]&&i('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(e+1,t[e],typeoft[e]));elsei("intraday_multipliers must be array")}(e.supported_resolutions||[]).filter((e=>!Re.Interval.isValid(e))).forEach((e=>{i("supported_resolutions field contains invalid value: "+e)})),OS||(void0!==e.subsessions&&i(`Symbol info contains subsessions but the ${NS} feature is not enabled, so the subsessions will be ignored`),void0!==e.subsession_id&&i(`Symbol info contains a subsession ID but the ${NS} feature is not enabled, so the subsession ID will be ignored`));!0===e.build_seconds_from_ticks&&i("build_seconds_from_ticks is true but building seconds from ticks is only available in Trading Platform.")}(t),this._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(r,JSON.stringify(t))),o(t)}),(e=>{this._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(r,e)),n(e)}),{currencyCode:t,unitId:i,session:s}),a=!1}))}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){consts=this._callbacks[e];for(lete=0;e<s.length;++e)s[e](t);i||(this._callbacks[e]=[])}}async_computeStudy(e,t,i,s,o,n,r,a,c,h){letd=!0;constu=[];null!==a&&(this._objectsDataCache[a]=null),this._timeScales[e].setCompleted(!1);const_=this._computeStudyCounter++;functionp(e,t){if(e<c())returnRS;if(0===t)return0;consti=u[t-1].index;returni===RS?0:i+1}constm=newMap;letg=!1;constf=(i,c)=>{const_=Re.Interval.parse(s);if((0,Hv.default)(i.supported_resolutions)&&i.supported_resolutions.length>0&&(0,lS.findSuitableResolutionToBuildFrom)(s,i).error)h.onSymbolErrorCallback(`unsupported resolution: ${i.ticker},${s}`);else{if(Re.Interval.isDWM(s)&&void0!==r.to){conste=(0,Jd.createDwmAligner)(s,i);null!==e&&(r.to=e.timeToExchangeTradingDay(r.to))}if(r.from&&r.to){conste=(0,Td.getPeriodsBetweenDates)(i.session,i.session_holidays,i.corrections,_.letter(),_.multiplier(),r.from,r.to);r.countBack=Math.max(e,r.countBack)}try{const_=newnS({datafeed:this._pineDatafeed,unitId:i.unit_id,currencyCode:i.currency_code,tickerid:c,symbolInfo:JS(i),period:s,body:t,sessionId:e,
onErrorCallback:h.onErrorCallback,dataRange:r,subsessionId:i.subsession_id,forceAlignBars:!l.enabled("disable_sameinterval_aligning")&&(0,Jd.isAlignmentEnabled)(),enableDwmAligning:l.enabled("align_dwm_bars_to_main_series")||!this._studyCanExtendTimeScale(e,o),input:e=>n[e],out:(e,t)=>{!function(e,t,i){consts=e.time,o="number"==typeoft?[t]:t;for(lete=0;e<o.length;++e){lett=o[e];t&&"object"==typeoft&&!Array.isArray(t)&&(m.set(e,t.offset),t=t.value),"number"==typeoft&&isNaN(t)&&(t=void0),o[e]=t}constn=u.length-1,r=n<0||s>u[n].timeMs;r?u.push({index:p(s,u.length),value:[s/1e3].concat(o),timeMs:s}):(u[n].index=p(s,n),u[n].value=[s/1e3].concat(o),u[n].timeMs=s),d||h.onRealtimeCallback([u[u.length-1]],r,u.length,m,i)}(e,t,i)},nonseriesOut:(e,t)=>{h.onNonSeriesDataUpdate(t,e)},setNoMoreData:()=>{g=!0},recalc:(e,s)=>{d=!1,u.endOfData=g,u.emptyBarCount=s.emptyBarCount,(!("error"int)||(0,Wv.default)(t.error)||(0,gc.default)(t.error)&&null===t.error())&&(null!==a&&(this._objectsDataCache[a]=u),h.onDataReadyCallback(u,m,i,s))}});if(!this._studiesCache[e]||!this._studiesCache[e][o])throwError("This should never happen");this._studiesCache[e][o].engine=_}catch(e){if(!((0,zv.default)(e)&&"studyError"ine&&e.studyError))throwe;h.onErrorCallback(zS(e,"unknown study error"))}}},y=()=>this._studiesCache[e]&&this._studiesCache[e][o]&&this._studiesCache[e][o].activeResolve===_;this._studiesCache[e][o].activeResolve=_;constv=this._resolvePromisesBySymbolId.get(US(e,i));if(void0===v)thrownewError("This should never happen");letS,b;try{conste=awaitv;S=e.symbolInfo,b=e.requestedSymbol}catch(e){returnvoid(y()&&h.onSymbolErrorCallback(zS(e,"unknown symbol error")))}y()&&f(S,b)}_getDataRangeForStudy(e,t){consti=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)},o=this._studiesCache[e][i.parentId];returnthis._studyCanExtendTimeScale(e,t)&&o?.completed?void0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s}_seriesDataRange(e,t){consti=this._studiesCache[e][t];returnnull!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange}_createStudy(e,t,i,s,o,r,a,l){this._studiesCache[s][o].completed=!1;constc=(e=>{if(Array.isArray(e))returne;constt=[],i=this._studiesCache[s][o].metainfo.inputs;if((0,Hv.default)(i))for(lets=0;s<i.length;s++)t[s]=e[i[s].id];returnt})(l);this._chartApiMessagerProvider.getChartApiMessager(s).onStudyLoading(o,r);consth=(e,t,i)=>{constn=this._studiesCache[s][o];if(n.completed=!0,e.length>0&&(n.firstLoadedTimeMs=e[0].timeMs),e=YS(e),this._setEndOfData(s,o,r,!this._studyCanExtendTimeScale(s,o)||e.endOfData),this._studyCanExtendTimeScale(s,o)){constt=e.map((e=>e.timeMs)),i=this._timeScales[s].setStudyBarsTimes(o,t);this._applyTimeScaleUpdate(s,i)}this._timeScales[s].fillIndexesInRows(e),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,e,t),this._chartApiMessagerProvider.getChartApiMessager(s).onStudyCompleted(o,r),this._updateTimeScaleState(s)},d=e=>{if(0===e.size)return{}
;constt={},i=this._studiesCache[s][o].metainfo;returne.forEach(((e,s)=>{t[(0,n.ensure)(i.plots)[s].id]=e})),{data:{offsets:t},indexes:[]}};letu=null,_=!1;this._computeStudy(s,i,e,t,o,c,this._getDataRangeForStudy(s,o),null,(()=>{if(this._studyCanExtendTimeScale(s,o))return-1/0;if(null===u){conste=this._getSeriesData(s,a)?.[0];if(void0===e)return1/0;u=e.timeMs}returnu}),{onDataReadyCallback:(e,t,i)=>{_&&0===e.length||h(e,d(t))},onRealtimeCallback:(e,t,i,n,a)=>{constl=YS(e);if(this._studyCanExtendTimeScale(s,o)){conste=l.map((e=>e.timeMs)),t=this._timeScales[s].replaceStudyBarsTimesTail(o,e);this._applyTimeScaleUpdate(s,t)}this._timeScales[s].fillIndexesInRows(l),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,l,d(n)),this._updateTimeScaleState(s)},onSymbolErrorCallback:()=>{this._studiesCache[s][o].completed=!0,this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,"error in series")},onErrorCallback:(e,t)=>{this._studiesCache[s][o].completed=!0;leti=e;t&&(i={error:e,title:t}),this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,i),this._updateTimeScaleState(s)},onNonSeriesDataUpdate:(e,t)=>{switch(_=!0,e.type){case"projection":break;case"study_gap":constt=this._timeScales[s].replaceStudyBarsTimesTail(o,e.times);this._applyTimeScaleUpdate(s,t);break;case"study_graphics":{constt={data:{graphicsCmds:e.data?.graphicsCmds,isUpdate:e.data?.isUpdate},indexes:[]},i=function(e){constt=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];consti=newMap,s=newSet;kS.forEach(((e,o)=>{constn=t[o];if(n)for(consttofn)for(constooft.data){constt=e(o);for(consteoft)i.set(e,-1),s.add(e)}}));consto=Array.from(s).sort(((e,t)=>e-t));returno.forEach(((e,t)=>i.set(e,t))),ES.forEach(((e,s)=>{consto=t[s];if(o)for(consttofo)for(constsoft.data)e(s,i)})),o}(t);this._studiesNonSeriesTimes[s][o]=i,t.indexes=this._timeScales[s].convertTimesToIndexes(i),h([],t);break}case"non_series_data":{constt={data:e.data,indexes:[]},i=t?.data?.data?.pivots,n=void0!==i;letr=function(e){constt={};gS(e,(e=>{(0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(t[e[i]]=!0)}))}),{visitInstances:!0});consti=Object.keys(t).map(Number).sort(((e,t)=>e-t));returni.forEach(((e,i)=>{t[e]=i})),Object.assign(e,gS(e,(e=>((0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(e[i.slice(0,-3)]=t[e[i]])})),e)),{visitInstances:!0})),i}(t),a=this._timeScales[s].convertTimesToIndexes(r,n);if(n){conste=newSet,t=[],s=[];leto=0;for(letn=a.length-1;n>=0;n--){constl=a[n];e.has(l)||l===Fh.INVALID_TIME_POINT_INDEX?(i.splice(n,1),o++):(t.unshift(r[n]),s.unshift(l),e.add(l))}o>0&&i.forEach(((e,t)=>{e.startIndex=t,e.endIndex=t+1})),r=t,a=s}this._studiesNonSeriesTimes[s][o]=r,t.indexes=a,h([],t);break}default:$S("unsupported non-series data type for study "+e.type)}}})}_isEndOfData(e,t,i){consts=e+"!"+t+"@"+i;returnBoolean(this._endOfData[s])}_setEndOfData(e,t,i,s){consto=e+"!"+t+"@"+i;this._endOfData[o]=!1!==s}_applyTimeScaleUpdate(e,t){
if(null===t)return;consti=[];for(consttofthis._getStudiesCacheSessionKeys(e)){consts=this._studiesCache[e][t];if(s&&"study"===s.type){consto=this._studiesNonSeriesTimes[e][t];if(o){constn={indexes:this._timeScales[e].convertTimesToIndexes(o),data:{indexes_replace:!0}};i.push({objId:t,turnaround:s.turnaround,data:[],nonSeriesData:n})}}}this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleUpdate(t,i),Promise.resolve().then((()=>{constt=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){consti=t.symbolInfo,s=(s=t.resolution)=>this._getSymbolExtrapolator(e,i,s);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,s,this._timeScales[e]).forEach(((t,i)=>{this._chartApiMessagerProvider.getChartApiMessager(e).onPointsetDataUpdate(i,null,t)}))}}))}_updateMainTsBuilder(e){constt=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){consti=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}}_updateTimeScaleState(e){if(!this._studiesCache[e])return;lett=!0,i=!0;for(constsofthis._getStudiesCacheSessionKeys(e)){consto=this._studiesCache[e][s];"InactivityGaps@tv-basicstudies-1"!==o?.metainfo?.id&&(i=i&&this._isEndOfData(e,s,o.turnaround),t=t&&o.completed)}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleCompleted(i))}_getStudiesCacheSessionKeys(e){returnvoid0!==this._studiesCache[e]?Object.keys(this._studiesCache[e]):[]}}WS.debugGetQuotesRequestId=1;constHS=WS;functionzS(e,t){return"string"==typeofe?e:(0,zv.default)(e)&&e&&"message"ine&&(0,et.default)(e.message)?e.message:t}functionUS(e,t){returne+"_"+t}functionjS(e,t){returne+"_"+t}functionGS(e,t,i,s){returne+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}functionqS(e,t,i,s){return[e,t,i,s].filter((e=>(0,et.default)(e)&&e.length>0)).join("|")}function$S(e){console.warn(`${(newDate).toISOString()}${e}`)}functionKS(e){constt=(0,Pv.decodeExtendedSymbol)(e),i="string"==typeoft.symbol?t:t.symbol;return[i.symbol,{currency:"currency-id"ini&&i["currency-id"],unit:"unit-id"ini&&i["unit-id"],session:"session"ini?i.session===Xv.SubsessionId.Regular?void0:i.session:void0}]}functionYS(e){constt=e.findIndex((e=>e.index!==RS));return-1===t?[]:0===t?e:e.slice(t)}functionZS(e){if(null===e||"number"==typeofe)returne;if("object"==typeofe&&Array.isArray(e)){switch(e[0]){case"bar_count":returne[2];case"from_to":returne.length>=3?e[2]??null:null}}returnnull}functionXS(e,t,i){if(i.logoid=void0,i["base-currency-logoid"]=void0,i["currency-logoid"]=void0,e){if("string"==typeofe)returnvoid$S("`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=t}t&&(i.provider_id=t,i.country=void0)}functionJS(e){returne.timezone=e.timezone,e}(0,A.setClasses)();constQS=(0,r.getChartingLibraryGlobalContext)(),eb=(0,r.getChartingLibraryOwner)(),tb=newclass{constructor(e,t){
;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=Ue(i,e.negotiations.width))),t||(s=0);consto=e.container.value();returno&&t&&(o.style.width=s+"px"),e.width.setValue(s),s},this._setHeight=(e,t,i)=>{lets=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=Ue(i,e.negotiations.height))),t||(s=0);consto=e.container.value();returno&&t&&(o.style.height=s+"px"),e.height.setValue(s),s};constt=e.container.value();if(!t)thrownewError("bridge.container.value() must be an element");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe((()=>this.recalculate())),this._height.subscribe((()=>this.recalculate())),this._bridge.visible.subscribe((()=>this._updateVisibility())),this._bridge.fullscreen.subscribe((()=>this._onParentFullscreenChange())),this.recalculate()}allocate(e){constt=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))thrownewError("unknown options.areaName");this.free(t);consti=this._createDOM(t),s={name:t,canNegotiate:{width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(consteinthis._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;constt=je(e);Ge(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;constt=je(e);Ge(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:newO.WatchedValue,height:newO.WatchedValue,availWidth:newO.WatchedValue,availHeight:newO.WatchedValue,alive:newO.WatchedValue(!0),container:newO.WatchedValue(i),visible:newO.WatchedValue(!0),fullscreen:newO.WatchedValue(!1),fullscreenable:newO.WatchedValue("right"===t||"center"===t),rdState:newNe};returns.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{consti=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{lete=null;for(leti=this._availableAreas.indexOf(t);i--;){constt=this._availableAreas[i];if(this.affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()}),{callWithLast:!0}),s.rdState.bridge()}free(e){constt=this._areas[e];if(!t)return;this._areas[e]=void0;consti=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){conste={};this._recalcSingleRunToken=e
;s&&(e&&this.affectsLayout(i)?s.visible.setValue(!0):s.visible.setValue(!1))}}_onParentFullscreenChange(){this._bridge.fullscreen.value()||(this._fullscreenArea=void0,this._updateFullscreen())}_updateFullscreen(){conste=void0!==this._fullscreenArea;for(lett=0;t<this._availableAreas.length;t++){consti=this._availableAreas[t],s=this._areas[i];if(!s)continue;if(i===this._fullscreenArea){s.fullscreen.setValue(!0);continue}s.fullscreen.setValue(!1);consto=s.container.value();o&&o.classList.toggle("js-hidden",e&&!Ye(i))}this._updateVisibility(),this.recalculate()}_createDOM(e){constt=document.createElement("div");returnt.classList.add("layout__area--"+e),t.style.position="absolute","tradingpanel"===e&&(t.style.borderTopRightRadius="4px"),"bottom"===e?t.style.bottom="0":t.style.top="0","right"===e||"tradingpanel"===e?t.style.right="0":t.style.left="0",t}}(tb.allocate()),sb=(eb.brokerFactory,Boolean(!1)),ob=QS.urlParams;QS.DEFAULT_SYMBOL=ob.symbol??"";constnb=newAbortController,rb=eb.getCustomIndicators,ab=(0,me.createDeferredPromise)(),lb=(0,me.createDeferredPromise)(),cb=(0,me.createDeferredPromise)(),hb=l.enabled("left_toolbar"),db=l.enabled("library_custom_color_themes"),ub=JSON.parse(ob.widgetbar),_b=l.enabled("right_toolbar")&&(ub.watchlist||ub.details||ub.news||ub.datawindow||l.enabled("dom_widget")||l.enabled("order_panel")||l.enabled("show_object_tree")||l.enabled("bugreport_button")),pb=l.enabled("header_widget")?ib.allocate({areaName:"top"}):null,mb=hb?ib.allocate({areaName:"left"}):null,gb=ib.allocate({areaName:"center"}),fb=(_b&&ib.allocate({areaName:"right"}),null);if(void0!==eb.contextMenu&&Cy.setContextMenuOptions(eb.contextMenu),Promise.all([ab.promise,lb.promise,cb.promise]).then((()=>{QS.ChartApiInstance.start()})),"function"==typeofrb){conste=rb({Std:Py.Std});e&&e.then?e.then((e=>{if(!Array.isArray(e))returnconsole.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),voidab.resolve();constt=QS.JSServer;for(constiofe)if("function"==typeofi){conste=(newEv).build(i);t.studyLibrary.push.call(t.studyLibrary,e)}elset.studyLibrary.push.call(t.studyLibrary,i);ab.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((e=>{console.warn("Error loading custom indicators "+e),ab.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),ab.resolve())}elseab.resolve();QS.widgetReady=e=>{ee.subscribe("onChartReady",e,null)};constyb=ob.theme?.toLowerCase()??$s.StdTheme.Light;varvb;functionSb(e){QS.__defaultsOverrides=QS.__defaultsOverrides||{},(0,ge.deepExtend)(QS.__defaultsOverrides,e),void0!==TradingView.defaultProperties&&void0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}vb=yb,L.themes[vb]&&(0,k.setTheme)(vb),asyncfunction(e){if(!db||void0===e)return;try{
const{overrideStandardThemes:t}=awaiti.e(2413).then(i.bind(i,79736));t(e)}catch(e){console.error("Error applying custom themes",e)}}(eb.customThemes).then(cb.resolve).catch(cb.resolve),QS.applyStudiesOverrides=e=>{e&&(QS.chartWidgetCollection?QS.chartWidgetCollection.applyStudiesOverrides?.(e):ns.StudyMetaInfo.mergeDefaultsOverrides(e))},QS.applyOverrides=e=>{Sb(e),QS.chartWidgetCollection&&QS.chartWidgetCollection.applyOverrides(e)},QS.doWhenApiIsReady=e=>{QS.tradingViewApi?e():lb.promise.then(e)},QS.applyTradingCustomization=e=>{if(e.order)for(consttine.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];if(e.position)for(consttine.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t];returnnull===fb?Promise.resolve():fb.then((t=>{functioni(e){constt={};for(constiofObject.keys(e??{})){consts=i.split(".");leto=t;for(consteofs.slice(0,s.length-1))o.hasOwnProperty(e)||(o[e]={}),o=o[e];o[s[s.length-1]]=e[i]}returnt}if(null===t)return;consts=i(e.brokerOrder),o=i(e.brokerPosition);t?.overrideTradedGroupStyles({order:{lightTheme:s,darkTheme:s},position:{lightTheme:o,darkTheme:o}})}))},QS.changeTheme=(e,t)=>{consti=L.themes[e.toLowerCase()];returni?QS.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},QS.getTheme=()=>QS.tradingViewApi.themes().getCurrentThemeName(),QS.customThemes=async()=>{if(!db)returnPromise.reject(newError("The library_custom_color_themes feature must be enabled to use the custom themes API"));returnnew((awaiti.e(2413).then(i.bind(i,82753))).CustomThemesApi)},QS.is_authenticated=!1;JSON.parse(QS.urlParams.brokerConfig);a.t(null,void0,i(94566)),a.t(null,void0,i(92800)),a.t(null,void0,i(44676));letbb=null;constwb=(0,me.createDeferredPromise)();letCb;constTb=()=>{if(l.setEnabled("charting_library_export_chart_data",!QS.configurationData.is_tradingview_data),l.setEnabled("charting_library_debug_mode","true"===ob.debug||l.enabled("charting_library_debug_mode")),l.setEnabled("chart_property_page_trading",!1),l.enabled("remove_library_container_border")){conste=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}l.enabled("no_min_chart_width")&&(document.body.style.minWidth="0px"),null!=ob.studiesOverrides&&ns.StudyMetaInfo.mergeDefaultsOverrides(JSON.parse(ob.studiesOverrides)),(0,n.assert)(void0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Sb(JSON.parse(ob.overrides));conste=ob.numeric_formatting?JSON.parse(ob.numeric_formatting):void0;e&&("string"==typeofe.decimal_sign&&(ue.formatterOptionsLibraryOverrides.decimalSign=e.decimal_sign[0]),"string"==typeofe.grouping_separator&&(ue.formatterOptionsLibraryOverrides.groupingSeparator=e.grouping_separator[0]));constt=newSv,s=newNv,c=newBv,h=ob.studiesAccess&&JSON.parse(ob.studiesAccess)||{type:"black",tools:[]},d=newDf(h,c),u=newOv((0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary),_=newHS(eb.datafeed,t,s,u);QS.ChartApiInstance=newEf(t,_,c,d)
constt=t=>Promise.all([i.e(9520),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(3359),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(8260),i.e(1979),i.e(7780),i.e(445),i.e(846),i.e(1667),i.e(3290),i.e(6870),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(2475),i.e(1890),i.e(1727),i.e(9754)]).then(i.bind(i,11065)).then((i=>{consts=new(0,i.GlobalSearchDialogRenderer)(e);returnnull!==Ve&&Ve.hide(),s.show(t),Ve=s,s}));return(0,D.createGroup)({desc:"GlobalSearch"}).add({desc:"Open",hotkey:D.Modifiers.Mod+75,handler:()=>t()}),t}(e.loadChartService):void0;returnnewT(newy,{chartSaver:QS.saver,chartApiInstance:QS.ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:t.chartTypes,defaultFavoriteIntervals:t.intervals,resizerBridge:pb,studyMarket:QS.studyMarket,studyTemplates:Cb,allowedModes:s,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:e.chartChangesWatcher,onClick:Ab,snapshotUrl:e.snapshotUrl,openGlobalSearch:n})}({chartWidgetCollection:C,saveChartService:k,chartChangesWatcher:A,loadChartService:E,snapshotUrl:ob.snapshotUrl});null!==B?B.load().then((e=>{bb=e.getComponent(),wb.resolve()})):(wb.promise.catch((()=>{})),wb.reject("header widget is not loaded"));constV=function(e){if(mb){constt=ob.toolbarbg&&/^[0-9a-f]+$/i.test(ob.toolbarbg)?String(ob.toolbarbg):void0;if(t){conste=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}returnnewM({bgColor:t,chartWidgetCollection:e,drawingsAccess:ob.drawingsAccess?JSON.parse(ob.drawingsAccess):void0,resizerBridge:mb,onClick:Ab})}returnnull}(C),R=null;QS.tradingViewApi=newCy({chartWidgetCollection:C,chartApiInstance:QS.ChartApiInstance,saveChartService:k,loadChartService:E,studyMarket:null});if(de.linking.bindToChartWidgetCollection(C),isNaN(ob.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+(0,n.ensureDefined)(ob.studyCountLimit))),!isNaN(ob.ssreqdelay)){conste=Math.max(0,+(0,n.ensureDefined)(ob.ssreqdelay));(0,Ty.setSearchRequestDelay)(e)}QS.ChartApiInstance.connect(),(async()=>{const{LineToolPropertiesWidget:e}=awaitPromise.all([i.e(7617),i.e(8185),i.e(1681),i.e(3439),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(7827),i.e(8220),i.e(9590),i.e(1667),i.e(9836),i.e(3290),i.e(6178),i.e(7777),i.e(2227),i.e(3179),i.e(1890),i.e(6193),i.e(6376),i.e(2306)]).then(i.bind(i,36699));x||(QS.lineToolPropertiesToolbar=newe(C))})();constO=document.querySelector(".tv-content");null!==O&&O.addEventListener("contextmenu",(e=>{e.targetinstanceofElement&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),lb.resolve(),C.undoHistory.undoStack().onChange().subscribe(null,(0,o.default)((e=>{e?.affectsState()&&ee.emit("onAutoSaveNeeded")}),1e3*(Number(ob.autoSaveDelay)||5),{leading:!1,trailing:!0}));letF=!1;functionW(){
if(l.enabled("saveload_separate_drawings_storage")){conste=awaiti.e(7129).then(i.bind(i,67387));returnBm=e.LineToolsSynchronizer,!0}return!1}(),Ib=(0,me.createDeferredPromise)();functionAb(){conste=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([Ib.promise,Pb.promise,QS.loadedCustomCss,Mb,cb.promise]).then((()=>{conste=document.querySelector(".loading-indicator");if(e&&(e.style.display="none"),setTimeout(Tb,0),l.enabled("14851")&&Math.random()<=.02){t=window,i=document,s="script",o="ga",t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=Number(newDate),r=i.createElement(s),a=i.getElementsByTagName(s)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",a.parentNode.insertBefore(r,a);conste=(0,n.ensureNotNull)(document.URL.match(newRegExp("(:?.*://)([^/]+)/.*")))[2];QS.ga("create","UA-112911840-1","auto"),QS.ga("set","anonymizeIp",!0),QS.ga("set",{hostname:e,page:e,referrer:e}),QS.ga("send","pageview")}vart,i,s,o,r,a})),(()=>{lete=!0;eb.datafeed.onReady((t=>{e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),QS.configurationData=t,Ib.resolve()})),e=!1})(),QS.createShortcutAction=(()=>{conste=D.createGroup({desc:"API",order:yv.ACTION_API_GROUP_ORDER});return(t,i)=>{vars;e.add({hotkey:(s=t,"number"==typeofs?s:"string"==typeofs?R(s.split("+")):Array.isArray(s)?R(s):0),handler:i})}})(),QS.initializationFinished=()=>{QS.chartWidgetCollection.undoHistory.clearStack()},QS.headerReady=()=>wb.promise,function e(t=0,i=10){consts={received:!1};QS.dispatchEvent(newCustomEvent("innerWindowLoad",{detail:s})),!s.received&&t<i&&setTimeout((()=>{e(t+1,i)}),10*Math.pow(2,t))}(),QS.createButton=e=>{if(null===bb)thrownewError("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1;constt=(0,fe.randomHash)();returnbb.addButton(t,e)??t},QS.removeButton=e=>{if(null===bb)thrownewError("Cannot remove button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");returnbb.removeButton(e)},QS.createDropdown=e=>{if(void0===e)thrownewError("Cannot create dropdown without any parameters. Please refer to the documentation");void0===e.align&&(e.align="left");constt=(0,fe.randomHash)();returnbb?(bb.addDropdown(t,e),Promise.resolve(newhv(bb,t))):wb.promise.then((()=>((0,n.ensureNotNull)(bb).addDropdown(t,e),newhv((0,n.ensureNotNull)(bb),t))))},QS.getAllFeatures=()=>{conste=l.getAllFeatures();returnObject.keys(e).forEach((t=>{isNaN(parseFloat(t))||deletee[t]})),e},QS.getNavigationButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,ve.property)()))),QS.getPaneButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,Se.property)()))),QS.getDateFormat=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)(be.dateFormatProperty))),
functionn(){returns}},84526:(e,t,i)=>{"use strict";functions(e){Promise.all([i.e(8622),i.e(8185),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3359),i.e(445),i.e(2112),i.e(9036),i.e(2227),i.e(9418),i.e(2477),i.e(9374)]).then(i.bind(i,46069)).then((({SymbolInfoDialogImpl:t})=>{t.getInstance().show(e)}))}i.d(t,{showSymbolInfoDialog:()=>s})},12362:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>d});vars=i(50279),o=i(50151),n=(i(11542),i(14411)),r=i(23024),a=i(48096),l=i(37103),c=i(81593);functionh(e,t){e.content=JSON.stringify(t)}newWeakMap;newTextEncoder;classd{constructor(e){this._prevChartState=null,this._chartSavedDelegate=newa.Delegate,this._chartAboutToBeSavedDelegate=newa.Delegate,this._chartSizeLimitExceededDelegate=newa.Delegate,this._isSaveInProcess=!1,this._savingToken=null,this._chartWidgetCollection=e}asyncsaveChartLineTools(e,t,s,o){if(l.enabled("saveload_separate_drawings_storage")){constn=await(0,r.getChartStorage)(),a=this.layoutId(),l=i=>n.saveLineToolsAndGroups(i,e,t,s,o);if(!a){this._chartSavedDelegate.subscribe(null,(e=>{if(e){conste=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=awaiti.e(5565).then(i.bind(i,98653));thrownewe("Layout ID not yet created.",!0)}returnl(a)}returnPromise.reject("Line tools storage is not supported")}layoutId(){returnthis._chartWidgetCollection.metaInfo.uid.value()}saveChartSilently(e,t,i){consts=i||{};this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart((e=>{constt=e&&l.enabled("saveload_separate_drawings_storage"),i=this._getChartWidgetCollectionState(!1,void0,void0,void0,t),o=this._getCommonSavingInfo(!1);returnh(o,i),s.chartName&&(o.name=s.chartName),o.name&&0!==o.name.length||!s.defaultChartName||(o.name=s.defaultChartName),s.autoSave&&(o.autoSave=!0),o}),((t,i)=>{(0,o.assert)(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),i&&this.layoutId()===t.uid&&this._chartWidgetCollection.metaInfo.name.setValue(i.name??""),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid,data:i}),this._prevChartState&&deletethis._prevChartState.savingToken}),(e=>{this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t(e)}),s)}saveToJSON(e){constt=e&&!1===e.includeDrawings||void0,i=this._getCommonSavingInfo(!1);returnh(i,this._getChartWidgetCollectionState(!1,!0,t,void0,t)),i}isSaveInProcess(){returnthis._isSaveInProcess}_getChartWidgetCollectionState(e,t,i,s,o){letn=!1;returne?n=!0:(t=!0,s=!1),this._chartWidgetCollection.state({withData:!!e,skipLineToolsFromOtherSymbols:!!i,wipeSensitiveData:!!s,skipLineTools:o,skipHiddenSources:n,addOnlyActiveChart:!t})}_getCommonSavingInfo(e){constt=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols()[t.activeChartWidget.value().id()],s={...(o=i,{...o,legs:JSON.stringify(o.legs??[])})};varo;constn=t.metaInfo,r=n.id.value();returnnull!==r&&(s.id=r),s.name=n.name.value()||"",s.description=n.description.value()||"",
s.is_realtime=s.is_realtime=e?"0":"1",s}async_saveLineToolsToStorage(){if(l.enabled("saveload_separate_drawings_storage")){this.layoutId();0;const[e,t]=this._chartWidgetCollection.getAll().reduce(((e,t)=>{consti=t.lineToolsSynchronizer();if(i){e[0]||=i.hasUnsavedMigrationsFromChartState();constt=i.flushPendingSavings();t&&e[1].push(t)}returne}),[!1,[]]);returnt.length&&awaitPromise.all(t),t.length>0&&e}return!1}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.invalidateAll()))}_saveChartImpl(e,t,i,s,o,n){letr;r=s=>{t.uid||t.uid!==this.layoutId()||(t.id=s.result,t.uid=`${s.result}`,this._chartWidgetCollection.metaInfo.id.setValue(t.id),this._chartWidgetCollection.metaInfo.uid.setValue(t.uid)),i(t,e)},e.name?c.backend.saveChart(e.name,e.short_name,e.resolution,e,t).then(r).catch((asynce=>{constt=einstanceofResponse?e:void0,i=einstanceofError?e:void0;this._savingToken=null;consto=s.bind(null,{status:t?.status,message:t?.statusText??i?.message??"Unknown error"});o()})):s({status:-1,message:"Saving chart with empty name is not allowed"})}async_saveChart(e,t,o,r){consta=this._chartWidgetCollection.metaInfo,c={name:a.name.value(),description:a.description.value(),uid:a.uid.value(),id:a.id.value(),lastModified:a.lastModified.value(),username:a.username.value(),isPrivate:a.isPrivate.value()};leth=r.changes??n.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();letd=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{awaitthis._saveLineToolsToStorage()&&(h|=1)}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=awaiti.e(5565).then(i.bind(i,98653));einstanceoft&&e.safe||(d=!1)}if(1&h){consti=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id)return this._chartSavedDelegate.fire(!0),voidt(c,i);0;constn=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.markAsValidatedBecauseOfSavingToContent())),t(e,i));returnthis._saveChartImpl(i,c,n,o,r,e)}this._chartSavedDelegate.fire(!0),t(c,e(d))}}},71846:(e,t,i)=>{"use strict";vars=i(12362).ChartSaverBase;i.i18next(null,void0,i(49947));t.ChartSaver=classextendss{constructor(e){super(e)}chartSizeLimitExceeded(){returnthis._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){returnthis._chartAboutToBeSavedDelegate}chartSaved(){returnthis._chartSavedDelegate}publishChart(e){}publishScript(e,t,i){}isScriptNameValid(e){return""!==e.trim()&&e.length<=64}isScriptDescriptionValid(e){return""!==e.trim()&&e.length<=7e4}isScriptDescribersValid(e,t){returnthis.isScriptNameValid(e)&&this.isScriptDescriptionValid(t)}openInNewTab(e,t,i){e.publishInProgress=!0,i||this.isScriptDescribersValid(t.name,t.description)&&undefined(newPromise((function(t){e.setPopupUrl=t})))}onPublish(e,t){}}},19e3:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);functions(e){returne.description||""}},29242:(e,t,i)=>{"use strict";functions(e){returne+"…"}i.d(t,{appendEllipsis:()=>s})},58043:(e,t,i)=>{"use strict"
})(e,["name","base_name","ticker","description","long_description","type","session","session_display","session_holidays","corrections","exchange","exchange","listed_exchange","timezone","format","pricescale","minmov","fractional","minmove2","variable_tick_size","has_intraday","supported_resolutions","intraday_multipliers","has_seconds","has_ticks","seconds_multipliers","has_daily","daily_multipliers","has_weekly_and_monthly","weekly_multipliers","monthly_multipliers","has_empty_bars","visible_plots_set","volume_precision","data_status","delay","expired","expiration_date","sector","industry","currency_code","original_currency_code","unit_id","original_unit_id","unit_conversion_types","subsession_id","subsessions","price_source_id","price_sources","logo_urls","exchange_logo","pro_name","library_custom_fields"]);returnt.pro_name=e.pro_name,t}resolution(){returnthis._chartWidget.model().mainSeries().interval()}marketStatus(){returnthis._chartWidget.model().mainSeries().marketStatusModel().currentSession().spawn()}getVisibleRange(){conste={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)returne;consts=i.firstBar(),o=i.lastBar(),r=this._convertIndexToPublicTime(o);if(null===r)returne;consta=Math.max((0,n.ensureNotNull)(t.points().range().value()).firstIndex,s);returne.from=(0,n.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=r,e}getVisibleBarsRange(){conste=this._chartWidget.model().timeScale();if(null===e.visibleBarsStrictRange())returnnull;lett=this.chartModel().mainSeries().data();for(consteofthis.chartModel().dataSources())if((0,An.isPriceDataSource)(e)&&e.isVisible()){consti=e.barsProvider().bars(),s=i.last(),o=t.last();null!==s&&null!==o&&s.index>o.index&&(t=i)}consti=e.visibleStrictDataRange(t);if(null===i)returnnull;consts=this._convertIndexToPublicTime(i.firstBar()),o=this._convertIndexToPublicTime(i.lastBar());returnnull===s||null===o?null:{from:s,to:o}}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())returnnull;returnthis._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}scrollPosition(){returnconsole.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){returnconsole.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}priceFormatter(){returnthis._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){returnthis._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){returnthis._chartWidget.getTimezone()}getTimezoneApi(){returnthis._timezoneApi}getPanes(){returnthis._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){
if(!l.enabled("charting_library_export_chart_data"))returnPromise.reject("Data export is not supported");constt={...e};returnvoid0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),Promise.all([i.e(2578),i.e(9498)]).then(i.bind(i,99207)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}setDragExportEnabled(e){l.enabled("chart_drag_export")?this._chartWidget.model().model().setDragExportEnabled(e):console.error("feature is not enabled")}canZoomOut(){return!this._chartWidget.model().zoomStack().isEmpty()}canZoomOutWV(){if(!this._zoomUndoStackIsNotEmpty){conste=newO.WatchedValue(!1);this._zoomUndoStackIsNotEmpty=e.spawn(),this._chartWidget.withModel(this,(()=>{constt=this._chartWidget.model().zoomStack();t.onChange().subscribe(this,(()=>e.setValue(!t.isEmpty())))}))}returnthis._zoomUndoStackIsNotEmpty.readonly()}zoomOut(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}shapesGroupController(){returnnew_y(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){returnthis._chartWidget.selectPointMode().value()!==mt.SelectPointMode.None}requestSelectBar(){returnthis.isSelectBarRequested()?Promise.reject("already requested"):newPromise(((e,t)=>{this._chartWidget.requestSelectPoint({pointType:"time"}).then((t=>{e(this._convertTimeToPublic((0,n.ensureDefined)(t.point.time)))})).catch((()=>{t("cancelled")}))}))}cancelSelectBar(){this.isSelectBarRequested()&&this._chartWidget.cancelRequestSelectPoint()}barTimeToEndOfPeriod(e){constt=this._prepareEndOfPeriodArgs();returnzf(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){constt=this._prepareEndOfPeriodArgs();returnfunction(e,t,i){if(i.isDays())returnt;consts=1e3*t-1;if(e.moveTo(s),i.isIntraday()){consti=e.indexOfBar(s);if(i<0)thrownewError(`${t} is out of the instrument session `);returne.startOfBar(i)/1e3}returne.startOfBar(0)/1e3}(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){consti=()=>newError(`Cannot create "${t.shape}" shape`),s=t.shape;if(Nf(s)&&!0!==Of[s].isAnchored)throwconsole.warn(`${s} is not an anchored shape. It can be created using createShape or createMultipointShape`),i();consto=this._chartWidget.model().model(),n=o.mainSeries();if(o.timeScale().isEmpty())throwi();constr=void0!==t.ownerStudyId?o.dataSourceForId(t.ownerStudyId):n,a=this._convertPositionPercentToDataSource(e,r);if(null===a)throwi();returnthis._createMultipointShape([a],t)}properties(){returnthis._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){returnthis._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){
returnthis._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){returnthis._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){constt=this._chartWidget.model(),i=t.model().dataSourceForId(e);returnt.cloneLineTools([i],!1)[0]}shareLineTools(e,t){consti=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}getLollipopSourcesApi(){thrownewError("getLollipopSourcesApi is not supported")}clickAtLatestUpdatesLollipop(){thrownewError("clickAtLatestUpdatesLollipop is not supported")}linkingGroupIndex(){returnthis._apiLinkingGroupIndex.spawn()}loadingScreenActive(){returnthis._chartWidget.screen.isShown()}symbolResolvingActive(){for(consteofthis._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){returnthis._chartWidget.hasModel()}disableAllUtilitySources(){0}chartProto(){returnkg.prototype}ranges(){thrownewError("not implemented")}getTimeScale(){returnnewUf(this._chartWidget.model().timeScale())}asyncloadChartTemplate(e){await(0,Vf.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}asyncsyncTime(e){if(this._chartWidget.hasModel()){constt=this._chartWidget.model().model(),i=t.mainSeries().syncModel();if(i)returnt.syncTimeWithModel(i.syncSourceTarget(),e)}}syncDateRange(e,t){this._chartWidget.hasModel()&&this._chartWidget.model().model().gotoTimeRange(e,t)}getLineToolsState(e=1,t,i){this._canUseLineToolsSynchronizer("getLineToolsState");consts=i??!0,o=(0,n.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,s);returndeleteo.clientId,o}asyncapplyLineToolsState(e){this._canUseLineToolsSynchronizer("applyLineToolsState"),await(0,n.ensureNotNull)(this.lineToolsSynchronizer()).applyDTO(e)}reloadLineToolsFromServer(){this._canUseLineToolsSynchronizer("reloadLineToolsFromServer"),(0,n.ensureNotNull)(this.lineToolsSynchronizer()).reloadAllLineTools()}studyMetaIntoRepository(){return(0,os.studyMetaInfoRepository)()}replayStatus(){returnthis._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){returnthis._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s,o){returnthis._chartWidget.model().insertStudyWithoutCheck(newns.StudyMetaInfo(e,o),t,i,s)}copyEntityToClipboard(e){constt=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([t])}pasteFromClipboard(){this._chartWidget.chartWidgetCollection().clipboard.uiRequestPaste()}inactivityGaps(){returnthis._chartWidget.model().model().inactivityGaps()}setInactivityGapsSession(e){this._chartWidget.model().model().setInactivityGapsSession(e)}_destroy(){this._zoomUndoStackIsNotEmpty?.destroy(),this._chartWidget.hasModel()&&(this._chartWidget.model().crosshairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged),
this._chartWidget.model().zoomStack().onChange().unsubscribeAll(this)),this._chartWidget.modelCreated().unsubscribeAll(this),this._widgetLinkingGroupIndex.destroy()}async_createTradingPrimitive(e){constt=this._chartWidget.model(),i=t.model(),s=(0,n.ensureNotNull)(i.paneForSource(i.mainSeries()));await(0,xo.ensureLineToolLoaded)(e);consto={pane:s,point:(()=>{conste=(0,n.ensureNotNull)(t.mainSeries().bars().last());return{index:e.index,price:e.value[4],interval:i.mainSeries().interval()}})(),linetool:e,actionSource:"API"};returni.createLineTool(o).adapter()}_createStudy(e){returnPromise.reject("Pine Script® and java studies are not supported")}_convertTimeToPublic(e){returnthis._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){returnnull===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_convertPositionPercentToDataSource(e,t){consti=this._chartWidget.model().timeScale(),s=t.priceScale(),o=t.firstValue();if(null==o||!isFinite(o)||null===s)returnnull;constn=i.coordinateToIndex(e.x*i.width());return{price:s.coordinateToPrice(e.y*s.height(),o),index:n}}_convertUserPointsToDataSource(e){constt=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),o=i.data();if(t.timeScale().isEmpty())returnnull;constr=e.map((e=>e.time||0)),a=this._alignPoints(r),l=(e,t,r)=>{consta=s.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,n.ensureNotNull)(s.valueAt(a)),h=(0,n.ensureNotNull)(s.range().value());if(e>c&&a===h.lastIndex){constt=(0,n.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}elseif(e<c&&a===h.firstIndex){constt=(0,n.ensureNotNull)(i.syncModel()).distance(e,c);t.success&&(l.index=l.index-t.result)}if((0,tt.isNumber)(t))l.price=t;else{lete=r?["open","high","low","close"].indexOf(r)+1:1;e<=0&&(e=1),l.price=(0,n.ensure)((0,n.ensureNotNull)(o.valueAt(a))[e])}returnl},c=[];for(lett=0;t<e.length;t++){consti=e[t];c.push(l(a[t],i.price,i.channel))}returnc}async_createMultipointShape(e,t){consti=()=>newError(`Cannot create "${s.shape}" shape`),s=Object.assign({},{filled:!0},t),o=Of[s.shape]||Of.flag;constr=this._chartWidget.model().model(),a=r.mainSeries();if(r.timeScale().isEmpty())throwi();constl=void0!==s.ownerStudyId?r.dataSourceForId(s.ownerStudyId)??a:a,c=r.paneForSource(l);if(null===e||null===c)throwi();if(o.onlySelectable)thrownewError(`Cannot create "${s.shape}" shape`);if("LineToolIcon"===o.name){conste=s;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!s.hasOwnProperty("icon"))thrownewError("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}await(0,xo.ensureLineToolLoaded)(o.name);consth=(0,zs.createLineToolProperties)(r.backgroundTheme().spawnOwnership(),o.name,!r.readOnly());if((0,zs.prepareLineToolPropertiesByOwnerSource)(h,l),s.overrides)for(consteins.overrides)h.hasChild(e)?(0,
n.ensureDefined)(h.child(e)).mergeAndFire(s.overrides[e]):ny(o.name)&&-1!==["profitLevel","stopLevel"].indexOf(e)&&h.addProperty(e,s.overrides[e]);letd;void0!==h.hasChild("text")&&s.text&&(0,n.ensureDefined)(h.child("text")).setValue(s.text),h.hasChild("filled")&&s.filled&&(0,n.ensureDefined)(h.child("filled")).setValue(!0),d=s.disableUndo?this._chartWidget.model().model():this._chartWidget.model();constu=d.createLineTool({pane:c,point:e[0],linetool:o.name,properties:h,ownerSource:l,actionSource:"API"});if(null===u)throwh.destroy(),i();if(u.properties()!==h&&h.destroy(),ny(o.name)){if(e.length>2)thrownewError(`Wrong points count for ${s.shape}. Required 1 or 2`);2===e.length&&(u.startChanging(1,e[1]),u.setPoint(1,e[1]),u.endChanging(!0,!1))}else{constt=u.pointsCount();if(t!==e.length&&-1!==t)thrownewError(`Wrong points count for ${s.shape}. Required ${t}`);consti=newTo.EnvironmentState(void0,!0),n=(0,Lt.isLineDrawnWithPressedButton)(o.name);for(lett=1;t<e.length&&this._chartWidget.model().lineBeingCreated();t++)u.setLastPoint(e[t]),d.continueCreatingLine(e[t],i,t<e.length-1||n);(0,Lt.isLineToolFinishRequiredWhenCreatedByApi)(o.name)&&(u.finish(),d.finishLineTool(u),d.continueCreatingLine(e[e.length-1],i,!1))}if(s.lock&&u.setUserEditEnabled(!1),s.disableSelection&&u.setSelectionEnabled(!1),s.disableSave&&(void0===u.customization&&(u.customization={}),u.customization.disableSave=!0),s.hasOwnProperty("showInObjectsTree")&&(void0===u.customization&&(u.customization={}),u.customization.showInObjectsTree=s.showInObjectsTree),s.zOrder){conste=this._chartWidget.model().availableZOrderOperations([u]);"top"===s.zOrder&&e.bringToFrontEnabled?d.bringToFront([u]):"bottom"===s.zOrder&&e.sendToBackEnabled&&d.sendToBack([u])}returnu.id()}_convertTimeFromPublic(e){returnthis._getTimeConverter().convertPublicTimeToInternalTime(e)}_getTimeConverter(){conste=this._chartWidget.model().mainSeries();return(0,On.getChartWidgetApiTimeConverter)(e.interval(),(0,n.ensureNotNull)(e.symbolInfo(),"main series symbol info"),this._chartWidget.model().model())}_onHoveredSourceChanged(e){constt=null!==e&&(0,An.isPriceDataSource)(e)?e.id():null,i=this._prevHoveredSourceId;this._prevHoveredSourceId=t,t!==i&&this._dataSourceHovered.fire(t)}_onCrosshairMoved(e){constt=this.chartModel().crosshairSource().pane;if(null===t)return;consti=this._chartWidget.offsetInDocument(t),s=this.chartModel().timeScale(),o=t.mainDataSource()?.priceScale(),n=s.indexToUserTime(e.index),r=this._convertIndexToPublicTime(e.index),a=s.indexToCoordinate(e.index),l=o?.priceToCoordinate(e.price,t.mainDataSource()?.firstValue()||0);if(void0===a||void0===l||null===n||null===r)return;constc={price:e.price,time:r,userTime:n.getTime()/1e3,entityValues:{},offsetX:a+i.left,offsetY:l+i.top},h=this.chartModel().priceDataSources(),d=(0,wi.sourceChangeEvent)(this._chartWidget.model().crosshairSource().id());for(lete=0;e<h.length;e++){constt=h[e],i=t.dataWindowView();if(null===i)continue;i.update(d)
;consts=t===this.chartModel().hoveredSource(),o=i.items().filter((e=>e.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));c.entityValues[t.id()]={isHovered:s,values:o,title:i.header()}}this._crosshairMoved.fire(c)}_makeSubscriptionFromDelegate(e){return{subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}_prepareEndOfPeriodArgs(){conste=this._chartWidget.model().model(),t=e.timezone(),i=(0,n.ensureNotNull)(e.mainSeries().symbolInfo()),s=e.mainSeries().interval(),o=newCd.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,Td.newBarBuilder)(s,o,o),intervalObj:Re.Interval.parse(s)}}_getPaneApi(e){lett=this._panes.get(e);returnvoid0===t&&(t=newXf(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){lett=this._studies.get(e);returnvoid0===t&&(t=newiy(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){lett=this._lineDataSources.get(e);returnvoid0===t&&(t=neway(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{constt=(0,n.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();returne.map((e=>{consts=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){constt=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),o=i.symbolInfo();if(t.timeScale().isEmpty()||!Re.Interval.isDWM(s)||null===o)returne;constn=(0,Jd.createDwmAligner)(s,o);returnnull===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){conste=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)returnvoide.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);consti=this.getVisibleRange();null!==this._prevVisibleRange&&(0,tt.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!l.enabled("saveload_separate_drawings_storage"))thrownewError(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}_onSymbolChanged(e){vart;this._onSymbolChangedDelegate.fire({name:(t=e).name,base_name:t.base_name,ticker:t.ticker,description:t.description,long_description:t.long_description,type:t.type,session:t.session,session_display:t.session_display,session_holidays:t.session_holidays,corrections:t.corrections,exchange:t.exchange,listed_exchange:t.listed_exchange,timezone:t.timezone,format:t.format,pricescale:t.pricescale,minmov:t.minmov,fractional:t.fractional,minmove2:t.minmove2,variable_tick_size:t.variable_tick_size,has_intraday:t.has_intraday,supported_resolutions:t.supported_resolutions,intraday_multipliers:t.intraday_multipliers,has_seconds:t.has_seconds,has_ticks:t["is-tickbars-available"],
this._supportedChartStylesSpawn=de.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=a,this._alertService=null,this._supportTicketData=h;constd=i.lock;this._symbolSync=d.symbol.spawn(),this._intervalSync=d.interval.spawn(),this._dateRangeSync=d.dateRange.spawn(),this._crosshairSync=d.crosshair.spawn(),this._timeSync=d.trackTime.spawn(),this._chartWidgetCollection.activeChartWidget.subscribe((()=>this._onActiveChartChanged()),{callWithLast:!0}),ee.subscribe("toggle_currency_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_currency_menu",...e)}),this),ee.subscribe("toggle_unit_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_unit_menu",...e)}),this)}destroy(){this._supportedChartStylesSpawn.destroy(),this._intervalsService?.destroy(),this._themesApi?.destroy(),this._widgebarApi?.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._drawOnAllCharts.destroy(),this._pineEditorApi?.destroy(),this._isDestroyed=!0,this._magnetEnabledWV?.destroy(),this._magnetModeWV?.destroy(),this._magnetSnapsToIndicatorsWV?.destroy(),ee.unsubscribeAll("toggle_currency_menu_inner",this),ee.unsubscribeAll("toggle_unit_menu_inner",this)}themes(){returnnull===this._themesApi&&(this._themesApi=newRf({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:this._saveChartService?.getSaveAsController()??null,ChartLayoutRename:this._saveChartService?.getRenameController()??null,ChartLayoutCreate:this._saveChartService?.getCreateController()??null,ChartLayoutLoad:this._loadChartService,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){ee.subscribe(e,t,void0)}unsubscribe(e,t){ee.unsubscribe(e,t,void0)}onActiveChartChanged(){returnthis._activeChartWidgetChangedDelegate}webview(){returnby(),this._webview}connect(){by()}disconnect(){by()}onConnectionStatusChanged(e){by()}isConnected(){by()}supportTicketData(){returnthis._supportTicketData}setPublishChartOptions(e){by()}publishChart(e){by()}studyTemplatesDrawerApi(){by()}fontIconsSettingsDrawer(){by()}intervalsService(){by()}alertService(){by()}asyncalerts(){by()}supportedChartTypes(){returnthis._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,mt.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,mt.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){returnthis._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,mt.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,mt.drawOnAllChartsMode)().setValue(e)
}currencies(){returnthis._chartApiInstance?.availableCurrencies()??Promise.reject()}units(){returnthis._chartApiInstance?.availableUnits()??Promise.reject()}disableTrackingEvents(){(0,re.disableTrackingEvents)()}getSaveChartService(){returnthis._saveChartService}symbolSync(){returnthis._symbolSync}intervalSync(){returnthis._intervalSync}dateRangeSync(){returnthis._dateRangeSync}crosshairSync(){returnthis._crosshairSync}timeSync(){returnthis._timeSync}setSymbolSearchUI(e){by()}chart(e=0){if(e<0||e>=this.chartsCount())throwError("Incorrect index: "+e);returnthis._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}*charts(){for(lete=0;e<this.chartsCount();e++)yieldthis.chart(e)}activeChart(){returnthis._getChartWidgetApi(this._activeChartWidget())}activeChartRangesState(){returnthis._activeChartRangeState}setActiveChart(e){if(e>=0&&e<this.chartsCount()){constt=this._chartWidgetCollection.getAll()[e];t&&(this._activeChartWidget().inFullscreen()?t.requestFullscreen():this._chartWidgetCollection.activeChartWidget.setValue(t))}}asyncreplayApi(){by()}asyncbacktestingStrategyApi(){if(by(),null===this._chartApiInstance)thrownewError("backtesting api isn't available");if(null===this._backtestingStrategyApi){awaitPromise.all(this._chartWidgetCollection.getAll().map(waitForModel));const{facade:e}=awaitgetBacktestingStrategyFacadeInstance(this._chartWidgetCollection);this._backtestingStrategyApi=e}returnthis._backtestingStrategyApi}pineEditorApi(){by()}activeChartIndex(){returnthis._chartIndex(this._activeChartWidget())}chartsCount(){returnut.layouts[this.layout()].count}layout(){returnthis._chartWidgetCollection.layout.value()}layoutName(){returnthis._chartWidgetCollection.metaInfo.name.value()}layoutNameWatchedValue(){returnthis._chartWidgetCollection.metaInfo.name.readonly()}asynclayoutSettingsDrawer(){by()}setLayout(e,t){t?.withUndo?this._chartWidgetCollection.setChartLayoutWithUndo(e):this._chartWidgetCollection.setLayout(e)}resetLayoutSizes(e){thrownewError("Unsupported. This API is only applicable to the Trading Edition of the library")}setLayoutSizes(e,t){thrownewError("Unsupported. This API is only applicable to the Trading Edition of the library")}unloadUnusedCharts(){thrownewError("Unsupported. This API is only applicable to the Trading Edition of the library")}moveActiveChart(e){this._chartWidgetCollection.moveActiveChartWithUndo(e)}asyncopenPublicationViewPopup(e){0}asyncclosePublicationViewPopup(){0}undoRedoState(){returnthis._chartWidgetCollection.undoHistory.state()}clearUndoHistory(){returnthis._chartWidgetCollection.undoHistory.clearStack()}undo(){this._chartWidgetCollection.undoHistory.undo()}redo(){this._chartWidgetCollection.undoHistory.redo()}asyncselectLineTool(e,t,i){if(!Nf(e))return;consts=Of[e].name;if("icon"===e){conste=t?.icon;void0!==e&&mt.iconTool.setValue(e)}if(await(0,zs.initLineTool)(s),"emoji"===e){conste=t?.emoji;void0!==e&&mt.emojiTool.setValue(e)}if("sticker"===e){conste=t?.sticker;void0!==e&&mt.stickerTool.setValue(e)}mt.tool.setValue(s),
(0,wn.trackDrawingToolSelected)(s,i)}favoriteDrawingsToolbar(){returni.e(5551).then(i.bind(i,46973)).then((e=>(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=newe.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){returnthis._sharingChartService}watchlist(){by()}setWatchlistApiPromise(e){by()}news(){by()}setNewsApiPromise(e){by()}widgetbar(){by()}setWidgetbarApiPromise(e){by()}getChartStorage(){returngetChartStorage()}setDebugMode(e){l.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?l.setEnabled(e,t):lu.addPlusButtonProperty.setValue(t)}magnetEnabled(){returnnull===this._magnetEnabledWV&&(this._magnetEnabledWV=wy((0,mt.properties)().childs().magnet)),this._magnetEnabledWV}magnetMode(){returnnull===this._magnetModeWV&&(this._magnetModeWV=wy((0,mt.properties)().childs().magnetMode)),this._magnetModeWV}magnetSnapsToIndicators(){returnnull===this._magnetSnapsToIndicatorsWV&&(this._magnetSnapsToIndicatorsWV=wy((0,mt.properties)().childs().magnetSnapsToIndicators)),this._magnetSnapsToIndicatorsWV}flushBufferedData(){Ff.fire()}chartWidgetCollectionState(e){returnthis._chartWidgetCollection.state(e)}chartWidgetCollectionSeriesStatuses(){returnthis._chartWidgetCollection.chartSeriesStatuses()}watermark(){{conste=P_.getInstance();if(!e.ready())thrownewError("Watermark API is not initialised yet.");returne}}setContextMenuOptions(e){Cy.setContextMenuOptions(e)}changeSymbol(e,t,i,s="API"){de.linking.setIntervalAndLogInitiator((0,n.ensureNotNull)(Re.Interval.normalize(t)),s),de.linking.setSymbolAndLogInitiator(e,s),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}closePopupsAndDialogs(){Io.ContextMenuManager.hideAll(),ee.emit(vy.CLOSE_POPUPS_AND_DIALOGS_COMMAND)}startFullscreen(){returnthis._chartWidgetCollection.startFullscreen()}exitFullscreen(){returnthis._chartWidgetCollection.exitFullscreen()}getFavoriteChartStylesService(){by()}getFavoriteIntervalsService(){by()}getFavoriteCurrencyUnitConversionApi(){by()}getIntervals(){lete=[];constt=(0,ht.getCustomResolutions)();returnnull!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),(0,ht.mergeResolutions)(e,t)}getLinetoolsFavoritesStore(){by()}getSavedCharts(e){z.backend.getCharts().then(e)}getStudiesList(){return(0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata().filter((e=>!e.is_hidden_study)).map((e=>e.description))}getStudyInputs(e){returnQf(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getStudyStyles(e){returney(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getSymbolInterval(e){constt={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};returne?.(t),t}hasChartChanges(){returnthis._chartWidgetCollection.hasChanges()}asyncloadChart(e){{this._chartApiInstance?.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),
this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name));constt=awaitthis._chartWidgetCollection.loadContent(e.json);this._chartWidgetCollection.unloadUnusedCharts(),this._chartApiInstance?.connect(),de.linking.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),ee.emit("chart_loaded"),t.contentMigrated&&ee.emit("chart_migrated")}}asyncloadChartFromServer(e){await(this._loadChartService?.loadChart(e,!1))}asyncloadLayoutFromServerByLayoutId(e,t,i){await(this._loadChartService?.loadChartByUrl(e,!!t,i))}layoutId(){returnthis._chartWidgetCollection.metaInfo.uid.value()}asynccreateNewLayout(e){by()}lockAllDrawingTools(){returnnull===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=newO.WatchedValue((0,mt.lockDrawings)().value()),this._lockDrawingsWatchedValue.subscribe((e=>{(0,mt.lockDrawings)().setValue(e)})),(0,mt.lockDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._lockDrawingsWatchedValue).setValue((0,mt.lockDrawings)().value())}))),this._lockDrawingsWatchedValue}hideAllDrawingTools(){returnnull===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=newO.WatchedValue((0,mt.hideAllDrawings)().value()),this._hideDrawingsWatchedValue.subscribe((e=>{(0,mt.hideAllDrawings)().setValue(e)})),(0,mt.hideAllDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideDrawingsWatchedValue).setValue((0,mt.hideAllDrawings)().value())}))),this._hideDrawingsWatchedValue}hideAllIndicators(){returnnull===this._hideIndicatorsWatchedValue&&(this._hideIndicatorsWatchedValue=newO.WatchedValue((0,mt.hideAllIndicators)().value()),this._hideIndicatorsWatchedValue.subscribe((e=>{(0,mt.hideAllIndicators)().setValue(e)})),(0,mt.hideAllIndicators)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideIndicatorsWatchedValue).setValue((0,mt.hideAllIndicators)().value())}))),this._hideIndicatorsWatchedValue}logs(){return{getLogHistory:ne.getLogHistory,enable:window.lon,disable:window.loff}}mainSeriesPriceFormatter(){returnthis._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()}onContextMenu(e){ee.subscribe("onContextMenu",(t=>{t.callback(e(t.unixtime,t.price))}),void0)}onGrayedObjectClicked(e){ee.subscribe("onGrayedObjectClicked",e,void0)}removeChartFromServer(e,t){z.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;consti=this._saveChartService.saveToJSON(t);returne&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}selectedLineTool(){conste=Object.keys(Of),t=mt.tool.value();for(leti=0;i<e.length;++i)if(Of[e[i]].name===t)returne[i];thrownewError("Unknown tool")}autosave(){if(!this._saveChartService)thrownewError("Saving service is not available");returnthis._saveChartService.autoSaveEnabled()}setForceFullscreenMode(){by()}setMultichartMode(){by()}setDateRangeLinkingEnabled(e){this._chartWidgetCollection.lock.dateRange.setValue(e)}
studyMetaIntoRepository(){return(0,os.studyMetaInfoRepository)()}deferredStudiesReady(){returnvh.ready()}hasPendingStudiesModuleLoading(){return(0,Ws.hasPendingStudiesModuleLoading)()}hasPendingLineToolsModuleLoading(){returnhasPendingLineToolsModuleLoading()}shouldBeSaved(){return!this._chartWidgetCollection.readOnly()&&(this._saveChartService?.hasChanges()||!1)}setIntervalLinkingEnabled(e){this._chartWidgetCollection.lock.interval.setValue(e)}setTimeFrame(e){this._chartWidgetCollection.setTimeFrame(e)}showConfirmDialog(e){lett=e.callback;consti=e=>{t&&(t(e),t=null)};(0,j.showConfirm)({title:e.title,text:e.body||"",onClose:()=>{i(!1)},onConfirm:e=>{i(!0),e.dialogClose()}})}showLoadChartDialog(){this._loadChartService?.showLoadDialog()}persistentLogger(){returnnull}showNoticeDialog(e){(0,j.showWarning)({title:e.title,text:e.body||"",onClose:e.callback})}showSupportDialog(){by()}showSaveAsChartDialog(){conste=this._saveChartService;e&&window.runOrSignIn((()=>{e.saveChartAs()}),{source:"Save as chart dialogue"})}showRenameChartDialog(){by()}saveChartOrShowTitleDialog(e,t,i){by()}showCreateAlertDialog(){by()}createGoProDialog(e){by()}setUserInfo(e){by()}openMobileChartPicker(){by()}closeMobileChartPicker(){by()}takeClientScreenshot(e){returnthis._chartWidgetCollection.clientSnapshot(e)}takeScreenshot(){returnthis._chartWidgetCollection.takeScreenshot()}trading(){by()}waitTrading(){by()}viewMode(){by()}viewModeWatchedValue(){by()}asyncdummyBrokerController(){returnPromise.reject("Not implemented")}pineLibApi(){returnby(),{saveNew,saveNext,requestBuiltinScripts}}resetCache(){(0,r.getChartingLibraryGlobalContext)().ChartApiInstance.resetCache()}getSymbolAliasService(){thrownewError("not supported")}staticsetContextMenuOptions(e){void0!==e.items_processor&&Io.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void0!==e.renderer_factory&&Io.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){lett=this._chartWidgets.get(e);returnvoid0===t&&(t=newyy(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){returnthis._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){returnthis._chartWidgetCollection.activeChartWidget.value()}_toggleUnitConversionMenu(e,t,i,s,o){if(t)returnvoidee.emit(e,t,-1,-1,"");constr=this._chartWidgetCollection.getAll(),a=r.findIndex((e=>e.model().model().id()===i));if(-1===a)return;constl=(0,n.ensureDefined)(r[a]).paneWidgets().findIndex((e=>e.state().id()===s));-1!==l&&ee.emit(e,t,a,l,o)}_onBeforeActiveChartChanged(){0}_onActiveChartChanged(){this._onBeforeActiveChartChanged(),this._activeChartWidgetWV.setValue(this.activeChart()),this._activeChartWidgetChangedDelegate.fire(),this._onAfterActiveChartChanged()}_onAfterActiveChartChanged(){this._updateActiveChartRangeState()}_updateActiveChartRangeState(){0}}i(4783),i(45);varTy=i(78136),Py=i(19979);constxy={ar_AE:"ar",de_DE:"de",en:"www",es:"es",ca_ES:"es",fa_IR:"www",fr:"fr",he_IL:"il",id:"id",in:"in",it:"it",ja:"jp",kr:"kr",ms_MY:"my",pl:"pl",
method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)}onTimescaleUpdate(e,t){consti={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,clearTickMarks:e.clearTickMarks}]};this._server.receiveLocalResponse(i)}onTimescaleCompleted(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})}onSeriesTimeframeUpdate(e,t,i,s,o,n){constr={method:"series_timeframe",params:[this._session,e,t,i,s,n||null,!0,o]};this._server.receiveLocalResponse(r)}onPointsetDataUpdate(e,t,i){this.onDataUpdate(e,t,i,null)}onDataUpdate(e,t,i,s){consto={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(o)}onQuotesData(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})}onDepthData(e){this._server.receiveLocalResponse({method:"dd",params:e})}onDepthUpdate(e){this._server.receiveLocalResponse({method:"dpu",params:e})}onClearData(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})}_prepareDataUpdateObjects(e){constt={};returne.forEach((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}}classSv{constructor(){this._instances=newMap}createChartApiMessager(e,t){consti=newvv(t,e);returnthis._instances.set(e,i),i}getChartApiMessager(e){return(0,n.ensureDefined)(this._instances.get(e),`ChartapiMessager instance for session ${e}`)}}constbv={blue:"#2962ff",gray:"#787B86",green:"#4CAF50",olive:"#808000",teal:"#00897B",new:(e,t)=>(0,Ro.applyTransparency)(e,t)},wv={hline:{style_dashed:qt.LINESTYLE_DASHED,style_dotted:qt.LINESTYLE_DOTTED,style_solid:qt.LINESTYLE_SOLID}},Cv={line:"line"};classTv{get(e){returnNaN}set(e){}indexOf(e){returnNaN}adopt(e,t,i){returnNaN}}varPv=i(60911);classxv{constructor(e,t){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>this._ctx.symbol.isLastBar},this.input={bool:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("boolean"==typeofe,"Study input value should be a boolean"),e},int:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("number"==typeofe,"Study input value should be a number"),e},source:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)((e=>{switch(e){case"open":case"high":case"low":case"close":case"hl2":case"hlc3":case"ohlc4":return!0;default:return!1}})(e),"Study input value should be a series source"),this._ctx.new_var(Py.Std[e](this._ctx))},string:()=>{conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeofe,"Study input value should be a string"),e},symbol:()=>{
conste=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeofe,"Study input value should be a symbol string"),e}},this.request={security:(e,t)=>{consti=this._symbolIndexByTickerId.get(e);this._addedTickerIds.has(e)||this._ctx.new_sym(e,Py.Std.period(this._ctx)),(0,n.assert)(void0!==i,`Unknown tickerId ${e}`);consts=this._ctx.new_unlimited_var(Py.Std.time(this._ctx));this._ctx.select_sym(i);consto=this._ctx.new_unlimited_var(Py.Std.time(this._ctx)),r=t?.expression?.()??this.close();returnthis._ctx.select_sym(0),this._ctx.new_var(r.adopt(o,s,0))}},this.runtime={error:e=>{Py.Std.error(e)}},this.math={max:(e,...t)=>{consti=e=>(0,Hd.isNumber)(e)?e:e.get(0),s=Math.max(i(e),...t.map(i));return(0,Hd.isNumber)(e)?s:this._ctx.new_var(s)},min:(e,...t)=>{consti=e=>(0,Hd.isNumber)(e)?e:e.get(0),s=Math.min(i(e),...t.map(i));return(0,Hd.isNumber)(e)?s:this._ctx.new_var(s)},negative:e=>(0,Hd.isNumber)(e)?-e:this._ctx.new_var(-e.get(0))},this.ta={change:e=>this._ctx.new_var(Py.Std.change(e)),correlation:(e,t,i)=>this._ctx.new_var(Py.Std.correlation(e,t,i,this._ctx)),cum:e=>this._ctx.new_var(Py.Std.cum(e.get(0),this._ctx)),ema:(e,t)=>this._ctx.new_var(Py.Std.ema(e,t,this._ctx)),rma:(e,t)=>this._ctx.new_var(Py.Std.rma(e,t,this._ctx)),sma:(e,t)=>this._ctx.new_var(Py.Std.sma(e,t,this._ctx)),vwap:(e,t,i)=>{const[s,o,n]=Py.Std.vwapBands(e,t,i,this._ctx);return[this._ctx.new_var(s),this._ctx.new_var(o),this._ctx.new_var(n)]},wma:(e,t)=>this._ctx.new_var(Py.Std.wma(e,t,this._ctx))},this.ticker={modify:(e,t)=>{leti;if((0,Pv.isEncodedExtendedSymbol)(e))i=e;else{consts={symbol:e,session:t};i=(0,Pv.encodeExtendedSymbolOrGetSimpleSymbolString)(s)}returnthis._symbolIndexByTickerId.has(i)||this._symbolIndexByTickerId.set(i,++this._symbolIndex),i}},this.timeframe={change:e=>{if(isNaN(Py.Std.time(this._ctx)))return!1;constt=(0,Td.newBarBuilder)(e,this._ctx.symbol.session,null);t.moveTo(Py.Std.time(this._ctx));return0===t.startOfBar(0)-Py.Std.time(this._ctx)},isDWM:()=>this._ctx.symbol.isdwm()},this._addedTickerIds=newSet,this._symbolIndexByTickerId=newMap,this._returnValues=[],this._ctx=e,this._inputCallback=t,this._inputIndex=0,this._symbolIndex=0}open(){returnthis._ctx.new_var(Py.Std.open(this._ctx))}high(){returnthis._ctx.new_var(Py.Std.high(this._ctx))}low(){returnthis._ctx.new_var(Py.Std.low(this._ctx))}close(){returnthis._ctx.new_var(Py.Std.close(this._ctx))}volume(){returnthis._ctx.new_var(Py.Std.volume(this._ctx))}year(){returnPy.Std.year(this._ctx)}na(e){return!!Py.Std.na(e)}series(e){returnthis._ctx.new_var(e)}fill(e,t,i){}hline(e,t){return{id:""}}indicator(e){}plot(e,t){consti="number"==typeofe?e:e.get(0),s=void0===t?.offset?i:{offset:t.offset,value:i};returnthis._returnValues.push(s),{id:""}}getReturnValues(){returnthis._returnValues}setMinimumAdditionalDepth(e){this._ctx.setMinimumAdditionalDepth(e)}}varMv=i(18330);constIv=e=>{switch(e){case"data_window":returnTs.InputDisplayFlags.DataWindow;case"none":returnTs.InputDisplayFlags.None;default:returnTs.InputDisplayFlags.All}},Av=e=>{
switch(e){case"data_window":return2;case"none":return0;default:return15}};classLv{constructor(){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>!1},this.input={bool:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,inline:i?.inline,id:this._getNextInputId(),name:t,type:"bool"}),e),int:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"integer"}),e),source:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"source"}),newTv),string:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,options:i?.options,type:"text"}),e),symbol:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"symbol"}),e)},this.math={max:e=>(0,Hd.isNumber)(e)?0:newTv,min:e=>(0,Hd.isNumber)(e)?0:newTv,negative:e=>(0,Hd.isNumber)(e)?0:newTv},this.ta={change:e=>newTv,correlation:(e,t,i)=>newTv,cum:e=>newTv,ema:()=>newTv,rma:()=>newTv,sma:()=>newTv,vwap:()=>[newTv,newTv,newTv],wma:()=>newTv},this.request={security:e=>(this._tickers.push(e),newTv)},this.runtime={error:e=>{thrownewError(e)}},this.ticker={modify:()=>""},this.timeframe={change:()=>!1,isDWM:()=>!1},this._bands=[],this._defaults={},this._filledAreas=[],this._format={type:"inherit"},this._inputs=[],this._overlay=!1,this._plots=[],this._shortTitle="",this._styles={},this._tickers=[],this._title="",this._version=1}getStudyName(){returnthis._title}getStudyMetainfo(){vare,t;return{_metainfoVersion:53,bands:this._bands,defaults:this._defaults,description:this._title,filledAreas:this._filledAreas,format:this._format,id:(e=this._title,t=this._version,`${e}@tv-basicstudies-${t}`),inputs:this._inputs,is_price_study:this._overlay,palettes:{},plots:this._plots,shortDescription:this._shortTitle,styles:this._styles}}getTickers(){returnthis._tickers}open(){returnnewTv}high(){returnnewTv}low(){returnnewTv}close(){returnnewTv}volume(){returnnewTv}year(){return0}na(e){return!1}series(e){returnnewTv}fill(e,t,i){consts=this._getNextFillId(),o=this._plots.some((t=>t.id===e.id)),n=this._plots.some((e=>e.id===t.id)),r=this._bands.some((t=>t.id===e.id)),a=this._bands.some((e=>e.id===t.id)),l=o&&n;l||r&&a||this.runtime.error(`Could not find pair of plots or pair of hlines with ids ${e.id}${t.id}`);constc=l?"plot_plot":"hline_hline";this._filledAreas.push({fillgaps:!1,id:s,isHidden:!1,objAId:e.id,objBId:t.id,title:i?.title??(l?"Plots Background":"Hlines Background"),type:c}),void0===this._defaults.filledAreasStyle&&(this._defaults.filledAreasStyle={}),this._defaults.filledAreasStyle[s]=(e=>{if((e=>void0===e?.color)(e))return{bottomColor:e?.bottomColor,fillType:"gradient",topColor:e?.topColor,visible:"all"===e?.display};return{fillType:void0,
findStudyObject(e){e.endsWith("!")&&(e=e.slice(0,-1));constt=e.split("@")[0],i=this._studyLibrary.filter((i=>i.metainfo.id===e||i.metainfo.shortDescription===t));if(0===i.length)returnnull;returni[0]}}varFv,Wv=i(63193),Hv=i(56052),zv=i(82433),Uv=i(47132),jv=i(16329);classGv{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(){returnthis.info}isLastBarClosed(){returnthis.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){constt=this.bars[e];if(void0===t)thrownewError(`BarSet has no value at index ${e}`);returnt}count(){returnthis.bars.length}emptyBarCount(){returnthis._emptyBarCount}add(e,t,i){void0===i&&(i=!1);consts=e,o=this.bars,n=o.length,r=s.time,a=0===n?NaN:o[n-1].time;0===n||a<r?(o.push(s),i&&(this._emptyBarCount+=1,this._lastBarIsEmpty=!0)):a===r?(i!==this._lastBarIsEmpty&&(this._emptyBarCount+=i?1:-1,this._lastBarIsEmpty=i),o[n-1]=s):console.error("time order violation, prev: "+newDate(a).toUTCString()+", cur: "+newDate(r).toUTCString()),this.isBarClosed=!!t}}functionqv(e,t){returne.ticker+(e.currency_code?"_#_"+e.currency_code:"")+(e.unit_id?"_#_"+e.unit_id:"")+(e.subsession_id?"_#_"+e.subsession_id:"")+"_#_"+t}function$v(e){returnnewDate(e).toISOString()}!function(e){e.ThreadKeySeparator="_#_"}(Fv||(Fv={})),function(e){e[e.MaxEmptyResponsesInARow=50]="MaxEmptyResponsesInARow",e[e.ResetCacheTimePeriod=1e4]="ResetCacheTimePeriod"}(Fv||(Fv={}));classKv{constructor(e,t,i,s,o,n){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._emptyResponsesCount=0,this._firstDataRequest=!0,this._datafeed=e,this._symbolInfo=t,this._interval=Re.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=o,this._serverTimeOffsetGetter=s,this._resetCacheTimePeriod=void0===n?1e4:n,this._sessionSpec=newjv.SessionsSpec(t.timezone,t.session,t.session_holidays,t.corrections),this._updateDatesFromExpirationDate()}destroy(){0!==this._subscribers.length&&this._logWarning("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),deletethis._datafeed,this._destroyed=!0}addSubscription(e,t,i){consts=this._getNextSubscriptionId();this._pendingSubscribers.push({key:s,range:e,onHistoryCallback:t,onErrorCallback:i}),Re.Interval.isDWM(this._resolution)&&void0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&this._logWarning(`Internal error: invalid date for DWM resolution ${$v(e.to)}, expected time without a time part`),this._clearResetCacheTimeout();returnsetTimeout((()=>{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){constt=this._pendingSubscribers.find((t=>t.key===e));if(t)returnvoidthis._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1)
;consti=this._subscribers.find((t=>t.key===e));if(i)returnthis._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=window.setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)));this._logWarning("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}resetCache(){this._unsubscribeRealtime();conste=this._leftDate;this._purgeCache(),null===e||l.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})}_logMessage(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logWarning(e){console.warn(`${this._logMessagePrefix()}${e}`)}_logError(e){console.error(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){conste=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(newDate).toISOString()} 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(){void0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){returnnull===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){constt=void0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void0!==e.to&&t<=(0,n.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};consti=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,Pt.lowerbound)(this._cache.bars,i,((e,t)=>e.time<t));returne.countBack<s?{countBack:0,to:0!==e.countBack&&s<=this._cache.bars.length?this._dealignTime(this._cache.bars[s-e.countBack].time):t}:{countBack:e.countBack-s,to:this._dealignTime(this._cache.bars[0].time)}}_processPendingSubscribers(){conste=this._pendingSubscribers;if(!e.length)return;if(this._requesting)returnvoidthis._logMessage("Processing is skipped due active request");if(this._logMessage(`Processing pending subscribers, count=${e.length}`),this._errorMessage){constt=this._errorMessage;returnthis._logMessage(`Return error: ${t}`),this._pendingSubscribers=[],voide.forEach((e=>{e.onErrorCallback(t)}))}lett=this._normalizeRange(e[0].range);for(constiofe.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 ${$v(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=>{constt=this._moveSubscriberToRealtime(e)
;this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){constt={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};returnthis._subscribers.push(t),t}_isSymbolExpired(){returnthis._symbolInfo.expired||void0!==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=>{consti=t.barset;if(null===i)thrownewError("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),qv(this._symbolInfo,this._resolution),this.resetCache.bind(this)),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(qv(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){consti=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(),$v(s.bars[0].time),$v(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){constt=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,Pt.lowerbound)(this._cache.bars,t,((e,t)=>e.time<t)),s=newGv(this._symbolInfo,this._cache.bars.slice(Math.max(0,i-e.countBack)));return0!==s.bars.length?s.firstLoadedTimeMs=this._dealignTime(s.bars[0].time):0!==this._cache.bars.length?s.firstLoadedTimeMs=this._dealignTime(this._cache.bars[this._cache.bars.length-1].time):s.firstLoadedTimeMs=this._dealignTime((0,n.ensureNotNull)(this._leftDate)),s}_ensureRequestedTo(e){lett;if(this._requesting&&this._logMessage("Internal error: trying to call getBars while the previous request is active",!0),null!==this._leftDate)t=this._leftDate;else{conste=this._now();if(null===this._dwmAligner)t=e;else{leti=this._sessionSpec.alignToNearestSessionStart(newDate(e),1).getTime();if(i<e){conste=this._sessionSpec.alignToNearestSessionEnd(newDate(i),1).getTime();i=this._sessionSpec.alignToNearestSessionStart(newDate(e+1e3),1).getTime()}t=this._dealignTime(i)}}consti=(0,Td.alignPeriodsBackForDataRequest)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.countBack,Math.min(e.to,t,this._nextTime??1/0));lets=e.countBack;if(e.to<t){s+=(0,
Td.getPeriodsBetweenDates)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.to,t)}if(null!==this._leftDate&&this._leftDate<i)returnvoidthis._processPendingSubscribers();consto=this._firstDataRequest||(this._isSymbolExpired()?0===this._cache.bars.length:null===this._leftDate);this._firstDataRequest=!1,this._requesting=!0,this._nextTime=null,this._leftDate=i;constn=`[${$v(i)} ... ${$v(t)}, ${s} bars]`;this._logMessage(`Requesting data: ${n}`);letr=!1;consta=i/1e3,l=t/1e3;this._datafeed.getBars(this._symbolInfo,this._resolution,{from:this._interval.isTicks()?a:Math.floor(a),to:this._interval.isTicks()?l:Math.floor(l),countBack:s,firstDataRequest:o},((e,t)=>{if(!this._destroyed)if(r)this._logMessage("getBars callback is already called before",!0);else{if(r=!0,e.length>0){constt=` [${$v(e[0].time)} ... ${$v(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${n}`)}elsethis._logMessage(`Receiving bars: barset is empty, requested range: ${n}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(r?this._logMessage("getBars callback is already called before",!0):(r=!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($v(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?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._logMessage("EOD received"),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?this._logWarning("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&this._setEndOfData()}_getNextSubscriptionId(){returnthis._nextSubscriptionId++}_checkBars(e,t=!1){if(l.enabled("charting_library_debug_mode"))for(leti=1;i<e.length;i++){if(e[i].time<=e[i-1].time){lets=`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"),this._logError(s)}
consts=this._getExpectedBarPropertyNames();s.some((t=>"number"!=typeofe[i][t]||!isFinite(e[i][t])))&&this._logError(`Wrong bars values: all ${s.join(", ")} properties should be numbers`)}}_getExpectedBarPropertyNames(){switch(this._symbolInfo.visible_plots_set){case"c":return["close","time"];case"hlc":return["high","low","close","time"];default:return["high","low","open","close","time"]}}_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)returnthis._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){constt=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)returnthis._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}returnthis._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){constt=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):this._logError(`putToCacheNewBar: time violation, previous bar time: ${$v(s)} should be less or equal to new time: ${$v(i)}`)}_alignBarsTime(e){if(this._dwmAligner)for(consttofe)t.time=this._dwmAligner.timeToSessionStart(t.time)}_now(){returnDate.now()+1e3*this._serverTimeOffsetGetter()+6e4}}classYv{constructor(e,t,i){this._threads={},this._datafeed=e,this._serverTimeOffsetGetter=t,this._resetCacheTimePeriod=i}destroy(){this._forEachThread(((e,t)=>t.destroy())),this._threads={},deletethis._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}resetCache(){this._forEachThread(((e,t)=>t.resetCache()))}subscribe(e,t,i,s,o){constn=qv(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));returnn+'"'+this._threads[n].addSubscription(i,s,o)}unsubscribe(e){constt=e.split('"');if(2!==t.length)returnvoidthis._logWarning("Wrong guid format");consti=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):this._logWarning("Data thread doesnt exist: "+e)}_createThread(e,t){returnnewKv(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,Jd.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}_logWarning(e){console.warn(`${(newDate).toISOString()} FEED: ${e}`)}}classZv{constructor(){this._listeners=[]}listenersCount(){returnthis._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){
constt=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;consti=this._listeners.indexOf(t[0]);deletethis._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";constt=this._listeners,i=t.length;for(lets=0;s<i;s++){consti=t[s];i&&i.onErrorCallback&&i.onErrorCallback(e)}}fire(e,t){t||(this._barset=e);consti=this._listeners,s=i.length;for(lett=0;t<s;t++){consts=i[t];s&&s.dataListener(e)}}}varXv=i(30342);classJv{constructor(e,t,i,s,o,n,r){this.periodBase="",this._shouldAlignDwmBarsToMainSeries=l.enabled("align_dwm_bars_to_main_series"),this._canExtendTimeScale=l.enabled("secondary_series_extend_time_scale");consta=(0,Pv.decodeExtendedSymbol)(e),c="string"==typeofa.symbol?a:a.symbol;if((0,Pv.isStudySymbol)(c))thrownewError(`Unexpected nested study symbol: ${e}`);consth="string"==typeofa.symbol?a.symbol:a.symbol.symbol;this.ticker=h,this.currencyCode=i||c["currency-id"],this.unitId=s||c["unit-id"],this.subsessionId=r||c.session;constd=c["currency-id"]!==this.currencyCode||c["unit-id"]!==this.unitId;c["currency-id"]=this.currencyCode,c["unit-id"]=this.unitId,d&&(e=(0,Pv.encodeExtendedSymbolOrGetSimpleSymbolString)(a)),this.tickerid=e;constu=Re.Interval.parse(t);this.resolution=u.letter(),this.interval=u.multiplier(),this.period=u.value(),this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN,this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.minTick=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.isFirstBar=!1,this.isLastBar=!1,this.session=newCd.SessionInfo("Etc/UTC","24x7"),this.regularSubsession=null,this.preMarketSubsession=null,this.postMarketSubsession=null,this.script=o,this.projectionTime=NaN,this.isBarUpdate=!1,this.isAdditionalDepthAllowed=!(0,Pv.isStudySymbol)(a)||a.type.includes("BarSetHeikenAshi"),n&&this.set_symbolinfo(n)}set_symbolinfo(e){if(e||console.error("WARN: symbolinfo isn't defined for "+this.tickerid),this.info=e,this.minTick=e.minmov/e.pricescale,this.currencyCode=e.currency_code,this.unitId=e.unit_id,this.subsessionId=e.subsession_id,this.timezone=(0,Ce.get_timezone)(e.timezone),this.utcTimezone=(0,Ce.get_timezone)("Etc/UTC"),this.session.init(e.timezone,e.session,e.session_holidays,e.corrections),void0!==e.subsessions){constt=e.subsessions.find((e=>e.id===Xv.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===Xv.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===Xv.SubsessionId.PostMarket));void0!==t&&(this.regularSubsession=newjv.SessionsSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void0!==i&&(this.preMarketSubsession=newjv.SessionsSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void0!==s&&(this.postMarketSubsession=newjv.SessionsSpec(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=(0,Td.newBarBuilder)(this.period,e,t)}bartime(){conste=this.time;if(!this.isdwm()||isNaN(e))returne;constt=(0,
this.minimumAdditionalDepth=null,this.targetAnchor=null,this._vars=[],this._varsIndex=0,this._ctx=[],this._ctxIndex=0,this.symbol=e}new_sym(e,t,i,s,o){returnthis.symbol.script.add_sym(e,t,i,s,o,void0)}select_sym(e){constt=this.symbol.script.get_sym(e);null==t&&Py.Std.error(`Attempted to select symbol at index ${e} but there is no such symbol`),this.symbol=t}is_main_symbol(e){returnvoid0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){constt=this._vars;t.length<=this._varsIndex&&t.push(newQv(this.symbol));consti=t[this._varsIndex++];returnarguments.length>0&&void0!==e&&i.set(e),i}new_unlimited_var(e){constt=this._vars;t.length<=this._varsIndex&&t.push(neweS(this.symbol));consti=t[this._varsIndex++];returnarguments.length>0&&i.set(e),i}new_ctx(){returnthis._ctx.length<=this._ctxIndex&&this._ctx.push(newtS(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(lett=0;t<this._vars.length;t++)this._vars[t].prepare(e);for(lett=0;t<this._ctx.length;t++)this._ctx[t].prepare(e)}maxAdditionalDepth(){if(null!==this.minimumAdditionalDepth)returnthis.minimumAdditionalDepth;lete=0;for(lett=0;t<this._vars.length;t++){consti=this._vars[t].mindepth;!isNaN(i)&&i>e&&(e=i)}returne}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}setTargetAnchor(e){this.targetAnchor=e}}functioniS(e){return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}classsS{constructor(e,t,i,s,o,n,r,a,l,c,h){this._body=n,this._symbols=[],this._runner=o,this._inputCallback=a,this._out=r,this._nonseriesOut=l,this._ctx=newtS(this.add_sym(e,t,i,s,h,c)),this.init()}calc(e){constt=this._ctx,i=this._body;t.prepare(e);consts=i.main(t,this._inputCallback,e);varo;if(null!=s)if(null===(o=s)||Array.isArray(o)||"composite"!==o.type)this._processResult(s);elsefor(lete=0;e<s.data.length;++e)this._processResult(s.data[e])}init(){conste=this._ctx,t=this._body;t.init&&t.init(e,this._inputCallback),t.main(e,this._inputCallback)}add_sym(e,t,i,s,o,n){constr=this._runner.add_sym(e,t,i,s,this,o,n);returnthis._symbols.push(r),r.isdwm()&&this._symbols.length>1&&this._runner.host.enableDwmAligning&&r.enable_dwm_aligning(this._symbols[0].session,r.session),r}maxAdditionalDepth(){returnthis._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}targetAnchor(){returnthis._ctx.targetAnchor}stop(){this._symbols=null,this._ctx?.stop(),this._ctx=null}get_sym(e){returnthis._symbols[e]}_processResult(e){constt=this._ctx;vari;this._out&&e&&(!isNaN(t.symbol.time)||iS(e))&&(iS(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)})))}}classoS{constructor(e){this._nonseriesUpdate=null,this._script=null,this._symbols=[],this._barsets=[],this._subscription=[],this.host=e,this._isRecalculated=!1,this.isStarted=!1,
this._script?.stop(),this._script=null,this._symbols=null,this.isStarted=!1}elseconsole.warn("Recurring script engine stop happened.")}update(e,t){if(!t)returnvoidconsole.error("Unexpected barset = null");consti=this._symbols[e];if(this._isRecalculated){conste=t.bar(t.count()-1);e.isBarClosed=t.isLastBarClosed(),e.isLastBar=!0,i.lastbar(e,!0)}elsethis._barsets[e]||(this._barsets[e]=t,i.set_symbolinfo(t.symbolinfo()),this.recalc())}recalc(){conste=this._symbols;for(lett=0;t<e.length;t++)if(!this._barsets[t])return;try{for(lett=e.length-1;t>=0;t--){consti=e[t],s=this._barsets[t],o=s.count();for(lete=0;e<o;e++){constt=s.bar(e);t.isLastBar=e===o-1,t.isBarClosed=!t.isLastBar||s.isLastBarClosed(),i.lastbar(t)}}this._isRecalculated=!0;constt=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(!(einstanceofkv.StudyError))throwe;this.host.onErrorCallback(e.message,e.title)}}}classnS{constructor(e){this.runner=newoS(e)}stop(){this.runner.stop()}isStarted(){returnthis.runner.isStarted}}classrS{constructor(e,t,i,s,o,n,r,a,l,c,h){this.listeners=t,this._isRecalculated=!1,this._symbolInfo=a,this.engine=newnS({datafeed:e,tickerid:i,currencyCode:s,unitId:o,subsessionId:h,period:n,body:r,sessionId:c,symbolInfo:a,dataRange:l,forceAlignBars:!1,enableDwmAligning:!1,input:()=>{thrownewError("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=newGv(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){consti=Object.assign({},t);i.nonseries=!0,i.data=t.bars,deletei.bars,i.barsetSize=this._barset?this._barset.count():0,i.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,this.listeners.fire(i,!0)}_out(e,t){consti=t[0];if(isNaN(i))return;consts={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},o=t[7];this._barset||(this._barset=newGv((0,n.ensureDefined)(e.info,"bar builder item output symbol info")));constr=t[8],a=t[9];if(rinstanceofArray&&a)for(lete=0;e<r.length;e++){constt=r[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(s,o),this._barset.isBarClosed=!!o,this._isRecalculated&&this.listeners.fire(this._barset)}}classaS{main(e){
constt=e.new_var(Py.Std.open(e)),i=e.new_var(Py.Std.close(e)),s=t.get(1),o=i.get(1),n=Py.Std.ohlc4(e),r=Py.Std.na(t.get(1))?(Py.Std.open(e)+Py.Std.close(e))/2:(s+o)/2;t.set(r),i.set(n);consta=Py.Std.max(Py.Std.high(e),Py.Std.max(r,n)),l=Py.Std.min(Py.Std.low(e),Py.Std.min(r,n)),c=Py.Std.volume(e),h=e.symbol;return[h.time,r,a,l,n,c,h.updatetime,h.isBarClosed,void0,void0]}}varlS=i(4622);classcS{constructor(e,t,i,s,o,n,r,a){this.listeners=e,this._host=n,this._host.resolve(t,i,(e=>{o&&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)}}varhS=i(99955);classdS{constructor(e,t){this._period=e,this._generateEmptyBars=!!t}init(e){this._bb=(0,Td.newBarBuilder)(this._period,e.symbol.session,null),this._bbEmptyBars=this._generateEmptyBars?(0,Td.newBarBuilder)(this._period,e.symbol.session,null):void0,e.setMinimumAdditionalDepth(0)}main(e){constt=(0,n.ensureDefined)(this._bb,"bar builder study bar builder"),i=e.symbol.time,s=t.alignTime(i),o=e.new_var(s),r=Py.Std.na(s),a=o.get(1),l=Py.Std.na(a)?1:Py.Std.neq(s,a),c=e.new_var(),h=e.new_var(),d=e.new_var(),u=e.new_var(),_=c.get(1),p=h.get(1),m=d.get(1),g=u.get(1),f=r?NaN:l?Py.Std.open(e):_,y=r?NaN:l?Py.Std.high(e):Py.Std.max(Py.Std.high(e),p),v=r?NaN:l?Py.Std.low(e):Py.Std.min(Py.Std.low(e),m),S=r?NaN:Py.Std.close(e),b=r?NaN:l?Py.Std.volume(e):Py.Std.volume(e)+g,w=r?NaN:i,C=e.symbol.isBarClosed&&t.isLastBar(0,i),T=this._generateEmptyBars&&l?this._extrapolate(a,s):void0,P=e.new_var(Py.Std.close(e)).get(1),x=TinstanceofArray?P:NaN;returnc.set(f),h.set(y),d.set(v),u.set(b),[s,f,y,v,S,b,w,C,T,x]}_extrapolate(e,t){returnisNaN(e)||isNaN(t)?void0:(0,hS.extrapolateBarsFrontToTime)((0,n.ensureDefined)(this._bbEmptyBars,"bar builder study empty bar builder"),e,t,Number.MAX_SAFE_INTEGER,!0).times}}const uS=e=>{console.error(e),Py.Std.error(e)},_S=Re.Interval.parse("1M").inMilliseconds(0);classpS{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,o,n,r,a,l,c,h){constd=l(r),u=((e,t,i,s,o,n,r,a,l)=>n+e+s+(t||"")+(i||"")+(l||"")+(o.has_empty_bars?"_":"")+"_"+r.countBack+"_"+r.to+"_"+Boolean(a))(e,t,i,s,r,a,d,c,h);let_=this._getCache(u);return_||(_=this._createItem(e,t,i,s,r,d,a,c,h),this._putCache(u,_)),_.listeners.addListener(o,n),{key:u,listener:o}}unsubscribe(e){constt=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){conste=[],t=e=>!!this._cache[e];for(constiinthis._cache)if(t(i)){0===(0,n.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(lett=0;t<e.length;t++){consti=e[t],s=(0,n.ensureNotNull)(this._cache[i],`unused datafeed cache item ${i}`);this._cache[i]=null,s.stop()}this.removeUnused()}}_getCache(e){returnthis._cache[e]}_putCache(e,t){this._cache[e]=t}_rebuildFrom(e,t){consti=(0,lS.findSuitableResolutionToBuildFrom)(e,t);if(i.error)throwuS(i.errorMessage),
newError(i.errorMessage);returni.resolution}_createItem(e,t,i,s,o,n,r,a,l){constc=newZv,h=(0,Pv.decodeExtendedSymbol)(e),d="string"!=typeofh.symbol?h.symbol:h;t=d["currency-id"]||t,i=d["unit-id"]||i;constu=d.symbol,_=d.session&&d.session!==Xv.SubsessionId.Extended;if((l=d.session||l)===Xv.SubsessionId.Regular&&(l=void0),"type"inh){conste=Object.assign({},o);returno.has_empty_bars&&(e.has_empty_bars=!1),newrS(this,c,u,t,i,s,function(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))returnnewaS;constt=`unknown builder type: ${e.type}`;throwconsole.error(t),newError(t)}(h),e,n,r,l)}a&&!(0,Jd.isAlignmentEnabled)()&&uS("Internal error: rebuilding is requested but it is disabled."),!a&&o.has_empty_bars&&uS('Misconfiguration error: attempt to request data for symbol with "has_empty_bars" flag, but "disable_resolution_rebuild" featureset is enabled');constp=this._rebuildFrom(s,o);if(!Re.Interval.isTicks(s)&&(!Re.Interval.isEqual(s,p)||a)){(0,Jd.isAlignmentEnabled)()||uS('Misconfiguration error: remove "disable_resolution_rebuild" featureset or provide '+s+" data by yourself");consta=o.has_empty_bars,h=Object.assign({},o);o.has_empty_bars&&(h.has_empty_bars=!1);constd=Math.ceil((m=Re.Interval.parse(s),g=Re.Interval.parse(p),m.kind()===g.kind()?m.multiplier()/g.multiplier():(m.isMonths()?m.multiplier()*_S:m.inMilliseconds())/(g.isMonths()?g.multiplier()*_S:g.inMilliseconds())));returnn=Object.assign({},n,{countBack:n.countBack*d}),newrS(this,c,e,t,i,p,newdS(s,a),h,n,r,l)}varm,g;returnnewcS(c,u,{currency:t,unit:i,session:l},s,!!_,this._host,o,n)}}functionmS(e,t,i){return(0,tt.isArray)(e)?function(e,t,i){returne.map((e=>{consts=mS(e,t,i),o=t(s);returnvoid0!==o?o:s}))}(e,t,i):(0,tt.isObject)(e)&&((0,tt.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){consts={};returnObject.keys(e).forEach((o=>{constn=mS(e[o],t,i),r=t(n);s[o]=void0!==r?r:n})),s}(e,t,i):e}functiongS(e,t,i){consts=mS(e,t,i),o=t(s);returnvoid0!==o?o:s}varfS,yS=i(92211);functionvS(e,t){returne.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit",e[e.ExtendedExtrapolateLimit=45e4]="ExtendedExtrapolateLimit"}(fS||(fS={}));classSS{constructor(e,t,i){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=Re.Interval.parse(t),this._extrapolateLimit=i??(l.enabled("extended_extrapolation_limit")?45e4:2e5),this._session=newCd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),this._barBuilder=(0,Td.newBarBuilder)(t,this._session,null)}destroy(){this.clear()}interval(){returnthis._interval}barBuilder(){returnthis._barBuilder}symbolInfo(){returnthis._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){returnthis._barsTimes.length}
futureBars(){returnthis._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)returnvoidthis.setBarsTimes(e,t);consti=e[0],s=this._barsTimes[this._barsTimes.length-1],o=i>s?this._barsTimes.length:(0,Pt.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,n.assert)(-1!==this._projectionFirstIndex,"something went wrong"),s!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){consti=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)returnthis._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)));consti=this.indexOfTime(e);if(null===i)returnnull;consts=this.timeOfBarIndex(i.index+t,0);returnnull===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);lett=(0,Pt.lowerbound_int)(this._historyBarsCache,e);if(0!==this._historyBarsCache.length&&0===t&&e<this._historyBarsCache[0])returnnull;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);lett=(0,Pt.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])returnnull;this._futureBarsCache[t]!==e&&(t-=1);consti=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,n.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs){conste=this.timeOfBarIndex(0,0);returnnull===e?null:{index:0,timeMs:e.timeMs}}returnnull}lett=(0,Pt.lowerbound_int)(this._barsTimes,e);returnthis._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){
constt=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;consti=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,n.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;constt=(0,hS.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,n.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;constt=(0,hS.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||vS(this._futureBarsCache,this._extrapolateLimit))&&(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{consts=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t,o=e-i;returnthis._calculateBarPattern(s,null,o)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times)))}_ensureExtrapolatedToHistoryBar(e){this._historyBarsCache.length>=e||vS(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||vS(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{consts=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;returns[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}functionbS(e){return60*e*60*1e3}functionwS(e){return60*e*1e3}constCS=[{divisor:1,weight:18},{divisor:(TS=1,1e3*TS),weight:19},{divisor:wS(1),weight:20},{divisor:wS(5),weight:21},{divisor:wS(30),weight:22},{divisor:bS(1),weight:30},{divisor:bS(3),weight:31},{divisor:bS(6),weight:32},{divisor:bS(12),weight:33}];varTS,PS;functionxS(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return70;if(e.getUTCMonth()!==t.getUTCMonth())return60;if(e.getUTCDate()!==t.getUTCDate())return50;consti=t.getTime(),s=e.getTime()
return0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}tickMarks(e=0){constt=this.firstFutureBarIndex();(0,n.assert)(e<=t,"tickmarks cannot be filtered in the future");consti=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);consts=[];for(lett=e;t<this._sortedTimePoints.length;++t)s.push(IS(this._sortedTimePoints[t],t));consto=i.map(((e,i)=>IS(e,i+t)));returns.concat(o)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,Ce.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;lett=-1,i=(0,Pt.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMs<t));for(constsofe){conste=Math.round(1e3*s.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,n.assert)(i!==t,"data must have unique times"),t=i,s.index=i}(0,n.assert)(i<this._sortedTimePoints.length,"data must be within a data range")}convertTimesToIndexes(e,t=!1){if(0===e.length)return[];leti=-1,s=(0,Pt.lowerbound)(this._sortedTimePoints,e[0],((e,t)=>e.timeMs<t));returne.map(((e,o,r)=>{for(;s<this._sortedTimePoints.length&&this._sortedTimePoints[s].timeMs<e;)s+=1;if(0===s&&e<this._sortedTimePoints[0].timeMs)returnFh.INVALID_TIME_POINT_INDEX;if(s>=this._sortedTimePoints.length){constt=this.indexOfTime(e);if(null===t)returnFh.INVALID_TIME_POINT_INDEX;s=t.timeMs!==e?t.index+1:t.index}return(!t||o>0&&e<=r[o-1])&&(0,n.assert)(s>i,"data must have unique sorted times"),i=s,s}))}firstSeriesBarTime(){return0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceStudyBarsTimesTail(e,t){returnthis._replaceInstanceBarsTimesTail(e,t)}replaceBarsTimesTail(e,t){returnthis._replaceInstanceBarsTimesTail(e,t)}setSeriesBarsTimes(e,t){returnthis._setBarsTimes(e,t)}setStudyBarsTimes(e,t,i){returnthis._setBarsTimes(e,t,i)}_setBarsTimes(e,t,i){consts=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(consttofthis._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),s&&this._cleanupPointsData(this._sortedTimePoints);consto=[];this._pointDataByTimePoint.forEach(((e,t)=>{o.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),o.sort(((e,t)=>e.timeMs-t.timeMs));constn=this._updateTimeScalePoints(o);returnthis._applyTimeScaleChanges(n,i||!1)}_replaceInstanceBarsTimesTail(e,t){if(0===t.length)returnnull;if(!this._instanceIds.has(e))returnthis._setBarsTimes(e,t);consti=[],s=(0,Pt.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs<t));for(lett=s;t<this._sortedTimePoints.length;++t){consts=this._sortedTimePoints[t];s.pointData.instances.delete(e)&&0===s.pointData.instances.size&&i.push(s)}consto=this._addBarsTimesToInstance(e,t,!0)
createPointset(e,t,i,s,o){letn=this._pointsetsDataBySymbol.get(t);void0===n&&(n=newMap,this._pointsetsDataBySymbol.set(t,n));constr=[];for(consttofs){const[s,n,a]=t;if("number"!=typeofs||Number.isNaN(s)){BS.logWarn(`Pointset time is invalid: id=${e}, ${s} of type ${typeofs}`);continue}constl=o(a||i);r.push({point:t,extrapolation:l.extrapolateTimeWithOffsetToTime(1e3*s,n)})}s.length===r.length&&n.set(e,{resolution:i,points:r})}removePointset(e){constt=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(consteoft)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){consti=this._pointsetsDataBySymbol.get(e);void0!==i&&i.forEach(((e,i)=>{if(Re.Interval.isEqual(e.resolution,t))for(consttofe.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){consto=newMap,n=this._pointsetsDataBySymbol.get(e);returnvoid0!==n&&n.forEach(((e,n)=>{constr=this._refreshPointsetData(e,t,i,s);null!==r&&o.set(n,r)})),o}_refreshPointsetData(e,t,i,s){if(Re.Interval.isEqual(e.resolution,t))for(lets=0;s<e.points.length;++s){consto=e.points[s];if(null!==o.extrapolation&&o.extrapolation.exact)continue;const[n,r,a]=o.point,l=i(a||t);o.extrapolation=l.extrapolateTimeWithOffsetToTime(1e3*n,r)}consto=[];for(leti=0;i<e.points.length;++i){constn=e.points[i];if(null===n.extrapolation)returnnull;constr=s.indexOfTime(n.extrapolation.timeMs);if(null===r)returnBS.logWarn(`Cannot get index of time: time=${n.extrapolation.timeMs}, ${e.resolution} -> ${t}`),null;o.push({index:i,value:[r.index,r.timeMs/1e3]})}returno}}constRS=-5e6,NS="pre_post_market_sessions",OS=l.enabled(NS),FS=l.enabled("pay_attention_to_ticker_not_symbol");classWS{constructor(e,t,i,s){this._chartApiMessagerProvider=t,this._marketStatusWatcherProvider=i,this._studyLibrary=s,this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._barsCoefficientsCache={},this._externalDatafeed=e,(0,gc.default)(e.getVolumeProfileResolutionForPeriod)&&(0,Uv.overwriteVolumeProfileResolutionForPeriodGetter)(((t,i,s,o)=>(0,n.ensure)(e.getVolumeProfileResolutionForPeriod)(t,i,s,o))),this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=newMap,this._symbolIdToSymbolRequestString=newMap,this._callbacks={},this._serverTimeOffset=0,this._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),this._datafeedConfiguration=function(e){constt=(0,tt.merge)({},e),i=t.supported_resolutions;if(!i||0===i.length)returnt.supported_resolutions=void0,t;consts=[];for(lete=0;e<i.length;e++){constt=i[e];if(-1!==s.indexOf(t))thrownewError("Duplicating resolution `"+t+"`");Re.Interval.parse(t).isRange()||s.push(t)}returnt.supported_resolutions=s,t}(window.configurationData),this._fireEvent("configuration_received"),this._externalDatafeed.getServerTime&&this._externalDatafeed.getServerTime((e=>{this._serverTimeOffset=e-(newDate).valueOf()/1e3})),
this._invalidatedPointsetSessions=newSet,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo={},this._depthInfo={},this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=newYv(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout);consto=(e,t,i)=>{consts=newCd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),o=(0,Td.newBarBuilder)(t,s,s);returne=>{if(e&&e.count()){constt=1e3*this.getCurrentUTCTime();o.moveTo(t),o.indexOfBar(t)>=0&&e.setLastBarClosed(!1)}i(e)}};this._pineDatafeed=newpS({resolve:(e,t,i,s)=>{this._resolveSymbolByName(e,t,(e=>i(JS(e))),s)},subscribe:(e,t,i,s,n)=>this._cachedDatafeed.subscribe(e,t,i,o(e,t,s),(e=>n(e??"Unknown datafeed error"))),unsubscribe:e=>this._cachedDatafeed.unsubscribe(e)})}destroy(){for(consteofObject.keys(this._quotesInfo))this._stopQuotesSubscription(e);this._cachedDatafeed.destroy(),this._externalDatafeed=null;for(consteofObject.keys(this._pointsetsManagers))this._pointsetsManagers[e].destroy();this._quotesInfo={},this._pointsetsManagers={}}purgeCache(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((e=>{this._pointsetsManagers[e].destroy()})),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((e=>{this._timeScales[e].destroy()})),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((e=>{this._symbolExtrapolators[e].destroy()})),this._symbolExtrapolators={}}purgeDataCache(){this._cachedDatafeed.purgeCache()}resetCache(){this._cachedDatafeed.resetCache()}serverTimeOffset(){returnthis._serverTimeOffset}getCurrentUTCTime(){return(newDate).valueOf()/1e3+this._serverTimeOffset}serverTime(){return1e3*this.getCurrentUTCTime()}switchTimezone(e,t){this._timeScales[e].setTimezone(t);consti=this._timeScales[e].tickMarks();null!==i&&this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(0,i)}on(e,t){returnthis._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}supportedResolutions(){returnthis._datafeedConfiguration.supported_resolutions}supportedCurrencies(){returnthis._datafeedConfiguration.currency_codes||[]}supportedUnits(){returnthis._datafeedConfiguration.units||{}}supportedPriceSources(e){returnnewPromise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(JS(e).price_sources)}),(e=>{i(e)}))}))}supportedSymbolsTypes(){returnthis._datafeedConfiguration.symbols_types||[]}symbolsGrouping(){returnthis._datafeedConfiguration.symbols_grouping||{futures:/$a/}}getMarks(e,t,i,s,o){constr={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks&&(this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,
n.ensure)(e.full_name),o,newDate(1e3*t).toUTCString(),newDate(1e3*i).toUTCString())),this._externalDatafeed.getMarks(JS(e),t,i,(t=>{consti=t.map((e=>(e.time=Number(e.time),e)));this._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(i)));consta=(0,Jd.createDwmAligner)(o,e),c=l.enabled("two_character_bar_marks_labels"),h=i.map((e=>{constt=e;returnt.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,t.direction=(0,et.default)(e.color)?r[e.color]:r.red,t.onClicked=()=>{ee.emit("onMarkClick",e.id)},t.label=e.label?c?e.label.slice(0,2):e.label[0]:"",t}));s(h)}),o))}getTimescaleMarks(e,t,i,s,o){this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks&&(this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,n.ensure)(e.full_name),o,newDate(1e3*t).toUTCString(),newDate(1e3*i).toUTCString())),this._externalDatafeed.getTimescaleMarks(JS(e),t,i,(t=>{this._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(t)));consti=(0,Jd.createDwmAligner)(o,e),r=t.map((e=>{constt=e;returnt.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,t}));s(r)}),o))}getSeriesLastBarTime(e,t){consti=this._getSeriesData(e,t);returnnull===i||0===i.length?null:i[i.length-1].timeMs}getSeriesInterval(e,t){consti=this._studiesCache[e][t];returni?i.resolution:null}onSessionSeriesError(e){this.stopSources(e);constt=this._mainSeriesRecord(e);null!==t&&(t.error=!0),this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}stopSources(e){for(consttofthis._getStudiesCacheSessionKeys(e)){consti=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}}getSeriesSymbolInfo(e,t){consti=this._studiesCache[e][t];returni?i.symbolInfo:null}modifySeries(e,t,i,s,o,r){consta=this._mainSeriesRecord(e);if(null===a||a.guid!==t){if(null!==a&&a.error)returnthis._studiesCache[e][t].symbolId=i,this._studiesCache[e][t].resolution=s,void(this._studiesCache[e][t].turnaround=o);this._stopSourcesTree(e,t),this.createSeries(e,t,o,i,s,{countBack:0},!0);for(constiofthis._getStudiesCacheSessionKeys(e)){consts=this._studiesCache[e][i];if(s&&"study"===s.type&&s.parentId===t){this._studiesNonSeriesTimes[e][i]=null;constt=this._studiesCache[e][s.parentId];this._createStudy(t.symbolId,t.resolution,s.studyObject,e,i,s.turnaround,s.parentId,(0,n.ensure)(s.inputs))}}}elsethis._modifyMainSeries(e,i,s,o,r)}createStudy(e,t,i,s,o,n){constr=this._studiesCache[e][i],a=this._studyLibrary.findStudyObject(o);if(null===a)return$S("Study does not exist: "+o),voidthis._chartApiMessagerProvider.getChartApiMessager(e).onStudyError(t,s,"unknown study name");constl=newa.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(r.symbolId,r.resolution,l,e,t,s,i,n)}modifyStudy(e,t,i,s){consto=this._studiesCache[e][t];if(!o)throwError("This should never happen");constn=this._studiesCache[e][o.parentId];o.inputs=s,o.turnaround=i,o.engine&&(o.engine.stop(),this._pineDatafeed.removeUnused()),this._studiesNonSeriesTimes[e][t]=null,this._createStudy(n.symbolId,n.resolution,o.studyObject,e,t,i,o.parentId,s)}sessionTimeScale(e){returnthis._timeScales[e]||null}isTimeScaleExtendedTo(e,t){consti=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(i.resolution)&&null!=i.symbolInfo){conste=(0,Jd.createDwmAligner)(i.resolution,i.symbolInfo);null!==e&&(t=e.timeToSessionStart(t))}consts=this._timeScales[e].indexOfTime(t);returnnull!==s&&s.index>=0}ensureExtendedTo(e,t,i){if(!this._studiesCache[t][e])throwError("This should never happen");setTimeout((()=>{this._recreateSourcesForDataRange(t,{to:i})}),0)}extendSeriesRange(e,t){leti=this._timeScales[e].firstSeriesBarTime();if(null===i)returnvoidthis._logMessage("Nothing to extend - there is no points on time scale");consts=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(s.resolution)&&null!=s.symbolInfo){conste=(0,Jd.createDwmAligner)(s.resolution,s.symbolInfo);null!==e&&(i=e.timeToExchangeTradingDay(i))}consto=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s.symbolId))),r=this._barsCoefficients(o,s.resolution),a=r.barsCoefficient||1;if(!r.barsCoefficient){consti=this._getSeriesData(e,s.guid);null!==i&&(r.expectedBarsCount=i.length+t)}setTimeout((()=>{this._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}seriesTurnaround(e,t){returnthis._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround}createSeries(e,t,i,s,o,r,a){this._setEndOfData(e,t,i,!1);constc=newDS;this._studiesCache[e]=this._studiesCache[e]||{};consth=this._getSeriesData(e,t),d=this._studiesCache[e][t],u=this._seriesCount(e),_=this._mainSeriesRecord(e),p=function(e){let{dataRange:t}=e;const{oldStudyRecord:i,resolution:s,symbolId:o,seriesCount:r,oldData:a,mainSeriesRecord:l,timeScales:c,session:h}=e;if(!i||Re.Interval.isEqual(i.resolution,s)&&i.symbolId===o)void0!==t.countBack&&null!==a&&0!==a.length&&(t.to=a[0].timeMs),i&&null!=i.firstLoadedTimeMs?t.to=void0!==t.to?Math.min(i.firstLoadedTimeMs,t.to):i.firstLoadedTimeMs:i||0===r||null!==l&&(null!=l.firstLoadedTimeMs?(t.to=l.firstLoadedTimeMs,t.countBack=0):t=Object.assign({},l.dataRange));elseif(1===r)t=Object.assign({},i.initialDatarange);else{conste=c[h].firstSeriesBarTime();(void0===t.to||null!==e&&e<t.to)&&(t.to=(0,n.ensureNotNull)(e),t.countBack=0)}void0===t.countBack&&(t.countBack=0);void0===t.to&&0===t.countBack&&(t.countBack=100);returnt}({dataRange:r,oldStudyRecord:d,resolution:o,symbolId:s,seriesCount:u,oldData:h,mainSeriesRecord:_,timeScales:this._timeScales,session:e});if(this._studiesCache[e][t]={symbolId:s,resolution:o,studyObject:c,guid:t,type:"series",turnaround:i,dataRange:p,initialDatarange:d&&d.initialDatarange||Object.assign({},p),firstLoadedTimeMs:null,
symbolInfo:null,isMain:d&&d.isMain||0===u,completed:!1},null!==_&&_.guid!==t&&_.error)return;this._updateMainTsBuilder(e),this._updateTimeScaleState(e),this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesLoading(t,i);constm=(s,n,r)=>{consta=[];if(void0!==r){conste=(r.data||[]).reduce(((e,t)=>Math.max(e,t[0]||0)),-1);if(null!=r.projectionTime)for(lett=0;t<=e;++t)a.push(r.projectionTime+t)}letl=null,c=null;consth=s?this._getSymbolExtrapolator(e,s,o):null;if(void0!==n){consti=n.map((e=>e.timeMs)).concat(a);null!==h&&h.replaceBarsTimesTail(i,n.length),c=this._timeScales[e].replaceBarsTimesTail(t,i),l=n}else{consti=this._getSeriesData(e,t)||[],s=i.map((e=>e.timeMs)).concat(a);null!==h&&h.setBarsTimes(s,i.length),c=this._timeScales[e].setSeriesBarsTimes(t,s),l=i}if(this._applyTimeScaleUpdate(e,c),0===l.length&&void0===r)return;this._timeScales[e].fillIndexesInRows(l);constd=void0!==r?this._prepareSeriesNonSeriesData(e,t,r):null;this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,l,d)},g=s=>{consto=this._studiesCache[e][t];o.completed=!0,this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesError(t,i,s),l.enabled("clear_bars_on_series_error")&&(o.isMain?this.onSessionSeriesError(e):this._clearSeriesData(e,t))};this._computeStudy(e,c,s,o,t,[],p,jS(e,t),(function(){return-1/0}),{onDataReadyCallback:(r,l,c,h)=>{constd=this._studiesCache[e][t];if(!d)throwError("This should never happen");if(d.symbolInfo=c,d.firstLoadedTimeMs=h.firstLoadedTimeMs,d.completed=!0,this._updateMainTsBuilder(e),a&&this._pointsetsManagers[e].invalidatePointsetsForSymbol(c.full_name,o),0!==r.length){consti=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s))),a=this._barsCoefficients(i,o);a.expectedBarsCount&&a.barsCount&&(a.barsCoefficient=Math.min(Math.max(a.barsCoefficient||1,Math.floor(a.expectedBarsCount/(r.length-a.barsCount)+.5)),100)),a.barsCount=r.length,this._clearSeriesData(e,t)}else!h.endOfData&&d.isMain&&setTimeout((()=>{this._studiesCache[e]&&this._recreateSourcesForDataRange(e,{countBack:10})}),0);m(c),h.endOfData&&(this._logMessage("Series has no more data on server: {0}".format(c.full_name)),this._setEndOfData(e,t,i)),0===r.length&&this._clearSeriesData(e,t),this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesCompleted(t,i,c.data_status),this._updateTimeScaleState(e)},onRealtimeCallback:(s,n,r,a,l)=>{m(l,s),this._timeScales[e].fillIndexesInRows(s);constc=s[s.length-1];if(n){if(!this._studiesCache[e][t])throwError("This should never happen");this._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c)))}elsethis._logMessage("Last bar update: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c))),this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,s,null);this._fireEvent("realtime_tick",s[s.length-1],!0)},onSymbolErrorCallback:e=>{this._logMessage("Series symbol resolve error: "+e),g(e||"resolve error")},onErrorCallback:e=>{this._logMessage("Series error: "+e),g(e)},
onNonSeriesDataUpdate:(s,o)=>{if("projection"!==s.type)thrownewError("unexpected non-series data type for series "+s.type);constr=this._getSeriesData(e,t);if(null!==r)m((0,n.ensure)(o.info),0===r.length?void0:[r[r.length-1]],s);else{consto=this._prepareSeriesNonSeriesData(e,t,s);this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,[],o)}}})}removeStudy(e,t){if(this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),this._pineDatafeed.removeUnused()),this._studyCanExtendTimeScale(e,t)){this._timeScales[e].setCompleted(!1);consti=this._timeScales[e].setStudyBarsTimes(t,[],!0);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}deletethis._studiesCache[e][t],deletethis._studiesNonSeriesTimes[e][t]}removeSeries(e,t){this._stopSourcesTree(e,t),deletethis._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);consti=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}requestMoreTickmarks(e,t){consti=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);consts=i.firstFutureBarIndex(),o=i.tickMarks(s);this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(s,o)}chartCreateSession(e){this._pointsetsManagers[e]=newVS,this._timeScales[e]=newAS,this._studiesNonSeriesTimes[e]={}}chartDeleteSession(e){this._pointsetsManagers[e].destroy(),deletethis._pointsetsManagers[e],this._timeScales[e].destroy(),deletethis._timeScales[e],deletethis._studiesNonSeriesTimes[e]}removePointset(e,t){this._pointsetsManagers[e].removePointset(t)}asynccreatePointset(e,t,i,s,o){constn=this._resolvePromisesBySymbolId.get(US(e,i));if(void0===n)return;letr;try{r=(awaitn).symbolInfo}catch(e){return}this._pointsetsManagers[e].createPointset(t,r.full_name,s,o,((t=s)=>this._getSymbolExtrapolator(e,r,t))),null===this._refreshPointsetsTimerId&&(this._refreshPointsetsTimerId=window.setTimeout((()=>{this._refreshPointsetsTimerId=null,this._refreshPointsets(this._invalidatedPointsetSessions),this._invalidatedPointsetSessions.clear()}),0)),this._invalidatedPointsetSessions.add(e)}searchSymbols(e,t,i,s,o){this._logMessage(`Symbol search requested: search string \`${e}\`, exchange: \`${t}\`, type \`${i}\``);this._externalDatafeed.searchSymbols(e,t,i,(e=>{this._logMessage(`Symbol search response: ${JSON.stringify(e)}`),e.forEach((e=>{XS(e.logo_urls,e.exchange_logo,e)})),s(e)}),o)}searchSymbolsPaginated(e,t){if(void0===this._externalDatafeed.searchSymbolsPaginated)returnvoidthis.searchSymbols(e.userInput??"",e.exchange??"",e.symbolType??"",(e=>t(e,0)),e.searchSource??"symbolSearch");this._logMessage(`Symbol search requested: search string \`${e.userInput}\`, exchange: \`${e.exchange}\`, type \`${e.symbolType}\`, start \`${e.start}\``);this._externalDatafeed.searchSymbolsPaginated?.(e,((e,i)=>{this._logMessage(`Symbol search response: ${JSON.stringify(e)}`),e.forEach((e=>{
constt=void0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for symbol ${a}${t}: ${JSON.stringify(n)}`)}setTimeout((()=>o(t)),0)}if(void0!==t[r.n]&&null!==t[r.n])s(r,t[r.n]);elseif(l.enabled("charting_library_debug_mode")){constt=void0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for unexpected symbol ${a}${t}: ${JSON.stringify(n)}`)}}))},r=asynce=>{try{const[s,o]=KS(e),r=awaitnewPromise(((e,t)=>{this._resolveSymbolByName(s,o,e,t)})),a=(0,n.ensure)(r.ticker);returnt[a]=t[e]=JS(r),a===e?a:(void0===i[a]&&(i[a]=newSet),a!==e&&i[a].add(e),a)}catch{returnnull}},a=asynce=>[...newSet((awaitPromise.all([...newSet(e)].map(r))).filter((e=>null!==e)))];if(this._externalDatafeed.getQuotes&&!l.enabled("charting_library")){const[t,i]=awaitPromise.all([a(this._quotesInfo[e].symbols),a(this._quotesInfo[e].fastSymbols)]),s={};if(l.enabled("charting_library_debug_mode")){conste=WS.debugGetQuotesRequestId++;this._logMessage(`QUOTES Requesting data for symbols ${JSON.stringify(t)} with request ID ${e}`);for(constioft){constt=1e4;s[i]=window.setTimeout((()=>{this._logMessage(`QUOTES Timeout after waiting ${t/1e3} seconds for data symbol ${i} with request ID ${e}`)}),t)}}this._externalDatafeed.getQuotes(t,(n=>{if(l.enabled("charting_library_debug_mode"))for(consteofn)void0!==s[e.n]&&clearTimeout(s[e.n]),deletes[e.n];this._quotesInfo[e]&&0!==this._quotesInfo[e].symbols.length&&(o(n),this._quotesInfo[e].listenerGUID=e,l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Subscribing listenerGUID ${this._quotesInfo[e].listenerGUID} to data for symbols ${JSON.stringify(t)} and fast symbols ${JSON.stringify(i)}`),this._externalDatafeed.subscribeQuotes(t,i,o,this._quotesInfo[e].listenerGUID))}),(e=>{this._logMessage(`QUOTES Error getting data for symbols ${JSON.stringify(t)}: ${e}`)}))}else!this._externalDatafeed.getQuotes&&l.enabled("trading_terminal")&&setTimeout((()=>{o(this._quotesInfo[e].symbols.map((e=>({n:e,s:"ok",v:{}}))))}));this._createMarketStatusWatchers(e,this._quotesInfo[e].symbols)}_createMarketStatusWatchers(e,t){void0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(leti=0;i<t.length;i+=1){consts=t[i];if(void0===this._marketStatusWatchers[e][s]){const[t,i]=KS(s);this._marketStatusWatchers[e][s]=this._marketStatusWatcherProvider.createMarketStatusWatcher(((o,n,r,a)=>this._resolveSymbolByName(t,i,r,(o=>{$S(`Error resolving for market status watcher ${qS(t,i.currency,i.unit,i.session)}:\n${o}`),this.quoteRemoveSymbols(e,[s]),a(o)}))),e,s,this._chartApiMessagerProvider)}}}_filteredSymbols(e){constt=[];returne.forEach((e=>{einstanceofObject||t.indexOf(e)<0&&t.push(e)})),t}_refreshPointsets(e){e.forEach((e=>{constt=this._studiesCache[e];if(null==t)return;leti=null;for(consteofObject.keys(t)){consts=t[e];if("series"===s.type){i=s;break}}if(null===i||null==i.symbolInfo)return;consts=i.symbolInfo
this.createSeries(e,r.guid,s,t,i,c,!0)}}for(consttofthis._getStudiesCacheSessionKeys(e)){consti=this._studiesCache[e][t];if(i&&"study"===i.type){this._studiesNonSeriesTimes[e][t]=null;consts=this._studiesCache[e][(0,n.ensure)(i.parentId)];this._createStudy(s.symbolId,s.resolution,i.studyObject,e,t,i.turnaround,i.parentId,(0,n.ensure)(i.inputs))}}a&&this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}_mainSeriesRecord(e){lett=null,i=null;for(constsofthis._getStudiesCacheSessionKeys(e)){consto=this._studiesCache[e][s];if("series"===o.type&&(null===t&&(t=o),o.isMain)){i=o;break}}returnnull===i&&(i=t),null!==i&&(i.isMain=!0),i}_stopSourcesTree(e,t){for(constiofthis._getStudiesCacheSessionKeys(e)){consts=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))}this._pineDatafeed.removeUnused()}_getSeriesData(e,t){returnthis._objectsDataCache[jS(e,t)]||null}_resolveSymbolImpl(e,t,i){vars;(0,Pv.isEncodedExtendedSymbol)(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(newDate).toISOString()}${s}`));const[o,n]=KS(e);this._resolveSymbolByName(o,n,t,i)}_getSymbolExtrapolator(e,t,i){consts=(0,n.ensure)(Re.Interval.normalize(i)),o=function(e,t,i){consts=void0!==t.subsession_id?","+t.subsession_id:"";returne+","+t.full_name+","+i+s}(e,t,s);letr=this._symbolExtrapolators[o];returnvoid0===r&&(r=newSS(t,s),this._symbolExtrapolators[o]=r),r}_barsCoefficients(e,t){consti=(0,Pv.decodeExtendedSymbol)(e);if(!("type"ini)||void0===i.type)return{};consts=e+t;returnthis._barsCoefficientsCache[s]||(this._barsCoefficientsCache[s]={}),this._barsCoefficientsCache[s]}_studyCanExtendTimeScale(e,t){consti=this._studiesCache[e][t]?.metainfo;returnvoid0!==i&&(l.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||l.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id||l.enabled("inactivity_gaps")&&"InactivityGaps@tv-basicstudies-1"===i.id)}_stopQuotesSubscription(e){this._quotesInfo[e].listenerGUID&&(l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Unsubscribe listenerGUID=${this._quotesInfo[e].listenerGUID}`),this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void0),this._removeMarketStatusWatchers(e)}_removeMarketStatusWatchers(e){Object.keys(this._marketStatusWatchers[e]||{}).forEach((t=>{this._marketStatusWatchers[e][t].stop()})),this._marketStatusWatchers[e]={}}_logMessage(e){l.enabled("charting_library_debug_mode")&&console.log(`${(newDate).toISOString()}${e}`)}_resolveSymbolByName(e,t,i,s){leto;constn=t&&t.currency,r=t&&t.unit,a=t&&t.session,l=GS(e,n,r,a);(0,Wv.default)(this._resolveRequests[l])?(o=this._resolveSymbolInternal(e,n||void0,r||void0,a||void0),this._resolveRequests[l]=o,o.then((t=>{this._resolveRequests[GS(e,t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,
yS.extractSymbolNameFromSymbolInfo)(t,null),t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,yS.extractSymbolNameFromSymbolInfo)(t,null),n,r,a)]=o})).catch((()=>{}))):o=this._resolveRequests[l],o.then(i).catch(s)}_resolveSymbolInternal(e,t,i,s){returnnewPromise(((o,n)=>{constr=qS(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(r));leta=!0;this._externalDatafeed.resolveSymbol(e,(e=>{a&&$S("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),this._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(r,JSON.stringify(e)));constt=function(e,t){if(e.ticker||(e.ticker=e.symbol||e.name),e.full_name=t.shouldUseTickerNotSymbol?e.ticker:`${e.exchange}:${e.name}`,e.pro_name=e.full_name,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),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),void0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions){constt=[];for(constiofe.supported_resolutions){conste=Re.Interval.parse(i);e.isValid()&&!e.isRange()&&t.push(e.value())}e.supported_resolutions=t}if(e.price_sources||(e.price_sources=[]),e["is-tickbars-available"]=!!e.has_ticks,deletee.has_ticks,!0===t.shouldUseSubsessions&&Array.isArray(e.subsessions))for(lett=0;t<e.subsessions.length;t++){consti=e.subsessions[t];switch(i.id){caseXv.SubsessionId.Regular:caseXv.SubsessionId.Extended:i.private=!1;break;caseXv.SubsessionId.PreMarket:caseXv.SubsessionId.PostMarket:i.private=!0}}returne.build_seconds_from_ticks=!1,e}(e,{shouldUseSubsessions:OS,shouldUseTickerNotSymbol:FS});!function(e){constt=e.ticker??e.name??("symbol"ine?e.symbol:void0)??"unknown symbol";functioni(e){$S(`SymbolInfo validation for${t}: `+e)}"string"==typeofe.ticker&&0!==e.ticker.length||!FS||i('ticker must be a non-empty string when the "pay_attention_to_ticker_not_symbol" featureset is enabled');void0!==e.exchange&&0!==e.exchange.length||i("exchange must be provided to the symbol information");e.has_empty_bars&&!(0,Jd.isAlignmentEnabled)()&&i('both has_empty_bars field and featureset "disable_resolution_rebuild" are enabled and may cause data issues (see #3329)');(void0===e.minmov||e.minmov<=0)&&i("minmov must be positive");(void0===e.pricescale||e.pricescale<=0)&&i("pricescale must be positive");void0!==e.name&&0!==e.name.length||i("name must be non-empty string");void0!==e.session&&0!==e.session.length||i("session must be non-empty string");"holidays"ine&&i("field holidays is deprecated, use session_holidays instead")
;"has_no_volume"ine&&i("field has_no_volume is deprecated, use visible_plots_set instead");void0===e.timezone||0===e.timezone.length?i("timezone must be non-empty string"):"exchange"!==e.timezone&&(0,Pe.timezoneIsAvailable)(e.timezone)||"UTC"!==e.timezone&&i('unsupported timezone "{0}"'.format(e.timezone));if(void0!==e.intraday_multipliers){constt=e.intraday_multipliers;if(Array.isArray(t))for(lete=0;e<t.length;++e)"string"!=typeoft[e]&&i('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(e+1,t[e],typeoft[e]));elsei("intraday_multipliers must be array")}(e.supported_resolutions||[]).filter((e=>!Re.Interval.isValid(e))).forEach((e=>{i("supported_resolutions field contains invalid value: "+e)})),OS||(void0!==e.subsessions&&i(`Symbol info contains subsessions but the ${NS} feature is not enabled, so the subsessions will be ignored`),void0!==e.subsession_id&&i(`Symbol info contains a subsession ID but the ${NS} feature is not enabled, so the subsession ID will be ignored`));!0===e.build_seconds_from_ticks&&i("build_seconds_from_ticks is true but building seconds from ticks is only available in Trading Platform.")}(t),this._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(r,JSON.stringify(t))),o(t)}),(e=>{this._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(r,e)),n(e)}),{currencyCode:t,unitId:i,session:s}),a=!1}))}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){consts=this._callbacks[e];for(lete=0;e<s.length;++e)s[e](t);i||(this._callbacks[e]=[])}}async_computeStudy(e,t,i,s,o,n,r,a,c,h){letd=!0;constu=[];null!==a&&(this._objectsDataCache[a]=null),this._timeScales[e].setCompleted(!1);const_=this._computeStudyCounter++;functionp(e,t){if(e<c())returnRS;if(0===t)return0;consti=u[t-1].index;returni===RS?0:i+1}constm=newMap;letg=!1;constf=(i,c)=>{const_=Re.Interval.parse(s);if((0,Hv.default)(i.supported_resolutions)&&i.supported_resolutions.length>0&&(0,lS.findSuitableResolutionToBuildFrom)(s,i).error)h.onSymbolErrorCallback(`unsupported resolution: ${i.ticker}, ${s}`);else{if(Re.Interval.isDWM(s)&&void0!==r.to){conste=(0,Jd.createDwmAligner)(s,i);null!==e&&(r.to=e.timeToExchangeTradingDay(r.to))}if(r.from&&r.to){conste=(0,Td.getPeriodsBetweenDates)(i.session,i.session_holidays,i.corrections,_.letter(),_.multiplier(),r.from,r.to);r.countBack=Math.max(e,r.countBack)}try{const_=newnS({datafeed:this._pineDatafeed,unitId:i.unit_id,currencyCode:i.currency_code,tickerid:c,symbolInfo:JS(i),period:s,body:t,sessionId:e,onErrorCallback:h.onErrorCallback,dataRange:r,subsessionId:i.subsession_id,forceAlignBars:!l.enabled("disable_sameinterval_aligning")&&(0,Jd.isAlignmentEnabled)(),enableDwmAligning:l.enabled("align_dwm_bars_to_main_series")||!this._studyCanExtendTimeScale(e,o),input:e=>n[e],out:(e,t)=>{!function(e,t,i){lets=e.time;consto="number"==typeoft?[t]:t;if(o[0]&&"object"==typeofo[0]&&"timeMs"ino[0]){conste=o[0];o.splice(0,1),s=void0===e.timeMs||isNaN(s)?s:e.timeMs}for(lete=0;e<o.length;++e){lett=o[e]
;t&&"object"==typeoft&&!Array.isArray(t)&&(m.set(e,t.offset),t=t.value),"number"==typeoft&&isNaN(t)&&(t=void0),o[e]=t}constn=u.length-1,r=n<0||s>u[n].timeMs;r?u.push({index:p(s,u.length),value:[s/1e3].concat(o),timeMs:s}):(u[n].index=p(s,n),u[n].value=[s/1e3].concat(o),u[n].timeMs=s),d||h.onRealtimeCallback([u[u.length-1]],r,u.length,m,i)}(e,t,i)},nonseriesOut:(e,t)=>{h.onNonSeriesDataUpdate(t,e)},setNoMoreData:()=>{g=!0},recalc:(e,s)=>{d=!1,u.endOfData=g,u.emptyBarCount=s.emptyBarCount,(!("error"int)||(0,Wv.default)(t.error)||(0,gc.default)(t.error)&&null===t.error())&&(null!==a&&(this._objectsDataCache[a]=u),h.onDataReadyCallback(u,m,i,s))}});if(!this._studiesCache[e]||!this._studiesCache[e][o])throwError("This should never happen");this._studiesCache[e][o].engine=_}catch(e){if(!((0,zv.default)(e)&&"studyError"ine&&e.studyError))throwe;h.onErrorCallback(zS(e,"unknown study error"))}}},y=()=>this._studiesCache[e]&&this._studiesCache[e][o]&&this._studiesCache[e][o].activeResolve===_;this._studiesCache[e][o].activeResolve=_;constv=this._resolvePromisesBySymbolId.get(US(e,i));if(void0===v)thrownewError("This should never happen");letS,b;try{conste=awaitv;S=e.symbolInfo,b=e.requestedSymbol}catch(e){returnvoid(y()&&h.onSymbolErrorCallback(zS(e,"unknown symbol error")))}y()&&f(S,b)}_getDataRangeForStudy(e,t){consti=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)},o=this._studiesCache[e][i.parentId];returnthis._studyCanExtendTimeScale(e,t)&&o?.completed?void0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s}_seriesDataRange(e,t){consti=this._studiesCache[e][t];returnnull!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange}_createStudy(e,t,i,s,o,r,a,l){this._studiesCache[s][o].completed=!1;constc=(e=>{if(Array.isArray(e))returne;constt=[],i=this._studiesCache[s][o].metainfo.inputs;if((0,Hv.default)(i))for(lets=0;s<i.length;s++)t[s]=e[i[s].id];returnt})(l);this._chartApiMessagerProvider.getChartApiMessager(s).onStudyLoading(o,r);consth=(e,t,i)=>{constn=this._studiesCache[s][o];if(n.completed=!0,e.length>0&&(n.firstLoadedTimeMs=e[0].timeMs),e=YS(e),this._setEndOfData(s,o,r,!this._studyCanExtendTimeScale(s,o)||e.endOfData),this._studyCanExtendTimeScale(s,o)){constt=e.map((e=>e.timeMs)),i=this._timeScales[s].setStudyBarsTimes(o,t);this._applyTimeScaleUpdate(s,i)}this._timeScales[s].fillIndexesInRows(e),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,e,t),this._chartApiMessagerProvider.getChartApiMessager(s).onStudyCompleted(o,r),this._updateTimeScaleState(s)},d=e=>{if(0===e.size)return{};constt={},i=this._studiesCache[s][o].metainfo;returne.forEach(((e,s)=>{t[(0,n.ensure)(i.plots)[s].id]=e})),{data:{offsets:t},indexes:[]}};letu=null,_=!1;this._computeStudy(s,i,e,t,o,c,this._getDataRangeForStudy(s,o),null,(()=>{if(this._studyCanExtendTimeScale(s,o))return-1/0;if(null===u){conste=this._getSeriesData(s,a)?.[0];if(void0===e)return1/0;u=e.timeMs}returnu}),{onDataReadyCallback:(e,t,i)=>{
_&&0===e.length||h(e,d(t))},onRealtimeCallback:(e,t,i,n,a)=>{constl=YS(e);if(this._studyCanExtendTimeScale(s,o)){conste=l.map((e=>e.timeMs)),t=this._timeScales[s].replaceStudyBarsTimesTail(o,e);this._applyTimeScaleUpdate(s,t)}this._timeScales[s].fillIndexesInRows(l),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,l,d(n)),this._updateTimeScaleState(s)},onSymbolErrorCallback:()=>{this._studiesCache[s][o].completed=!0,this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,"error in series")},onErrorCallback:(e,t)=>{this._studiesCache[s][o].completed=!0;leti=e;t&&(i={error:e,title:t}),this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,i),this._updateTimeScaleState(s)},onNonSeriesDataUpdate:(e,t)=>{switch(_=!0,e.type){case"projection":break;case"study_gap":constt=this._timeScales[s].replaceStudyBarsTimesTail(o,e.times);this._applyTimeScaleUpdate(s,t);break;case"study_graphics":{constt={data:{graphicsCmds:e.data?.graphicsCmds,isUpdate:e.data?.isUpdate},indexes:[]},i=function(e){constt=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];consti=newMap,s=newSet;kS.forEach(((e,o)=>{constn=t[o];if(n)for(consttofn)for(constooft.data){constt=e(o);for(consteoft)i.set(e,-1),s.add(e)}}));consto=Array.from(s).sort(((e,t)=>e-t));returno.forEach(((e,t)=>i.set(e,t))),ES.forEach(((e,s)=>{consto=t[s];if(o)for(consttofo)for(constsoft.data)e(s,i)})),o}(t);this._studiesNonSeriesTimes[s][o]=i,t.indexes=this._timeScales[s].convertTimesToIndexes(i),h([],t);break}case"non_series_data":{constt={data:e.data,indexes:[]},i=t?.data?.data?.pivots,n=void0!==i;letr=function(e){constt={};gS(e,(e=>{(0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(t[e[i]]=!0)}))}),{visitInstances:!0});consti=Object.keys(t).map(Number).sort(((e,t)=>e-t));returni.forEach(((e,i)=>{t[e]=i})),Object.assign(e,gS(e,(e=>((0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(e[i.slice(0,-3)]=t[e[i]])})),e)),{visitInstances:!0})),i}(t),a=this._timeScales[s].convertTimesToIndexes(r,n);if(n){conste=newSet,t=[],s=[];leto=0;for(letn=a.length-1;n>=0;n--){constl=a[n];e.has(l)||l===Fh.INVALID_TIME_POINT_INDEX?(i.splice(n,1),o++):(t.unshift(r[n]),s.unshift(l),e.add(l))}o>0&&i.forEach(((e,t)=>{e.startIndex=t,e.endIndex=t+1})),r=t,a=s}this._studiesNonSeriesTimes[s][o]=r,t.indexes=a,h([],t);break}default:$S("unsupported non-series data type for study "+e.type)}}})}_isEndOfData(e,t,i){consts=e+"!"+t+"@"+i;returnBoolean(this._endOfData[s])}_setEndOfData(e,t,i,s){consto=e+"!"+t+"@"+i;this._endOfData[o]=!1!==s}_applyTimeScaleUpdate(e,t){if(null===t)return;consti=[];for(consttofthis._getStudiesCacheSessionKeys(e)){consts=this._studiesCache[e][t];if(s&&"study"===s.type){consto=this._studiesNonSeriesTimes[e][t];if(o){constn={indexes:this._timeScales[e].convertTimesToIndexes(o),data:{indexes_replace:!0}};i.push({objId:t,turnaround:s.turnaround,data:[],nonSeriesData:n})}}}
this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleUpdate(t,i),Promise.resolve().then((()=>{constt=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){consti=t.symbolInfo,s=(s=t.resolution)=>this._getSymbolExtrapolator(e,i,s);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,s,this._timeScales[e]).forEach(((t,i)=>{this._chartApiMessagerProvider.getChartApiMessager(e).onPointsetDataUpdate(i,null,t)}))}}))}_updateMainTsBuilder(e){constt=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){consti=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}}_updateTimeScaleState(e){if(!this._studiesCache[e])return;lett=!0,i=!0;for(constsofthis._getStudiesCacheSessionKeys(e)){consto=this._studiesCache[e][s];"InactivityGaps@tv-basicstudies-1"!==o?.metainfo?.id&&(i=i&&this._isEndOfData(e,s,o.turnaround),t=t&&o.completed)}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleCompleted(i))}_getStudiesCacheSessionKeys(e){returnvoid0!==this._studiesCache[e]?Object.keys(this._studiesCache[e]):[]}}WS.debugGetQuotesRequestId=1;constHS=WS;functionzS(e,t){return"string"==typeofe?e:(0,zv.default)(e)&&e&&"message"ine&&(0,et.default)(e.message)?e.message:t}functionUS(e,t){returne+"_"+t}functionjS(e,t){returne+"_"+t}functionGS(e,t,i,s){returne+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}functionqS(e,t,i,s){return[e,t,i,s].filter((e=>(0,et.default)(e)&&e.length>0)).join("|")}function$S(e){console.warn(`${(newDate).toISOString()}${e}`)}functionKS(e){constt=(0,Pv.decodeExtendedSymbol)(e),i="string"==typeoft.symbol?t:t.symbol;return[i.symbol,{currency:"currency-id"ini&&i["currency-id"],unit:"unit-id"ini&&i["unit-id"],session:"session"ini?i.session===Xv.SubsessionId.Regular?void0:i.session:void0}]}functionYS(e){constt=e.findIndex((e=>e.index!==RS));return-1===t?[]:0===t?e:e.slice(t)}functionZS(e){if(null===e||"number"==typeofe)returne;if("object"==typeofe&&Array.isArray(e)){switch(e[0]){case"bar_count":returne[2];case"from_to":returne.length>=3?e[2]??null:null}}returnnull}functionXS(e,t,i){if(i.logoid=void0,i["base-currency-logoid"]=void0,i["currency-logoid"]=void0,e){if("string"==typeofe)returnvoid$S("`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=t}t&&(i.provider_id=t,i.country=void0)}functionJS(e){returne.timezone=e.timezone,e}(0,A.setClasses)();constQS=(0,r.getChartingLibraryGlobalContext)(),eb=(0,r.getChartingLibraryOwner)(),tb=newclass{constructor(e,t){this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=newOe(e.document),this._viewportType=ze.CheckMobile.iOS()&&!(0,He.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks",
t||(s=0);consto=e.container.value();returno&&t&&(o.style.height=s+"px"),e.height.setValue(s),s};constt=e.container.value();if(!t)thrownewError("bridge.container.value() must be anelement");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe((()=>this.recalculate())),this._height.subscribe((()=>this.recalculate())),this._bridge.visible.subscribe((()=>this._updateVisibility())),this._bridge.fullscreen.subscribe((()=>this._onParentFullscreenChange())),this.recalculate()}allocate(e){constt=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))thrownewError("unknown options.areaName");this.free(t);consti=this._createDOM(t),s={name:t,canNegotiate:{width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(consteinthis._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;constt=je(e);Ge(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;constt=je(e);Ge(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:newO.WatchedValue,height:newO.WatchedValue,availWidth:newO.WatchedValue,availHeight:newO.WatchedValue,alive:newO.WatchedValue(!0),container:newO.WatchedValue(i),visible:newO.WatchedValue(!0),fullscreen:newO.WatchedValue(!1),fullscreenable:newO.WatchedValue("right"===t||"center"===t),rdState:newNe};returns.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{consti=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{lete=null;for(leti=this._availableAreas.indexOf(t);i--;){constt=this._availableAreas[i];if(this.affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()}),{callWithLast:!0}),s.rdState.bridge()}free(e){constt=this._areas[e];if(!t)return;this._areas[e]=void0;consti=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){conste={};this._recalcSingleRunToken=e;constt=this._areas.topleft,i=this._areas.left,s=this._areas.tradingpanel,o=this._areas.right,n=this._areas.top,r=this._areas.bottom,a=this._areas.center,l=this._areas.extratop,c=this._width.value(),h=this._height.value();letd=0,u=0,_=0,p=0,m=0,g=0,f=0,y=0;if(e===this._recalcSingleRunToken&&l){conste=this._processVisibility(l);y=this._setHeight(l,e,h),this._setWidth(l,e,c)}
s.fullscreen.setValue(!0);continue}s.fullscreen.setValue(!1);consto=s.container.value();o&&o.classList.toggle("js-hidden",e&&!Ye(i))}this._updateVisibility(),this.recalculate()}_createDOM(e){constt=document.createElement("div");returnt.classList.add("layout__area--"+e),t.style.position="absolute","tradingpanel"===e&&(t.style.borderTopRightRadius="4px"),"bottom"===e?t.style.bottom="0":t.style.top="0","right"===e||"tradingpanel"===e?t.style.right="0":t.style.left="0",t}}(tb.allocate()),sb=(eb.brokerFactory,Boolean(!1)),ob=QS.urlParams;QS.DEFAULT_SYMBOL=ob.symbol??"";constnb=newAbortController,rb=eb.getCustomIndicators,ab=(0,me.createDeferredPromise)(),lb=(0,me.createDeferredPromise)(),cb=(0,me.createDeferredPromise)(),hb=l.enabled("left_toolbar"),db=l.enabled("library_custom_color_themes"),ub=JSON.parse(ob.widgetbar),_b=l.enabled("right_toolbar")&&(ub.watchlist||ub.details||ub.news||ub.datawindow||l.enabled("dom_widget")||l.enabled("order_panel")||l.enabled("show_object_tree")||l.enabled("bugreport_button")),pb=l.enabled("header_widget")?ib.allocate({areaName:"top"}):null,mb=hb?ib.allocate({areaName:"left"}):null,gb=ib.allocate({areaName:"center"}),fb=(_b&&ib.allocate({areaName:"right"}),null);if(void0!==eb.contextMenu&&Cy.setContextMenuOptions(eb.contextMenu),Promise.all([ab.promise,lb.promise,cb.promise]).then((()=>{QS.ChartApiInstance.start()})),"function"==typeofrb){conste=rb({Std:Py.Std});e&&e.then?e.then((e=>{if(!Array.isArray(e))returnconsole.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),voidab.resolve();constt=QS.JSServer;for(constiofe)if("function"==typeofi){conste=(newEv).build(i);t.studyLibrary.push.call(t.studyLibrary,e)}elset.studyLibrary.push.call(t.studyLibrary,i);ab.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((e=>{console.warn("Error loading custom indicators "+e),ab.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),ab.resolve())}elseab.resolve();QS.widgetReady=e=>{ee.subscribe("onChartReady",e,null)};constyb=ob.theme?.toLowerCase()??$s.StdTheme.Light;varvb;functionSb(e){QS.__defaultsOverrides=QS.__defaultsOverrides||{},(0,ge.deepExtend)(QS.__defaultsOverrides,e),void0!==TradingView.defaultProperties&&void0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}vb=yb,L.themes[vb]&&(0,k.setTheme)(vb),asyncfunction(e){if(!db||void0===e)return;try{const{overrideStandardThemes:t}=awaiti.e(2413).then(i.bind(i,79736));t(e)}catch(e){console.error("Error applying custom themes",e)}}(eb.customThemes).then(cb.resolve).catch(cb.resolve),QS.applyStudiesOverrides=e=>{e&&(QS.chartWidgetCollection?QS.chartWidgetCollection.applyStudiesOverrides?.(e):ns.StudyMetaInfo.mergeDefaultsOverrides(e))},QS.applyOverrides=e=>{Sb(e),QS.chartWidgetCollection&&QS.chartWidgetCollection.applyOverrides(e)},
QS.doWhenApiIsReady=e=>{QS.tradingViewApi?e():lb.promise.then(e)},QS.applyTradingCustomization=e=>{if(e.order)for(consttine.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];if(e.position)for(consttine.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t];returnnull===fb?Promise.resolve():fb.then((t=>{functioni(e){constt={};for(constiofObject.keys(e??{})){consts=i.split(".");leto=t;for(consteofs.slice(0,s.length-1))o.hasOwnProperty(e)||(o[e]={}),o=o[e];o[s[s.length-1]]=e[i]}returnt}if(null===t)return;consts=i(e.brokerOrder),o=i(e.brokerPosition);t?.overrideTradedGroupStyles({order:{lightTheme:s,darkTheme:s},position:{lightTheme:o,darkTheme:o}})}))},QS.changeTheme=(e,t)=>{consti=L.themes[e.toLowerCase()];returni?QS.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},QS.getTheme=()=>QS.tradingViewApi.themes().getCurrentThemeName(),QS.customThemes=async()=>{if(!db)returnPromise.reject(newError("The library_custom_color_themes feature must be enabled to use the custom themes API"));returnnew((awaiti.e(2413).then(i.bind(i,82753))).CustomThemesApi)},QS.is_authenticated=!1;JSON.parse(QS.urlParams.brokerConfig);a.t(null,void0,i(94566)),a.t(null,void0,i(92800)),a.t(null,void0,i(44676));letbb=null;constwb=(0,me.createDeferredPromise)();letCb;constTb=()=>{if(l.setEnabled("charting_library_export_chart_data",!QS.configurationData.is_tradingview_data),l.setEnabled("charting_library_debug_mode","true"===ob.debug||l.enabled("charting_library_debug_mode")),l.setEnabled("chart_property_page_trading",!1),l.enabled("remove_library_container_border")){conste=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}l.enabled("no_min_chart_width")&&(document.body.style.minWidth="0px"),null!=ob.studiesOverrides&&ns.StudyMetaInfo.mergeDefaultsOverrides(JSON.parse(ob.studiesOverrides)),(0,n.assert)(void0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Sb(JSON.parse(ob.overrides));const e=ob.numeric_formatting?JSON.parse(ob.numeric_formatting):void0;e&&("string"==typeofe.decimal_sign&&(ue.formatterOptionsLibraryOverrides.decimalSign=e.decimal_sign[0]),"string"==typeofe.grouping_separator&&(ue.formatterOptionsLibraryOverrides.groupingSeparator=e.grouping_separator[0]));constt=newSv,s=newNv,c=newBv,h=ob.studiesAccess&&JSON.parse(ob.studiesAccess)||{type:"black",tools:[]},d=newDf(h,c),u=newOv((0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary),_=newHS(eb.datafeed,t,s,u);QS.ChartApiInstance=newEf(t,_,c,d);constp=eb.customFormatters;p&&(p.timeFormatter&&(_e.customFormatters.timeFormatter=p.timeFormatter),p.dateFormatter&&(_e.customFormatters.dateFormatter=p.dateFormatter),p.tickMarkFormatter&&(_e.customFormatters.tickMarkFormatter=p.tickMarkFormatter),p.priceFormatterFactory&&(_e.customFormatters.priceFormatterFactory=p.priceFormatterFactory),p.studyFormatterFactory&&(_e.customFormatters.studyFormatterFactory=p.studyFormatterFactory)),
i.GlobalSearchDialogRenderer)(e);returnnull!==Ve&&Ve.hide(),s.show(t),Ve=s,s}));return(0,D.createGroup)({desc:"GlobalSearch"}).add({desc:"Open",hotkey:D.Modifiers.Mod+75,handler:()=>t()}),t}(e.loadChartService):void0;returnnewT(newy,{chartSaver:QS.saver,chartApiInstance:QS.ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:t.chartTypes,defaultFavoriteIntervals:t.intervals,resizerBridge:pb,studyMarket:QS.studyMarket,studyTemplates:Cb,allowedModes:s,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:e.chartChangesWatcher,onClick:Ab,snapshotUrl:e.snapshotUrl,openGlobalSearch:n})}({chartWidgetCollection:C,saveChartService:k,chartChangesWatcher:A,loadChartService:E,snapshotUrl:ob.snapshotUrl});null!==B?B.load().then((e=>{bb=e.getComponent(),wb.resolve()})):(wb.promise.catch((()=>{})),wb.reject("header widget is not loaded"));constV=function(e){if(mb){constt=ob.toolbarbg&&/^[0-9a-f]+$/i.test(ob.toolbarbg)?String(ob.toolbarbg):void0;if(t){conste=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}returnnewM({bgColor:t,chartWidgetCollection:e,drawingsAccess:ob.drawingsAccess?JSON.parse(ob.drawingsAccess):void0,resizerBridge:mb,onClick:Ab})}returnnull}(C),R=null;QS.tradingViewApi=newCy({chartWidgetCollection:C,chartApiInstance:QS.ChartApiInstance,saveChartService:k,loadChartService:E,studyMarket:null});if(de.linking.bindToChartWidgetCollection(C),isNaN(ob.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+(0,n.ensureDefined)(ob.studyCountLimit))),!isNaN(ob.ssreqdelay)){conste=Math.max(0,+(0,n.ensureDefined)(ob.ssreqdelay));(0,Ty.setSearchRequestDelay)(e)}QS.ChartApiInstance.connect(),(async()=>{const{LineToolPropertiesWidget:e}=awaitPromise.all([i.e(7617),i.e(8185),i.e(1681),i.e(3439),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(7827),i.e(8220),i.e(9590),i.e(1667),i.e(9836),i.e(3290),i.e(6178),i.e(7777),i.e(2227),i.e(3179),i.e(1890),i.e(6193),i.e(6376),i.e(2306)]).then(i.bind(i,36699));x||(QS.lineToolPropertiesToolbar=new e(C))})();constO=document.querySelector(".tv-content");null!==O&&O.addEventListener("contextmenu",(e=>{e.targetinstanceofElement&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),lb.resolve(),C.undoHistory.undoStack().onChange().subscribe(null,(0,o.default)((e=>{e?.affectsState()&&ee.emit("onAutoSaveNeeded")}),1e3*(Number(ob.autoSaveDelay)||5),{leading:!1,trailing:!0}));letF=!1;functionW(){V&&V.load(nb.signal),R&&R.load(nb.signal).then((e=>{QS.footerWidget=e.getComponent()}))}QS.chartWidget.withModel(null,(()=>{QS.ChartApiInstance.on("realtime_tick",(e=>{ee.emit("onTick",e)}));if(!L.savedThemeName()&&yb){conste=L.getStdTheme(yb);e&&e.content&&void0===m&&C.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:yb,standardTheme:!0,syncState:!0,noUndo:!0
setTimeout(Tb,0),l.enabled("14851")&&Math.random()<=.02){t=window,i=document,s="script",o="ga",t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=Number(newDate),r=i.createElement(s),a=i.getElementsByTagName(s)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",a.parentNode.insertBefore(r,a);conste=(0,n.ensureNotNull)(document.URL.match(newRegExp("(:?.*://)([^/]+)/.*")))[2];QS.ga("create","UA-112911840-1","auto"),QS.ga("set","anonymizeIp",!0),QS.ga("set",{hostname:e,page:e,referrer:e}),QS.ga("send","pageview")}vart,i,s,o,r,a})),(()=>{lete=!0;eb.datafeed.onReady((t=>{e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),QS.configurationData=t,Ib.resolve()})),e=!1})(),QS.createShortcutAction=(()=>{conste=D.createGroup({desc:"API",order:yv.ACTION_API_GROUP_ORDER});return(t,i)=>{vars;e.add({hotkey:(s=t,"number"==typeofs?s:"string"==typeofs?R(s.split("+")):Array.isArray(s)?R(s):0),handler:i})}})(),QS.initializationFinished=()=>{QS.chartWidgetCollection.undoHistory.clearStack()},QS.headerReady=()=>wb.promise,functione(t=0,i=10){consts={received:!1};QS.dispatchEvent(newCustomEvent("innerWindowLoad",{detail:s})),!s.received&&t<i&&setTimeout((()=>{e(t+1,i)}),10*Math.pow(2,t))}(),QS.createButton=e=>{if(null===bb)thrownewError("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1;constt=(0,fe.randomHash)();returnbb.addButton(t,e)??t},QS.removeButton=e=>{if(null===bb)thrownewError("Cannot remove button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");returnbb.removeButton(e)},QS.createDropdown=e=>{if(void0===e)thrownewError("Cannot create dropdown without any parameters. Please refer to the documentation");void0===e.align&&(e.align="left");constt=(0,fe.randomHash)();returnbb?(bb.addDropdown(t,e),Promise.resolve(newhv(bb,t))):wb.promise.then((()=>((0,n.ensureNotNull)(bb).addDropdown(t,e),newhv((0,n.ensureNotNull)(bb),t))))},QS.getAllFeatures=()=>{conste=l.getAllFeatures();returnObject.keys(e).forEach((t=>{isNaN(parseFloat(t))||deletee[t]})),e},QS.getNavigationButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,ve.property)()))),QS.getPaneButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,Se.property)()))),QS.getDateFormat=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)(be.dateFormatProperty))),QS.getTimeHoursFormat=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)(we.timeHoursFormatProperty))),QS.getCurrencyAndUnitVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,Be.currencyUnitVisibilityProperty)()))),QS.customSymbolStatus=()=>_v.getInstance();QS.urlParams.debugBroker,newSet(["connectionStatus"]);constLb=ob.locale||"en",kb=Dt.getInstance();kb.createElement(document),kb.setLocale(Lb),
;vars=i(50279),o=i(50151),n=(i(11542),i(14411)),r=i(23024),a=i(48096),l=i(37103),c=i(81593);functionh(e,t){e.content=JSON.stringify(t)}newWeakMap;newTextEncoder;classd{constructor(e){this._prevChartState=null,this._chartSavedDelegate=newa.Delegate,this._chartAboutToBeSavedDelegate=newa.Delegate,this._chartSizeLimitExceededDelegate=newa.Delegate,this._isSaveInProcess=!1,this._savingToken=null,this._chartWidgetCollection=e}asyncsaveChartLineTools(e,t,s,o){if(l.enabled("saveload_separate_drawings_storage")){constn=await(0,r.getChartStorage)(),a=this.layoutId(),l=i=>n.saveLineToolsAndGroups(i,e,t,s,o);if(!a){this._chartSavedDelegate.subscribe(null,(e=>{if(e){conste=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=awaiti.e(5565).then(i.bind(i,98653));thrownewe("Layout ID not yet created.",!0)}returnl(a)}returnPromise.reject("Line tools storage is not supported")}layoutId(){returnthis._chartWidgetCollection.metaInfo.uid.value()}saveChartSilently(e,t,i){consts=i||{};this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart((e=>{constt=e&&l.enabled("saveload_separate_drawings_storage"),i=this._getChartWidgetCollectionState(!1,void0,void0,void0,t),o=this._getCommonSavingInfo(!1);returnh(o,i),s.chartName&&(o.name=s.chartName),o.name&&0!==o.name.length||!s.defaultChartName||(o.name=s.defaultChartName),s.autoSave&&(o.autoSave=!0),o}),((t,i)=>{(0,o.assert)(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),i&&this.layoutId()===t.uid&&this._chartWidgetCollection.metaInfo.name.setValue(i.name??""),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid,data:i}),this._prevChartState&&deletethis._prevChartState.savingToken}),(e=>{this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t(e)}),s)}saveToJSON(e){constt=e&&!1===e.includeDrawings||void0,i=this._getCommonSavingInfo(!1);returnh(i,this._getChartWidgetCollectionState(!1,!0,t,void0,t)),i}isSaveInProcess(){returnthis._isSaveInProcess}_getChartWidgetCollectionState(e,t,i,s,o){letn=!1;returne?n=!0:(t=!0,s=!1),this._chartWidgetCollection.state({withData:!!e,skipLineToolsFromOtherSymbols:!!i,wipeSensitiveData:!!s,skipLineTools:o,skipHiddenSources:n,addOnlyActiveChart:!t})}_getCommonSavingInfo(e){constt=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols()[t.activeChartWidget.value().id()],s={...(o=i,{...o,legs:JSON.stringify(o.legs??[])})};varo;constn=t.metaInfo,r=n.id.value();returnnull!==r&&(s.id=r),s.name=n.name.value()||"",s.description=n.description.value()||"",s.is_realtime=s.is_realtime=e?"0":"1",s}async_saveLineToolsToStorage(){if(l.enabled("saveload_separate_drawings_storage")){this.layoutId();0;const[e,t]=this._chartWidgetCollection.getAll().reduce(((e,t)=>{consti=t.lineToolsSynchronizer();if(i){e[0]||=i.hasUnsavedMigrationsFromChartState();constt=i.flushPendingSavings();t&&e[1].push(t)}returne}),[!1,[]]);returnt.length&&awaitPromise.all(t),t.length>0&&e}return!1
}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.invalidateAll()))}_saveChartImpl(e,t,i,s,o,n){letr;r=s=>{t.uid||t.uid!==this.layoutId()||(t.id=s.result,t.uid=`${s.result}`,this._chartWidgetCollection.metaInfo.id.setValue(t.id),this._chartWidgetCollection.metaInfo.uid.setValue(t.uid)),i(t,e)},e.name?c.backend.saveChart(e.name,e.short_name,e.resolution,e,t).then(r).catch((asynce=>{constt=einstanceofResponse?e:void0,i=einstanceofError?e:void0;this._savingToken=null;consto=s.bind(null,{status:t?.status,message:t?.statusText??i?.message??"Unknown error"});o()})):s({status:-1,message:"Saving chart with empty name is not allowed"})}async_saveChart(e,t,o,r){consta=this._chartWidgetCollection.metaInfo,c={name:a.name.value(),description:a.description.value(),uid:a.uid.value(),id:a.id.value(),lastModified:a.lastModified.value(),username:a.username.value(),isPrivate:a.isPrivate.value()};leth=r.changes??n.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();letd=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{awaitthis._saveLineToolsToStorage()&&(h|=1)}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=awaiti.e(5565).then(i.bind(i,98653));einstanceoft&&e.safe||(d=!1)}if(1&h){consti=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id)returnthis._chartSavedDelegate.fire(!0),voidt(c,i);0;constn=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.markAsValidatedBecauseOfSavingToContent())),t(e,i));returnthis._saveChartImpl(i,c,n,o,r,e)}this._chartSavedDelegate.fire(!0),t(c,e(d))}}},71846:(e,t,i)=>{"use strict";vars=i(12362).ChartSaverBase;i.i18next(null,void0,i(49947));t.ChartSaver=classextendss{constructor(e){super(e)}chartSizeLimitExceeded(){returnthis._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){returnthis._chartAboutToBeSavedDelegate}chartSaved(){returnthis._chartSavedDelegate}publishChart(e){}publishScript(e,t,i){}isScriptNameValid(e){return""!==e.trim()&&e.length<=64}isScriptDescriptionValid(e){return""!==e.trim()&&e.length<=7e4}isScriptDescribersValid(e,t){returnthis.isScriptNameValid(e)&&this.isScriptDescriptionValid(t)}openInNewTab(e,t,i){e.publishInProgress=!0,i||this.isScriptDescribersValid(t.name,t.description)&&undefined(newPromise((function(t){e.setPopupUrl=t})))}onPublish(e,t){}}},19e3:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);functions(e){returne.description||""}},29242:(e,t,i)=>{"use strict";functions(e){returne+"…"}i.d(t,{appendEllipsis:()=>s})},58043:(e,t,i)=>{"use strict";functions(e){lett;if("object"!=typeofe||null==e||"number"==typeofe.nodeType)t=e;elseif(einstanceofDate)t=newDate(e.valueOf());elseif(Array.isArray(e)){t=[];leti=0;consto=e.length;for(;i<o;i++)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=s(e[i]))}else{t={};for(constiine)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=s(e[i]))}returnt}i.d(t,{deepCopy:()=>s})},39527:(e,t,i)=>{"use strict"
t.parentNode&&t.parentNode.removeChild(t),f&&f.forEach((e=>e(c))),a)returna(c)},_=setTimeout(s.bind(null,void0,{type:"timeout",target:t}),12e4);t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),l&&document.head.appendChild(t)}},o.r=e=>{"undefined"!=typeofSymbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{vare;o.g.importScripts&&(e=o.g.location+"");vara=o.g.document;if(!e&&a&&(a.currentScript&&(e=a.currentScript.src),!e)){varc=a.getElementsByTagName("script");c.length&&(e=c[c.length-1].src)}if(!e)thrownewError("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),o.g.location&&o.p.startsWith(o.g.location.origin)&&(o.p=o.p.slice(o.g.location.origin.length)),(()=>{conste=o.u;o.u=a=>e(a).replace("__LANG__",o.g.language)})(),o.p=o.g.WEBPACK_PUBLIC_PATH||o.p;varl=o.e,n=Object.create(null);functionr(e,a){returnl(e).catch((function(){returnnewPromise((function(c){vard=function(){self.removeEventListener("online",d,!1),!1===navigator.onLine?self.addEventListener("online",d,!1):c(a<2?r(e,a+1):l(e))};setTimeout(d,a*a*1e3)}))}))}o.e=function(e){if(!n[e]){n[e]=r(e,0);vara=function(){deleten[e]};n[e].then(a,a)}returnn[e]},(()=>{if("undefined"!=typeofdocument){vare=e=>newPromise(((a,c)=>{vard=o.miniCssF(e),f=o.p+d;if(((e,a)=>{for(varc=document.getElementsByTagName("link"),d=0;d<c.length;d++){varf=(t=c[d]).getAttribute("data-href")||t.getAttribute("href");if("stylesheet"===t.rel&&(f===e||f===a))returnt}varb=document.getElementsByTagName("style");for(d=0;d<b.length;d++){vart;if((f=(t=b[d]).getAttribute("data-href"))===e||f===a)returnt}})(d,f))returna();((e,a,c,d,f)=>{varb=document.createElement("link");b.rel="stylesheet",b.type="text/css",b.onerror=b.onload=c=>{if(b.onerror=b.onload=null,"load"===c.type)d();else{vart=c&&("load"===c.type?"missing":c.type),o=c&&c.target&&c.target.href||a,l=newError("Loading CSS chunk "+e+" failed.\n("+o+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=t,l.request=o,b.parentNode&&b.parentNode.removeChild(b),f(l)}},b.href=a,0!==b.href.indexOf(window.location.origin+"/")&&(b.crossOrigin="anonymous"),c?c.parentNode.insertBefore(b,c.nextSibling):document.head.appendChild(b)})(e,f,null,a,c)})),a={3666:0};o.f.miniCss=(c,d)=>{a[c]?d.push(a[c]):0!==a[c]&&{4:1,159:1,445:1,509:1,628:1,683:1,844:1,846:1,861:1,903:1,1065:1,1166:1,1171:1,1450:1,1488:1,1667:1,1681:1,1697:1,1979:1,2112:1,2202:1,2307:1,2318:1,2537:1,2641:1,2647:1,3014:1,3290:1,3329:1,3359:1,3425:1,3439:1,3460:1,3476:1,3637:1,3672:1,3853:1,3946:1,4059:1,4240:1,4248:1,4422:1,4495:1,4587:1,4633:1,4678:1,4719:1,4765:1,5371:1,5445:1,5563:1,5743:1,5834:1,6032:1,6043:1,6052:1,6094:1,6178:1,6195:1,6633:1,6697:1,6870:1,6954:1,6956:1,7369:1,7399:1,7463:1,7519:1,7682:1,7691:1,7777:1,7780:1,7827:1,7833:1,8185:1,8220:1,8260:1,8752:1,8894:1,8933:1,9002:1,9036:1,9297:1,9323:1,9468:1,9487:1,9590:1,9646:1,
*Passtheresultingarraytothecallbackfor[`searchSymbols`](https://www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/required-methods#searchsymbols) or [`searchSymbolsPaginated`](https://www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/additional-methods#searchsymbolspaginated).
/** Array of strings with valid duration values. You can check that in Order Ticket. */
allowedDurations?: string[];
@@ -29548,7 +29591,7 @@ export type ChartingLibraryFeatureset =
"long_press_floating_tooltip"|
/**
*Enableschartdrageventhandling.
*See{@linkIChartWidgetApi.setDragExportEnabled}and{@linkSubscribeEventsMap.dragstart}for more implementation details.
*See[Enabledrag-to-exportfeature](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#enable-drag-to-export-feature) for moreimplementationdetails.
* [Symbol Search](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Symbol-Search) result item.
* Pass the resulting array of symbols as a parameter to {@link SearchSymbolsCallback} of the [`searchSymbols`](https://www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/required-methods#searchsymbols) method.
* Pass the resulting array to the callback for [`searchSymbols`](https://www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/required-methods#searchsymbols) or [`searchSymbolsPaginated`](https://www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/additional-methods#searchsymbolspaginated).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.